diff --git a/main.js b/main.js index d53aba77..07c40b40 100644 --- a/main.js +++ b/main.js @@ -802,14 +802,22 @@ class SmartConnectionsPlugin extends Obsidian.Plugin { return "excluded"; } } - // get from cache if mtime is same + // get from cache if mtime is same and values are not empty let current_note_embedding_values = []; - if((this.embeddings[current_note.path]) && (this.embeddings[current_note.path].mtime >= current_note.stat.mtime)) { - // log skipping file + if (!this.embeddings[current_note.path] + || !(this.embeddings[current_note.path].mtime >= current_note.stat.mtime) + || !this.embeddings[current_note.path].values + || !Array.isArray(this.embeddings[current_note.path].values) + || !(this.embeddings[current_note.path].values.length > 0) + ) { + // console.log("getting current") + await this.get_file_embeddings(current_note); + }else{ + // skipping get file embeddings because nothing has changed //console.log("skipping file (mtime)"); - }else{ - // console.log("getting current") - await this.get_file_embeddings(current_note); + } + if(!this.embeddings[current_note.path] || !this.embeddings[current_note.path].values) { + return "Error getting embeddings for: "+current_note.path; } current_note_embedding_values = this.embeddings[current_note.path].values; diff --git a/manifest.json b/manifest.json index cfa75b57..16086ab1 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "Smart Connections", "author": "Brian Petro", "description": "Find links to similar notes using artificial intelligence from OpenAI.", - "version": "1.0.35", + "version": "1.0.36", "minAppVersion": "1.1.0", "authorUrl": "https://wfhbrian.com", "isDesktopOnly": true