feat: store and display backend + host metadata on chat messages

Each assistant message in the session JSON now carries:
  backend, backend_label, host (platform.node())

These fields are shown as model tags in the UI — on live responses and
when loading session history. Session log entries (sessions/YYYY-MM-DD.md)
include the backend label and host in the turn header.

The local (OpenAI-compat) backend strips non-standard fields before
sending messages to the API so extra fields don't leak upstream.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-04-08 22:16:48 -04:00
parent 6c84d6ae72
commit 3b3456600a
4 changed files with 36 additions and 8 deletions

View File

@@ -183,7 +183,8 @@ async def _local(system_prompt: str, messages: list[dict], model_cfg: dict | Non
msgs: list[dict] = []
if system_prompt:
msgs.append({"role": "system", "content": system_prompt})
msgs.extend(messages)
# Strip any non-standard metadata fields before sending to the API
msgs.extend({"role": m["role"], "content": m["content"]} for m in messages)
url = api_url.rstrip("/") + chat_path
headers: dict[str, str] = {}