brianpetro / obsidian-smart-connections

Chat with your notes & see links to related content with AI embeddings. Use local models or 100+ via APIs like Claude, Gemini, ChatGPT & Llama 3
https://smartconnections.app
GNU General Public License v3.0
2.74k stars 181 forks source link

seems to have stopped working after update #697

Open nathanielvirgo opened 3 months ago

nathanielvirgo commented 3 months ago

I updated this plugin today, and it seems that now whatever I do I can't get it to generate new connections. It just pops up a message saying

[Smart Connections]

Embedding smart_notes
Progress: 0 / 1 smart notes
0 tokens/sec
(This is a resource intensive operation)

and hangs there forever until I pause it, and the right hand panel never updates.

I'm using the BGE-small-4k local model.

Extra info: I have no idea what the proper way is to make the connections update (please fix this!) so I bound a key to the "Smart Connections: Refresh & Make Connections" action and that's what I'm using to try and update them. Previously it would also update if I clicked into a different note and back again, but after the update it no longer does.

I tried doing a force reset, but it had no effect, the symptoms are the same.

brianpetro commented 3 months ago

Hi @nathanielvirgo and thanks for letting me know.

Are you seeing any errors in the developer console? If so,n please screenshot and share them here.

I recommend sticking with the BGE-micro-v2 model until the issue gets resolved. Then try other models once things are working with that known reliable model.

🌴

nathanielvirgo commented 3 months ago

I think maybe this is the relevant thing in the logs - it appears whenever I can get the "Embedding smart_notes" notification to appear:

plugin:smart-connections:8781 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'contentWindow')
    at IframeAdapter.request_embedding (plugin:smart-connections:8781:20)
    at IframeAdapter.embed_batch (plugin:smart-connections:8806:33)
    at SmartEmbedModel.embed_batch (plugin:smart-connections:9092:37)
    at SmartNotes.ensure_embeddings (plugin:smart-connections:836:47)
    at async SmartNotes.ensure_embeddings (plugin:smart-connections:1059:9)
request_embedding @ plugin:smart-connections:8781
embed_batch @ plugin:smart-connections:8806
embed_batch @ plugin:smart-connections:9092
ensure_embeddings @ plugin:smart-connections:836
await in ensure_embeddings (async)
callback @ plugin:smart-connections:824
eval @ plugin:smart-connections:9849

Indeed, switching back to BGE-micro-v2 does fix the issue. Before the update, I had BGE-small-4k working, and I was getting better results with it.

brianpetro commented 3 months ago

@nathanielvirgo happy to see it's working with BGE-micro-v2.

The local embeddings are handled by transformers.js, so nothing I update has any impact on it.

The error you shared is likely from the transformers.js instance failing and so the iframe which it was loaded in became unavailable.

The Smart Connect app uses the same embedding internals, but it often handles larger models since it's not restricted to the by the Obsidian/iframe environment. Once the app is installed and running, restart Obsidian and it should use Smart Connect to process the embeddings. This may get the 4k model working for you again, but it still may fail after some time, like if your computer resource usage is too high to handle running the model.

🌴