fix(webui): preserve answer checkpoints and stream order (#6368)
* fix(webui): preserve answer checkpoints and stream order * fix(stream): close hosted-tool answer segments at the producer
This commit is contained in:
1 parent
d2ab462b42
commit
76da55994b
19 files changed
+745
-195
No files matched your search
@@ -1,8 +1,10 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { ThreadMessageCache } from "@/lib/thread-message-cache";
|
||||
import type { UIMessage } from "@/lib/types";
|
||||
import { createThreadCheckpoint } from "@/lib/thread-checkpoint";
|
||||
|
||||
const rows: UIMessage[] = [{ id: "u", role: "user", content: "hello", createdAt: 1 }];
|
||||
const messages: UIMessage[] = [{ id: "u", role: "user", content: "hello", createdAt: 1 }];
|
||||
const rows = createThreadCheckpoint(messages);
|
||||
|
||||
it("keeps recently visited chats within the entry budget", () => {
|
||||
const cache = new ThreadMessageCache(() => false, 10000, 2);
|
||||
@@ -15,7 +17,7 @@ it("keeps recently visited chats within the entry budget", () => {
|
||||
it("bounds large replay snapshots while retaining temporary chats", () => {
|
||||
const cache = new ThreadMessageCache((key) => key === "temporary", 1000, 2);
|
||||
cache.set("temporary", rows);
|
||||
cache.set("large", [{ ...rows[0], content: "x".repeat(1000) }]);
|
||||
cache.set("large", createThreadCheckpoint([{ ...messages[0], content: "x".repeat(1000) }]));
|
||||
expect(cache.get("large")).toBeUndefined();
|
||||
expect(cache.get("temporary")).toBe(rows);
|
||||
cache.delete("temporary");
|
||||
|
||||
Reference in new issue
Block a user