import { describe, expect, it } from "vitest"; import { buildHistoryContextFromEntries } from "../auto-reply/reply/history.js"; import { extractTextFromChatContent } from "../shared/chat-content.js"; import { buildAgentMessageFromConversationEntries } from "./agent-prompt.js";
describe("gateway agent prompt", () => {
it("returns empty for no entries", () => {
expect(buildAgentMessageFromConversationEntries([])).toBe("");
});
it("returns current body when there is no history", () => {
expect(
buildAgentMessageFromConversationEntries([
{ role: "user", entry: { sender: "User", body: "hi" } },
]),
).toBe("hi");
});
it("extracts text from content-array body when there is no history", () => {
expect(
buildAgentMessageFromConversationEntries([
{
role: "user",
entry: {
sender: "User",
body: [
{ type: "text", text: "hi" },
{ type: "image", data: "base64-image", mimeType: "image/png" },
{ type: "text", text: "there" },
] as unknown as string,
},
},
]),
).toBe("hi there");
});
it("uses history context when there is history", () => { const entries = [
{ role: "assistant", entry: { sender: "Assistant", body: "prev" } },
{ role: "user", entry: { sender: "User", body: "next" } },
] as const;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.