重建会话记录逻辑
This commit is contained in:
@@ -135,4 +135,37 @@ describe("SessionTranscriptStore", () => {
|
||||
expect(forkRecentTurns).toHaveLength(1);
|
||||
expect(forkRecentTurns[0]?.assistantMessage).toBe("第一轮回复");
|
||||
});
|
||||
|
||||
it("does not duplicate the latest turn when the frontend state is saved again", async () => {
|
||||
await store.appendTurn(
|
||||
{
|
||||
actorKey: "actor-3",
|
||||
clientSessionId: "thread-3",
|
||||
projectKey: "project-3",
|
||||
sessionId: "thread-3",
|
||||
},
|
||||
{
|
||||
assistantMessage: "已完成压力波动分析。",
|
||||
toolCallCount: 1,
|
||||
userMessage: "分析压力波动。",
|
||||
},
|
||||
);
|
||||
|
||||
const transcript = await store.appendTurn(
|
||||
{
|
||||
actorKey: "actor-3",
|
||||
clientSessionId: "thread-3",
|
||||
projectKey: "project-3",
|
||||
sessionId: "thread-3",
|
||||
},
|
||||
{
|
||||
assistantMessage: "已完成压力波动分析。",
|
||||
toolCallCount: 2,
|
||||
userMessage: "分析压力波动。",
|
||||
},
|
||||
);
|
||||
|
||||
expect(transcript.turns).toHaveLength(1);
|
||||
expect(transcript.turns[0]?.toolCallCount).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user