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,18 +1,20 @@
# AIclinicalresearch 系统当前状态与开发指南
> **文档版本:** v4.1
> **文档版本:** v4.2
> **创建日期:** 2025-11-28
> **维护者:** 开发团队
> **最后更新:** 2026-01-22
> **最后更新:** 2026-01-24
> **🎉 重大里程碑:**
> - **2026-01-24Protocol Agent MVP完成** 可复用Agent框架+5阶段对话流程
> - **2026-01-22OSS 存储集成完成!** 阿里云 OSS 正式接入平台基础层
> - **2026-01-21成功替换 Dify** PKB 模块完全使用自研 pgvector RAG 引擎
>
> **最新进展(OSS 集成**
> - ✅ **4个 Bucket 已创建**:生产/开发 × 数据/静态资源
> - ✅ **存储适配器架构**OSSAdapter + LocalAdapter支持云端和私有化部署
> - ✅ **PKB 模块集成**:文档上传到 OSS目录结构规范化
> - ✅ **开发规范建立**`docs/04-开发规范/11-OSS存储开发规范.md`
> **最新进展(Protocol Agent**
> - ✅ **通用Agent框架**Query→Planner→Executor→Tools→Reflection 五层架构
> - ✅ **8张数据库表**agent_schema(6) + protocol_schema(2)
> - ✅ **5阶段对话流程**科学问题→PICO→研究设计→样本量→观察指标
> - ✅ **前端完整实现**Gemini折叠侧边栏+状态面板+100%原型图还原
> - ⏳ **待联调测试**:前后端集成调试
>
> **部署状态:** ✅ 生产环境运行中 | 公网地址http://8.140.53.236/
> **文档目的:** 快速了解系统当前状态为新AI助手提供上下文
@@ -47,7 +49,7 @@
| 模块代号 | 模块名称 | 核心功能 | 商业价值 | 当前状态 | 优先级 |
|---------|---------|---------|---------|---------|--------|
| **AIA** | AI智能问答 | 12个智能体(选题→方案→评审→写作 | ⭐⭐⭐⭐⭐ | 🎉 **V2.1完成(90%** - Prompt管理集成 | **P0** |
| **AIA** | AI智能问答 | 12个智能体 + Protocol Agent全流程方案 | ⭐⭐⭐⭐⭐ | 🎉 **V3.0 MVP完成(75%** - Agent框架+5阶段流程 | **P0** |
| **PKB** | 个人知识库 | RAG问答、私人文献库 | ⭐⭐⭐ | 🎉 **Dify已替换自研RAG上线95%** | P1 |
| **ASL** | AI智能文献 | 文献筛选、Meta分析、证据图谱 | ⭐⭐⭐⭐⭐ | 🎉 **智能检索MVP完成60%** - DeepSearch集成 | **P0** |
| **DC** | 数据清洗整理 | ETL + 医学NER百万行级数据 | ⭐⭐⭐⭐⭐ | ✅ **Tool B完成 + Tool C 99%(异步架构+性能优化-99%+多指标转换+7大功能** | **P0** |