auto-sync: 2026-05-21 00:19:35

This commit is contained in:
cfdaily
2026-05-21 00:19:35 +08:00
parent 80e91e1afa
commit 95110e9b86
+11 -13
View File
@@ -117,22 +117,20 @@ async def _generate_title(description: str) -> str | None:
return None
try:
from openai import OpenAI
import yaml
# 从 moziplus 配置读 LLM 凭据
cfg_path = Path(__file__).parent.parent.parent / "config" / "default.yaml"
import json as _json
# 从 OpenClaw 配置读 zhipu 凭据
base_url = "https://open.bigmodel.cn/api/paas/v4"
api_key = ""
model = "glm-4-flash"
if cfg_path.exists():
with open(cfg_path) as f:
cfg = yaml.safe_load(f)
routing = cfg.get("daemon", {}).get("routing", {})
if routing.get("api_base"):
base_url = routing["api_base"]
if routing.get("api_key"):
api_key = routing["api_key"]
if routing.get("model"):
model = routing["model"]
oc_cfg = Path.home() / ".openclaw" / "openclaw.json"
if oc_cfg.exists():
with open(oc_cfg) as f:
cfg = _json.load(f)
zhipu = cfg.get("models", {}).get("providers", {}).get("zhipu", {})
if zhipu.get("baseUrl"):
base_url = zhipu["baseUrl"]
if zhipu.get("apiKey"):
api_key = zhipu["apiKey"]
if not api_key:
return None # 没配 API key 就跳过
client = OpenAI(base_url=base_url, api_key=api_key)