MCPcopy Create free account
hub / github.com/astercloud/aster / WorkflowDemoGetRunHandler

Method WorkflowDemoGetRunHandler

pkg/server/workflow_demo.go:130–151  ·  view source on GitHub ↗

WorkflowDemoGetRunHandler 返回指定 run_id 的工作流运行记录。 路径示例: GET /v1/workflows/demo/runs?id= 响应体: { "id": "run-...", "workflow_id": "sequential_demo", "input": "处理用户数据", "events": [...], "eval_scores": [...], "created_at": "..." }

()

Source from the content-addressed store, hash-verified

128// "created_at": "..."
129// }
130func (s *Server) WorkflowDemoGetRunHandler() http.Handler {
131 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
132 if r.Method != http.MethodGet {
133 http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
134 return
135 }
136
137 runID := r.URL.Query().Get("id")
138 if runID == "" {
139 http.Error(w, "id is required", http.StatusBadRequest)
140 return
141 }
142
143 rec, ok := s.workflowRuns.Get(runID)
144 if !ok {
145 http.Error(w, "run not found", http.StatusNotFound)
146 return
147 }
148
149 writeJSON(w, http.StatusOK, rec)
150 })
151}
152
153// WorkflowDemoRunHandler 返回一个 HTTP handler, 用于运行内置的演示工作流。
154//

Callers

nothing calls this directly

Calls 4

writeJSONFunction · 0.70
ErrorMethod · 0.65
GetMethod · 0.65
QueryMethod · 0.65

Tested by

no test coverage detected