Files
AIclinicalresearch/backend/env.example.md
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

2.1 KiB
Raw Blame History

环境变量配置示例

复制以下内容到 .env 文件中:

# ===========================================
# AI Clinical Research Platform - 环境变量配置
# ===========================================

# ==================== 应用配置 ====================
NODE_ENV=development
PORT=3001
HOST=0.0.0.0
LOG_LEVEL=debug
SERVICE_NAME=aiclinical-backend

# ==================== 数据库配置 ====================
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/ai_clinical

# ==================== 存储配置 ====================
# 存储类型local | oss
STORAGE_TYPE=local

# --- 本地存储配置STORAGE_TYPE=local---
LOCAL_STORAGE_DIR=uploads
LOCAL_STORAGE_URL=http://localhost:3001/uploads

# --- 阿里云OSS配置STORAGE_TYPE=oss---
# OSS_REGION=oss-cn-beijing
# OSS_BUCKET=ai-clinical-data-dev
# OSS_BUCKET_STATIC=ai-clinical-static-dev
# OSS_ACCESS_KEY_ID=your-access-key-id
# OSS_ACCESS_KEY_SECRET=your-access-key-secret
# OSS_INTERNAL=false
# OSS_SIGNED_URL_EXPIRES=3600

# ==================== 安全配置 ====================
JWT_SECRET=your-secret-key-change-in-production
JWT_EXPIRES_IN=7d
CORS_ORIGIN=http://localhost:5173

# ==================== LLM API配置 ====================
DEEPSEEK_API_KEY=
DEEPSEEK_BASE_URL=https://api.deepseek.com
DASHSCOPE_API_KEY=
GEMINI_API_KEY=

# ==================== 文件上传配置 ====================
UPLOAD_MAX_SIZE=31457280

OSS 开发环境配置

如果要测试 OSSSTORAGE_TYPE 改为 oss 并填写以下配置:

STORAGE_TYPE=oss
OSS_REGION=oss-cn-beijing
OSS_BUCKET=ai-clinical-data-dev
OSS_BUCKET_STATIC=ai-clinical-static-dev
OSS_ACCESS_KEY_ID=LTAI5tBHkL39GjdLfcr77Y3f
OSS_ACCESS_KEY_SECRET=<从安全渠道获取>
OSS_INTERNAL=false
OSS_SIGNED_URL_EXPIRES=3600

OSS 生产环境配置SAE

STORAGE_TYPE=oss
OSS_REGION=oss-cn-beijing
OSS_BUCKET=ai-clinical-data
OSS_BUCKET_STATIC=ai-clinical-static
OSS_ACCESS_KEY_ID=LTAI5tBHkL39GjdLfcr77Y3f
OSS_ACCESS_KEY_SECRET=<从安全渠道获取>
OSS_INTERNAL=true  # 🔴 生产必须用内网
OSS_SIGNED_URL_EXPIRES=3600