chore: 初始化 eightbf-analysis-go(对齐 Java 会商作业服务)
Go 实现 /api/v1/analysis 契约、Demo/Live Worker、DeerFlow SSE;含设计文档与冒烟脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
0c45b86d67
29 files changed
+3789
No files matched your search
@@ -0,0 +1,56 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package domain
|
||||
|
||||
// 会商作业状态(与 Java JobStatus / 前端约定一致,勿自创别名)。
|
||||
const (
|
||||
StatusQueued = "queued"
|
||||
StatusRunning = "running"
|
||||
StatusAwaitingInput = "awaiting_input"
|
||||
StatusDone = "done"
|
||||
StatusError = "error"
|
||||
StatusCancelled = "cancelled"
|
||||
)
|
||||
|
||||
// IsActive 是否仍可能被 worker 推进(含等人中)。
|
||||
func IsActive(status string) bool {
|
||||
return status == StatusQueued || status == StatusRunning || status == StatusAwaitingInput
|
||||
}
|
||||
|
||||
// IsTerminal 是否已结束,不应再 resume / inject / 改计划。
|
||||
func IsTerminal(status string) bool {
|
||||
return status == StatusDone || status == StatusError || status == StatusCancelled
|
||||
}
|
||||
Reference in new issue
Block a user