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
2.9 KiB
2.9 KiB
部署微信服务号到SAE(快速指南)
🎯 目标
将微信服务号回调服务部署到SAE生产环境,使用域名:iit.xunzhengyixue.com
📋 Step 1: 确认环境变量配置
编辑 backend/.env,确认以下配置存在:
# 微信服务号配置
WECHAT_MP_APP_ID=wx062568ff49e4570c
WECHAT_MP_APP_SECRET=c0d19435d1a1e948939c16d767ec0faf
WECHAT_MP_TOKEN=IitPatientWechat2026JanToken
WECHAT_MP_ENCODING_AES_KEY=VIzwMGRG4Ll8Sd7fPxPXLlBaWdsh2rK2qIGpyaEoc1v
📋 Step 2: 在SAE控制台配置环境变量
- 登录阿里云SAE控制台
- 进入应用管理 → 选择应用
- 配置管理 → 环境变量
- 添加以下环境变量:
WECHAT_MP_APP_ID=wx062568ff49e4570c
WECHAT_MP_APP_SECRET=c0d19435d1a1e948939c16d767ec0faf
WECHAT_MP_TOKEN=IitPatientWechat2026JanToken
WECHAT_MP_ENCODING_AES_KEY=VIzwMGRG4Ll8Sd7fPxPXLlBaWdsh2rK2qIGpyaEoc1v
- 保存配置
📋 Step 3: 部署代码到SAE
cd D:\MyCursor\AIclinicalresearch\backend
.\deploy-to-sae.ps1
等待部署完成(约5-10分钟)
📋 Step 4: 验证部署
访问以下URL,确认服务正常:
https://iit.xunzhengyixue.com/api/v1/iit/health
期望返回:
{
"status": "ok",
"module": "iit-manager",
"version": "1.1.0"
}
📋 Step 5: 配置微信公众平台
- 登录微信公众平台:https://mp.weixin.qq.com/
- 进入:设置与开发 → 基本配置 → 服务器配置
- 点击"修改配置"
- 填写以下信息:
| 配置项 | 值 |
|---|---|
| URL | https://iit.xunzhengyixue.com/wechat/patient/callback |
| Token | IitPatientWechat2026JanToken |
| EncodingAESKey | VIzwMGRG4Ll8Sd7fPxPXLlBaWdsh2rK2qIGpyaEoc1v |
| 消息加解密方式 | 安全模式(推荐) |
| 数据格式 | XML |
- 点击"提交"
- 验证成功后点击"启用"
✅ 验证成功标志
配置阶段:
- ✅ 页面显示"配置成功"
- ✅ 服务器配置状态为"已启用"
测试阶段:
- 关注公众号:AI for 临床研究
- 查看SAE日志,应该看到:
📥 收到微信服务号回调消息
🔐 检测到加密消息,开始解密...
✅ 消息解密成功
👤 用户关注公众号
🔧 如何查看SAE日志
- 登录阿里云SAE控制台
- 应用管理 → 选择应用 → 实例管理
- 点击"日志" → "实时日志"
- 查看最近的日志输出
📝 优势
使用生产环境的优势:
- ✅ 域名
iit.xunzhengyixue.com已备案 - ✅ HTTPS证书已配置
- ✅ 已在企业微信中验证过
- ✅ 无需natapp内网穿透
- ✅ 稳定性更好
- ✅ 无需配置域名验证
⏱️ 预计用时
- 配置环境变量:2分钟
- 部署到SAE:5-10分钟
- 配置微信公众平台:3分钟
- 总计:10-15分钟
立即开始部署! 🚀