Files
AIclinicalresearch/backend/update-env-closeai.ps1
HaHafeng 8eef9e0544 feat(asl): Complete Week 4 - Results display and Excel export with hybrid solution
Features:
- Backend statistics API (cloud-native Prisma aggregation)
- Results page with hybrid solution (AI consensus + human final decision)
- Excel export (frontend generation, zero disk write, cloud-native)
- PRISMA-style exclusion reason analysis with bar chart
- Batch selection and export (3 export methods)
- Fixed logic contradiction (inclusion does not show exclusion reason)
- Optimized table width (870px, no horizontal scroll)

Components:
- Backend: screeningController.ts - add getProjectStatistics API
- Frontend: ScreeningResults.tsx - complete results page (hybrid solution)
- Frontend: excelExport.ts - Excel export utility (40 columns full info)
- Frontend: ScreeningWorkbench.tsx - add navigation button
- Utils: get-test-projects.mjs - quick test tool

Architecture:
- Cloud-native: backend aggregation reduces network transfer
- Cloud-native: frontend Excel generation (zero file persistence)
- Reuse platform: global prisma instance, logger
- Performance: statistics API < 500ms, Excel export < 3s (1000 records)

Documentation:
- Update module status guide (add Week 4 features)
- Update task breakdown (mark Week 4 completed)
- Update API design spec (add statistics API)
- Update database design (add field usage notes)
- Create Week 4 development plan
- Create Week 4 completion report
- Create technical debt list

Test:
- End-to-end flow test passed
- All features verified
- Performance test passed
- Cloud-native compliance verified

Ref: Week 4 Development Plan
Scope: ASL Module MVP - Title Abstract Screening Results
Cloud-Native: Backend aggregation + Frontend Excel generation
2025-11-21 20:12:38 +08:00

89 lines
2.5 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PowerShell脚本自动添加CloseAI配置到.env文件
# 使用方法:在 backend 目录下运行 .\update-env-closeai.ps1
$envFile = ".env"
# 检查.env文件是否存在
if (-not (Test-Path $envFile)) {
Write-Host "错误:.env文件不存在" -ForegroundColor Red
Write-Host "请先创建.env文件" -ForegroundColor Yellow
exit 1
}
# 读取现有配置
$envContent = Get-Content $envFile -Raw
# 检查是否已经包含CloseAI配置
if ($envContent -match "CLOSEAI_API_KEY") {
Write-Host "检测到.env文件中已包含CloseAI配置" -ForegroundColor Yellow
$overwrite = Read-Host "是否要覆盖现有配置?(y/n)"
if ($overwrite -ne "y") {
Write-Host "取消更新" -ForegroundColor Yellow
exit 0
}
# 删除旧的CloseAI配置
$envContent = $envContent -replace "(?ms)# ={32}.*?# CloseAI.*?# ={32}.*?(?=\r?\n# ={32}|\r?\n\r?\n|\Z)", ""
}
# CloseAI配置内容
$closeaiConfig = @"
# ================================
# CloseAIOpenAIClaude
# ================================
# CloseAIAPIOpenAIClaude访
# https://platform.openai-proxy.org
# API KeyOpenAIClaude
CLOSEAI_API_KEY=sk-cu0iepbXYGGx2jc7BqP6ogtSWmP6fk918qV3RUdtGC3Edlpo
# OpenAI
CLOSEAI_OPENAI_BASE_URL=https://api.openai-proxy.org/v1
# Claude
CLOSEAI_CLAUDE_BASE_URL=https://api.openai-proxy.org/anthropic
#
# - OpenAI: gpt-5-pro (), gpt-4-turbo-preview, gpt-3.5-turbo
# - Claude: claude-sonnet-4-5-20250929 (), claude-3-5-sonnet-20241022
"@
# 添加到文件末尾
$envContent = $envContent.TrimEnd() + "`r`n" + $closeaiConfig
# 写回文件
Set-Content -Path $envFile -Value $envContent -NoNewline
Write-Host "✅ CloseAI配置已成功添加到.env文件" -ForegroundColor Green
Write-Host ""
Write-Host "已添加的配置:" -ForegroundColor Cyan
Write-Host "- CLOSEAI_API_KEY: sk-cu0iep...真实API Key" -ForegroundColor White
Write-Host "- CLOSEAI_OPENAI_BASE_URL: https://api.openai-proxy.org/v1" -ForegroundColor White
Write-Host "- CLOSEAI_CLAUDE_BASE_URL: https://api.openai-proxy.org/anthropic" -ForegroundColor White
Write-Host ""
Write-Host "可用模型:" -ForegroundColor Cyan
Write-Host "- GPT-5-Pro: gpt-5-pro" -ForegroundColor White
Write-Host "- Claude-4.5-Sonnet: claude-sonnet-4-5-20250929" -ForegroundColor White
Write-Host ""
Write-Host "下一步:重启后端服务以应用新配置" -ForegroundColor Yellow