Go 实现 /api/v1/analysis 契约、Demo/Live Worker、DeerFlow SSE;含设计文档与冒烟脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
57 lines
2.5 KiB
Go
57 lines
2.5 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
// AnalysisJob 一场会商作业(服务端「研讨录像带」)。
|
|
// JSON 字段名与前端 mapJob / Java 实体对齐,少做二次映射。
|
|
type AnalysisJob struct {
|
|
ID string `json:"id"`
|
|
RequestID string `json:"requestId,omitempty"`
|
|
TaskID string `json:"taskId,omitempty"`
|
|
DraftID string `json:"draftId,omitempty"`
|
|
DraftKey string `json:"draftKey,omitempty"`
|
|
Status string `json:"status"`
|
|
Phase string `json:"phase,omitempty"`
|
|
Cycle int `json:"cycle"`
|
|
ActiveAgentID string `json:"activeAgentId,omitempty"`
|
|
ConsensusPercentage int `json:"consensusPercentage"`
|
|
PendingClarification string `json:"pendingClarification,omitempty"`
|
|
OrchestrationMode string `json:"orchestrationMode,omitempty"`
|
|
Model string `json:"model,omitempty"`
|
|
Error string `json:"error,omitempty"`
|
|
OwnerAccountID string `json:"ownerAccountId,omitempty"`
|
|
Agents []map[string]interface{} `json:"agents"`
|
|
Dialogues []map[string]interface{} `json:"dialogues"`
|
|
ThreadIDs map[string]interface{} `json:"threadIds,omitempty"`
|
|
Plan map[string]interface{} `json:"plan"`
|
|
Access map[string]interface{} `json:"access"`
|
|
Progress map[string]interface{} `json:"progress"`
|
|
Result map[string]interface{} `json:"result,omitempty"`
|
|
CreatedAt *time.Time `json:"createdAt,omitempty"`
|
|
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
|
|
}
|
|
|
|
// EnsurePlan plan 为空时补可写 Map。
|
|
func (j *AnalysisJob) EnsurePlan() map[string]interface{} {
|
|
if j.Plan == nil {
|
|
j.Plan = map[string]interface{}{}
|
|
}
|
|
return j.Plan
|
|
}
|
|
|
|
// EnsureProgress progress 为空时补可写 Map。
|
|
func (j *AnalysisJob) EnsureProgress() map[string]interface{} {
|
|
if j.Progress == nil {
|
|
j.Progress = map[string]interface{}{}
|
|
}
|
|
return j.Progress
|
|
}
|
|
|
|
// EnsureDialogues dialogues 为空时补切片。
|
|
func (j *AnalysisJob) EnsureDialogues() []map[string]interface{} {
|
|
if j.Dialogues == nil {
|
|
j.Dialogues = []map[string]interface{}{}
|
|
}
|
|
return j.Dialogues
|
|
}
|