mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:51:23 +00:00
Memory/QMD: add limit arg to search command
This commit is contained in:
@@ -340,7 +340,15 @@ describe("QmdMemoryManager", () => {
|
||||
).resolves.toEqual([]);
|
||||
|
||||
const searchCall = spawnMock.mock.calls.find((call) => call[1]?.[0] === "search");
|
||||
expect(searchCall?.[1]).toEqual(["search", "test", "--json", "-c", "workspace"]);
|
||||
expect(searchCall?.[1]).toEqual([
|
||||
"search",
|
||||
"test",
|
||||
"--json",
|
||||
"-n",
|
||||
String(resolved.qmd?.limits.maxResults),
|
||||
"-c",
|
||||
"workspace",
|
||||
]);
|
||||
expect(spawnMock.mock.calls.some((call) => call[1]?.[0] === "query")).toBe(false);
|
||||
expect(maxResults).toBeGreaterThan(0);
|
||||
await manager.close();
|
||||
@@ -394,7 +402,7 @@ describe("QmdMemoryManager", () => {
|
||||
(args): args is string[] => Array.isArray(args) && ["search", "query"].includes(args[0]),
|
||||
);
|
||||
expect(searchAndQueryCalls).toEqual([
|
||||
["search", "test", "--json", "-c", "workspace"],
|
||||
["search", "test", "--json", "-n", String(maxResults), "-c", "workspace"],
|
||||
["query", "test", "--json", "-n", String(maxResults), "-c", "workspace"],
|
||||
]);
|
||||
await manager.close();
|
||||
@@ -558,7 +566,21 @@ describe("QmdMemoryManager", () => {
|
||||
|
||||
await manager.search("test", { sessionKey: "agent:main:slack:dm:u123" });
|
||||
const searchCall = spawnMock.mock.calls.find((call) => call[1]?.[0] === "search");
|
||||
expect(searchCall?.[1]).toEqual(["search", "test", "--json", "-c", "workspace", "-c", "notes"]);
|
||||
const maxResults = resolved.qmd?.limits.maxResults;
|
||||
if (!maxResults) {
|
||||
throw new Error("qmd maxResults missing");
|
||||
}
|
||||
expect(searchCall?.[1]).toEqual([
|
||||
"search",
|
||||
"test",
|
||||
"--json",
|
||||
"-n",
|
||||
String(maxResults),
|
||||
"-c",
|
||||
"workspace",
|
||||
"-c",
|
||||
"notes",
|
||||
]);
|
||||
await manager.close();
|
||||
});
|
||||
|
||||
|
||||
@@ -972,7 +972,7 @@ export class QmdMemoryManager implements MemorySearchManager {
|
||||
if (command === "query") {
|
||||
return ["query", query, "--json", "-n", String(limit)];
|
||||
}
|
||||
return [command, query, "--json"];
|
||||
return [command, query, "--json", "-n", String(limit)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user