feat: 添加本地启动/停止脚本并纳入版本控制

新增 setup.bat(首次安装)、start.bat(前台启动)、start-bg.bat(后台启动)、
stop.bat(停止)四个脚本,便于一键起停前后端;.gitignore 移除
start.bat/end.bat 遗留忽略条目。
This commit is contained in:
happymy
2026-09-12 08:42:45 +08:00
parent 047048eee5
commit 929df8c9b6
5 changed files with 102 additions and 2 deletions
-2
View File
@@ -36,8 +36,6 @@ calliope-backend/src/calliope/static/
# Electron shell was dropped — keep ignoring so a leftover folder cannot be committed.
electron/
AGENTS.md
start.bat
end.bat
ScreenShots/
docs/*
!docs/changelogs/
+35
View File
@@ -0,0 +1,35 @@
@echo off
chcp 936 >nul
setlocal
set ROOT=%~dp0
set BACKEND=%ROOT%calliope-backend
set WEB=%ROOT%calliope-web
echo ============================================
echo Calliope 首次安装(幂等,可重复运行)
echo ============================================
if not exist "%BACKEND%\.venv\Scripts\python.exe" (
echo [1/2] 创建虚拟环境并安装后端依赖...
cd /d "%BACKEND%"
python -m venv .venv
call .venv\Scripts\activate.bat
.venv\Scripts\python -m pip install --upgrade pip
.venv\Scripts\pip install -e ".[dev]"
) else (
echo [1/2] 后端依赖已安装,跳过。
)
if not exist "%WEB%\node_modules" (
echo [2/2] 安装前端依赖 npm install...
cd /d "%WEB%"
call npm install
) else (
echo [2/2] 前端依赖已安装,跳过。
)
echo.
echo 安装完成。首次启动前可复制 calliope_config.example.json 为 calliope_config.json 配置 LLM/ComfyUI,
echo 也可以在应用内 Settings 页面配置。
echo.
pause
+29
View File
@@ -0,0 +1,29 @@
@echo off
chcp 936 >nul
setlocal
set ROOT=%~dp0
set BACKEND=%ROOT%calliope-backend
set WEB=%ROOT%calliope-web
if not exist "%BACKEND%\.venv\Scripts\python.exe" (
echo [错误] 后端未安装,请先运行 setup.bat
pause
exit /b 1
)
if not exist "%WEB%\node_modules" (
echo [错误] 前端未安装,请先运行 setup.bat
pause
exit /b 1
)
if not exist "%ROOT%logs" mkdir "%ROOT%logs"
echo 后台启动后端... 日志: logs\backend.log
powershell -NoProfile -Command "$p = Start-Process -FilePath '%ROOT%calliope-backend\.venv\Scripts\python.exe' -ArgumentList '-m','calliope.main','--host','127.0.0.1','--port','8247' -WorkingDirectory '%ROOT%calliope-backend' -RedirectStandardOutput '%ROOT%logs\backend.log' -RedirectStandardError '%ROOT%logs\backend.err.log' -PassThru -WindowStyle Hidden; Write-Host ('Backend PID -> ' + $p.Id)"
echo 后台启动前端... 日志: logs\web.log
powershell -NoProfile -Command "$p = Start-Process -FilePath 'npm.cmd' -ArgumentList 'run','dev' -WorkingDirectory '%ROOT%calliope-web' -RedirectStandardOutput '%ROOT%logs\web.log' -RedirectStandardError '%ROOT%logs\web.err.log' -PassThru -WindowStyle Hidden; Write-Host ('Web npm PID -> ' + $p.Id)"
echo.
echo 后台服务已启动:后端 http://127.0.0.1:8247 前端 http://127.0.0.1:5173
echo 用 stop.bat 停止。
+25
View File
@@ -0,0 +1,25 @@
@echo off
chcp 936 >nul
setlocal
set ROOT=%~dp0
set BACKEND=%ROOT%calliope-backend
set WEB=%ROOT%calliope-web
if not exist "%BACKEND%\.venv\Scripts\python.exe" (
echo [错误] 后端未安装,请先运行 setup.bat
pause
exit /b 1
)
if not exist "%WEB%\node_modules" (
echo [错误] 前端未安装,请先运行 setup.bat
pause
exit /b 1
)
echo 打开两个窗口:
echo 后端 http://127.0.0.1:8247
echo 前端 http://127.0.0.1:5173
echo 关闭窗口即停止对应服务。
start "Calliope Backend" /D "%BACKEND%" cmd /k ".venv\Scripts\python -m calliope.main --host 127.0.0.1 --port 8247"
start "Calliope Web" /D "%WEB%" cmd /k "npm run dev"
+13
View File
@@ -0,0 +1,13 @@
@echo off
chcp 936 >nul
setlocal
set ROOT=%~dp0
echo 正在停止 Calliope 后端和前端进程...
powershell -NoProfile -Command "Get-CimInstance Win32_Process | Where-Object { $_.Name -match '^(python|node)(\.exe)?$' -and $_.CommandLine -match 'calliope' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue; Write-Host ('Killed ' + $_.Name + ' PID ' + $_.ProcessId) }"
echo.
echo 已停止。若还有残留窗口,可直接关闭对应 cmd 窗口。
echo.
pause