fix(webui): broadcast runtime model updates
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
Xubin Ren
co-authored by
Cursor
parent
c92345bbb1
commit
bcc4b97183
@@ -89,6 +89,26 @@ describe("NanobotClient", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("dispatches runtime model updates globally", () => {
|
||||
const client = new NanobotClient({
|
||||
url: "ws://test",
|
||||
reconnect: false,
|
||||
socketFactory: (url) => new FakeSocket(url) as unknown as WebSocket,
|
||||
});
|
||||
const handler = vi.fn();
|
||||
client.onRuntimeModelUpdate(handler);
|
||||
client.connect();
|
||||
lastSocket().fakeOpen();
|
||||
|
||||
lastSocket().fakeMessage({
|
||||
event: "runtime_model_updated",
|
||||
model_name: "openai/gpt-4.1",
|
||||
model_preset: "fast",
|
||||
});
|
||||
|
||||
expect(handler).toHaveBeenCalledWith("openai/gpt-4.1", "fast");
|
||||
});
|
||||
|
||||
it("resolves newChat() via the server-assigned chat_id", async () => {
|
||||
const client = new NanobotClient({
|
||||
url: "ws://test",
|
||||
|
||||
Reference in New Issue
Block a user