Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(doctor): validate vlm credentials config (#4406)

zgye1bdd6c28378
diff --git a/openviking_cli/doctor.py b/openviking_cli/doctor.py
index 852dadd5a..4e6d23b03 100644
--- a/openviking_cli/doctor.py
+++ b/openviking_cli/doctor.py
@@ -351,7 +351,7 @@ def check_vlm() -> tuple[bool, str, Optional[str]]:
raw_vlm = data.get("vlm", {})
normalized_vlm = VLMConfig.sync_provider_backend(dict(raw_vlm))
- vlm = VLMConfig.model_construct(**normalized_vlm)
+ vlm = VLMConfig.model_validate(normalized_vlm)
_, provider = vlm.get_provider_config()
model = vlm.model or ""
diff --git a/tests/cli/test_doctor.py b/tests/cli/test_doctor.py
index 8e716dfeb..f8bfcca83 100644
--- a/tests/cli/test_doctor.py
+++ b/tests/cli/test_doctor.py
@@ -503,6 +503,28 @@ class TestCheckVlm:
ok, detail, fix = check_vlm()
assert ok
+ def test_pass_with_credentials_config(self, tmp_path: Path):
+ config = tmp_path / "ov.conf"
+ config.write_text(
+ json.dumps(
+ {
+ "vlm": {
+ "provider": "openai",
+ "model": "gpt-4o-mini",
+ "credentials": [
+ {"api_key": "sk-primary"},
+ {"api_key": "sk-backup"},
+ ],
+ }
+ }
+ )
+ )
+ with patch("openviking_cli.doctor._find_config", return_value=config):
+ ok, detail, fix = check_vlm()
+ assert ok
+ assert "openai/gpt-4o-mini" in detail
+ assert fix is None
+
def test_fail_no_provider(self, tmp_path: Path):
config = tmp_path / "ov.conf"
config.write_text(json.dumps({"vlm": {}}))