mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-06-11 07:21:00 +00:00
add tool use, update system prompt
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { minimatch } from 'minimatch'
|
||||
import { Vault } from 'obsidian'
|
||||
import { TFile, TFolder, Vault } from 'obsidian'
|
||||
|
||||
export const findFilesMatchingPatterns = async (
|
||||
patterns: string[],
|
||||
@@ -10,3 +10,24 @@ export const findFilesMatchingPatterns = async (
|
||||
return patterns.some((pattern) => minimatch(file.path, pattern))
|
||||
})
|
||||
}
|
||||
|
||||
export const listFilesAndFolders = async (vault: Vault, path: string) => {
|
||||
const folder = vault.getAbstractFileByPath(path)
|
||||
const childrenFiles: string[] = []
|
||||
const childrenFolders: string[] = []
|
||||
if (folder instanceof TFolder) {
|
||||
folder.children.forEach((child) => {
|
||||
if (child instanceof TFile) {
|
||||
childrenFiles.push(child.path)
|
||||
} else if (child instanceof TFolder) {
|
||||
childrenFolders.push(child.path + "/")
|
||||
}
|
||||
})
|
||||
return [...childrenFolders, ...childrenFiles]
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
export const regexSearchFiles = async (vault: Vault, path: string, regex: string, file_pattern: string) => {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user