Files
AIclinicalresearch/docs/03-业务模块/AIA-AI智能问答
HaHafeng 4d7d97ca19 feat(aia): Protocol Agent streaming + editable state panel + protocol generation plan
Day 2 Development (2026-01-24):

Backend Enhancements:
- Implement SSE streaming in ProtocolAgentController using createStreamingService
- Add data condensation via LLM in ProtocolOrchestrator.handleProtocolSync
- Support stage editing without resetting progress
- Add explicit JSON output format for each stage in system prompt
- Create independent seed script for Protocol Agent (seed-protocol-agent.ts)

Frontend Improvements:
- Integrate useAIStream hook for typewriter effect in ChatArea
- Add MarkdownContent component for basic Markdown rendering
- Implement StageEditModal for editing stage data (scientific question, PICO, etc.)
- Add edit button to StageCard (visible on hover)
- Fix routing paths from /aia to /ai-qa
- Enhance CSS with full-screen layout and Markdown styles

New Documentation:
- One-click protocol generation development plan (v1.1)
- Editor selection evaluation (Novel vs BlockNote vs Tiptap)
- Novel fork strategy for AI-native editing

Technical Decisions:
- Choose Novel (Fork) as protocol editor for AI-first design
- Two-stage progressive generation: summary in chat, full protocol in editor
- 10-day development plan for protocol generation feature

Code Stats:
- Backend: 3 files modified, 1 new file
- Frontend: 9 files modified, 2 new files
- Docs: 3 new files

Status: Streaming and editable features working, protocol generation pending
2026-01-24 23:06:33 +08:00
..

AIA - AI智能问答模块

覆盖临床研究全生命周期的智能助手系统


📚 文档导航

核心文档

文档 说明 重要性
模块当前状态与开发指南 必读 了解模块真实状态
AIA模块PRD 产品需求文档
原型图V11 AgentHub设计精确还原
原型图V2 ChatWorkspace设计

开发文档

文档 说明
开发计划 实施路径
后端API设计 12个API端点
前端组件设计 组件架构

🎯 快速开始

访问模块

前端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. 查看 模块状态文档
  2. 查看 通用能力层清单
  3. 查看 系统总体设计

最后更新: 2026-01-14