fix: derive citations chat type via session parser

This commit is contained in:
Vignesh Natarajan
2026-02-02 20:10:45 -08:00
committed by Vignesh
parent d0b98c75e5
commit edd6289f26
2 changed files with 47 additions and 5 deletions

View File

@@ -84,4 +84,40 @@ describe("memory search citations", () => {
const details = result.details as { results: Array<{ snippet: string; citation?: string }> };
expect(details.results[0]?.snippet.length).toBeLessThanOrEqual(20);
});
it("honors auto mode for direct chats", async () => {
backend = "builtin";
const cfg = {
memory: { citations: "auto" },
agents: { list: [{ id: "main", default: true }] },
};
const tool = createMemorySearchTool({
config: cfg,
agentSessionKey: "agent:main:discord:dm:u123",
});
if (!tool) {
throw new Error("tool missing");
}
const result = await tool.execute("auto_mode_direct", { query: "notes" });
const details = result.details as { results: Array<{ snippet: string }> };
expect(details.results[0]?.snippet).toMatch(/Source:/);
});
it("suppresses citations for auto mode in group chats", async () => {
backend = "builtin";
const cfg = {
memory: { citations: "auto" },
agents: { list: [{ id: "main", default: true }] },
};
const tool = createMemorySearchTool({
config: cfg,
agentSessionKey: "agent:main:discord:group:c123",
});
if (!tool) {
throw new Error("tool missing");
}
const result = await tool.execute("auto_mode_group", { query: "notes" });
const details = result.details as { results: Array<{ snippet: string }> };
expect(details.results[0]?.snippet).not.toMatch(/Source:/);
});
});