feat(ssa): Implement dual-channel architecture Phase 1-3 (QPER + LLM Agent pipeline)
Completed: - Phase 1: DB schema (execution_mode + ssa_agent_executions), ModeToggle component, Session PATCH API - Phase 2: AgentPlannerService + AgentCoderService (streaming) + CodeRunnerService + R Docker /execute-code endpoint - Phase 3: AgentCodePanel (3-step confirmation UI), SSE event handling (7 agent events), streaming code display - Three-step confirmation pipeline: plan -> user confirm -> stream code -> user confirm -> execute R code -> results - R Docker sandbox /execute-code endpoint with 120s timeout + block_helpers preloaded - E2E dual-channel test script (8 tests) - Updated R engine architecture doc (v1.5) and SSA module status doc (v4.0) Technical details: - AgentCoderService uses LLM streaming (chatStream) for real-time code generation feedback - ReviewerAgent temporarily disabled, prioritizing Plan -> Code -> Execute flow - CodeRunnerService wraps user code with auto data loading (df variable injection) - Frontend handles agent_planning, agent_plan_ready, code_generating, code_generated, code_executing, code_result events - ask_user mechanism used for plan and code confirmation steps Files: 24 files (4 new services, 2 new components, 1 migration, 1 E2E test, 16 modified) Made-with: Cursor
This commit is contained in:
@@ -2480,13 +2480,15 @@ model SsaSession {
|
||||
dataPayload Json? @map("data_payload") /// 真实数据(仅R可见)
|
||||
dataOssKey String? @map("data_oss_key") /// OSS 存储 key(大数据)
|
||||
dataProfile Json? @map("data_profile") /// 🆕 Python 生成的 DataProfile(Phase 2A)
|
||||
executionMode String @default("qper") @map("execution_mode") /// qper | agent
|
||||
status String @default("active") /// active | consult | completed | error
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
messages SsaMessage[]
|
||||
executionLogs SsaExecutionLog[]
|
||||
workflows SsaWorkflow[] /// 🆕 多步骤流程(Phase 2A)
|
||||
messages SsaMessage[]
|
||||
executionLogs SsaExecutionLog[]
|
||||
workflows SsaWorkflow[] /// 🆕 多步骤流程(Phase 2A)
|
||||
agentExecutions SsaAgentExecution[] /// Agent 模式执行记录
|
||||
|
||||
@@index([userId], map: "idx_ssa_session_user")
|
||||
@@index([status], map: "idx_ssa_session_status")
|
||||
@@ -2494,6 +2496,30 @@ model SsaSession {
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA Agent 执行记录(LLM 代码生成通道)
|
||||
model SsaAgentExecution {
|
||||
id String @id @default(uuid())
|
||||
sessionId String @map("session_id")
|
||||
query String
|
||||
planText String? @map("plan_text")
|
||||
generatedCode String? @map("generated_code")
|
||||
reviewResult Json? @map("review_result")
|
||||
executionResult Json? @map("execution_result")
|
||||
reportBlocks Json? @map("report_blocks")
|
||||
retryCount Int @default(0) @map("retry_count")
|
||||
status String @default("pending") /// pending | planning | coding | reviewing | executing | completed | error
|
||||
errorMessage String? @map("error_message")
|
||||
durationMs Int? @map("duration_ms")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
session SsaSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([sessionId], map: "idx_ssa_agent_exec_session")
|
||||
@@map("ssa_agent_executions")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA 消息记录
|
||||
model SsaMessage {
|
||||
id String @id @default(uuid())
|
||||
|
||||
Reference in New Issue
Block a user