Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 Unauthorized Error when trying to use chat #600

Open
joshuadanpeterson opened this issue May 12, 2024 · 2 comments
Open

401 Unauthorized Error when trying to use chat #600

joshuadanpeterson opened this issue May 12, 2024 · 2 comments

Comments

@joshuadanpeterson
Copy link

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
@christianngarcia
Copy link
Collaborator

Is this still a problem? It should work if you have an API key connected. When you hit save the API key, does it say it was successful? 🌸

@joshuadanpeterson
Copy link
Author

Is this still a problem? It should work if you have an API key connected. When you hit save the API key, does it say it was successful? 🌸

I updated the plugin and created a new API key. It works perfectly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants