mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 03:01:50 +03:00
feat(memory-lancedb): make auto-capture max length configurable
This commit is contained in:
@@ -194,8 +194,9 @@ const MEMORY_TRIGGERS = [
|
||||
/always|never|important/i,
|
||||
];
|
||||
|
||||
export function shouldCapture(text: string): boolean {
|
||||
if (text.length < 10 || text.length > 500) {
|
||||
export function shouldCapture(text: string, options?: { maxChars?: number }): boolean {
|
||||
const maxChars = options?.maxChars ?? 1500;
|
||||
if (text.length < 10 || text.length > maxChars) {
|
||||
return false;
|
||||
}
|
||||
// Skip injected context from memory recall
|
||||
@@ -570,7 +571,9 @@ const memoryPlugin = {
|
||||
}
|
||||
|
||||
// Filter for capturable content
|
||||
const toCapture = texts.filter((text) => text && shouldCapture(text));
|
||||
const toCapture = texts.filter(
|
||||
(text) => text && shouldCapture(text, { maxChars: cfg.captureMaxChars }),
|
||||
);
|
||||
if (toCapture.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user