mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 04:02:42 +00:00
fix(memory/qmd): scope query to managed collections (#11645)
This commit is contained in:
@@ -262,7 +262,12 @@ export class QmdMemoryManager implements MemorySearchManager {
|
||||
this.qmd.limits.maxResults,
|
||||
opts?.maxResults ?? this.qmd.limits.maxResults,
|
||||
);
|
||||
const args = ["query", trimmed, "--json", "-n", String(limit)];
|
||||
const collectionFilterArgs = this.buildCollectionFilterArgs();
|
||||
if (collectionFilterArgs.length === 0) {
|
||||
log.warn("qmd query skipped: no managed collections configured");
|
||||
return [];
|
||||
}
|
||||
const args = ["query", trimmed, "--json", "-n", String(limit), ...collectionFilterArgs];
|
||||
let stdout: string;
|
||||
try {
|
||||
const result = await this.runQmd(args, { timeoutMs: this.qmd.limits.timeoutMs });
|
||||
@@ -975,4 +980,12 @@ export class QmdMemoryManager implements MemorySearchManager {
|
||||
new Promise<void>((resolve) => setTimeout(resolve, SEARCH_PENDING_UPDATE_WAIT_MS)),
|
||||
]);
|
||||
}
|
||||
|
||||
private buildCollectionFilterArgs(): string[] {
|
||||
const names = this.qmd.collections.map((collection) => collection.name).filter(Boolean);
|
||||
if (names.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return names.flatMap((name) => ["-c", name]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user