MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _read_current_advisor_model

Function _read_current_advisor_model

src/command_system/builtins.py:488–510  ·  view source on GitHub ↗

Resolve the user's currently configured advisor model. Prefers the reactive AppState store if the caller wired one (so a just-issued ``/advisor`` from this session reads its own write without a settings-cache roundtrip), and falls back to the persisted settings — the source of truth

(context: CommandContext)

Source from the content-addressed store, hash-verified

486
487
488def _read_current_advisor_model(context: CommandContext) -> str | None:
489 """Resolve the user's currently configured advisor model.
490
491 Prefers the reactive AppState store if the caller wired one (so a
492 just-issued ``/advisor`` from this session reads its own write
493 without a settings-cache roundtrip), and falls back to the
494 persisted settings — the source of truth on every restart.
495 """
496 store = getattr(context, "app_state_store", None)
497 if store is not None:
498 try:
499 state = store.get_state()
500 value = getattr(state, "advisor_model", None)
501 if value:
502 return value
503 except Exception:
504 pass
505 try:
506 from ..settings.settings import get_settings
507 configured = (get_settings().advisor_model or "").strip()
508 return configured or None
509 except Exception:
510 return None
511
512
513def _write_advisor_model(context: CommandContext, value: str | None) -> None:

Callers 1

advisor_command_callFunction · 0.85

Calls 2

get_settingsFunction · 0.85
get_stateMethod · 0.45

Tested by

no test coverage detected