feat(aia): Complete AIA V2.0 with universal streaming capabilities

Major Updates:
- Add StreamingService with OpenAI Compatible format (backend/common/streaming)
- Upgrade Chat component V2 with Ant Design X integration
- Implement AIA module with 12 intelligent agents
- Create AgentHub with 100% prototype V11 restoration
- Create ChatWorkspace with streaming response support
- Add ThinkingBlock for deep thinking display
- Add useAIStream Hook for OpenAI Compatible stream handling

Backend Common Capabilities (~400 lines):
- OpenAIStreamAdapter: SSE adapter with OpenAI format
- StreamingService: unified streaming service
- Support content and reasoning_content dual streams
- Deep thinking tag processing (<think>...</think>)

Frontend Common Capabilities (~2000 lines):
- AIStreamChat: modern streaming chat component
- ThinkingBlock: collapsible deep thinking display
- ConversationList: conversation management with grouping
- useAIStream: OpenAI Compatible stream handler Hook
- useConversations: conversation state management Hook
- Modern design styles (Ultramodern theme)

AIA Module Frontend (~1500 lines):
- AgentHub: 12 agent cards with timeline design
- ChatWorkspace: fullscreen immersive chat interface
- AgentCard: theme-colored cards (blue/yellow/teal/purple)
- 5 phases, 12 agents configuration
- Responsive layout (desktop + mobile)

AIA Module Backend (~900 lines):
- agentService: 12 agents config with system prompts
- conversationService: refactored with StreamingService
- attachmentService: file upload skeleton (30k token limit)
- 12 API endpoints with authentication
- Full CRUD for conversations and messages

Documentation:
- AIA module status and development guide
- Universal capabilities catalog (11 services)
- Quick reference card for developers
- System overview updates

Testing:
- Stream response verified (HTTP 200)
- Authentication working correctly
- Auto conversation creation working
- Deep thinking display working
- Message input and send working

Status: Core features completed (85%), attachment and history loading pending
This commit is contained in:
2026-01-14 19:09:28 +08:00
parent 4ed67a8846
commit 3d35e9c58b
38 changed files with 8448 additions and 335 deletions

View File

@@ -1,82 +1,117 @@
# AIA - AI智能问答
# AIA - AI智能问答模块
> **模块代号:** AIA (AI Intelligent Answer)
> **开发状态:** ✅ 已完成
> **商业价值:** ⭐⭐⭐⭐
> **独立性:** ⭐⭐⭐
> 覆盖临床研究全生命周期的智能助手系统
---
## 📋 模块概述
## 📚 文档导航
AI智能问答模块提供10+个专业AI智能体覆盖科研关键节点。
### 核心文档
**核心价值:** 差异化AI能力覆盖科研全流程
| 文档 | 说明 | 重要性 |
|------|------|--------|
| [模块当前状态与开发指南](./00-模块当前状态与开发指南.md) | ⭐⭐⭐⭐⭐ 必读 | 了解模块真实状态 |
| [AIA模块PRD](./01-需求分析/AIA模块PRD.md) | ⭐⭐⭐⭐ | 产品需求文档 |
| [原型图V11](./01-需求分析/AI问答原型图V11.html) | ⭐⭐⭐⭐⭐ | AgentHub设计精确还原 |
| [原型图V2](./01-需求分析/AI智能问答V2.html) | ⭐⭐⭐⭐ | ChatWorkspace设计 |
### 开发文档
| 文档 | 说明 |
|------|------|
| [开发计划](./04-开发计划/01-AIA-V2.1开发计划.md) | 实施路径 |
| [后端API设计](./04-开发计划/02-后端API设计.md) | 12个API端点 |
| [前端组件设计](./04-开发计划/03-前端组件设计.md) | 组件架构 |
---
## 🎯 核心功能
## 🎯 快速开始
### 已完成功能
1.**12个智能体** - YAML配置框架
2.**多轮对话** - 上下文管理、历史记录
3.**流式输出** - SSE打字机效果
4.**模型切换** - DeepSeek、Qwen3、Qwen-Long
5.**@知识库问答** - RAG增强
### 主要智能体
- 选题评价智能体(四维度评价)
- PICO梳理智能体
- 样本量计算智能体
- 研究方案制定智能体
- 文章润色与翻译智能体
---
## 📂 文档结构
### 访问模块
```
AIA-AI智能问答/
├── [AI对接] AIA快速上下文.md # ⏳ 待创建
├── 00-项目概述/
├── 01-设计文档/
└── README.md # ✅ 当前文档
前端http://localhost:5173/aia
后端http://localhost:3000/api/v1/aia
```
### 测试账号
需要先登录系统获取token
---
## ✨ 核心特性
### 12个智能体
| 阶段 | 智能体 | ID |
|------|--------|-----|
| **选题优化** | 科学问题梳理 | TOPIC_01 |
| **选题优化** | PICO梳理 | TOPIC_02 |
| **选题优化** | 选题评价 | TOPIC_03 |
| **方案设计** | 观察指标设计 | DESIGN_04 |
| **方案设计** | 病例报告表设计 | DESIGN_05 |
| **方案设计** | 样本量计算 | DESIGN_06 |
| **方案设计** | 临床研究方案撰写 | DESIGN_07 |
| **方案预评审** | 方法学评审智能体 | REVIEW_08 |
| **数据与统计** | 数据评价与预处理 | TOOL_09工具类 |
| **数据与统计** | 智能统计分析 | TOOL_10工具类 |
| **写作助手** | 论文润色 | WRITING_11 |
| **写作助手** | 论文翻译 | WRITING_12 |
### V2.0 新特性
-**OpenAI Compatible** - 标准流式格式
-**深度思考展示** - 可折叠展示AI推理过程
-**现代感UI** - 100%还原原型图设计
-**通用能力复用** - Chat组件可供其他模块使用
-**流式响应** - 逐字显示,打字机效果
---
## 🏗️ 技术架构
```
前端React 19
├── AgentHub智能体大厅
│ └── 12个AgentCard
└── ChatWorkspace对话工作台
├── Sidebar会话列表
└── AIStreamChat流式对话
├── ThinkingBlock深度思考
└── 输入区(附件+深度思考开关)
后端Fastify
├── agentService智能体配置
├── conversationService对话管理
└── StreamingService流式响应
└── OpenAIStreamAdapterSSE适配器
```
---
## 🔗 依赖的通用能力
## 📊 当前状态
- **LLM网关** - 模型调用和切换
- **RAG引擎** - @知识库问答
- **版本:** V2.0
- **完成度:** 85%
- **测试状态:** 核心功能测试通过 ✅
- **部署状态:** 开发环境就绪
### 待完成功能
- 🔜 附件上传与处理
- 🔜 历史消息加载
- 🔜 知识库集成RAG
- 🔜 Prompt管理系统对接
---
**最后更新:** 2025-11-06
**维护人:** 技术架构师
## 🆘 获取帮助
1. 查看 [模块状态文档](./00-模块当前状态与开发指南.md)
2. 查看 [通用能力层清单](../../02-通用能力层/00-通用能力层清单.md)
3. 查看 [系统总体设计](../../00-系统总体设计/00-系统当前状态与开发指南.md)
---
**最后更新:** 2026-01-14