mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:37:40 +00:00
fix: derive citations chat type via session parser
This commit is contained in:
committed by
Vignesh
parent
d0b98c75e5
commit
edd6289f26
@@ -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:/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user