fix(agent): Lea.bat kill par PID + LeaServerClient URL
- Lea.bat ne tue plus TOUS les pythonw.exe du poste (Jupyter, Spyder) Kill ciblé uniquement sur le PID lu dans lea_agent.lock - LeaServerClient utilise RPA_SERVER_URL (HTTPS prod) au lieu de hardcode http://:5005 - Normalisation du slash final de l'URL Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -71,8 +71,16 @@ class LeaServerClient:
|
||||
self._chat_port = chat_port
|
||||
self._stream_port = stream_port
|
||||
|
||||
# En prod, la base URL passe par le reverse proxy HTTPS
|
||||
# (ex. https://lea.labs.laurinebazin.design). Si RPA_SERVER_URL est
|
||||
# definie on l'utilise telle quelle, sinon on reconstruit http://host:port.
|
||||
server_url = os.environ.get("RPA_SERVER_URL", "").strip().rstrip("/")
|
||||
if server_url:
|
||||
self._stream_base = server_url
|
||||
else:
|
||||
self._stream_base = f"http://{self._host}:{self._stream_port}"
|
||||
|
||||
self._chat_base = f"http://{self._host}:{self._chat_port}"
|
||||
self._stream_base = f"http://{self._host}:{self._stream_port}"
|
||||
|
||||
# Etat de connexion
|
||||
self._connected = False
|
||||
|
||||
@@ -8,12 +8,17 @@ title Lea - Assistante IA
|
||||
cd /d "%~dp0"
|
||||
|
||||
:: ---------------------------------------------------------------
|
||||
:: Fermer les anciennes instances de Lea
|
||||
:: Fermer l'ancienne instance de Lea (UNIQUEMENT via le PID du lock)
|
||||
:: NE JAMAIS tuer tous les pythonw.exe/python.exe du poste :
|
||||
:: cela tuerait Jupyter, Spyder, Anaconda, scripts metier, etc.
|
||||
:: ---------------------------------------------------------------
|
||||
taskkill /F /IM pythonw.exe >nul 2>&1
|
||||
taskkill /F /IM python.exe >nul 2>&1
|
||||
taskkill /F /IM rpa-agent.exe >nul 2>&1
|
||||
timeout /t 2 >nul
|
||||
if exist "lea_agent.lock" (
|
||||
for /f "usebackq tokens=* delims=" %%i in ("lea_agent.lock") do (
|
||||
taskkill /F /PID %%i >nul 2>&1
|
||||
)
|
||||
del /f /q "lea_agent.lock" >nul 2>&1
|
||||
timeout /t 2 >nul
|
||||
)
|
||||
|
||||
:: ---------------------------------------------------------------
|
||||
:: Verifier que l'installation a ete faite
|
||||
@@ -53,10 +58,15 @@ echo.
|
||||
|
||||
start "" /b .venv\Scripts\pythonw.exe run_agent_v1.py
|
||||
|
||||
:: Attendre 3s puis verifier que Lea tourne
|
||||
:: Attendre 3s puis verifier que Lea tourne (via le PID du lock)
|
||||
timeout /t 3 >nul
|
||||
tasklist /FI "IMAGENAME eq pythonw.exe" /NH 2>nul | findstr /I "pythonw" >nul
|
||||
if errorlevel 1 (
|
||||
set "LEA_ALIVE=0"
|
||||
if exist "lea_agent.lock" (
|
||||
for /f "usebackq tokens=* delims=" %%i in ("lea_agent.lock") do (
|
||||
tasklist /FI "PID eq %%i" /NH 2>nul | findstr /I "pythonw" >nul && set "LEA_ALIVE=1"
|
||||
)
|
||||
)
|
||||
if "%LEA_ALIVE%"=="0" (
|
||||
echo.
|
||||
echo Lea n'a pas demarre correctement.
|
||||
echo Tentative avec affichage des erreurs...
|
||||
|
||||
Reference in New Issue
Block a user