@echo off echo === 阶段一:搭建后端环境 === echo. echo [1/3] Creating Python virtual environment... if not exist venv ( python -m venv venv if %ERRORLEVEL% EQU 0 ( echo [OK] Virtual environment created ) else ( echo [ERROR] Failed to create venv exit /b 1 ) ) else ( echo [OK] Virtual environment already exists ) echo. echo [2/3] Installing dependencies with Tsinghua mirror... call venv\Scripts\activate.bat pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple if %ERRORLEVEL% EQU 0 ( echo [OK] Dependencies installed successfully ) else ( echo [ERROR] Failed to install dependencies exit /b 1 ) echo. echo [3/3] Verifying installation... python -c "import fastapi; import langchain; import llama_index; print('[OK] All core packages imported')" echo. echo === Setup Complete === echo To start the backend: echo venv\Scripts\activate.bat echo uvicorn app:app --host 0.0.0.0 --port 8002