fix(webui): sync model badge after preset switch

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Xubin Ren
2026-05-12 20:06:22 +08:00
committed by Xubin Ren
co-authored by Cursor
parent b61c6304c3
commit c92345bbb1
9 changed files with 61 additions and 4 deletions
+20
View File
@@ -229,6 +229,26 @@ async def test_send_delivers_json_message_with_media_and_reply() -> None:
assert payload["buttons"] == [["Yes", "No"]]
@pytest.mark.asyncio
async def test_send_includes_webui_model_name_metadata() -> None:
bus = MagicMock()
channel = WebSocketChannel({"enabled": True, "allowFrom": ["*"]}, bus)
mock_ws = AsyncMock()
channel._attach(mock_ws, "chat-1")
await channel.send(
OutboundMessage(
channel="websocket",
chat_id="chat-1",
content="switched",
metadata={"_webui_model_name": "openai/gpt-4.1"},
)
)
payload = json.loads(mock_ws.send.call_args[0][0])
assert payload["model_name"] == "openai/gpt-4.1"
@pytest.mark.asyncio
async def test_send_stages_external_media_as_signed_url(monkeypatch, tmp_path) -> None:
bus = MagicMock()