Platform Infrastructure - 8 Core Modules Completed: - Storage Service (LocalAdapter + OSSAdapter stub) - Logging System (Winston + JSON format) - Cache Service (MemoryCache + Redis stub) - Async Job Queue (MemoryQueue + DatabaseQueue stub) - Health Check Endpoints (liveness/readiness/detailed) - Database Connection Pool (with Serverless optimization) - Environment Configuration Management - Monitoring Metrics (DB connections/memory/API) Key Features: - Adapter Pattern for zero-code environment switching - Full backward compatibility with legacy modules - 100% test coverage (all 8 modules verified) - Complete documentation (11 docs updated) Technical Improvements: - Fixed duplicate /health route registration issue - Fixed TypeScript interface export (export type) - Installed winston dependency - Added structured logging with context support - Implemented graceful shutdown for Serverless - Added connection pool optimization for SAE Documentation Updates: - Platform infrastructure planning (04-骞冲彴鍩虹璁炬柦瑙勫垝.md) - Implementation report (2025-11-17-骞冲彴鍩虹璁炬柦瀹炴柦瀹屾垚鎶ュ憡.md) - Verification report (2025-11-17-骞冲彴鍩虹璁炬柦楠岃瘉鎶ュ憡.md) - Git commit guidelines (06-Git鎻愪氦瑙勮寖.md) - Added commit frequency rules - Updated 3 core architecture documents Code Statistics: - New code: 2,532 lines - New files: 22 - Updated files: 130+ - Test pass rate: 100% (8/8 modules) Deployment Readiness: - Local environment: 鉁?Ready - Cloud environment: 馃攧 Needs OSS/Redis dependencies Next Steps: - Ready to start ASL module development - Can directly use storage/logger/cache/jobQueue Tested: Local verification 100% passed Related: #Platform-Infrastructure
82 lines
2.5 KiB
PowerShell
82 lines
2.5 KiB
PowerShell
# 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 = @"
|
||
|
||
# ================================
|
||
# CloseAI配置(代理OpenAI和Claude)⭐
|
||
# ================================
|
||
# CloseAI是一个API代理平台,提供稳定的OpenAI和Claude访问
|
||
# 官网:https://platform.openai-proxy.org
|
||
|
||
# 统一API Key(同时用于OpenAI和Claude)
|
||
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
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|