@echo off
chcp 65001 >nul
echo ================================
echo 启动文档提取微服务
echo ================================
echo.

REM 检查虚拟环境
if exist venv\Scripts\activate.bat (
    echo [1/3] 激活虚拟环境...
    call venv\Scripts\activate
) else (
    echo 警告: 未找到虚拟环境，使用全局Python
)

REM 检查依赖
echo [2/3] 检查依赖...
pip list | findstr "fastapi" >nul
if errorlevel 1 (
    echo 依赖未安装，正在安装...
    pip install -r requirements.txt
)

REM 启动服务
echo [3/3] 启动服务...
echo.
echo 服务地址: http://localhost:8000
echo 健康检查: http://localhost:8000/api/health
echo API文档: http://localhost:8000/docs
echo.
echo 按 Ctrl+C 停止服务
echo.

uvicorn main:app --host 0.0.0.0 --port 8000 --reload

pause

