## Backend
- Add workspace_card SSE event protocol: {id, name, props, merge}
- Add _extract_llm_text / _maybe_emit_workspace_card helpers in chat.py
- Refactor all tools to dual-output format: {llm_text, ui: {name, props}}
- kb_search → KnowledgeResultCard
- ticket_list/detail → TicketSummaryCard / TicketDetailCard
- web_search → SearchResultCard
- generate_document → DocumentResultCard
- sandbox_run → SandboxResultCard
- Update SYSTEM_PROMPT: instruct LLM not to repeat tool data (UI shows it)
## Frontend
- Three-column layout: sidebar + chat + Agent Workspace (360px right panel)
- WorkspaceSession state model with ActivityNode + WorkspaceCard
- New components/workspace/: AgentWorkspace, ActivityTimeline, WorkspaceCardRenderer
- 6 card components: Knowledge/Ticket/Search/Document/Sandbox/ErrorCard
- GeminiChat: workspace state management, SSE routing for workspace_card events
- GeminiMessage: replace TracePanel with lightweight activity summary line
- lib/api.ts: add WorkspaceSession/ActivityNode/WorkspaceCard types
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1.1 KiB
1.1 KiB
CoT (Chain of Thought) 实现方案
目标:当用户选择 Auto 或 Pro 模式时,实时展示模型推理过程(正在做什么)
文档结构
- architecture.md — 整体架构与数据流
- backend.md — 后端实现方案(Python/LangGraph)
- frontend.md — 前端实现方案(Next.js/React)
核心结论
方案选择:Prompt 标签 + 流式状态机解析
| 方案 | 描述 | 结论 |
|---|---|---|
| A. 原生 reasoning tokens | Azure o1/o3 的 reasoning_content | 备用升级路径,gpt-5.4 支持情况待验证 |
| B. Prompt 标签解析 ✅ | 注入 <think> 标签,流式解析 |
默认实现,兼容所有 GPT 模型 |
| C. LangGraph 多节点 | 专门的 thinking 节点 | 双倍延迟/成本,不采用 |
Auto vs Pro 差异
| 维度 | Flash | Auto | Pro |
|---|---|---|---|
| CoT | 关闭 | 轻量(关键决策点) | 完整(每步详细推理) |
| max_tokens | 500 | 2048 | 4096 |
| temperature | 0.2 | 0.3 | 0.3 |
| 前端 thinking UI | 无 | 3个脉冲点,done后消失 | 可折叠 thinking block |