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