feat(api): add support for user-provided OpenAI API key (#311)

- Add support for user-provided OpenAI API key by setting OPENAI_KEY to
  "user_provided" in .env.example
- Pass oaiApiKey to titleConvo function in titleConvo.js
- Pass oaiApiKey to askClient function in askOpenAI.js
- Modify openAI object in endpoints.js to include userProvide property
  based on whether OPENAI_KEY is set to "user_provided" or not.
This commit is contained in:
Danny Avila 2023-05-17 21:58:56 -04:00 committed by GitHub
parent 61a4231feb
commit 26152d7e5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View file

@ -24,7 +24,8 @@ MONGO_URI=mongodb://127.0.0.1:27017/chatgpt-clone
##########################
# Access key from OpenAI platform.
# Leave it blank to disable this feature.
# Leave it blank to disable this feature.
# Set to "user_provided" to allow the user to provide their API key from the UI.
OPENAI_KEY=
# Identify the available models, separated by commas *without spaces*.