Files
deerflow-code/scripts/start-backend.ps1
T
董宏凯 6d326a21cd feat(backend): 完善 Workflow 与 DeepResearch 的运行链路与持久化能力
功能说明:\n- 重构并增强工作流网关执行链路,支持更完整的 proposal 与 run 调度参数透传\n- 增加 DeepResearch/workflow 运行事件持久化能力并补齐建表 SQL 与查询/保存接口适配\n- 优化 lead agent 与 deep research runner 的中间态处理,增强线程收集与执行链并发控制\n- 调整工作流执行器与任务路由,提升兼容性并完善错误与回放行为\n- 补充回归测试:deep_research 持久化、workflow 并发、定义加载、引擎执行、run 流程等覆盖
2026-09-02 12:52:37 +08:00

43 lines
1.8 KiB
PowerShell

. "$PSScriptRoot\env.ps1"
$PidFile = Join-Path $PidDir "backend.pid"
$LogFile = Join-Path $LogDir "backend.log"
if (Test-PidRunning $PidFile) {
$existingPid = Get-Content -LiteralPath $PidFile | Select-Object -First 1
Write-Host "Backend is already running (pid $existingPid)."
Write-Host "URL: $BackendPublicBaseUrl"
exit 0
}
if (-not (Test-Path -LiteralPath $BackendPython)) {
throw "Backend Python not found: $BackendPython. Run uv sync in offline-backend-20260512/backend first."
}
Remove-Item -LiteralPath $PidFile -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $BackendVendorDir | Out-Null
Write-Host "Starting backend..."
Write-Host "Log: $LogFile"
$RunnerFile = Join-Path $RuntimeDir "run-backend.ps1"
$runner = @"
`$ErrorActionPreference = "Continue"
Set-Location -LiteralPath $(ConvertTo-PSLiteral $BackendDir)
`$env:GATEWAY_CORS_ORIGINS = $(ConvertTo-PSLiteral $GatewayCorsOrigins)
`$env:PYTHONPATH = $(ConvertTo-PSLiteral ".;$BackendVendorDir")
if (-not `$env:WEKNORA_ADMIN_PASSWORD) { `$env:WEKNORA_ADMIN_PASSWORD = "1qaz@WSX" }
& $(ConvertTo-PSLiteral $BackendPython) -m uvicorn app.gateway.app:app --host $(ConvertTo-PSLiteral $BackendHost) --port $(ConvertTo-PSLiteral $BackendPort) --reload --reload-dir 'app' --reload-dir 'packages' --reload-exclude $(ConvertTo-PSLiteral (Join-Path $BackendDir '.deer-flow')) --reload-exclude $(ConvertTo-PSLiteral $RuntimeDir) *> $(ConvertTo-PSLiteral $LogFile)
"@
Set-Content -LiteralPath $RunnerFile -Value $runner -Encoding UTF8
$proc = Start-Process -FilePath "powershell.exe" -ArgumentList @(
"-NoProfile",
"-ExecutionPolicy", "Bypass",
"-File", $RunnerFile
) -WindowStyle Hidden -PassThru
Set-Content -LiteralPath $PidFile -Value $proc.Id
Write-Host "Backend started (pid $($proc.Id))."
Write-Host "URL: $BackendPublicBaseUrl"