Initial commit: Javis project
This commit is contained in:
commit
435c645f36
164 files changed
+35279
No files matched your search
@@ -0,0 +1,109 @@
|
||||
@echo off
|
||||
REM Javis launcher (Windows) - hardware-aware bootstrap
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
|
||||
set VENV=%~dp0.venv
|
||||
|
||||
set FRESH_INSTALL=0
|
||||
REM A valid venv has activate.bat and pip.exe; python.exe alone means broken/partial venv.
|
||||
if not exist "%VENV%\Scripts\activate.bat" goto :create_venv
|
||||
if not exist "%VENV%\Scripts\pip.exe" goto :create_venv
|
||||
goto :venv_ready
|
||||
|
||||
:create_venv
|
||||
if exist "%VENV%" (
|
||||
echo Removing incomplete virtual environment...
|
||||
rmdir /s /q "%VENV%"
|
||||
)
|
||||
echo Creating virtual environment in %VENV%...
|
||||
py -3 -m venv "%VENV%" 2>NUL
|
||||
if errorlevel 1 (
|
||||
python -m venv "%VENV%"
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Could not create venv. Is Python 3.10+ installed?
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
set FRESH_INSTALL=1
|
||||
|
||||
:venv_ready
|
||||
|
||||
call "%VENV%\Scripts\activate.bat"
|
||||
|
||||
REM Self-heal: trigger full install if the venv exists but javis is not installed.
|
||||
"%VENV%\Scripts\python.exe" -c "import javis" >NUL 2>&1
|
||||
if errorlevel 1 set FRESH_INSTALL=1
|
||||
|
||||
if not "%FRESH_INSTALL%"=="1" goto :ensure_mcp_servers
|
||||
|
||||
echo Installing base dependencies...
|
||||
"%VENV%\Scripts\python.exe" -m pip install --upgrade pip wheel setuptools
|
||||
"%VENV%\Scripts\pip.exe" install -r requirements.txt
|
||||
"%VENV%\Scripts\pip.exe" install -e .
|
||||
|
||||
echo.
|
||||
echo Detecting hardware and installing matching PyTorch wheel...
|
||||
"%VENV%\Scripts\python.exe" -m javis --install-deps
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo [WARN] Bootstrap reported problems. You can retry with:
|
||||
echo "%VENV%\Scripts\python.exe" -m javis --repair
|
||||
echo.
|
||||
)
|
||||
|
||||
:ensure_espeak
|
||||
REM Ensure piper-tts is installed (auto-heal if venv predates the Piper migration)
|
||||
"%VENV%\Scripts\python.exe" -c "import piper" >NUL 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Installing piper-tts...
|
||||
"%VENV%\Scripts\pip.exe" install piper-tts
|
||||
)
|
||||
|
||||
REM Ensure espeak-ng is on PATH (needed for Piper training)
|
||||
where espeak-ng >NUL 2>&1
|
||||
if not errorlevel 1 goto :ensure_mcp_servers
|
||||
if exist "C:\Program Files\eSpeak NG\espeak-ng.exe" (
|
||||
set "PATH=C:\Program Files\eSpeak NG;%PATH%"
|
||||
goto :ensure_mcp_servers
|
||||
)
|
||||
if "%FRESH_INSTALL%"=="1" (
|
||||
echo [WARN] espeak-ng not found on PATH.
|
||||
echo Voice training requires espeak-ng. Download from:
|
||||
echo https://github.com/espeak-ng/espeak-ng/releases
|
||||
)
|
||||
|
||||
:ensure_mcp_servers
|
||||
REM Install each MCP sub-project into its own venv if not already present.
|
||||
call :ensure_subvenv "homey-mcp" "homey_mcp"
|
||||
call :ensure_subvenv "duckduckgo-mcp" "duckduckgo_mcp"
|
||||
call :ensure_subvenv "emby-mcp" "emby_mcp"
|
||||
|
||||
call :ensure_subvenv "javis-slave-mcp" "javis_slave_mcp"
|
||||
|
||||
:run_app
|
||||
if not exist "config.yaml" copy config.example.yaml config.yaml >NUL
|
||||
if not exist "mcp_servers.json" copy mcp_servers.example.json mcp_servers.json >NUL
|
||||
|
||||
"%VENV%\Scripts\python.exe" -m javis %*
|
||||
endlocal
|
||||
goto :EOF
|
||||
|
||||
:ensure_subvenv
|
||||
REM Usage: call :ensure_subvenv <dir> <import_name>
|
||||
REM Always uses 'python -m pip' to avoid broken pip.exe launchers after a directory move.
|
||||
setlocal
|
||||
set SDIR=%~dp0%~1
|
||||
set SVENV=%SDIR%\.venv
|
||||
if not exist "%SVENV%\Scripts\python.exe" (
|
||||
echo Creating venv for %~1...
|
||||
python -m venv "%SVENV%"
|
||||
"%SVENV%\Scripts\python.exe" -m pip install --upgrade pip >NUL
|
||||
)
|
||||
"%SVENV%\Scripts\python.exe" -c "import %~2" >NUL 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Installing %~1...
|
||||
"%SVENV%\Scripts\python.exe" -m pip install -e "%SDIR%"
|
||||
)
|
||||
endlocal
|
||||
goto :EOF
|
||||
Reference in new issue
Block a user