feat: mark each speaker with a role icon in the transcript (#5)
This commit was merged in pull request #5.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
ASSISTANT_MARKER,
|
||||
STREAMING_CURSOR,
|
||||
USER_MARKER,
|
||||
buildThreadMarkdown,
|
||||
previewText,
|
||||
quote,
|
||||
@@ -44,6 +46,18 @@ describe("buildThreadMarkdown", () => {
|
||||
expect(markdown).toContain("4");
|
||||
});
|
||||
|
||||
it("marks each speaker with a role icon", () => {
|
||||
const markdown = buildThreadMarkdown([
|
||||
message({ role: "user", text: "q" }),
|
||||
message({ role: "assistant", text: "a" }),
|
||||
]);
|
||||
|
||||
expect(markdown).toContain(USER_MARKER);
|
||||
expect(markdown).toContain(ASSISTANT_MARKER);
|
||||
// The user marker must not leak onto the answer or vice versa.
|
||||
expect(markdown.indexOf(USER_MARKER)).toBeLessThan(markdown.indexOf(ASSISTANT_MARKER));
|
||||
});
|
||||
|
||||
it("keeps the conversation in order", () => {
|
||||
const markdown = buildThreadMarkdown([
|
||||
message({ id: "a", role: "user", text: "first" }),
|
||||
|
||||
Reference in New Issue
Block a user