修复memory-lancedb对齐preference分类关键词

This commit is contained in:
fan 2026-02-16 00:13:02 +08:00
parent 05173ec53a
commit b888387e67
2 changed files with 7 additions and 1 deletions

View File

@ -187,6 +187,12 @@ describe("memory plugin e2e", () => {
const { detectCategory } = await import("./index.js");
expect(detectCategory("I prefer dark mode")).toBe("preference");
expect(detectCategory("I need dark mode")).toBe("preference");
expect(detectCategory("I always use dark mode")).toBe("preference");
expect(detectCategory("I never use emojis")).toBe("preference");
expect(detectCategory("This is important for me")).toBe("preference");
expect(detectCategory("Preferuji tmavý režim")).toBe("preference");
expect(detectCategory("Nechci používat světlý režim")).toBe("preference");
expect(detectCategory("We decided to use React")).toBe("decision");
expect(detectCategory("My email is test@example.com")).toBe("entity");
expect(detectCategory("The server is running on port 3000")).toBe("fact");

View File

@ -264,7 +264,7 @@ export function shouldCapture(text: string, options?: { maxChars?: number }): bo
export function detectCategory(text: string): MemoryCategory {
const lower = text.toLowerCase();
if (/prefer|radši|like|love|hate|want/i.test(lower)) {
if (/prefer|preferuji|radši|nechci|like|love|hate|want|need|always|never|important/i.test(lower)) {
return "preference";
}
if (/rozhodli|decided|will use|budeme/i.test(lower)) {