feat(v3): Web 应用化基线(异步任务/SSE/llama-server 管理/Vue SPA 四页 + 设置页整页滚动修复)
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
// ── 协作任务状态 ──────────────────────────────────────────────────────────────
|
||||
|
||||
/** POST /chat 立即返回 */
|
||||
export interface ChatInitResponse {
|
||||
request_id: string
|
||||
status: 'pending'
|
||||
}
|
||||
|
||||
/** GET /runs/{id}/status 返回 */
|
||||
export interface RunStatus {
|
||||
request_id: string
|
||||
status: 'pending' | 'running' | 'done' | 'failed' // JobStore 任务状态
|
||||
ws_state: string | null // workspace.json 内 state
|
||||
started_at: number
|
||||
finished_at: number
|
||||
error: string | null
|
||||
// PipelineResult 等效字段(扁平时 TaskInfo)
|
||||
response: string | null
|
||||
pipeline_status: string | null // done | fast_path | escalated | failed
|
||||
fast_path: boolean
|
||||
rounds_used: number
|
||||
api_input_tokens: number
|
||||
api_output_tokens: number
|
||||
cost_est: number
|
||||
model_used: string | null
|
||||
latency_ms: number | null
|
||||
route: string[]
|
||||
workspace_path: string | null
|
||||
}
|
||||
|
||||
// ── SSE 事件 ─────────────────────────────────────────────────────────────────
|
||||
|
||||
export type SSEEvent =
|
||||
| { type: 'workspace'; version: number; state: string; request_id: string; workspace: Workspace }
|
||||
| { type: 'status'; value: string; request_id: string }
|
||||
| { type: 'error'; detail: string }
|
||||
|
||||
// ── 交流文本(workspace.json)────────────────────────────────────────────────
|
||||
|
||||
export interface Workspace {
|
||||
request_id: string
|
||||
query: string
|
||||
brief: Brief | null
|
||||
plan: PlanStep[]
|
||||
progress: ProgressStep[]
|
||||
issues: Issue[]
|
||||
decisions: Decision[]
|
||||
archive: string[]
|
||||
meta: WsMeta
|
||||
status?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface Brief {
|
||||
goal: string
|
||||
tags: string[]
|
||||
domain: string
|
||||
constraints: string[]
|
||||
}
|
||||
|
||||
export interface PlanStep {
|
||||
id: string
|
||||
task: string
|
||||
deps: string[]
|
||||
status?: string
|
||||
}
|
||||
|
||||
export interface ProgressStep {
|
||||
step: string
|
||||
status: 'pending' | 'running' | 'done'
|
||||
artifact?: string
|
||||
note?: string
|
||||
}
|
||||
|
||||
export interface Issue {
|
||||
id: string
|
||||
step: string
|
||||
description: string
|
||||
suggestion?: string
|
||||
}
|
||||
|
||||
export interface Decision {
|
||||
ref: string
|
||||
reply: string
|
||||
patch_plan?: PlanStep[]
|
||||
}
|
||||
|
||||
export interface WsMeta {
|
||||
state: 'draft' | 'in_progress' | 'reviewing' | 'done' | 'failed'
|
||||
round: number
|
||||
rounds_cap: number
|
||||
version?: number
|
||||
api_input_tokens: number
|
||||
api_output_tokens: number
|
||||
}
|
||||
|
||||
// ── 人工检验 ─────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface ReviewItem {
|
||||
id: number
|
||||
request_id: string
|
||||
query: string
|
||||
response: string
|
||||
verdict: 'pending' | 'approved' | 'rejected'
|
||||
tags: string[]
|
||||
created_at: string
|
||||
correction?: string
|
||||
}
|
||||
|
||||
// ── 指标 ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface Metrics {
|
||||
router: Record<string, unknown>
|
||||
cache: Record<string, unknown>
|
||||
v2?: Record<string, unknown>
|
||||
review?: { pending: number; total: number }
|
||||
}
|
||||
Reference in New Issue
Block a user