xqdoo00o / chatgpt-web

Pure Javascript ChatGPT demo based on OpenAI API
https://xqdoo00o.github.io/chatgpt-web/
MIT License
983 stars 369 forks source link

Separate .env variables #98

Closed mxrk314 closed 1 year ago

mxrk314 commented 1 year ago

Hi bro, is it possible to make a separate .env variables for the apiEndpoint and apiKey values? so that you wont need to include these into the index.html?

I am planning to get rid of the placeholders for endpoint and key, and add my pre-configured setup, but i dont want to expose my key and endpoint in the html

anyway, tnx for your new update!

xqdoo00o commented 1 year ago

Added, add a new file env.js under the same directory of index.html, example

envAPIEndpoint="https://api.openai.com/"
envAPIKey="sk-your-token"
mxrk314 commented 1 year ago

ill try, thank you so much bro

Nriver commented 1 year ago

Cool!

mxrk314 commented 1 year ago

hello bro, the env.js works, the thing is it still exposes your endpoint and key when check in the browser'sw developers option, see image !(https://memos.renj.dev/o/r/1/427657b8-ef92-4ce5-9289-fc73f9b5b6a9/IMG_20230718_153411.jpg)

Nriver commented 1 year ago

That is inevatable.

xqdoo00o commented 1 year ago

hello bro, the env.js works, the thing is it still exposes your endpoint and key when check in the browser'sw developers option, see image !(https://memos.renj.dev/o/r/1/427657b8-ef92-4ce5-9289-fc73f9b5b6a9/IMG_20230718_153411.jpg)

yeah, you can't hide http request endpoint and parameter in web browser. Actually everything is debuggable in web browser. so use https, then you can get rid of MITM at least.

mxrk314 commented 1 year ago

ill close this one now, thank you for this update sir/bro..