karafra / ai-art

Discord bot generating images from given query
https://karafra.github.io/ai-art/
Apache License 2.0
75 stars 33 forks source link

AI-Story Failing Error 401 #7

Closed dKatsuro closed 2 years ago

dKatsuro commented 2 years ago

Have the bot deployed via Docker. OpenAI key is valid and functioning tested by sending a request to https://api.openai.com/v1/models with my API key in the header and it did return the list of available models so that seems to be working fine.

I did slap the tokens into the docker-compose file but that hasn't been an issue for me for the required bot tokens. Tried with and without quotation marks for the OpenAI token.

  args:  
   - DISCORD_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
   - DISCORD_BOTID=111111111111111111  
   - OPEN_AI_TOKEN=xx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

When sending the story request I get the following error in Discord: Could not process prompt due to internal error (Request failed with status code 401)

Of course, the Docker log also reports: 2022-07-14 06:45:05 : Generating story with headline a storm is brewing based on text-davinci-002 model 2022-07-14 06:45:06 : Request failed with status code 401

karafra commented 2 years ago

Hi. Sorry, I was quite bussy lately with migrating to nestjs framework so I didn't notice this issue sooner.

401 should mean your token for openAI is bad. Could you check usage charts on openAi/did you copy it correctly?

If so, I will look into it. There is high likehood of something screwing with token formating. I am planning nestjs release for tonight, so I will inform you if I found same problem there.

dKatsuro commented 2 years ago

My API key works I have tested it - the wrong (old key) is currently being used.

This is an error on my behalf. Maybe I had attempted to set the variable via $Env (I'm running Windows) at one point in time but I can't seem to change it as I can confirm the key in there was a key I have had at one point in time. Doesn't matter if I change the environment value via the docker-compose file it seems to use the invalid key wherever it's stored and I'm not sure how to resolve this.

karafra commented 2 years ago

Heyy, so I was testing it right now (using linux), error is not repeating for me. Installing windows vm to take a look at it in your environment. 👍🏼

karafra commented 2 years ago

Sorry, i cant reproduce this issue 😢

karafra commented 2 years ago

Heyyy, so I finally managed to put together 2.0.0 release, this one includes custom configuration loader with environment variable transposition. Could you please try if it solves your problem?

karafra commented 2 years ago

Could not reproduce, no further feedback given