2026-06-01 01:26:27 +00:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
|
2026-06-09 22:00:07 +00:00
|
|
|
import { conversationSummaryFromTranscriptEntries, nonEmptyConversationSummaries } from "../../../src/domain/threads/transcript";
|
2026-06-01 01:26:27 +00:00
|
|
|
|
2026-06-09 22:00:07 +00:00
|
|
|
describe("thread transcript model", () => {
|
|
|
|
|
it("builds conversation summaries from the first user entry and last assistant-like entry", () => {
|
2026-06-01 01:26:27 +00:00
|
|
|
expect(
|
2026-06-09 22:00:07 +00:00
|
|
|
conversationSummaryFromTranscriptEntries([
|
|
|
|
|
{ kind: "assistant", text: "途中経過", timestamp: 1 },
|
|
|
|
|
{ kind: "user", text: "最初の依頼", timestamp: 2 },
|
|
|
|
|
{ kind: "user", text: "補足", timestamp: 3 },
|
|
|
|
|
{ kind: "plan", text: "最終計画", timestamp: 4 },
|
|
|
|
|
]),
|
|
|
|
|
).toEqual({ userText: "最初の依頼", assistantText: "最終計画" });
|
2026-06-01 01:26:27 +00:00
|
|
|
});
|
|
|
|
|
|
2026-06-09 22:00:07 +00:00
|
|
|
it("drops empty summaries", () => {
|
2026-06-01 01:26:27 +00:00
|
|
|
expect(
|
2026-06-09 22:00:07 +00:00
|
|
|
nonEmptyConversationSummaries([
|
|
|
|
|
{ userText: null, assistantText: null },
|
|
|
|
|
{ userText: "依頼", assistantText: null },
|
2026-06-01 01:26:27 +00:00
|
|
|
]),
|
2026-06-09 22:00:07 +00:00
|
|
|
).toEqual([{ userText: "依頼", assistantText: null }]);
|
2026-06-01 01:26:27 +00:00
|
|
|
});
|
|
|
|
|
});
|