Next.js 前端 + FastAPI/LangChain 后端透明 agent平台 - 含 .gitignore, 敏感文件(sessions数据/.env/venv等)已排除 - 待后续添加 trajectory 自进化机制
40 lines
1.0 KiB
Batchfile
40 lines
1.0 KiB
Batchfile
@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
|