-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.bat
More file actions
92 lines (81 loc) · 2.67 KB
/
Copy pathrun.bat
File metadata and controls
92 lines (81 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
echo ==================================================
echo Report2Statistics Launch Script
echo ==================================================
echo.
:: [1/5] Check Python
echo [1/5] Checking Python environment...
py -3.13 --version >nul 2>&1
if !errorlevel! equ 0 (
set PYTHON_CMD=py -3.13
echo Found Python 3.13 via launcher.
) else (
python --version >nul 2>&1
if !errorlevel! neq 0 (
echo Error: Python not found!
echo Please install Python 3.11 or higher from https://www.python.org/downloads/
pause
exit /b 1
)
set PYTHON_CMD=python
echo Found default system Python.
)
:: [2/5] Check/create folders
echo [2/5] Verifying directory structure...
if not exist input mkdir input
if not exist output mkdir output
if not exist local_mem mkdir local_mem
echo Folders 'input/', 'output/', and 'local_mem/' are ready.
:: [3/5] Check/install orchestrator dependencies
echo [3/5] Checking orchestrator dependencies...
!PYTHON_CMD! -c "import fastmcp, fitz, matplotlib, pptx, google.genai, dotenv, docling" >nul 2>&1
if !errorlevel! neq 0 (
echo Missing dependencies. Installing via requirements.txt...
!PYTHON_CMD! -m pip install -r requirements.txt
if !errorlevel! neq 0 (
echo.
echo Error: Dependency installation failed.
echo Please run: !PYTHON_CMD! -m pip install -r requirements.txt manually.
pause
exit /b 1
)
)
echo All dependencies verified.
:: [4/5] Synchronize optional scan-agent files
echo [4/5] Synchronizing optional scan-agent files...
if exist scan-agent (
!PYTHON_CMD! agents/setup_agent.py >nul
)
:: [5/5] Launch
echo [5/5] Launching Orchestrator Server...
echo.
echo Starting orchestrator in a dedicated window...
start "Report2Plot Orchestrator" /D "%~dp0" cmd /c "!PYTHON_CMD! agents/orchestrator.py --watch"
set APP_URL=
for /f "usebackq delims=" %%U in (`!PYTHON_CMD! agents/wait_for_server.py`) do (
set APP_URL=%%U
)
if not defined APP_URL (
echo Error: Orchestrator did not become ready on ports 5000-5010.
echo Check the "Report2Plot Orchestrator" window for Python errors.
pause
exit /b 1
)
:server_ready
echo Orchestrator ready at !APP_URL!
echo Opening browser...
start "" "!APP_URL!"
set HISTORY_URL=!APP_URL:description_page.html=history_page.html!
if exist local_mem\*.json (
echo Opening assignment history in a new browser tab...
start "" "!HISTORY_URL!"
)
echo.
echo ==================================================
echo Report2Plot launched successfully.
echo The orchestrator is running in its own window.
echo ==================================================
echo.
exit /b 0