feat(admin): Add user management and upgrade to module permission system

Features - User Management (Phase 4.1):
- Database: Add user_modules table for fine-grained module permissions
- Database: Add 4 user permissions (view/create/edit/delete) to role_permissions
- Backend: UserService (780 lines) - CRUD with tenant isolation
- Backend: UserController + UserRoutes (648 lines) - 13 API endpoints
- Backend: Batch import users from Excel
- Frontend: UserListPage (412 lines) - list/filter/search/pagination
- Frontend: UserFormPage (341 lines) - create/edit with module config
- Frontend: UserDetailPage (393 lines) - details/tenant/module management
- Frontend: 3 modal components (592 lines) - import/assign/configure
- API: GET/POST/PUT/DELETE /api/admin/users/* endpoints

Architecture Upgrade - Module Permission System:
- Backend: Add getUserModules() method in auth.service
- Backend: Login API returns modules array in user object
- Frontend: AuthContext adds hasModule() method
- Frontend: Navigation filters modules based on user.modules
- Frontend: RouteGuard checks requiredModule instead of requiredVersion
- Frontend: Remove deprecated version-based permission system
- UX: Only show accessible modules in navigation (clean UI)
- UX: Smart redirect after login (avoid 403 for regular users)

Fixes:
- Fix UTF-8 encoding corruption in ~100 docs files
- Fix pageSize type conversion in userService (String to Number)
- Fix authUser undefined error in TopNavigation
- Fix login redirect logic with role-based access check
- Update Git commit guidelines v1.2 with UTF-8 safety rules

Database Changes:
- CREATE TABLE user_modules (user_id, tenant_id, module_code, is_enabled)
- ADD UNIQUE CONSTRAINT (user_id, tenant_id, module_code)
- INSERT 4 permissions + role assignments
- UPDATE PUBLIC tenant with 8 module subscriptions

Technical:
- Backend: 5 new files (~2400 lines)
- Frontend: 10 new files (~2500 lines)
- Docs: 1 development record + 2 status updates + 1 guideline update
- Total: ~4900 lines of code

Status: User management 100% complete, module permission system operational
This commit is contained in:
2026-01-16 13:42:10 +08:00
parent 98d862dbd4
commit 66255368b7
560 changed files with 70424 additions and 52353 deletions

View File

@@ -1,161 +1,161 @@
# AIA 妯″潡 V2.1 寮€鍙戣<EFBFBD>鍒?
# AIA 模块 V2.1 开发计划
> **版本**V2.1
> **鍒涘缓鏃ユ湡**锛?026-01-11
> **璁″垝鍛ㄦ湡**锛氱害 8-11 澶?
> **绛栫暐**锛氶噸鍐欏悗绔?+ 澶嶇敤鏁版嵁搴?+ 鏂板紑鍙戝墠绔?
> **鍏宠仈PRD**锛歚01-闇€姹傚垎鏋?AIA妯″潡PRD.md`
> **鍏宠仈鍘熷瀷**锛歚01-闇€姹傚垎鏋?AI鏅鸿兘闂<E58598>V2.html`
> **创建日期**2026-01-11
> **计划周期**:约 8-11
> **策略**:重写后端 + 复用数据库 + 新开发前端
> **关联PRD**`01-需求分析/AIA模块PRD.md`
> **关联原型**`01-需求分析/AI智能问答V2.html`
---
## 馃搵 寮€鍙戠瓥鐣ユ<E990A3>杩?
## 📋 开发策略概述
### 核心决策
| 组件 | 策略 | 理由 |
|------|------|------|
| **鍚庣<EFBFBD>** | 馃敶 **閲嶅啓** | х増涓嶇<EFBFBD>鍚堜簯鍘熺敓瑙勮寖锛坈onsole.log銆佹湭浣跨敤骞冲彴鑳藉姏锛?|
| **鏁版嵁搴?* | 鉁?**澶嶇敤** | aia_schema 宸插畬鍠勶紝瀛楁<EFBFBD>婊¤冻闇€姹?|
| **鍓嶇<EFBFBD>** | 馃敶 **鏂板紑鍙?* | 澶嶇敤 shared/components/Chat 閫氱敤缁勪欢锛屽叏鏂癠I |
| **后端** | 🔴 **重写** | 旧版不符合云原生规范console.log、未使用平台能力 |
| **数据库** | ✅ **复用** | aia_schema 已完善,字段满足需求 |
| **前端** | 🔴 **新开发** | 复用 shared/components/Chat 通用组件全新UI |
### 鎶€鏈<EFBFBD><EFBFBD>鑼?
### 技术规范
| 规范 | 要求 |
|------|------|
| **鏃ュ織** | 浣跨敤 `logger` from `@/common/logging`锛堢<EFBFBD>姝?console.log锛?|
| **日志** | 使用 `logger` from `@/common/logging`(禁止 console.log |
| **存储** | 使用 `storage` from `@/common/storage` |
| **缓存** | 使用 `cache` from `@/common/cache` |
| **队列** | 使用 `jobQueue` from `@/common/jobs` |
| **Prompt** | 使用 `promptService.get()` from `@/common/prompts` |
| **代码位置** | `backend/src/modules/aia/` |
| **API<EFBFBD>** | `/api/v1/aia/*` |
| **API路由** | `/api/v2/aia/*` |
---
## 馃搳 鏁版嵁搴撶姸鎬侊紙鉁?宸插畬鎴愶級
## 📊 数据库状态(✅ 已完成)
### 琛ㄧ粨鏋勶紙3涓<EFBFBD>〃锛?
### 表结构3个表
```
aia_schema.projects 鉁?淇濈暀
aia_schema.conversations 鉁?淇濈暀
aia_schema.messages 鉁?淇濈暀 + 鏂板<E98F82>瀛楁<E7809B>
aia_schema.projects ✅ 保留
aia_schema.conversations ✅ 保留
aia_schema.messages ✅ 保留 + 新增字段
```
### 鏂板<EFBFBD>瀛楁<EFBFBD>锛?026-01-11 宸茶縼绉伙級
### 新增字段2026-01-11 已迁移)
| 琛?| 瀛楁<E7809B> | 绫诲瀷 | 璇存槑 |
| 表 | 字段 | 类型 | 说明 |
|----|------|------|------|
| messages | `thinking_content` | TEXT | 娣卞害鎬濊€冨唴瀹?`<think>...</think>` |
| messages | `attachments` | JSONB | 闄勪欢鏁扮粍锛堜笂闄?涓<>紝鍗曚釜鈮?0MB锛屾枃鏈<E69E83>30K tokens锛?|
| messages | `thinking_content` | TEXT | 深度思考内容 `<think>...</think>` |
| messages | `attachments` | JSONB | 附件数组上限5个单个≤20MB文本≤30K tokens |
### 已删除表
| 琛?| 鍘熷洜 |
| 表 | 原因 |
|----|------|
| `general_conversations` | 鍔熻兘閲嶅彔锛屼娇鐢?conversations.project_id = NULL |
| `general_conversations` | 功能重叠,使用 conversations.project_id = NULL |
| `general_messages` | 功能重叠 |
---
## 馃棑锔?寮€鍙戦樁娈?
## 🗓️ 开发阶段
### Phase 1: 鍚庣<EFBFBD>閲嶅啓锛?-4澶╋級
### Phase 1: 后端重写3-4天
#### Day 1: 模块骨架 + 核心服务
**目标**:搭建模块结构,迁移核心对话服务
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **1.1 创建模块目录结构**
```
backend/src/modules/aia/
├── controllers/
鈹? 鈹溾攢鈹€ conversationController.ts
鈹? 鈹溾攢鈹€ agentController.ts
鈹? 鈹斺攢鈹€ projectController.ts
│ ├── conversationController.ts
│ ├── agentController.ts
│ └── projectController.ts
├── services/
鈹? 鈹溾攢鈹€ conversationService.ts
鈹? 鈹溾攢鈹€ agentService.ts
鈹? 鈹斺攢鈹€ projectService.ts
│ ├── conversationService.ts
│ ├── agentService.ts
│ └── projectService.ts
├── routes/
鈹? 鈹斺攢鈹€ index.ts
│ └── index.ts
├── types/
鈹? 鈹斺攢鈹€ index.ts
│ └── index.ts
└── index.ts
```
- [ ] **1.2 重写 conversationService**
- 浠?legacy 澶嶅埗鏍稿績閫昏緫
- 鏇挎崲 `console.log` 鈫?`logger`
- 浣跨敤 `prisma.message`锛堝凡鍦?aia_schema锛?
- legacy 复制核心逻辑
- 替换 `console.log` `logger`
- 使用 `prisma.message`(已在 aia_schema
- 添加 `thinkingContent` 处理逻辑
- 保持流式输出能力
- [ ] **1.3 重写 agentService**
- 改用 `promptService.get()` 获取 Prompt
- 缂撳瓨鏅鸿兘浣撻厤缃<EFBFBD>紙浣跨敤 `cache`锛?
- 缓存智能体配置(使用 `cache`
- [ ] **1.4 注册 v2 路由**
- 娉ㄥ唽鍒?`/api/v1/aia/*`
- 淇濇寔 legacy <EFBFBD>敱鍏煎<EFBFBD>锛堥€愭<EFBFBD>杩佺Щ锛?
- 注册到 `/api/v2/aia/*`
- 保持 legacy 路由兼容(逐步迁移)
**楠屾敹鏍囧噯**锛?
**验收标准**
- [ ] 基础对话功能可用
- [ ] 流式输出正常
- [ ] 鏃ュ織杈撳嚭鍒?logger
- [ ] 日志输出到 logger
---
#### Day 2: 娣卞害鎬濊€?+ 闄勪欢涓婁紶
#### Day 2: 深度思考 + 附件上传
**<EFBFBD>爣**锛氬疄鐜?V2.1 鏂板<E98F82>鍔熻兘
**目标**:实现 V2.1 新增功能
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **2.1 娣卞害鎬濊€冩ā寮?*
- 妫€娴?LLM 杈撳嚭涓<E59AAD> `<think>...</think>` 鏍囩<EFBFBD>
- [ ] **2.1 深度思考模式**
- 检测 LLM 输出中的 `<think>...</think>` 标签
- 提取并存储到 `messages.thinking_content`
- 浠?`content` <EFBFBD>Щ闄?think 鏍囩<EFBFBD>
- 娴佸紡杈撳嚭鏃跺垎绂?thinking 鍜?content
- `content` 中移除 think 标签
- 流式输出时分离 thinking content
- [ ] **2.2 附件上传服务**
- 浣跨敤 `storage.upload()` 涓婁紶鍒?OSS
- 璋冪敤 Python <EFBFBD>湇鍔℃彁鍙栨枃鏈?
- Token 璁℃暟锛堜娇鐢?tiktoken锛?
- <EFBFBD>柇澶勭悊锛堣秴杩?30K tokens锛?
- 瀛樺偍闄勪欢淇℃伅鍒?`messages.attachments`
- 使用 `storage.upload()` 上传到 OSS
- 调用 Python 微服务提取文本
- Token 计数(使用 tiktoken
- 截断处理(超过 30K tokens
- 存储附件信息到 `messages.attachments`
- [ ] **2.3 闄勪欢娉ㄥ叆 LLM 涓婁笅鏂?*
- 缁勮<EFBFBD>闄勪欢鏂囨湰鍒?User Prompt
- 鎺у埗鎬?Token 闀垮害
- [ ] **2.3 附件注入 LLM 上下文**
- 组装附件文本到 User Prompt
- 控制总 Token 长度
**鎶€鏈<EFBFBD><EFBFBD>鏍?*锛?
**技术规格**
```typescript
// 附件处理配置
const ATTACHMENT_CONFIG = {
maxCount: 5, // 姣忔潯娑堟伅鏈€澶?涓<>檮浠?
maxCount: 5, // 每条消息最多5个附件
maxSizePerFile: 20 * 1024 * 1024, // 单个文件20MB
maxTokens: 30000, // 鎻愬彇鏂囨湰鏈€澶?0K tokens
maxTokens: 30000, // 提取文本最多30K tokens
supportedTypes: ['pdf', 'docx', 'txt', 'xlsx'],
};
```
**楠屾敹鏍囧噯**锛?
- [ ] 娣卞害鎬濊€冨唴瀹规<EFBFBD><EFBFBD>垎绂诲瓨鍌?
**验收标准**
- [ ] 深度思考内容正确分离存储
- [ ] 附件上传成功
- [ ] 附件文本正确注入 LLM
---
#### Day 3: 鎰忓浘璺<EFBFBD>敱 + 鐭ヨ瘑搴撻泦鎴?
#### Day 3: 意图路由 + 知识库集成
**目标**:实现全局意图路由,完善知识库引用
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **3.1 意图路由服务**
- 新建 `intentRouterService.ts`
@@ -163,27 +163,27 @@ const ATTACHMENT_CONFIG = {
- 返回目标 Agent ID + 预填 Prompt
- 添加 500ms 防抖(前端实现)
- [ ] **3.2 瀹屽杽鐭ヨ瘑搴撻泦鎴?*
- 澶嶇敤 PKB 妯″潡鐨?RAG 妫€绱?
- 鏅鸿兘寮曠敤绯荤粺锛圼鏉ユ簮N]锛?
- 寮曠敤娓呭崟鏍煎紡鍖?
- [ ] **3.2 完善知识库集成**
- 复用 PKB 模块的 RAG 检索
- 智能引用系统([来源N]
- 引用清单格式化
- [ ] **3.3 API 端点完善**
```
POST /api/v1/aia/intent/route # 鎰忓浘璺<EFBFBD>
POST /api/v1/aia/conversations # 鍒涘缓瀵硅瘽
GET /api/v1/aia/conversations # 瀵硅瘽鍒楄〃
GET /api/v1/aia/conversations/:id # 瀵硅瘽璇︽儏
POST /api/v1/aia/conversations/:id/messages/stream # 鍙戦€佹秷鎭<EFBFBD>紙娴佸紡锛?
POST /api/v1/aia/conversations/:id/attachments # 涓婁紶闄勪欢
GET /api/v1/aia/agents # 鏅鸿兘浣撳垪琛?
GET /api/v1/aia/agents/:id # 鏅鸿兘浣撹<EFBFBD>鎯?
POST /api/v2/aia/intent/route # 意图路由
POST /api/v2/aia/conversations # 创建对话
GET /api/v2/aia/conversations # 对话列表
GET /api/v2/aia/conversations/:id # 对话详情
POST /api/v2/aia/conversations/:id/messages/stream # 发送消息(流式)
POST /api/v2/aia/conversations/:id/attachments # 上传附件
GET /api/v2/aia/agents # 智能体列表
GET /api/v2/aia/agents/:id # 智能体详情
```
**楠屾敹鏍囧噯**锛?
- [ ] 鎰忓浘璺<EFBFBD>敱姝璇嗗埆骞惰烦杞?
- [ ] 鐭ヨ瘑搴撳紩鐢ㄦ<EFBFBD><EFBFBD>樉绀?
- [ ] 鎵€鏈?API 绔<>偣鍙<E581A3>
**验收标准**
- [ ] 意图路由正确识别并跳转
- [ ] 知识库引用正确显示
- [ ] 所有 API 端点可用
---
@@ -191,23 +191,23 @@ const ATTACHMENT_CONFIG = {
**目标**:完成后端测试和文档
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **4.1 单元测试**
- conversationService 测试
- 娣卞害鎬濊€冭В鏋愭祴璇?
- 深度思考解析测试
- 附件处理测试
- [ ] **4.2 集成测试**
- 完整对话流程
- 附件上传流程
- 鐭ヨ瘑搴撴<EFBFBD>绱㈡祦绋?
- 知识库检索流程
- [ ] **4.3 API 文档**
- 更新 REST Client 测试文件
- 编写 API 使用示例
**楠屾敹鏍囧噯**锛?
**验收标准**
- [ ] 测试覆盖核心功能
- [ ] API 文档完整
@@ -215,66 +215,66 @@ const ATTACHMENT_CONFIG = {
### Phase 2: 前端开发5-7天
#### Day 5-6: 鏅鸿兘浣撳ぇ鍘咃紙Dashboard锛?
#### Day 5-6: 智能体大厅(Dashboard
**目标**:实现首页智能体大厅
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **5.1 创建模块目录结构**
```
frontend-v2/src/modules/aia/
├── pages/
鈹? 鈹溾攢鈹€ Dashboard.tsx # 鏅鸿兘浣撳ぇ鍘?
鈹? 鈹斺攢鈹€ Workspace.tsx # 瀵硅瘽宸ヤ綔鍙?
│ ├── Dashboard.tsx # 智能体大厅
│ └── Workspace.tsx # 对话工作台
├── components/
鈹? 鈹溾攢鈹€ AgentPipeline.tsx # 5闃舵<EFBFBD>娴佹按绾?
鈹? 鈹溾攢鈹€ AgentCard.tsx # 鏅鸿兘浣撳崱鐗?
鈹? 鈹溾攢鈹€ IntentSearch.tsx # 鎰忓浘鎼滅储妗?
鈹? 鈹溾攢鈹€ ConversationList.tsx # 鍘嗗彶浼氳瘽鍒楄〃
鈹? 鈹溾攢鈹€ ThinkingBlock.tsx # 娣卞害鎬濊€冩姌鍙犲潡
鈹? 鈹溾攢鈹€ AttachmentUpload.tsx # 闄勪欢涓婁紶
鈹? 鈹溾攢鈹€ AttachmentCard.tsx # 闄勪欢鍗$墖
鈹? 鈹斺攢鈹€ SlashCommands.tsx # <EFBFBD>嵎鎸囦护
│ ├── AgentPipeline.tsx # 5阶段流水线
│ ├── AgentCard.tsx # 智能体卡片
│ ├── IntentSearch.tsx # 意图搜索框
│ ├── ConversationList.tsx # 历史会话列表
│ ├── ThinkingBlock.tsx # 深度思考折叠块
│ ├── AttachmentUpload.tsx # 附件上传
│ ├── AttachmentCard.tsx # 附件卡片
│ └── SlashCommands.tsx # 快捷指令
├── hooks/
鈹? 鈹溾攢鈹€ useConversation.ts
鈹? 鈹溾攢鈹€ useAgents.ts
鈹? 鈹斺攢鈹€ useIntentRouter.ts
│ ├── useConversation.ts
│ ├── useAgents.ts
│ └── useIntentRouter.ts
├── api/
鈹? 鈹斺攢鈹€ index.ts
│ └── index.ts
├── types/
鈹? 鈹斺攢鈹€ index.ts
│ └── index.ts
└── index.tsx
```
- [ ] **5.2 鏅鸿兘浣撴祦姘寸嚎锛圓gentPipeline锛?*
- 5闃舵<EFBFBD>甯冨眬锛堜弗鏍艰繕鍘?V11 鍘熷瀷锛?
- 3鑹茶<EFBFBD>瑙変綋绯?
- [ ] **5.2 智能体流水线AgentPipeline**
- 5阶段布局(严格还原 V11 原型)
- 3色视觉体系
- 卡片点击跳转 Workspace
- 宸ュ叿鍗$墖璺宠浆澶栭儴妯″潡锛圖C/ST锛?
- 工具卡片跳转外部模块DC/ST
- [ ] **5.3 鎰忓浘鎼滅储妗嗭紙IntentSearch锛?*
- [ ] **5.3 意图搜索框(IntentSearch**
- 顶部大搜索框
- 500ms 防抖
- 调用意图路由 API
- 自动跳转目标 Agent
**楠屾敹鏍囧噯**锛?
- [ ] 5闃舵<EFBFBD>娴佹按绾挎<EFBFBD><EFBFBD>睍绀?
**验收标准**
- [ ] 5阶段流水线正确展示
- [ ] 意图搜索功能可用
- [ ] 涓庡師鍨嬪浘涓€鑷?
- [ ] 与原型图一致
---
#### Day 7-8: 瀵硅瘽宸ヤ綔鍙帮紙Workspace锛?
#### Day 7-8: 对话工作台(Workspace
**目标**:实现沉浸式对话界面
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **7.1 工作台布局**
- Gemini 风格(大留白、少分割线)
- 宸︿晶渚ц竟鏍忥紙鍘嗗彶浼氳瘽锛屽彲鎶樺彔锛?
- 左侧侧边栏(历史会话,可折叠)
- 主对话区Header + 消息列表 + 输入框)
- [ ] **7.2 复用 Chat 通用组件**
@@ -283,17 +283,17 @@ const ATTACHMENT_CONFIG = {
<ChatContainer
providerConfig={{
apiEndpoint: '/api/v1/aia/conversations/:id/messages/stream',
apiEndpoint: '/api/v2/aia/conversations/:id/messages/stream',
requestFn: sendMessageWithStream,
}}
customMessageRenderer={renderAIAMessage}
/>
```
- [ ] **7.3 娣卞害鎬濊€冩姌鍙犲潡锛圱hinkingBlock锛?*
- [ ] **7.3 深度思考折叠块ThinkingBlock**
- 可折叠灰色引用块
- 生成中展开,完成后自动收起
- 鏄剧ず"宸叉繁搴︽€濊€?(鑰楁椂 Xs)"
- 显示"已深度思考 (耗时 Xs)"
- [ ] **7.4 附件上传组件**
- 支持拖拽上传
@@ -302,13 +302,13 @@ const ATTACHMENT_CONFIG = {
- 消息气泡下方附件卡片
- [ ] **7.5 历史会话列表**
- 鎸夋椂闂村垎缁勶紙浠婂ぉ銆佹槰澶┿€?澶╁墠锛?
- 妗岄潰绔<EFBFBD>浐瀹氭樉绀?
- 绉诲姩绔<EFBFBD>娊灞夋粦鍑?
- 按时间分组今天、昨天、7天前
- 桌面端固定显示
- 移动端抽屉滑出
**楠屾敹鏍囧噯**锛?
**验收标准**
- [ ] Gemini 风格 UI
- [ ] 娣卞害鎬濊€冩<EFBFBD><EFBFBD>睍绀?
- [ ] 深度思考正确展示
- [ ] 附件上传完整流程
- [ ] 历史会话切换
@@ -316,30 +316,30 @@ const ATTACHMENT_CONFIG = {
#### Day 9: Markdown 增强 + 快捷指令
**<EFBFBD>爣**锛氬<E9949B>寮哄<E5AFAE>璇濅綋楠?
**目标**:增强对话体验
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **9.1 Markdown 渲染增强**
- KaTeX 公式渲染(医学公式)
- 表格横向滚动
- 爜鍧楄<EFBFBD>娉曢珮浜?+ 涓€閿<E282AC><E996BF>鍒?
- 代码块语法高亮 + 一键复制
- [ ] **9.2 <EFBFBD>嵎鎸囦护锛圫lashCommands锛?*
- [ ] **9.2 快捷指令SlashCommands**
- 输入 `/` 弹出菜单
- <EFBFBD>寔锛?娑﹁壊, /鎵╁啓, /缈昏瘧, /瀵煎嚭Word
- 支持:/润色, /扩写, /翻译, /导出Word
- 键盘导航
- [ ] **9.3 缁撴灉鎿嶄綔鏍?*
- Hover 鏄剧ず宸ュ叿鏍?
- 澶嶅埗锛圡arkdown 婧愮爜锛?
- [ ] **9.3 结果操作栏**
- Hover 显示工具栏
- 复制Markdown 源码)
- 重新生成
- 瀵煎嚭 Word锛堣皟鐢?RVW 瀵煎嚭鏈嶅姟锛?
- 导出 Word(调用 RVW 导出服务)
**楠屾敹鏍囧噯**锛?
**验收标准**
- [ ] 公式正确渲染
- [ ] 快捷指令可用
- [ ] 鎿嶄綔鏍忓姛鑳藉畬鏁?
- [ ] 操作栏功能完整
---
@@ -347,25 +347,25 @@ const ATTACHMENT_CONFIG = {
**目标**:响应式布局适配
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **10.1 Dashboard 绉诲姩绔?*
- [ ] **10.1 Dashboard 移动端**
- 隐藏复杂导航
- 卡片单列流式布局
- 鏃堕棿杞存牱寮忚皟鏁?
- 时间轴样式调整
- [ ] **10.2 Workspace 绉诲姩绔?*
- 渚ц竟鏍忔敼涓烘娊灞?
- 杈撳叆妗嗛敭鐩橀€傞厤锛坰crollIntoView锛?
- 鍙戦€佹寜閽<EFBFBD><EFBFBD>缁堝彲瑙?
- [ ] **10.2 Workspace 移动端**
- 侧边栏改为抽屉
- 输入框键盘适配scrollIntoView
- 发送按钮始终可见
- [ ] **10.3 触控优化**
- 鎸夐挳 active 鎬?
- 按钮 active
- 触控区域优化
**楠屾敹鏍囧噯**锛?
**验收标准**
- [ ] md (768px) 断点响应正确
- [ ] 绉诲姩绔<EFBFBD>氦浜掓祦鐣?
- [ ] 移动端交互流畅
---
@@ -373,27 +373,27 @@ const ATTACHMENT_CONFIG = {
**目标**:完成整体测试和优化
**浠诲姟娓呭崟**锛?
**任务清单**
- [ ] **11.1 <EFBFBD>埌绔<EFBFBD>祴璇?*
- [ ] **11.1 端到端测试**
- 完整对话流程
- 附件上传流程
- 娣卞害鎬濊€冩祦绋?
- 鐭ヨ瘑搴撳紩鐢ㄦ祦绋?
- 深度思考流程
- 知识库引用流程
- [ ] **11.2 性能优化**
- TTFB < 1.5s
- 绉诲姩绔?LCP < 1s
- 移动端 LCP < 1s
- 意图搜索防抖
- [ ] **11.3 Bug 修复**
- [ ] **11.4 文档更新**
- 鏇存柊妯″潡鐘舵€佹枃妗?
- 鏇存柊绯荤粺褰撳墠鐘舵€?
- 更新模块状态文档
- 更新系统当前状态
**楠屾敹鏍囧噯**锛?
- [ ] 鎵€鏈夊姛鑳芥<EFBFBD>甯?
**验收标准**
- [ ] 所有功能正常
- [ ] 性能达标
- [ ] 文档完整
@@ -406,22 +406,22 @@ const ATTACHMENT_CONFIG = {
```
backend/src/modules/aia/
├── controllers/
鈹? 鈹溾攢鈹€ conversationController.ts # ~300琛?
鈹? 鈹溾攢鈹€ agentController.ts # ~150琛?
鈹? 鈹斺攢鈹€ projectController.ts # ~200琛?
│ ├── conversationController.ts # ~300
│ ├── agentController.ts # ~150
│ └── projectController.ts # ~200
├── services/
鈹? 鈹溾攢鈹€ conversationService.ts # ~500琛岋紙鏍稿績锛?
鈹? 鈹溾攢鈹€ agentService.ts # ~200琛?
鈹? 鈹溾攢鈹€ projectService.ts # ~150琛?
鈹? 鈹溾攢鈹€ intentRouterService.ts # ~100琛岋紙鏂帮級
鈹? 鈹斺攢鈹€ attachmentService.ts # ~200琛岋紙鏂帮級
│ ├── conversationService.ts # ~500行(核心)
│ ├── agentService.ts # ~200
│ ├── projectService.ts # ~150
│ ├── intentRouterService.ts # ~100行(新)
│ └── attachmentService.ts # ~200行(新)
├── routes/
鈹? 鈹斺攢鈹€ index.ts # ~100琛?
│ └── index.ts # ~100
├── types/
鈹? 鈹斺攢鈹€ index.ts # ~100琛?
鈹斺攢鈹€ index.ts # ~20琛?
│ └── index.ts # ~100
└── index.ts # ~20
棰勮<EFBFBD>鎬昏<EFBFBD>锛殈2000琛?
预计总计:~2000
```
### 前端新增文件
@@ -429,28 +429,28 @@ backend/src/modules/aia/
```
frontend-v2/src/modules/aia/
├── pages/
鈹? 鈹溾攢鈹€ Dashboard.tsx # ~400琛?
鈹? 鈹斺攢鈹€ Workspace.tsx # ~500琛?
│ ├── Dashboard.tsx # ~400
│ └── Workspace.tsx # ~500
├── components/
鈹? 鈹溾攢鈹€ AgentPipeline.tsx # ~300琛?
鈹? 鈹溾攢鈹€ AgentCard.tsx # ~100琛?
鈹? 鈹溾攢鈹€ IntentSearch.tsx # ~150琛?
鈹? 鈹溾攢鈹€ ConversationList.tsx # ~200琛?
鈹? 鈹溾攢鈹€ ThinkingBlock.tsx # ~100琛?
鈹? 鈹溾攢鈹€ AttachmentUpload.tsx # ~200琛?
鈹? 鈹溾攢鈹€ AttachmentCard.tsx # ~80琛?
鈹? 鈹斺攢鈹€ SlashCommands.tsx # ~150琛?
│ ├── AgentPipeline.tsx # ~300
│ ├── AgentCard.tsx # ~100
│ ├── IntentSearch.tsx # ~150
│ ├── ConversationList.tsx # ~200
│ ├── ThinkingBlock.tsx # ~100
│ ├── AttachmentUpload.tsx # ~200
│ ├── AttachmentCard.tsx # ~80
│ └── SlashCommands.tsx # ~150
├── hooks/
鈹? 鈹溾攢鈹€ useConversation.ts # ~150琛?
鈹? 鈹溾攢鈹€ useAgents.ts # ~100琛?
鈹? 鈹斺攢鈹€ useIntentRouter.ts # ~80琛?
│ ├── useConversation.ts # ~150
│ ├── useAgents.ts # ~100
│ └── useIntentRouter.ts # ~80
├── api/
鈹? 鈹斺攢鈹€ index.ts # ~200琛?
│ └── index.ts # ~200
├── types/
鈹? 鈹斺攢鈹€ index.ts # ~100琛?
鈹斺攢鈹€ index.tsx # ~50琛?
│ └── index.ts # ~100
└── index.tsx # ~50
棰勮<EFBFBD>鎬昏<EFBFBD>锛殈2900琛?
预计总计:~2900
```
---
@@ -466,8 +466,8 @@ frontend-v2/src/modules/aia/
| `cache` | `@/common/cache` | Redis/PG缓存 |
| `jobQueue` | `@/common/jobs` | 异步任务 |
| `promptService` | `@/common/prompts` | Prompt管理 |
| `LLMFactory` | `@/common/llm` | LLM閫傞厤鍣?|
| `prisma` | `@/config/database` | 鏁版嵁搴?|
| `LLMFactory` | `@/common/llm` | LLM适配器 |
| `prisma` | `@/config/database` | 数据库 |
| `ExtractionClient` | `@/clients` | 文档提取 |
| `TokenService` | `@/services` | Token计数 |
@@ -476,7 +476,7 @@ frontend-v2/src/modules/aia/
| 依赖 | 来源 | 说明 |
|------|------|------|
| `ChatContainer` | `@/shared/components/Chat` | 通用对话组件 |
| `Ant Design` | `antd` | UI缁勪欢搴?|
| `Ant Design` | `antd` | UI组件库 |
| `Ant Design X` | `@ant-design/x` | AI对话组件 |
| `KaTeX` | `katex` | 公式渲染 |
| `react-markdown` | `react-markdown` | Markdown渲染 |
@@ -487,37 +487,37 @@ frontend-v2/src/modules/aia/
| 风险 | 概率 | 影响 | 缓解措施 |
|------|------|------|---------|
| 娴佸紡杈撳嚭鍏煎<EFBFBD>鎬?| 涓?| 楂?| 澶嶇敤宸查獙璇佺殑 SSE 浠g爜 |
| 闄勪欢鎻愬彇瓒呮椂 | 涓?| 涓?| 浣跨敤 jobQueue 寮傛<EFBFBD>澶勭悊 |
| 绉诲姩绔<EFBFBD>€傞厤闂<EFBFBD><EFBFBD> | 浣?| 涓?| 鎻愬墠瑙勫垝鏂<E59E9D>偣鍜屽竷灞€ |
| Prompt悊鏈嶅姟鏈<EFBFBD>氨缁?| 浣?| 涓?| 鍙<>复鏃跺洖閫€鍒版枃浠惰<E6B5A0>鍙?|
| 流式输出兼容性 | 中 | 高 | 复用已验证的 SSE 代码 |
| 附件提取超时 | 中 | 中 | 使用 jobQueue 异步处理 |
| 移动端适配问题 | 低 | 中 | 提前规划断点和布局 |
| Prompt管理服务未就绪 | 低 | 中 | 可临时回退到文件读取 |
---
## 鉁?楠屾敹鏍囧噯
## ✅ 验收标准
### 功能验收
- [ ] 鏅鸿兘浣撳ぇ鍘呭畬鏁村睍绀?
- [ ] 智能体大厅完整展示
- [ ] 意图搜索正确路由
- [ ] 多轮对话正常
- [ ] 流式输出流畅
- [ ] 娣卞害鎬濊€冩<EFBFBD><EFBFBD>姌鍙?
- [ ] 深度思考正确折叠
- [ ] 附件上传完整
- [ ] 鐭ヨ瘑搴撳紩鐢ㄦ<EFBFBD>纭?
- [ ] 知识库引用正确
- [ ] 快捷指令可用
- [ ] 移动端适配正常
### 性能验收
- [ ] TTFB < 1.5s
- [ ] 绉诲姩绔?LCP < 1s
- [ ] 移动端 LCP < 1s
- [ ] 意图搜索响应 < 500ms
### 质量验收
- [ ] 鏃?console.log锛堜娇鐢?logger锛?
- [ ] 爜绗﹀悎浜戝師鐢熻<EFBFBD>鑼?
- [ ] console.log(使用 logger
- [ ] 代码符合云原生规范
- [ ] API 文档完整
- [ ] 单元测试覆盖核心功能
@@ -527,14 +527,13 @@ frontend-v2/src/modules/aia/
| 日期 | 版本 | 内容 |
|------|------|------|
| 2026-01-11 | V1.0 | 鍒涘缓寮€鍙戣<EFBFBD>鍒?|
| 2026-01-11 | V1.0 | 创建开发计划 |
---
**璁″垝鍒跺畾浜?*锛欰I Assistant
**瀹℃牳浜?*锛氬緟瀹?
**鎵瑰噯浜?*锛氬緟瀹?
**计划制定人**AI Assistant
**审核人**:待定
**批准人**:待定