refactor: 聊天室 Agent 重构 — ToolLoopAgent + 论坛式布局

后端:
- 删除 agent-stream.ts,新建 alfred-agent.ts (ToolLoopAgent 工厂)
- 新建 get-current-time.ts 工具 (zod schema)
- 重构 send.ts: createAgentUIStreamResponse + onFinish 可靠持久化

前端:
- 删除 MessageBubble.tsx,新建 ToolCallCard.tsx (四态)
- 重构 ChatPanel.tsx: 论坛式 Card 布局 + PartRenderer 分派
- 移除 @ant-design/x 依赖,改用 antd 组件 + streamdown

依赖:
+ zod + streamdown
- @ant-design/x - @ant-design/x-markdown

测试: 306 pass, typecheck/lint 0 errors
This commit is contained in:
2026-05-31 17:25:29 +08:00
parent f83f434863
commit 6eeb4ced7b
16 changed files with 698 additions and 322 deletions

View File

@@ -58,7 +58,6 @@
"@ai-sdk/openai-compatible": "^2.0.48",
"@ai-sdk/react": "^3.0.195",
"@ant-design/icons": "^6.2.3",
"@ant-design/x": "^2.7.0",
"@sinclair/typebox": "^0.34.49",
"@tanstack/react-query": "^5.100.14",
"ai": "^6.0.193",
@@ -72,6 +71,8 @@
"react": "^19.2.6",
"react-dom": "^19.2.6",
"react-router": "^7.15.1",
"recharts": "^3.8.1"
"recharts": "^3.8.1",
"streamdown": "^2.5.0",
"zod": "^4.4.3"
}
}