refactor(webui): infer fallback from active model

This commit is contained in:
chengyongru
2026-08-21 16:49:30 +08:00
committed by chengyongru
parent 7f97373490
commit 953d2ed217
9 changed files with 8 additions and 19 deletions
-1
View File
@@ -100,7 +100,6 @@ class TurnModelUpdatedEvent(OutboundEvent):
model: str
model_preset: str | None = None
context_window_tokens: int | None = None
is_fallback: bool = False
def outbound_message_for_event(
-3
View File
@@ -1685,7 +1685,6 @@ class WebSocketChannel(BaseChannel):
model_name=event.model,
model_preset=event.model_preset,
context_window_tokens=event.context_window_tokens,
is_fallback=event.is_fallback,
)
return
if isinstance(event, UserInputEvent):
@@ -2103,7 +2102,6 @@ class WebSocketChannel(BaseChannel):
model_name: Any,
model_preset: Any = None,
context_window_tokens: Any = None,
is_fallback: Any = False,
) -> None:
"""Notify one chat's subscribers which model is handling its current request."""
conns = list(self._subs.get(chat_id, ()))
@@ -2117,7 +2115,6 @@ class WebSocketChannel(BaseChannel):
"event": "turn_model_updated",
"chat_id": chat_id,
"model_name": model_name.strip(),
"is_fallback": is_fallback is True,
}
if isinstance(model_preset, str) and model_preset.strip():
body["model_preset"] = model_preset.strip()
@@ -2061,7 +2061,6 @@ async def test_send_scopes_turn_model_updates_to_the_subscribed_chat() -> None:
model="deepseek/deepseek-chat",
model_preset="Deep Research",
context_window_tokens=128_000,
is_fallback=True,
),
)
)
@@ -2073,7 +2072,6 @@ async def test_send_scopes_turn_model_updates_to_the_subscribed_chat() -> None:
"model_name": "deepseek/deepseek-chat",
"model_preset": "Deep Research",
"context_window_tokens": 128_000,
"is_fallback": True,
}
chat_two.send.assert_not_awaited()
-1
View File
@@ -495,7 +495,6 @@ def build_webui_fallback_model_observer(bus: MessageBus) -> FallbackModelObserve
if context.runtime is not None
else None
),
is_fallback=True,
),
metadata=context.metadata,
)