[配置]:完成 .env 文件读取配置,包含自动加载、CLI 参数、测试覆盖和中文说明

This commit is contained in:
mkbk
2026-06-17 18:59:11 +08:00
parent 9729969915
commit 61abf0c674
5 changed files with 78 additions and 20 deletions
+3 -2
View File
@@ -15,7 +15,7 @@
## 配置
密钥不得写入仓库。运行时通过环境变量配置
密钥不得写入仓库。运行时默认读取项目根目录的 `.env` 文件
- `OWNER_LLM_BASE_URL`
- `OWNER_LLM_API_KEY`
@@ -25,6 +25,8 @@
默认配置面向当前 NewAPI
```bash
cp .env.example .env
# 然后编辑 .env,填入 OWNER_LLM_API_KEY
OWNER_LLM_BASE_URL=https://newapi.mkbk.shop
OWNER_LLM_MODEL=gpt-5.4-mini
OWNER_LLM_API_STYLE=chat_completions
@@ -44,7 +46,6 @@ openspec validate --all --strict
真实 NewAPI smoke 测试示例:
```bash
OWNER_LLM_API_KEY=你的临时Key \
PYTHONPATH=src python3.11 -m owner_voice_pet llm-smoke --no-stream --message '用一句中文回复:小杰在线。'
```