fix: preserve interaction replies across chat recovery
This commit is contained in:
@@ -7,6 +7,15 @@ import {
|
||||
} from "../../src/routes/chatStreamRoute.js";
|
||||
|
||||
describe("task collaboration history", () => {
|
||||
it("keeps accepted reply snapshots with both text and rich history", () => {
|
||||
const reply = { type: "data-interaction_reply" as const, data: { interaction_id: "accepted-question" } };
|
||||
for (const rich of [false, true]) {
|
||||
const parts: UIMessage["parts"] = [{ type: "text", text: "核查范围: 北侧管网" }, reply,
|
||||
...(rich ? [{ type: "data-final_answer" as const, data: { content: "核查范围: 北侧管网" } }] : [])];
|
||||
const messages = [{ id: "reply", role: "user", parts: [...parts, { type: "data-progress", data: { title: "执行记录" } }] }] as unknown as UIMessage[];
|
||||
expect(toCollaborationMessages(messages)).toEqual([{ id: "reply", role: "user", parts }]);
|
||||
}
|
||||
});
|
||||
it("persists only user and assistant text instead of execution trajectory", () => {
|
||||
const messages = [
|
||||
{ id: "user-1", role: "user", parts: [{ type: "text", text: "为什么这样判断?" }] },
|
||||
|
||||
Reference in New Issue
Block a user