diff --git a/pilot/opencode_review.py b/pilot/opencode_review.py index c2524ab..48b9923 100644 --- a/pilot/opencode_review.py +++ b/pilot/opencode_review.py @@ -406,7 +406,8 @@ def install_config(src: str, dst: str) -> bool: if not os.path.isfile(src): return False base_url = os.environ.get("PRAGENT_MODEL_BASE_URL", "").strip() - if not base_url: + api_key = os.environ.get("PRAGENT_MODEL_API_KEY", "").strip() + if not base_url and not api_key: shutil.copy2(src, dst) return True try: @@ -414,7 +415,10 @@ def install_config(src: str, dst: str) -> bool: cfg = json.load(f) for prov in (cfg.get("provider") or {}).values(): if isinstance(prov, dict) and isinstance(prov.get("options"), dict): - prov["options"]["baseURL"] = base_url + if base_url: + prov["options"]["baseURL"] = base_url + if api_key: + prov["options"]["apiKey"] = api_key with open(dst, "w", encoding="utf-8") as f: json.dump(cfg, f, indent=2) except (OSError, ValueError, AttributeError):