feat(web): cloud chat-model selector in Settings
Pick which OpenAI model answers on the Cloud backend (gpt-4o / -mini / 4.1 / 4.1-mini / o4-mini, or Default). Persisted in localStorage, sent as `model` in the chat request; respond() applies it only on the cloud backend (local/mi50 keep their fixed models). Reachable from desktop + mobile via Settings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+9
-2
@@ -113,14 +113,21 @@ def build_messages(session_id: str, user_msg: str) -> list[Message]:
|
||||
return messages
|
||||
|
||||
|
||||
def respond(session_id: str, user_msg: str, backend: Backend = "cloud") -> str:
|
||||
"""Produce Lyra's reply to a single user message and persist the exchange."""
|
||||
def respond(session_id: str, user_msg: str, backend: Backend = "cloud",
|
||||
model_override: str | None = None) -> str:
|
||||
"""Produce Lyra's reply to a single user message and persist the exchange.
|
||||
|
||||
`model_override` (from the UI's cloud-model picker) only applies on the cloud
|
||||
backend; local/mi50 keep their own configured models.
|
||||
"""
|
||||
cfg = config.load()
|
||||
# Live chat uses the stronger chat_model on cloud (bulk consolidation keeps
|
||||
# cloud_model). local/mi50 use their own configured model.
|
||||
model = {"local": cfg.local_model, "cloud": cfg.chat_model, "mi50": cfg.mi50_model}.get(
|
||||
backend, backend
|
||||
)
|
||||
if model_override and backend == "cloud":
|
||||
model = model_override
|
||||
logbus.log(
|
||||
"info", "chat request", session=session_id, backend=backend,
|
||||
model=model, embed=cfg.embed_backend,
|
||||
|
||||
Reference in New Issue
Block a user