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
194 lines
4.1 KiB
PowerShell
194 lines
4.1 KiB
PowerShell
# ===================================================================
|
||
# AI临床研究平台 - SAE部署自动化脚本
|
||
# ===================================================================
|
||
# 用途:自动构建Docker镜像并推送到阿里云容器镜像服务
|
||
# 使用方法:.\deploy-to-sae.ps1 -Version "v1.0.0"
|
||
# 作者:技术架构师
|
||
# 日期:2025-12-11
|
||
# ===================================================================
|
||
|
||
param(
|
||
[Parameter(Mandatory=$true)]
|
||
[string]$Version,
|
||
|
||
[Parameter(Mandatory=$false)]
|
||
[string]$Registry = "registry.cn-hangzhou.aliyuncs.com",
|
||
|
||
[Parameter(Mandatory=$false)]
|
||
[string]$Namespace = "aiclinical",
|
||
|
||
[Parameter(Mandatory=$false)]
|
||
[string]$Repository = "backend-dev"
|
||
)
|
||
|
||
# 颜色输出函数
|
||
function Write-ColorOutput($ForegroundColor) {
|
||
$fc = $host.UI.RawUI.ForegroundColor
|
||
$host.UI.RawUI.ForegroundColor = $ForegroundColor
|
||
if ($args) {
|
||
Write-Output $args
|
||
}
|
||
$host.UI.RawUI.ForegroundColor = $fc
|
||
}
|
||
|
||
# 标题
|
||
Write-ColorOutput Cyan "================================================"
|
||
Write-ColorOutput Cyan " AI临床研究平台 - SAE部署脚本"
|
||
Write-ColorOutput Cyan "================================================"
|
||
Write-Host ""
|
||
|
||
# 检查Docker是否运行
|
||
Write-ColorOutput Yellow "🔍 检查Docker状态..."
|
||
try {
|
||
docker ps > $null 2>&1
|
||
if ($LASTEXITCODE -ne 0) {
|
||
Write-ColorOutput Red "❌ Docker未运行,请先启动Docker Desktop"
|
||
exit 1
|
||
}
|
||
Write-ColorOutput Green "✅ Docker运行正常"
|
||
} catch {
|
||
Write-ColorOutput Red "❌ Docker未安装或未运行"
|
||
exit 1
|
||
}
|
||
|
||
# 构建镜像
|
||
Write-Host ""
|
||
Write-ColorOutput Yellow "🔨 开始构建Docker镜像..."
|
||
Write-Host "版本: $Version"
|
||
Write-Host "目录: backend/"
|
||
Write-Host ""
|
||
|
||
Set-Location backend
|
||
|
||
$imageName = "aiclinical-backend"
|
||
$fullImageName = "${Registry}/${Namespace}/${Repository}:${Version}"
|
||
|
||
Write-ColorOutput Cyan "执行: docker build -t ${imageName}:${Version} ."
|
||
docker build -t "${imageName}:${Version}" .
|
||
|
||
if ($LASTEXITCODE -ne 0) {
|
||
Write-ColorOutput Red "❌ Docker镜像构建失败"
|
||
exit 1
|
||
}
|
||
|
||
Write-ColorOutput Green "✅ Docker镜像构建成功"
|
||
|
||
# 打标签
|
||
Write-Host ""
|
||
Write-ColorOutput Yellow "🏷️ 为镜像打标签..."
|
||
Write-ColorOutput Cyan "执行: docker tag ${imageName}:${Version} ${fullImageName}"
|
||
docker tag "${imageName}:${Version}" $fullImageName
|
||
|
||
if ($LASTEXITCODE -ne 0) {
|
||
Write-ColorOutput Red "❌ 打标签失败"
|
||
exit 1
|
||
}
|
||
|
||
Write-ColorOutput Green "✅ 标签创建成功"
|
||
|
||
# 推送镜像
|
||
Write-Host ""
|
||
Write-ColorOutput Yellow "📤 推送镜像到阿里云..."
|
||
Write-Host "目标仓库: $fullImageName"
|
||
Write-Host ""
|
||
Write-ColorOutput Cyan "提示:如果提示需要登录,请执行以下命令:"
|
||
Write-ColorOutput Cyan "docker login --username=<你的阿里云账号> ${Registry}"
|
||
Write-Host ""
|
||
|
||
Write-ColorOutput Cyan "执行: docker push ${fullImageName}"
|
||
docker push $fullImageName
|
||
|
||
if ($LASTEXITCODE -ne 0) {
|
||
Write-ColorOutput Red "❌ 镜像推送失败"
|
||
Write-ColorOutput Yellow "请检查:"
|
||
Write-Host " 1. 是否已登录阿里云容器镜像服务"
|
||
Write-Host " 2. 命名空间和仓库名称是否正确"
|
||
Write-Host " 3. 网络连接是否正常"
|
||
exit 1
|
||
}
|
||
|
||
Write-ColorOutput Green "✅ 镜像推送成功"
|
||
|
||
# 完成
|
||
Write-Host ""
|
||
Write-ColorOutput Cyan "================================================"
|
||
Write-ColorOutput Green "🎉 部署准备完成!"
|
||
Write-ColorOutput Cyan "================================================"
|
||
Write-Host ""
|
||
Write-Host "镜像信息:"
|
||
Write-ColorOutput Cyan " 完整地址: $fullImageName"
|
||
Write-ColorOutput Cyan " 版本号: $Version"
|
||
Write-Host ""
|
||
Write-Host "下一步操作:"
|
||
Write-Host " 1. 登录阿里云SAE控制台"
|
||
Write-Host " 2. 进入应用 '${Repository}'"
|
||
Write-Host " 3. 点击'部署应用'"
|
||
Write-Host " 4. 选择镜像版本: $Version"
|
||
Write-Host " 5. 点击'确定'开始部署"
|
||
Write-Host ""
|
||
Write-ColorOutput Cyan "部署文档: docs/05-部署文档/02-SAE部署完全指南(产品经理版).md"
|
||
Write-Host ""
|
||
|
||
Set-Location ..
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|