@echo off
setlocal
cd /d "%~dp0"
where py >nul 2>nul
if errorlevel 1 (
  echo Python launcher not found. Install Python 3.11 or newer, then run this again.
  pause
  exit /b 1
)
if not exist .venv (
  echo Creating local virtual environment...
  py -m venv .venv
)
call .venv\Scripts\activate.bat
python -m pip install --upgrade pip
pip install -r requirements.txt
if errorlevel 1 (
  echo Core MelumiyaChat setup failed.
  pause
  exit /b 1
)
echo.
echo Installing the optional native desktop window...
pip install "pywebview>=5.4,<6"
if errorlevel 1 (
  echo Native window support could not be installed. That is OK: MelumiyaChat can fall back to your browser.
)
if not exist .env copy .env.example .env >nul
echo.
echo Setup complete.
echo Cloud model access is configured server-side. Customer PCs do not need provider API keys.
echo Run run_windows.bat for the RP app.
pause
