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

Cannot start smart chat due to errors #442

Open ramarivera opened 6 months ago

ramarivera commented 6 months ago

Hey!

First time using the plugin, and after I created the embeddings I wanted to play with smart chat. But no matter the prompt, it just errors out and hangs.

I've seen some other issue mentioning the same errors I am getting, but in theory it should be fixed in the latest version (which I already checked I have).

Console logs

max_total_tokens 50000
plugin:smart-connections:4432 curr_token_est 169
plugin:smart-connections:4438 max_available_tokens 4096
plugin:smart-connections:1705 embed_input is empty
plugin:smart-connections:5268 TypeError: Cannot read properties of undefined (reading 'vec')
    at SmartSearch2.search (plugin:smart-connections:5259:47)
    at async SmartChatView2.get_context_hyde (plugin:smart-connections:4582:23)
    at async SmartChatView2.initialize_response (plugin:smart-connections:4258:29)
search @ plugin:smart-connections:5268
await in search (async)
get_context_hyde @ plugin:smart-connections:4582
await in get_context_hyde (async)
initialize_response @ plugin:smart-connections:4258
await in initialize_response (async)
eval @ plugin:smart-connections:4241
plugin:smart-connections:4583 nearest before std dev slice 0
plugin:smart-connections:4603 Uncaught (in promise) TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at SmartChatView2.get_nearest_until_next_dev_exceeds_std_dev (plugin:smart-connections:4603:27)
    at SmartChatView2.get_context_hyde (plugin:smart-connections:4584:24)
    at async SmartChatView2.initialize_response (plugin:smart-connections:4258:29)
get_nearest_until_next_dev_exceeds_std_dev @ plugin:smart-connections:4603
get_context_hyde @ plugin:smart-connections:4584
await in get_context_hyde (async)
eval @ plugin:smart-connections:4241
plugin:smart-connections:257 Saving: smart_notes-jina-embeddings-v2-small-en-4096.ajson
brianpetro commented 6 months ago

Hey @ramarivera

Thanks for bringing this to my attention.

I added some checks to help figure out what might be preventing the smart search from working.

Let me know if v2.0.108 clears up the issue for you.

🌴

ramarivera commented 6 months ago

Thanks for the prompt response!

I took a look, and at the very least, there is one less error 😅

max_total_tokens 50000
plugin:smart-connections:4432 curr_token_est 178
plugin:smart-connections:4438 max_available_tokens 4096
plugin:smart-connections:1407 input is empty
plugin:smart-connections:4583 nearest before std dev slice 0
plugin:smart-connections:4603 Uncaught (in promise) TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at SmartChatView2.get_nearest_until_next_dev_exceeds_std_dev (plugin:smart-connections:4603:27)
    at SmartChatView2.get_context_hyde (plugin:smart-connections:4584:24)
    at async SmartChatView2.initialize_response (plugin:smart-connections:4258:29)
get_nearest_until_next_dev_exceeds_std_dev @ plugin:smart-connections:4603
get_context_hyde @ plugin:smart-connections:4584
await in get_context_hyde (async)
eval @ plugin:smart-connections:4241
brianpetro commented 6 months ago

@ramarivera, I just pushed an update v2.0.109 that should alleviate that error.

Are you seeing any notifications pop up that might explain why this is happening in the first place? For example, your Smart View might not be open, which is required for the context search to work.

Let me know how it goes.

🌴