Persistent, channel-NEUTRAL per-session model preference.
ONE source of truth — session_soul.llm_pref_provider + llm_pref_model
in the DB — for every channel (web gateway + TUI), so a session routes
through the same PROVIDER + MODEL wherever it's opened and the choice
survives restarts. Provider + model (not just a model name) mirrors how a
turn records its route and disambiguates a model name shared by >1 provider.
The engine reads it at turn start (prepare-turn-context in loop.clj) as
the default route when the caller passes none; router-for-model hoists the
chosen model (the provider follows, since it's the one carrying that model).
DEBOUNCED WRITE-BACK: set-model! updates an in-memory value IMMEDIATELY
(footer + engine see it at once) and coalesces the DB write, so cycling the
model (TUI Ctrl+T) many times in a row produces a SINGLE write. Reads prefer
the pending in-memory value, falling back to the DB.
Values are {:provider <id-string-or-nil> :model <name>} or nil. Keyed by
the session-soul id (the gateway's sid and the engine env's :session-id).
Persistent, channel-NEUTRAL per-session model preference.
ONE source of truth — `session_soul.llm_pref_provider` + `llm_pref_model`
in the DB — for every channel (web gateway + TUI), so a session routes
through the same PROVIDER + MODEL wherever it's opened and the choice
survives restarts. Provider + model (not just a model name) mirrors how a
turn records its route and disambiguates a model name shared by >1 provider.
The engine reads it at turn start (`prepare-turn-context` in loop.clj) as
the default route when the caller passes none; `router-for-model` hoists the
chosen model (the provider follows, since it's the one carrying that model).
DEBOUNCED WRITE-BACK: `set-model!` updates an in-memory value IMMEDIATELY
(footer + engine see it at once) and coalesces the DB write, so cycling the
model (TUI Ctrl+T) many times in a row produces a SINGLE write. Reads prefer
the pending in-memory value, falling back to the DB.
Values are `{:provider <id-string-or-nil> :model <name>}` or nil. Keyed by
the session-soul id (the gateway's `sid` and the engine env's `:session-id`).(model-of db-info sid)The preference for session sid as {:provider :model}, or nil for the
router default. Prefers the immediate in-memory value, else the DB. Use on
the routing path (engine, gateway).
The preference for session `sid` as `{:provider :model}`, or nil for the
router default. Prefers the immediate in-memory value, else the DB. Use on
the routing path (engine, gateway).(model-of-cached db-info sid)Like model-of but DISPLAY-oriented: when no pending value exists, a recent
DB value is served from a tiny TTL cache so callers can read it every frame
without a DB hit.
Like `model-of` but DISPLAY-oriented: when no pending value exists, a recent DB value is served from a tiny TTL cache so callers can read it every frame without a DB hit.
(set-model! db-info sid provider model)Set (or clear, with blank model) the PROVIDER + MODEL preference for session
sid. Takes effect IMMEDIATELY for reads; the DB write is debounced so
rapid cycling coalesces to one write. Returns {:provider :model} (or nil).
Set (or clear, with blank model) the PROVIDER + MODEL preference for session
`sid`. Takes effect IMMEDIATELY for reads; the DB write is debounced so
rapid cycling coalesces to one write. Returns `{:provider :model}` (or nil).cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |