-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding path based file exclusions #29
Conversation
src/VectorStore.ts
Outdated
@@ -238,6 +255,10 @@ export class VectorStore { | |||
} | |||
|
|||
async addFile(file: TFile) { | |||
if(this.isFileExcluded(file)) { | |||
console.log("Skipping excluded file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a debug log or remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will just remove
src/VectorStore.ts
Outdated
keysToBeDeleted.forEach(k => { | ||
this.embeddings.delete(k) | ||
}) | ||
await this.saveEmbeddingsToDatabaseFile() // todo debounce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh we need to consider this when merging #30 which does the debouncing 😈
src/main.ts
Outdated
this.vectorStore.setExclusionPath(this.settings.exclusionPath) | ||
this.vectorStore.deleteByPathPrefix() | ||
const files = this.app.vault.getMarkdownFiles() | ||
this.vectorStore.updateDatabase(files) // TODO trigger re-indexing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the todo here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed ty
src/UserSettings.ts
Outdated
.onChange(async (value) => this.provisionalExclusionPath = value)) | ||
.addButton(button => button. | ||
setButtonText("Set Exclusion") | ||
.onClick(async _ => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the _
i haven't seen this syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Drop this variable, dont give it a name". NVM, what I wanted here was ()
src/VectorStore.ts
Outdated
} | ||
|
||
private isFilePathExcluded(file: string): boolean { | ||
return (!!this.exclusionPath.trim() && file.startsWith(this.exclusionPath)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know if its possible for this.exclusionPath to be null/undefined? to be safe, you may want to check that first
this.exclusionPath && !!this.exclusionPath.trim() && file.startsWith(this.exclusionPath)
src/VectorStore.ts
Outdated
const keysToBeDeleted: string[] = [] | ||
for (const key of this.embeddings.keys()) { | ||
if(this.isFilePathExcluded(key)) { | ||
console.log("Excluded Path:" + key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug log or remove
Adds the ability to exclude a path in your Vault with sensitive data from being sent to OpenAI for indexing. Intention is to support users who want this plugin's functionality, but want to keep some files private.
Fixes #20