fix: prepare Guideng for isolated JD runtime

This commit is contained in:
冰朔 2026-07-20 23:51:14 +08:00
commit d4b0ce3ddc
2 changed files with 13 additions and 7 deletions

View file

@ -6,9 +6,9 @@ import json, os, subprocess, sys, urllib.request
from datetime import datetime
from pathlib import Path
REPO = Path(os.environ.get("GUIDENG_REPO", "/opt/guideng/repo"))
REPO = Path(os.environ.get("GUIDENG_REPO", "/var/lib/guanghu/personas/guideng/repository"))
CFG = json.loads(Path(os.environ.get("GUIDENG_CONFIG", "/etc/guideng/agent.json")).read_text())
API_KEY = os.environ["GUIDENG_MODEL_API_KEY"] # 只从环境注入, 服务器 secret.env 提供
API_KEY = os.environ.get("GUIDENG_MODEL_API_KEY") or os.environ["DEEPSEEK_API_KEY"]
TZ = CFG.get("timezone", "Asia/Shanghai")
def sh(*args, check=True):
@ -37,8 +37,8 @@ def call_model(messages):
def heartbeat():
today = datetime.now().strftime("%Y-%m-%d")
sh("git", "fetch", "origin", check=False)
sh("git", "pull", "--rebase", "origin", "main", check=False)
sh("git", "fetch", "origin")
sh("git", "pull", "--rebase", "origin", "main")
channel = (REPO / "lake-heart-channel/冰朔的湖心频道.md").read_text(encoding="utf-8")
identity = load_identity()
@ -73,7 +73,7 @@ def heartbeat():
sh("git", "-c", "user.name=归灯 GLS-LA-20260720-003 · 铸渊 ICE-GL-ZY001",
"-c", "user.email=ICE-GL-ZY001@fifth-domain.local",
"commit", "-m", f"归灯 · {today} 心跳 · 签到与湖心回音\n\n国作登字-2026-A-00037559")
sh("git", "push", "origin", "main", check=False)
sh("git", "push", "origin", "main")
if __name__ == "__main__":
if "--once" in sys.argv: