reworkd / AgentGPT

🤖 Assemble, configure, and deploy autonomous AI Agents in your browser.
https://agentgpt.reworkd.ai
GNU General Public License v3.0
31.48k stars 9.22k forks source link

Invalid API Key #1624

Open taia-source opened 3 weeks ago

taia-source commented 3 weeks ago

Please check that this issue hasn't been reported before.

Expected Behavior

Should accept OpenAI API Key.

Current behaviour

git clone https://github.com/reworkd/AgentGPT.git cd AgentGPT ./setup.bat

I did this, cmd couldn't understand .setup.bat so I had to run setup.bat only. Asks me to choose between Docker and Manual. I choose Docker. Asks me for OpenAPI Key. I input API Key with no success.

Steps to reproduce

No idea.

Possible solution

I'm doing something wrong clearly as no one have reported this bug. I followed the instructions to get started but this is where i am at.

Which Operating Systems are you using?

Acknowledgements

bogdan-marian commented 2 weeks ago

No you are not doing anythig wrong. I just landed here super exited about how strateforeword all this looks anb bam~ Invalid api key. Please try again.

I'm on linux Ubuntu 24.04.1 LTS x86_64

jarodsmk commented 2 weeks ago

Yea, something's weird. Also happening to me.

The issue stems from this line: https://github.com/reworkd/AgentGPT/blame/main/cli/src/questions/newEnvQuestions.js#L15

The regex is incorrect and should be changed from /^sk-[a-zA-Z0-9]{48}$/ to /^sk-[a-zA-Z0-9\-\_]{92}$/ as OpenAI API secrets have 92 characters after the 'sk-' prefix, and also have underscores & dashes. Unless I'm missing something

Edit: The above only accounts for User API Secret Keys and not 'Project' API Secret Keys which seem to have a different length

Edit 2: Testing the change now, will probably create a PR tomorrow if all is ok

elhenro commented 1 week ago

Same happened for me on Ubuntu 24.04.1 LTS x86_64

twobeass commented 3 days ago

same for me...