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

TypeError reading 'match' #584

Open AMGMNPLK opened 2 months ago

AMGMNPLK commented 2 months ago

Error

plugin:smart-connections:2791 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'match')
    at render_dataview_codeblocks (plugin:smart-connections:2791:49)
    at SmartBlock.get_as_context (plugin:smart-connections:2833:31)
    at async eval (plugin:smart-connections:5931:29)
    at async Promise.all (index 2)
    at async eval (plugin:smart-connections:5928:13)
    at async Promise.all (index 2)
    at async ScChatModel.request_middlewares (plugin:smart-connections:5915:9)
    at async ScChatModel.complete (plugin:smart-connections:5572:16)
    at async ScChatMD.new_user_message (plugin:smart-connections:6994:9) 

Prompt to Replicate

Tell me if any of these are not in the [[A quite long note with many links and names]] : 

{{An article with about 2600 words}}

Post note:

Attempt 1

I've just tried similar prompt in chatGPT3.5 and Gemini and got that it is too long, probably this is the reason. It works in ChatGPT4.

Attempt 2

With a small prompt, asking about another short note with [[note]] notation, I got again the same error

brianpetro commented 2 months ago

Hi @AMGMNPLK

Thanks for the detailed issue.

It looks like there is some sort of issue with rendering a dataview. Are you using dataview in your Obsidian?

Also, if you could toggle on this setting in the community plugins section:

Screenshot 2024-05-06 at 4 22 32 PM

It will make it so I can better diagnose the issue based on your error logs.

Looking at the code, the file_content provided to the render dataview method is null for some reason.

Do you know if this continues to happen after restarting Obsidian?

If there is a specific note that you can share with me for testing, that would also be helpful.

Thanks for your help in solving this, 🌴

AMGMNPLK commented 2 months ago

Thanks for your time @brianpetro ,

Yes, I'm using dataview in some notes.

Toggle activated:

smart-connections: 269ms
Loading Smart Connections v2...
ObsAJSON.js:23 Loading: .smart-connections/smart_notes-jina-embeddings-v2-base-zh-8192.ajson
ObsAJSON.js:23 Loading: .smart-connections/smart_blocks-jina-embeddings-v2-base-zh-8192.ajson
smart_socket.js:26 Smart Connect is not running, will try to connect again later
smart_socket.js:72 Attempting to reconnect in 2 seconds...
smart_socket.js:26 Smart Connect is not running, will try to connect again later
smart_socket.js:72 Attempting to reconnect in 4 seconds...
smart_socket.js:26 Smart Connect is not running, will try to connect again later
smart_socket.js:72 Attempting to reconnect in 8 seconds...
5
smart_socket.js:26 Smart Connect is not running, will try to connect again later
ScEnv2 {config: {…}, item_types: {…}, collections: {…}, data_path: '.smart-connections', ltm_adapter: ƒ, …}
smart_entities.js:77 Checking for local Smart Connect server...
smart_entities.js:88 Could not connect to local Smart Connect server
smart_entities.js:60 ScEnv2 {config: {…}, item_types: {…}, collections: {…}, data_path: '.smart-connections', ltm_adapter: ƒ, …}
smart_entities.js:77 Checking for local Smart Connect server...
smart_entities.js:88 Could not connect to local Smart Connect server
2iframe.js:44 SmartEmbedTransformersWebAdapter Connected
Smart Connections v2 loaded
smart_socket.js:26 Smart Connect is not running, will try to connect again later
iframe.js:61 Uncaught (in promise) Error: Timeout waiting for response
    at eval (iframe.js:61:18)
eval @ iframe.js:61
2smart_socket.js:26 Smart Connect is not running, will try to connect again later
smart_socket.js:56 Failed to reconnect after 10 attempts
can_attempt_connection @ smart_socket.js:56
connect @ smart_socket.js:20
connect @ smart_socket.js:27
smart_socket.js:195 Failed to reconnect, will not retry...
on_fail_to_reconnect @ smart_socket.js:195
can_attempt_connection @ smart_socket.js:57
connect @ smart_socket.js:20
connect @ smart_socket.js:27

I'm not getting that error, I'll let you know if I get it again.

I also tried to make a summary of a note that use and render dataview. I'm not sure, but I would say that it render it and it read it. Is this that way? this is awesome!