cogentapps / chat-with-gpt

An open-source ChatGPT app with a voice
https://www.chatwithgpt.ai
MIT License
2.3k stars 493 forks source link

store API keys in account settings, not cookie #77

Closed occasionallydavid closed 1 year ago

occasionallydavid commented 1 year ago

I lose my API keys every time I close my tab (self-destructing cookies). I'd like to setup some accounts for family that are preconfigured. Would it be possible to move API keys into backend storage rather than cookie

jordon31 commented 1 year ago

need to create an .env file for both APIs for this

i hope he adds it

occasionallydavid commented 1 year ago

It's a really nice project, a little shame it requires a tech user to set it up though :/

I think conversation history is also somehow related to session? I can see chats in SQLite, but the left tab does not populate with my old chats after login either

Frajder commented 1 year ago

Storing the API key in a .env file is not a good idea since the app supports multiple users.

iloahz commented 1 year ago

my use case is family sharing too, adding api key every time is not convenience and even a blocker for non-tech users, I just want to setup a out-of-the-box chatgpt that everyone in the family can instantly explore, even if it compromises the multi-user feature

GOvEy1nw commented 1 year ago

Yes I agree, an option to support multiple users (login) using the same API key would be great.

occasionallydavid commented 1 year ago

just FYI https://github.com/mckaywrigley/chatbot-ui allows setting the key in the backend. Only "problem" is it's a next.js app that seems to think it's okay to send 1MB of JS and fonts to the client for such a simple app, and streaming doesn't seem to work properly in Firefox (but it's fine in Chrome derivs)

SimonMacIntyre commented 1 year ago

In my case, as an exclusive local docker use only, it would be ideal to bootstrap the container with my API key. It won't have other users, ever.

Maybe if an env variable is present it can be automatically set?

In the same vein, I'd love to preset the model to use 4, but thats far less important. Bootstrapping the api key is crucial, its so tedious for docker users.

Storing the API key in a .env file is not a good idea since the app supports multiple users.

This is a deployment concern, the app does not need to be used with multiple users. That is a feature of the app, in fact one I didn't even use when I evaluated the web hosted deployment. In deployments you simply don't set the api token env variable and use the stock setup which uses cookies or whatnot.

Re-using the account feature, to bootstrap with an api key as well would work.

I think this github project which is of course deployed, makes sense, but imo there should be a way to use it as a local user for personal use.

I like booting it up ephemerally with fresh empty history for example, and don't want to have to leave it up 24/7 just to avoid having to re-add my api key every single time.

cogentapps commented 1 year ago

Added for self-hosters:

https://github.com/cogentapps/chat-with-gpt#store-your-api-keys-on-the-server