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
This commit is contained in:
2026-01-24 17:29:24 +08:00
parent 61cdc97eeb
commit 96290d2f76
345 changed files with 13945 additions and 47 deletions

View File

@@ -1,15 +1,16 @@
# AIA AI智能问答模块 - 当前状态与开发指南
> **文档版本:** v2.1
> **文档版本:** v3.0
> **创建日期:** 2026-01-14
> **维护者:** AIA模块开发团队
> **最后更新:** 2026-01-18 🎉 **V2.1版本发布 - Prompt管理系统集成完成**
> **最后更新:** 2026-01-24 🎉 **V3.0版本发布 - Protocol Agent MVP完成**
> **重大里程碑:**
> - 🏆 通用流式响应服务OpenAI Compatible
> - 🎨 现代感UI100%还原原型图V11
> - 🚀 Ant Design X 深度集成
> - ✨ 12个智能体配置完成
> - 🆕 Prompt管理系统集成灰度预览、版本管理
> - 🎉 **Protocol Agent MVP完成可复用Agent框架+5阶段对话流程**
---
@@ -41,9 +42,9 @@ AIAAI Intelligent Assistant模块提供覆盖临床研究全生命周期
### 当前状态
- **开发阶段:** ✅ **V2.1 Prompt 管理集成完成**
- **架构版本:** V2.1(集成 PromptService
- **完成度:** 90%Prompt 管理已对接,支持灰度预览
- **开发阶段:** ✅ **V3.0 Protocol Agent MVP完成**
- **架构版本:** V3.0通用Agent框架 + Protocol Agent
- **完成度:** 75%MVP核心流程完成待前后端联调
### ✅ V2.1 新增功能2026-01-18
@@ -71,9 +72,26 @@ AIAAI Intelligent Assistant模块提供覆盖临床研究全生命周期
---
### ✅ V3.0 Protocol Agent MVP2026-01-24
**通用Agent框架:**
- [x] 5层架构完整实现Query→Planner→Executor→Tools→Reflection
- [x] ConfigLoader, BaseAgentOrchestrator, QueryAnalyzer, StageManager, TraceLogger
- [x] agent_schema: 6张表protocol_schema: 2张表
- [x] 完整类型定义382行
**Protocol Agent:**
- [x] 后端6个核心服务6个API端点10/10测试通过
- [x] 前端三栏布局5阶段状态面板100%还原原型图
- [x] 5阶段流程科学问题→PICO→研究设计→样本量→观察指标
**待完成:** 前后端联调、一键生成、Word导出
---
## 🏗️ 架构设计
### V2 架构特点
### V3 架构特点
```
┌─────────────────────────────────────────────────────────┐