mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
chore: update env example and add browser client config
This commit is contained in:
parent
719413f87a
commit
71b7eaa3f5
2 changed files with 27 additions and 4 deletions
|
|
@ -18,17 +18,33 @@ MONGO_URI="mongodb://127.0.0.1:27017/chatgpt-clone"
|
||||||
# API key configuration.
|
# API key configuration.
|
||||||
# Leave blank if you don't want them.
|
# Leave blank if you don't want them.
|
||||||
OPENAI_KEY=
|
OPENAI_KEY=
|
||||||
CHATGPT_TOKEN=
|
|
||||||
BING_TOKEN=
|
BING_TOKEN=
|
||||||
|
|
||||||
|
# ChatGPT Browser Client (free but use at your own risk)
|
||||||
|
# Access token from https://chat.openai.com/api/auth/session
|
||||||
|
# Exposes your access token to a 3rd party
|
||||||
|
CHATGPT_TOKEN=
|
||||||
|
# If you have access to other models on the official site, you can use them here.
|
||||||
|
# Defaults to 'text-davinci-002-render-sha' if left empty.
|
||||||
|
# options: gpt-4, text-davinci-002-render, text-davinci-002-render-paid, or text-davinci-002-render-sha
|
||||||
|
# You cannot use a model that your account does not have access to. You can check
|
||||||
|
# which ones you have access to by opening DevTools and going to the Network tab.
|
||||||
|
# Refresh the page and look at the response body for https://chat.openai.com/backend-api/models.
|
||||||
|
BROWSER_MODEL=
|
||||||
|
|
||||||
# Enable Message/Convo Search
|
# Enable Message/Convo Search
|
||||||
# Requires installation of self-hosted Meilisearch or Paid Remote Plan
|
# Requires installation of free self-hosted Meilisearch or Paid Remote Plan (Remote not tested)
|
||||||
# this is taken care of you if you use the docker-compose file.
|
# The easiest setup for this is through docker-compose, which takes care of it for you.
|
||||||
# SEARCH=TRUE
|
# SEARCH=TRUE
|
||||||
SEARCH=
|
SEARCH=
|
||||||
|
# REQUIRED FOR SEARCH: MeiliSearch Host, mainly for api server to connect to the search server.
|
||||||
MEILI_HOST='http://0.0.0.0:7700'
|
MEILI_HOST='http://0.0.0.0:7700'
|
||||||
|
# REQUIRED FOR SEARCH: MeiliSearch HTTP Address, mainly for docker-compose to expose the search server.
|
||||||
MEILI_HTTP_ADDR='0.0.0.0:7700'
|
MEILI_HTTP_ADDR='0.0.0.0:7700'
|
||||||
# needs a secure key, feel free to generate your own.
|
# REQUIRED FOR SEARCH: needs a secure key, feel free to generate your own.
|
||||||
|
# This master key must be at least 16 bytes, composed of valid UTF-8 characters.
|
||||||
|
# Meilisearch will throw an error and refuse to launch if no master key is provided or if it is under 16 bytes,
|
||||||
|
# Meilisearch will suggest a secure autogenerated master key.
|
||||||
MEILI_MASTER_KEY=WjRvKvpelIYHa4dlcDGsdT9c0CKRbY-4VcuCQ1iZPcc
|
MEILI_MASTER_KEY=WjRvKvpelIYHa4dlcDGsdT9c0CKRbY-4VcuCQ1iZPcc
|
||||||
|
|
||||||
# User System
|
# User System
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const { KeyvFile } = require('keyv-file');
|
const { KeyvFile } = require('keyv-file');
|
||||||
|
const set = new Set(["gpt-4", "text-davinci-002-render", "text-davinci-002-render-paid", "text-davinci-002-render-sha"]);
|
||||||
|
|
||||||
const clientOptions = {
|
const clientOptions = {
|
||||||
// Warning: This will expose your access token to a third party. Consider the risks before using this.
|
// Warning: This will expose your access token to a third party. Consider the risks before using this.
|
||||||
|
|
@ -10,6 +11,12 @@ const clientOptions = {
|
||||||
proxy: process.env.PROXY || null,
|
proxy: process.env.PROXY || null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// You can check which models you have access to by opening DevTools and going to the Network tab.
|
||||||
|
// Refresh the page and look at the response body for https://chat.openai.com/backend-api/models.
|
||||||
|
if (set.has(process.env.BROWSER_MODEL)) {
|
||||||
|
clientOptions.model = process.env.BROWSER_MODEL;
|
||||||
|
}
|
||||||
|
|
||||||
const browserClient = async ({ text, onProgress, convo, abortController }) => {
|
const browserClient = async ({ text, onProgress, convo, abortController }) => {
|
||||||
const { ChatGPTBrowserClient } = await import('@waylaidwanderer/chatgpt-api');
|
const { ChatGPTBrowserClient } = await import('@waylaidwanderer/chatgpt-api');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue