Files
AIclinicalresearch/docs/03-业务模块/AIA-AI智能问答
HaHafeng 96290d2f76 feat(aia): Implement Protocol Agent MVP with reusable Agent framework
Sprint 1-3 Completed (Backend + Frontend):

Backend (Sprint 1-2):
- Implement 5-layer Agent framework (Query->Planner->Executor->Tools->Reflection)
- Create agent_schema with 6 tables (agent_definitions, stages, prompts, sessions, traces, reflexion_rules)
- Create protocol_schema with 2 tables (protocol_contexts, protocol_generations)
- Implement Protocol Agent core services (Orchestrator, ContextService, PromptBuilder)
- Integrate LLM service adapter (DeepSeek/Qwen/GPT-5/Claude)
- 6 API endpoints with full authentication
- 10/10 API tests passed

Frontend (Sprint 3):
- Add Protocol Agent entry in AgentHub (indigo theme card)
- Implement ProtocolAgentPage with 3-column layout
- Collapsible sidebar (Gemini style, 48px <-> 280px)
- StatePanel with 5 stage cards (scientific_question, pico, study_design, sample_size, endpoints)
- ChatArea with sync button and action cards integration
- 100% prototype design restoration (608 lines CSS)
- Detailed endpoints structure: baseline, exposure, outcomes, confounders

Features:
- 5-stage dialogue flow for research protocol design
- Conversation-driven interaction with sync-to-protocol button
- Real-time context state management
- One-click protocol generation button (UI ready, backend pending)

Database:
- agent_schema: 6 tables for reusable Agent framework
- protocol_schema: 2 tables for Protocol Agent
- Seed data: 1 agent + 5 stages + 9 prompts + 4 reflexion rules

Code Stats:
- Backend: 13 files, 4338 lines
- Frontend: 14 files, 2071 lines
- Total: 27 files, 6409 lines

Status: MVP core functionality completed, pending frontend-backend integration testing

Next: Sprint 4 - One-click protocol generation + Word export
2026-01-24 17:29:24 +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