mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- Add new ListVaultFiles AI function for listing vault contents - Remove auto-fallback to listing all files when search returns 0 results - Improve SearchVaultFiles description to clarify it searches content - Add listFoldersInDirectory and listDirectoryContents methods to VaultService - Update SanitiserService to normalize empty strings to "/" (vault root) - Add allowAccessToPluginRoot parameter to searchVaultFiles - Update tests to reflect new search behavior and list operations - Add DeregisterAllServices call in plugin onunload - Update dependencies (@google/genai, svelte, vitest, eslint)
27 lines
No EOL
1.5 KiB
TypeScript
27 lines
No EOL
1.5 KiB
TypeScript
import { AIFunction } from "Enums/AIFunction";
|
|
import type { IAIFunctionDefinition } from "../IAIFunctionDefinition";
|
|
|
|
export const SearchVaultFiles: IAIFunctionDefinition = {
|
|
name: AIFunction.SearchVaultFiles,
|
|
description: `Searches the content of all vault files using regex pattern matching.
|
|
Returns files containing the search term with contextual snippets showing where matches appear.
|
|
Use this function when you need to:
|
|
- Find specific concepts, keywords, or text within note contents
|
|
- Locate content matching a pattern or phrase
|
|
- Answer questions about what the user has written about a topic
|
|
- Search across both file names and file contents simultaneously`,
|
|
parameters: {
|
|
type: "object",
|
|
properties: {
|
|
search_term: {
|
|
type: "string",
|
|
description: `The regex pattern to search for in vault files. Supports both simple text searches (e.g., 'meeting notes', 'project alpha') and advanced regex patterns (e.g., '(urgent|important)', '\\d{4}-\\d{2}-\\d{2}' for dates). The search is case-insensitive and performed on both file names and content. Use empty string "" to return all vault files.`
|
|
},
|
|
user_message: {
|
|
type: "string",
|
|
description: "A short message to be displayed to the user explaining what is being searched for. Example: 'Searching for notes about project meetings' or 'Finding files containing todo items'"
|
|
}
|
|
},
|
|
required: ["search_term", "user_message"]
|
|
}
|
|
} |