Files
AIclinicalresearch/docs/03-业务模块/AIA-AI智能问答/README.md
HaHafeng 3d35e9c58b 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
2026-01-14 19:09:28 +08:00

118 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AIA - 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) | 组件架构 |
---
## 🎯 快速开始
### 访问模块
```
前端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适配器
```
---
## 📊 当前状态
- **版本:** V2.0
- **完成度:** 85%
- **测试状态:** 核心功能测试通过 ✅
- **部署状态:** 开发环境就绪
### 待完成功能
- 🔜 附件上传与处理
- 🔜 历史消息加载
- 🔜 知识库集成RAG
- 🔜 Prompt管理系统对接
---
## 🆘 获取帮助
1. 查看 [模块状态文档](./00-模块当前状态与开发指南.md)
2. 查看 [通用能力层清单](../../02-通用能力层/00-通用能力层清单.md)
3. 查看 [系统总体设计](../../00-系统总体设计/00-系统当前状态与开发指南.md)
---
**最后更新:** 2026-01-14