Niek / chatgpt-web

ChatGPT web interface using the OpenAI API
https://niek.github.io/chatgpt-web/
GNU General Public License v3.0
1.78k stars 462 forks source link

get-apikey-from-env-var #462

Closed XMCyber closed 1 month ago

XMCyber commented 1 month ago

@Niek Could you please review and approve this PR? This feature should give us the ability to use the API KEY directly from the env file instead of configuring for each user. It simplifies the deploy process for bigger companies that uses this chatgpt-web as main FE and not all people have the access to the token - so in this case it will be distributed directly from the UI

Niek commented 1 month ago

@XMCyber this is a good addition, but IMHO this should be optional. So comment OPENAI_API_KEY in .env and only if set, use that.

XMCyber commented 1 month ago

@Niek Make sense, I made the change accordingly - let me know if that is Ok now. Thanks!

Niek commented 1 month ago

Merged, thanks!

AurimasNav commented 2 weeks ago

hey, how do you exactly use this? I've added OPENAI_API_KEY to my container env, but the UI still asks to set OpenAI API key?

XMCyber commented 2 weeks ago

Please pull the latest version, there was a bug, the env should be named VITE_OPENAI_API_KEY (also in the code)

On Thu, Jun 13, 2024, 08:57 'Aurimas Navardauskas' via Devops < @.***> wrote:

hey, how do you exactly use this? I've added OPENAI_API_KEY to my container env, but the UI still asks to set OpenAI API key?

— Reply to this email directly, view it on GitHub https://github.com/Niek/chatgpt-web/pull/462#issuecomment-2164492445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOOM24WV34GFTPFPI56KZTLZHEYEPAVCNFSM6AAAAABIBRE5WWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRUGQ4TENBUGU . You are receiving this because you were mentioned.Message ID: @.***>

AurimasNav commented 2 weeks ago

Please pull the latest version, there was a bug, the env should be named VITE_OPENAI_TOKEN (also in the code) On Thu, Jun 13, 2024, 08:57 'Aurimas Navardauskas' via Devops < @.> wrote: hey, how do you exactly use this? I've added OPENAI_API_KEY to my container env, but the UI still asks to set OpenAI API key? — Reply to this email directly, view it on GitHub <#462 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOOM24WV34GFTPFPI56KZTLZHEYEPAVCNFSM6AAAAABIBRE5WWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRUGQ4TENBUGU . You are receiving this because you were mentioned.Message ID: @.>

thanks it works, for anyone else reading this it is actually VITE_OPENAI_API_KEY to save you some time :)