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.7k stars 181 forks source link

Smart Connections freezing and re-embedding frequently #583

Open MorganOnCode opened 5 months ago

MorganOnCode commented 5 months ago

My Smart Connections instance has become unusable. Every time I try to use it, it either freezes or forces re-embedding, which then freezes my whole Obsidian app.

Smart Connections used to be so good! It seems the latest updates have killed it for my machine. I'm on a Macbook Pro M2 Ultra chipset.

When using chat, it fails frequently without any error warning - just doesn't function. Single line prompts in the chat sometimes work, but often don't. When I type a line break, it seems to fail more often.

I'd like to understand if I'm doing anything wrong?

These are my settings (it's presently frozen on this screen)

Screenshot 2024-05-05 at 10 42 12
AdalaceV2 commented 5 months ago

I seem to also be suffering from this same issue. Also on an M2.

brianpetro commented 5 months ago

Hi @AdalaceV2 & @MorganOnCode

Thanks for letting me know about this.

While the computer hardware running Obsidian may be overall sufficient, the underlying software Obsidian uses (electron) arbitrarily limits memory usage. That's why running almost any model within Obsidian tends to grind things to a halt.

You can improve this immediately by getting the Smart Connect software. Smart Connect uses the same internals to offload the embedding processing from the Obsidian app. To do this, install and open Smart Connect, then click "Connect to Smart Connect," as seen in the screenshot above, to begin using it for your embeddings.

Every time I try to use it, it either freezes or forces re-embedding, which then freezes my whole Obsidian app.

See https://github.com/brianpetro/obsidian-smart-connections/issues/578#issuecomment-2096835694 for a couple important notes for preventing re-embedding.

Smart Connections used to be so good! It seems the latest updates have killed it for my machine.

This is most likely due to the introduction of local embeddings. If you switch back to OpenAI embeddings, performance should be equivalent to v1.x.x while still having the many new and improved features added since v1.

When using chat, it fails frequently without any error warning - just doesn't function.

Is this during the embedding processing?

Single line prompts in the chat sometimes work, but often don't.

Can you send me a screenshot of the developer console logs when this happens so I can take a look?

When I type a line break, it seems to fail more often.

Is this in reference to the chat input? Or on a note during the embedding processing? Considering the above, it would make sense if it is the latter since a new line in a note will cause re-rendering, which could cause the application to exceed that arbitrary memory limit.

Thanks for your help in getting to the bottom of these issues 🌴

AdalaceV2 commented 5 months ago

How can I grab some logs of the error? I'm pretty sure I can reproduce the problem on my end.

brianpetro commented 5 months ago

Hey @AdalaceV2

Make sure you update to the latest version, just made a few bugfixes now available in 2.1.57.

Then open the dev console using View > Toggle Developer Tools to see the logs.

Thanks for your help 🌴

AdalaceV2 commented 5 months ago

Ok I've narrowed it down.

It is triggered whenever I try to access the search (through the magnifier icon) after moving a file to a different folder.

The program goes into an infinite loop of this message: image

This happens here: image

Because of this error: image

MorganOnCode commented 5 months ago
image

This doesn't seem that useful to me. I uninstalled Smart Connections for a bit because it was making Obsidian unusable. I've reinstalled to try to fix.

@brianpetro - How can I help navigate the dev console and give you useful data?

MorganOnCode commented 5 months ago

Hey @brianpetro,

image

See https://github.com/brianpetro/obsidian-smart-connections/issues/578#issuecomment-2096835694 for a couple important notes for preventing re-embedding.

I've selected the "Embedding file per note (EXPERIMENTAL)" setting and it seemed to give me these red errors in the console. I also set all the models to OpenAI in input a fresh API key (which was validated and works). Sadly, Obsidian immediately crashed and I've had to force quit it again.

Is this in reference to the chat input? Or on a note during the embedding processing? Considering the above, it would make sense if it is the latter since a new line in a note will cause re-rendering, which could cause the application to exceed that arbitrary memory limit.

Yes, when I was able to chat with it, a single line input would get a response, but a multi line (with a line break return) input would get no response.

When I get it working again, I'll paste the logs

I'd love for Smart Connections to work again

MorganOnCode commented 5 months ago

@brianpetro - I got SC setup, the API key is entered and it seemed to finish embedding. But:

image

When I ask it basic questions, it says it doesn't have access to my notes.

image

Apologies, I don't know what is useful to you from the dev console - if there's a way to export the logs - I will send them to you in a better format

brianpetro commented 5 months ago

Hey @MorganOnCode

Thanks for the screenshots! While they may look like gibberish, they do help.

If you don't mind, turning on the "debug at startup time" in the community settings tab will make the logs more helpful (it gives me accurate file names and line numbers for inspecting the code).

Based on the logs, I can see that it looks up your notes. However, it seems that the lookup is failing to return any results.

This is likely because either the embeddings don't exist or the embeddings failed to load.

One way to confirm this is to see if the Smart View is working. If the Smart View is not working, then the lookup in the chat won't work either.

Thanks for your help and patience while we figure this one out 🌴

bbecausereasonss commented 5 months ago

For the record, since the new releases I'm having the issue of being asked to rebuild embedding every time I switch between PC/OSX again. This stopped happening before after I did the individual embeddings, and synched to a separate folder, but now it's back and Im unsure why.

brianpetro commented 5 months ago

Hey @bbecausereasonss

Are you syncing the embeddings folder?

I recommend not syncing the folder. Each device will have to "catch up" with any changes made on the other devices, but this processing time should be negligible unless you make major changes.

Are you on the v2.2 early release?

On v2.2, I've been switching back and forth between OSX and Windows and haven't noticed any unnecessary re-embeddings.

Can you make the issue happen on demand, i.e., by opening on one platform, closing, then opening on the other platform and observing the issue?

Thanks for the update 🌴