@echo off
chcp 65001 > nul
rem 启动Ollama服务
start "Ollama DeepSeek" cmd /k ollama run deepseek-r1:1.5b

rem 检测11434端口是否就绪
echo 等待Ollama服务启动...
:retry
powershell -command "$result = Test-NetConnection -ComputerName localhost -Port 11434 -WarningAction SilentlyContinue; if (-not $result.TcpTestSucceeded) { exit 1 }"
if %errorlevel% neq 0 (
    timeout /t 5 >nul
    goto retry
)

rem 启动Python脚本
call .\AIGC\Scripts\activate.bat
start "AIGC Python" python main.py