Files
human-voice-rewrite-demo/start.bat

35 lines
1.2 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
REM Human Voice Rewrite Demo - Windows 一键启动
REM 需要本机已安装 Python 3.10+(未安装请先到 python.org 安装,勾选 Add to PATH
REM 注意:本文件必须保持 ANSI(GBK) 编码。若用编辑器另存为 UTF-8,中文行会被 Windows 命令提示符当成乱码命令导致启动失败。
setlocal
cd /d "%~dp0"
if not exist ".venv\Scripts\python.exe" (
echo 首次运行:创建独立虚拟环境并安装依赖...
py -3 -m venv .venv
if errorlevel 1 (
echo 错误:py -3 不可用,请确认已安装 Python 3.10+ 并勾选 Add to PATH
pause
exit /b 1
)
".venv\Scripts\python.exe" -m pip install -q --upgrade pip
".venv\Scripts\python.exe" -m pip install -q -r requirements.txt
)
REM 从 .env 读取 Key 与代理地址(值不带引号)
for /f "usebackq tokens=1,* delims==" %%a in (".env") do (
if "%%a"=="PRODREAM_BACKEND_OPENROUTER_API_KEY" set "OPENROUTER_API_KEY=%%b"
if "%%a"=="PRODREAM_BACKEND_OPENROUTER_PROXY_URL" set "OPENROUTER_PROXY_URL=%%b"
)
if "%OPENROUTER_API_KEY%"=="" (
echo 错误:.env 中没有配置 PRODREAM_BACKEND_OPENROUTER_API_KEY
pause
exit /b 1
)
if "%HVR_PORT%"=="" set "HVR_PORT=8000"
echo Human Voice Rewrite Demo: http://127.0.0.1:%HVR_PORT%
".venv\Scripts\uvicorn.exe" main:app --host 127.0.0.1 --port %HVR_PORT%
pause