brianpetro / smart-connect

82 stars 9 forks source link

401 Unauthorized while trying to use chat #5

Closed joshuadanpeterson closed 6 months ago

joshuadanpeterson commented 6 months ago

I'm getting an API error when I try to use the smart connections chat. I have the API key in place, but it won't let me choose a model. I checked the console and saw these errors:

POST https://api.openai.com/v1/chat/completions 401 (Unauthorized)
stream @ plugin:smart-connections:5647
full_text @ plugin:smart-connections:6278
stream @ plugin:smart-connections:6253
complete @ plugin:smart-connections:6115
await in complete (async)
new_user_message @ plugin:smart-connections:8053
await in new_user_message (async)
new_user_message @ plugin:smart-connections:8279
eval @ plugin:smart-connections:6664
plugin:smart-connections:6273 CustomEvent {isTrusted: false, data: '{\n    "error": {\n        "message": "Incorrect API… null,\n        "code": "invalid_api_key"\n    }\n}\n', source: SmartStreamer, detail: null, type: 'error', …}
eval @ plugin:smart-connections:6273
eval @ plugin:smart-connections:5623
dispatchEvent @ plugin:smart-connections:5622
onStreamFailure_fn @ plugin:smart-connections:5672
onStreamProgress_fn @ plugin:smart-connections:5685
XMLHttpRequest.send (async)
stream @ plugin:smart-connections:5647
full_text @ plugin:smart-connections:6278
stream @ plugin:smart-connections:6253
complete @ plugin:smart-connections:6115
await in complete (async)
new_user_message @ plugin:smart-connections:8053
await in new_user_message (async)
new_user_message @ plugin:smart-connections:8279
eval @ plugin:smart-connections:6664
plugin:smart-connections:6155 CustomEvent {isTrusted: false, data: '{\n    "error": {\n        "message": "Incorrect API… null,\n        "code": "invalid_api_key"\n    }\n}\n', source: SmartStreamer, detail: null, type: 'error', …}
complete @ plugin:smart-connections:6155
await in complete (async)
new_user_message @ plugin:smart-connections:8053
await in new_user_message (async)
new_user_message @ plugin:smart-connections:8279
eval @ plugin:smart-connections:6664
plugin:smart-connections:7379 chat_ml
Screenshot 2024-05-11 at 20 16 43

The chat worked for me for a little bit, but then it started giving me that message. I didn't do anything different. I even downloaded the update and restarted my Obsidian to see if that would make a difference and it didn't.

When I press "Refresh Model List", I get:

plugin:smart-connections:5864 

GET https://api.openai.com/v1/models 401 (Unauthorized)
fetch_openai_models @ plugin:smart-connections:5864
get_models @ plugin:smart-connections:6372
get_view_data @ plugin:smart-connections:7148
render @ plugin:smart-connections:6961
changed_smart_chat_model @ plugin:smart-connections:7123
await in changed_smart_chat_model (async)
eval @ plugin:smart-connections:7049
(anonymous) @ app.js:1
plugin:smart-connections:5887 Failed to fetch model data: Error: Network response was not ok
at Object.fetch_openai_models [as openai] (plugin:smart-connections:5870:17)
at async ScChatModel.get_models (plugin:smart-connections:6372:26)
at async SmartChatSettings.get_view_data (plugin:smart-connections:7148:42)
at async SmartChatSettings.render (plugin:smart-connections:6961:70)
Screenshot 2024-05-11 at 20 16 29
joshuadanpeterson commented 6 months ago

Closing this issue since I opened it on the wrong repo.