diff --git a/.gitignore b/.gitignore index b060e466..df923c59 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/setup.bat b/setup.bat new file mode 100644 index 00000000..d829fbc6 --- /dev/null +++ b/setup.bat @@ -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 \ No newline at end of file diff --git a/start-bg.bat b/start-bg.bat new file mode 100644 index 00000000..6a9753f3 --- /dev/null +++ b/start-bg.bat @@ -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 Í£Ö¹¡£ \ No newline at end of file diff --git a/start.bat b/start.bat new file mode 100644 index 00000000..71942876 --- /dev/null +++ b/start.bat @@ -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" \ No newline at end of file diff --git a/stop.bat b/stop.bat new file mode 100644 index 00000000..ede0a262 --- /dev/null +++ b/stop.bat @@ -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 \ No newline at end of file