feat(chat): 引入 @ant-design/x 组件 — Sender/Conversations/XMarkdown 替代手动拼装

- ConfigProvider → XProvider(ConsoleShell + test-utils)
- ChatSidebar → Conversations(menu dropdown + MoreOutlined trigger)
- ChatInputArea → Sender(footer 左右排版 + 模型 Select + 自动清空)
- Streamdown → XMarkdown(streaming hasNextChunk 映射 AI SDK 状态)
- CSS 清理 ~94 行废弃样式,新增统一布局规则
- 删除 streamdown 依赖
This commit is contained in:
2026-06-02 18:31:31 +08:00
parent 9c9afbd108
commit 26ecaadb26
13 changed files with 289 additions and 561 deletions

View File

@@ -9,7 +9,7 @@
- **Admin**`src/web/consoles/admin/`):路由 `/`(总览)、`/projects``/models`
- **Workbench**`src/web/consoles/workbench/`):路由 `/workbench/:projectId``/workbench/:projectId/chat``WorkbenchProjectGate` 从 URL 读 projectId通过 `ProjectContext` 提供项目上下文,仅 active 项目渲染。
ConsoleShell 包含:`ConfigProvider(zhCN)` + `AntApp` + `Layout`(Header/Sider/Content) + 主题切换(明亮/黑暗/系统)+ 侧边栏折叠。Header 显示品牌名、版本号和控制台标题。
ConsoleShell 包含:`XProvider(zhCN + zhCN_X)` + `AntApp` + `Layout`(Header/Sider/Content) + 主题切换(明亮/黑暗/系统)+ 侧边栏折叠。Header 显示品牌名、版本号和控制台标题。
`Sidebar``src/web/components/Sidebar/`)纯展示组件,通过 `menuItems` props 接收配置。
@@ -25,11 +25,11 @@ ConsoleShell 包含:`ConfigProvider(zhCN)` + `AntApp` + `Layout`(Header/Sider/
### 聊天页面
`ChatPage` = `ChatSidebar` + `ChatPanel`
`ChatPage` = `Conversations`@ant-design/x+ `ChatPanel`
- **ChatSidebar**TanStack Query 管理会话列表,创建/删除操作
- **ChatPanel**`useChat`@ai-sdk/react+ `DefaultChatTransport`ai 包)与后端 SSE 通信。按 `part.type` 分派渲染TextPartstreamdown Markdown、ReasoningPart、ToolPart四态。支持编辑重发、重新生成、复制。
- **ChatInputArea**`Input.TextArea` + `Button` + `Select`(模型切换)。
- **Conversations**:会话侧边栏,TanStack Query 管理会话列表,支持创建/选中/删除menu dropdown
- **ChatPanel**`useChat`@ai-sdk/react+ `DefaultChatTransport`ai 包)与后端 SSE 通信。按 `part.type` 分派渲染TextPartXMarkdown、ReasoningPart、ToolPart四态。支持编辑重发、重新生成、复制。
- **Sender**@ant-design/x输入框 + 发送/停止按钮 + 模型 Selectfooter slot)。
## Hooks