Add per-chat model selection #2

Open
opened 2026-08-12 16:55:04 +00:00 by hermes · 0 comments
Owner

Summary

Let users change the model for an individual chat: pick at chat creation, and switch it mid-session from the composer. This is distinct from the global default (see the Settings feature) — it overrides only that one session.

API surface (verified against Hermes 0.20.0)

  • New chat: session.create accepts model (+ optional provider) as a pinned per-session override — never a global write. The response's info.model / info.provider echo it back. Also supports reasoning_effort and fast.
  • Existing chat: WS config.set with { "key": "model", "value": "<model>" or "<model> --provider <slug>", "session_id": "<runtimeSessionID>" } (or slash.exec /model <x>). Session-scoped; deferred to the next turn if a turn is streaming (deferred: true); may return confirm_required for expensive models.
  • Current model: read from the session.create / session.resume result's info.model / info.provider, and from the session.info WS event. session.resume does NOT accept a model param — use config.set to change an existing session.

Changes

  • Talaria/Features/Chat/ChatView.swift:
    • Add a model button to the composer showing the current model; tapping opens a ModelPickerView sheet scoped to the chat.
    • ChatViewModel: add selectedModel / selectedProvider; pass them in session.create; add switchModel(...) issuing config.set; handle the session.info event (currently falls through to default: break in handle()) to read/refresh the live model.
    • Read the model from the session.create / session.resume result's info on connect so resumed chats show the correct model.
  • Reuse ModelPickerView from the Settings feature.

Acceptance criteria

  • New chats can be started with a chosen model (passed via session.create).
  • The current model is shown in the composer and initialized correctly for resumed sessions.
  • Switching the model mid-session issues config.set and applies to the next turn.
  • deferred (streaming) and confirm_required (expensive) responses are handled.
  • The override survives backgrounding/reconnect (server pins it; client re-reads from the resume result / session.info).
  • Unit test for the session.info payload decode / model extraction.
## Summary Let users change the model for an individual chat: pick at chat creation, and switch it mid-session from the composer. This is distinct from the global default (see the Settings feature) — it overrides only that one session. ## API surface (verified against Hermes 0.20.0) - **New chat:** `session.create` accepts `model` (+ optional `provider`) as a pinned per-session override — never a global write. The response's `info.model` / `info.provider` echo it back. Also supports `reasoning_effort` and `fast`. - **Existing chat:** WS `config.set` with `{ "key": "model", "value": "<model>" or "<model> --provider <slug>", "session_id": "<runtimeSessionID>" }` (or `slash.exec` `/model <x>`). Session-scoped; deferred to the next turn if a turn is streaming (`deferred: true`); may return `confirm_required` for expensive models. - **Current model:** read from the `session.create` / `session.resume` result's `info.model` / `info.provider`, and from the `session.info` WS event. `session.resume` does NOT accept a `model` param — use `config.set` to change an existing session. ## Changes - `Talaria/Features/Chat/ChatView.swift`: - Add a model button to the composer showing the current model; tapping opens a `ModelPickerView` sheet scoped to the chat. - `ChatViewModel`: add `selectedModel` / `selectedProvider`; pass them in `session.create`; add `switchModel(...)` issuing `config.set`; handle the `session.info` event (currently falls through to `default: break` in `handle()`) to read/refresh the live model. - Read the model from the `session.create` / `session.resume` result's `info` on connect so resumed chats show the correct model. - Reuse `ModelPickerView` from the Settings feature. ## Acceptance criteria - [ ] New chats can be started with a chosen model (passed via `session.create`). - [ ] The current model is shown in the composer and initialized correctly for resumed sessions. - [ ] Switching the model mid-session issues `config.set` and applies to the next turn. - [ ] `deferred` (streaming) and `confirm_required` (expensive) responses are handled. - [ ] The override survives backgrounding/reconnect (server pins it; client re-reads from the resume result / `session.info`). - [ ] Unit test for the `session.info` payload decode / model extraction.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coop/talaria#2
No description provided.