Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(llm): dedupe search_help words without tripping tsc --build
Elian Doranb42e6347865c
diff --git a/apps/server/src/services/llm/tools/help_tools.ts b/apps/server/src/services/llm/tools/help_tools.tsindex 254fe3699a..c77aa2a207 100644--- a/apps/server/src/services/llm/tools/help_tools.ts+++ b/apps/server/src/services/llm/tools/help_tools.ts@@ -43,9 +43,11 @@ export const helpTools = defineTools({// Strip punctuation (models happily send "cloning?" despite the// schema hint) and deduplicate so repeated words don't skew scoring.- const words = [...new Set(- query.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu, " ").split(/\s+/).filter(Boolean)- )];+ const words = query.toLowerCase()+ .replace(/[^\p{L}\p{N}\s]/gu, " ")+ .split(/\s+/)+ .filter(Boolean)+ .filter((word, index, all) => all.indexOf(word) === index);if (words.length === 0) {return { error: "Empty search query." };}