fix(webui): identify OAuth reauthentication behind fallback replies

This commit is contained in:
Xubin Ren committed 2026-09-21 00:13:46 +08:00
1 parent a05f11ba10
commit 448767d147
28 files changed
+269 -40

No files matched your search

+3
View File
@@ -1531,6 +1531,7 @@ class WebSocketChannel(BaseChannel):
model_preset: Any = None,
context_window_tokens: Any = None,
fallback: bool = False,
reauth_provider: str | None = None,
) -> None:
"""Notify one chat's subscribers which model is handling its current request."""
conns = list(self._subs.get(chat_id, ()))
@@ -1551,6 +1552,8 @@ class WebSocketChannel(BaseChannel):
body["context_window_tokens"] = context_window_tokens
if fallback:
body["fallback"] = True
if reauth_provider:
body["reauth_provider"] = reauth_provider
raw = json.dumps(body, ensure_ascii=False)
for connection in conns:
await self._safe_send_to(connection, raw, label=" turn_model_updated ")
@@ -2309,11 +2309,13 @@ async def test_send_scopes_turn_model_updates_to_the_subscribed_chat() -> None:
model="deepseek/deepseek-chat",
model_preset="Deep Research",
fallback=True,
reauth_provider="openai_codex",
),
)
)
fallback_payload = json.loads(chat_one.send.call_args.args[0])
assert fallback_payload["fallback"] is True
assert fallback_payload["reauth_provider"] == "openai_codex"
chat_two.send.assert_not_awaited()