DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix(doctor): convert resolved LLM config before the online probe
0xtidalbore6af53e2582c0
diff --git a/deeptutor/services/doctor.py b/deeptutor/services/doctor.pyindex bbae73326..c51c900d0 100644--- a/deeptutor/services/doctor.py+++ b/deeptutor/services/doctor.py@@ -376,8 +376,13 @@ async def run_diagnostics("""Run setup diagnostics without network access unless ``online`` is set."""if resolve_llm is None:from deeptutor.services.config import resolve_llm_runtime_config+ from deeptutor.services.model_selection.runtime import llm_config_from_resolved++ # The probe hands this config to ``complete_with_config``, which needs+ # an LLMConfig, not the provider-runtime ResolvedLLMConfig.+ def resolve_llm() -> Any:+ return llm_config_from_resolved(resolve_llm_runtime_config())- resolve_llm = resolve_llm_runtime_configif data_root is None:from deeptutor.services.path_service import get_path_servicediff --git a/tests/cli/test_doctor_cli.py b/tests/cli/test_doctor_cli.pyindex fbcfcd883..c045e5d15 100644--- a/tests/cli/test_doctor_cli.py+++ b/tests/cli/test_doctor_cli.py@@ -570,3 +570,39 @@ def test_doctor_online_rich_output_succeeds(monkeypatch) -> None:assert result.exit_code == 0, result.outputassert "PASS" in result.outputassert "Provider response" in result.output+++async def test_online_probe_converts_default_resolved_config(monkeypatch, tmp_path) -> None:+ """The default resolver yields ResolvedLLMConfig; the probe needs an LLMConfig."""+ from deeptutor.services.config.provider_runtime import ResolvedLLMConfig+ from deeptutor.services.llm.config import LLMConfig++ resolved = ResolvedLLMConfig(+ model="gpt-4o-mini",+ provider_name="openai",+ provider_mode="standard",+ api_key="sk-test-secret",+ base_url="https://api.openai.com/v1",+ effective_url="https://api.openai.com/v1",+ )+ captured = {}++ async def fake_complete(config, **kwargs):+ captured["config"] = config+ captured["api_key"] = config.get_api_key()+ return "OK"++ monkeypatch.setattr("deeptutor.services.config.resolve_llm_runtime_config", lambda: resolved)+ monkeypatch.setattr("deeptutor.services.llm.factory.complete_with_config", fake_complete)++ report = await run_diagnostics(+ online=True,+ data_root=tmp_path,+ load_rag_config=lambda: {"defaults": {}, "knowledge_bases": {}},+ )++ assert report.ok is True+ assert isinstance(captured["config"], LLMConfig)+ assert captured["config"].model == "gpt-4o-mini"+ assert captured["api_key"] == "sk-test-secret"