GetStatus 获取指定调用的状态
(c *gin.Context)
| 21 | |
| 22 | // GetStatus 获取指定调用的状态 |
| 23 | func (h *ToolRuntimeHandler) GetStatus(c *gin.Context) { |
| 24 | agentID := c.Query("agent_id") |
| 25 | callID := c.Param("id") |
| 26 | if agentID == "" || callID == "" { |
| 27 | c.JSON(http.StatusBadRequest, gin.H{"error": "agent_id and call id are required"}) |
| 28 | return |
| 29 | } |
| 30 | |
| 31 | if snap := h.runtimeSnapshot(agentID, callID); snap != nil { |
| 32 | c.JSON(http.StatusOK, gin.H{"status": snap}) |
| 33 | return |
| 34 | } |
| 35 | |
| 36 | records, err := (*h.store).LoadToolCallRecords(c.Request.Context(), agentID) |
| 37 | if err != nil { |
| 38 | c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) |
| 39 | return |
| 40 | } |
| 41 | |
| 42 | for _, rec := range records { |
| 43 | if rec.ID == callID { |
| 44 | c.JSON(http.StatusOK, gin.H{ |
| 45 | "status": mapRecordToSnapshot(&rec), |
| 46 | }) |
| 47 | return |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | c.JSON(http.StatusNotFound, gin.H{"error": "call not found"}) |
| 52 | } |
| 53 | |
| 54 | // ListRunning 返回运行中的工具调用 |
| 55 | func (h *ToolRuntimeHandler) ListRunning(c *gin.Context) { |
nothing calls this directly
no test coverage detected