Files
AIclinicalresearch/docs/03-业务模块/ASL-AI智能文献/05-开发记录
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
..

ASL模块开发记录

本目录记录ASLAI智能文献筛选模块的完整开发历程。


📁 文档索引

Week 1 完成报告2025-11-18

文档 内容 重要性
今日工作总结.md 2025-11-18全天工作总结
两步测试完整报告.md 国内外模型对比 + 三种风格测试
卒中数据泛化测试报告.md 最初的泛化能力测试
Prompt设计与测试完成报告.md Prompt v1.0.0测试
Week1完成报告.md Week 1开发完成总结

🎯 核心发现

1. 根本问题确认

准确率不高的根本原因 = AI与人类对边界情况的理解差异

不是:

  • 模型智商不够
  • Prompt设计不好
  • 宽松/严格程度不对

而是:

  • 纳排标准存在隐含规则
  • 边界情况定义不明确
  • AI无法猜测用户真实意图

2. 解决方案

短期方案(已实现)

三种筛选风格:

  • 宽松模式:初筛使用,宁可多纳入
  • 标准模式:常规使用,平衡准确率
  • 严格模式:精筛使用,宁可错杀

状态: 后端完成,前端待开发


中期方案(推荐)

用户自定义边界情况:

  1. 用户输入PICOS + 纳排标准
  2. LLM分析生成20种边界情况
  3. 用户确认每种情况的处理方式
  4. 系统生成定制化Prompt

优点: 消除AI与人类理解差异


长期方案V1.0+🔮

Few-shot学习:

  • 从用户纠正中学习
  • 持续优化准确率
  • 个性化Prompt

📊 测试数据

模型性能对比

模型 准确率 一致率 速度 JSON稳定性
DeepSeek-V3 + Qwen-Max 40% 60% 16秒 100%
GPT-4o + Claude-4.5 0%* 80% 10秒 20%

*因JSON格式错误导致失败

筛选风格对比

风格 准确率 召回率 精确率
标准模式 60% 0% 100%
宽松模式 20% 50% 0%
严格模式 未测试 - -

🚀 下一步计划

本周任务

  1. 前端开发:筛选风格选择器
  2. API集成传递style参数
  3. 扩大测试20篇真实数据
  4. 用户培训:三种风格使用场景

Week 2任务

  1. 设计边界情况确认UI
  2. 实现LLM边界情况生成
  3. 用户确认流程开发
  4. 定制化Prompt生成

📝 快速链接

测试脚本

  • backend/scripts/test-stroke-screening.ts - 标准模式测试
  • backend/scripts/test-stroke-screening-lenient.ts - 宽松模式测试
  • backend/scripts/test-stroke-screening-international-models.ts - 模型对比
  • backend/scripts/test-json-parser.ts - JSON解析器测试

Prompt文件

  • backend/prompts/asl/screening/v1.1.0-lenient.txt - 宽松Prompt
  • backend/prompts/asl/screening/v1.1.0-standard.txt - 标准Prompt
  • backend/prompts/asl/screening/v1.1.0-strict.txt - 严格Prompt

核心代码

  • backend/src/modules/asl/schemas/screening.schema.ts - Prompt生成
  • backend/src/modules/asl/services/llmScreeningService.ts - 筛选服务
  • backend/src/common/utils/jsonParser.ts - JSON解析器

💡 重要提示

  1. JSON解析器已修复 - 支持中文引号自动转换
  2. 三种风格已实现 - 后端完成,前端待开发
  3. 根本问题已确认 - 需要用户自定义边界情况

更新日期: 2025-11-18
维护人: AI Assistant
版本: v1.0