Skip to content

Commit 9e96a9b

Browse files
fuegovicshortpoet
authored andcommitted
doc: PandoraNext guide (danny-avila#1276)
1 parent 95c73b1 commit 9e96a9b

File tree

6 files changed

+174
-9
lines changed

6 files changed

+174
-9
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ BINGAI_TOKEN=user_provided
166166
#============#
167167

168168
CHATGPT_TOKEN=
169-
CHATGPT_MODELS=text-davinci-002-render-sha,gpt-4
169+
CHATGPT_MODELS=text-davinci-002-render-sha
170170
# CHATGPT_REVERSE_PROXY=<YOUR REVERSE PROXY>
171171

172172
#============#

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ Keep up with the latest updates by visiting the releases page - [Releases](https
107107

108108

109109
* [Automated Moderation](docs/features/mod_system.md)
110+
* [Token Usage](docs/features/token_usage.md)
111+
* [Manage Your Database](docs/features/manage_your_database.md)
112+
* [PandoraNext Deployment Guide](docs/features/pandoranext.md)
110113
* [Third-Party Tools](docs/features/third_party.md)
111114
* [Proxy](docs/features/proxy.md)
112115
* [Bing Jailbreak](docs/features/bing_jailbreak.md)
113-
* [Token Usage](docs/features/token_usage.md)
114-
* [Manage Your Database](docs/features/manage_your_database.md)
116+
115117
</details>
116118

117119
<details>

docs/features/pandoranext.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# PandoraNext Deployment Guide
2+
3+
If you're looking to use the `ChatGPT` Endpoint in LibreChat, setting up a reverse proxy is a essential. PandoraNext offers a robust solution for this purpose. This guide will walk you through deploying PandoraNext to enable the `CHATGPT_REVERSE_PROXY` for use with LibreChat.
4+
5+
> Using this method you will only be able to use `text-davinci-002-render-sha` with PandoraNext in LibreChat. Other models offer with the `plus` subscription do not work.
6+
7+
You can use it locally in docker or deploy it onthe web for remote access.
8+
9+
## Deploy Online by Duplicating Hugging Face Space
10+
11+
To deploy PandoraNext online by duplicating the Hugging Face Space, follow these steps:
12+
13+
1. Get your PandoraNext license id here: [PandoraNext Dashboard](https://dash.pandoranext.com/)
14+
15+
2. **Configure `config.json`:**
16+
Edit the following `config.json`. Specify your `license_id` and `proxy_api_prefix`. For the `proxy_api_prefix`, use at least 8 characters, avoid characters that can't be used in a URL and make sure it's unique.
17+
18+
Here's the `config.json` for your reference:
19+
20+
```json
21+
{
22+
"bind": "0.0.0.0:8181",
23+
"tls": {
24+
"enabled": false,
25+
"cert_file": "",
26+
"key_file": ""
27+
},
28+
"timeout": 600,
29+
"proxy_url": "",
30+
"license_id": "",
31+
"public_share": false,
32+
"site_password": "",
33+
"setup_password": "",
34+
"server_tokens": true,
35+
"proxy_api_prefix": "",
36+
"isolated_conv_title": "*",
37+
"captcha": {
38+
"provider": "",
39+
"site_key": "",
40+
"site_secret": "",
41+
"site_login": false,
42+
"setup_login": false,
43+
"oai_username": false,
44+
"oai_password": false
45+
},
46+
"whitelist": null
47+
}
48+
```
49+
50+
3. **Hugging Face Space:**
51+
Visit the [PandoraNext LibreChat Space](https://huggingface.co/spaces/LibreChat/PandoraNext) on Hugging Face.
52+
53+
4. **Duplicate the Space:**
54+
Utilize the available options to duplicate or fork the space into your own Hugging Face account.
55+
56+
5. **Fill the required secrets**
57+
When asked for the `SECRETS`,
58+
- for `CONFIG_JSON` use the whole content of the `config.json` you just modified,
59+
- for `TOKENS_JSON` use the following default `token.json`:
60+
```json
61+
{
62+
"test-1": {
63+
"token": "access token / session token / refresh token",
64+
"shared": true,
65+
"show_user_info": false
66+
},
67+
"test-2": {
68+
"token": "access token / session token / refresh token",
69+
"shared": true,
70+
"show_user_info": true,
71+
"plus": true
72+
},
73+
"test2": {
74+
"token": "access token / session token / refresh token / share token",
75+
"password": "12345"
76+
}
77+
}
78+
```
79+
6. **Configure LibreChat:**
80+
In the .env file (or secrets settings if you host LibreChat on Hugging Face), set the `CHATGPT_REVERSE_PROXY` variable using the following format:
81+
82+
```bash
83+
CHATGPT_REVERSE_PROXY=http://your_server_domain.com/your_proxy_api_prefix_here/backend-api/conversation
84+
```
85+
86+
- Replace `your_server_domain.com` with the domain of your deployed space.
87+
- you can use this format: `https://username-pandoranext.hf.space` (replace `username` with your Huggingface username)
88+
- Replace `your_proxy_api_prefix_here` with the `proxy_api_prefix` you have set in your `config.json`.
89+
- The resulting URL should look similar to:
90+
`https://username-pandoranext.hf.space/your_proxy_api_prefix_here/backend-api/conversation`
91+
92+
## Deploy Locally Using Docker
93+
94+
For local deployment using Docker, the steps are as follows:
95+
96+
1. **Clone or Download the Repository:**
97+
Get the latest release from the [PandoraNext GitHub repository](https://github.com/pandora-next/deploy).
98+
99+
```bash
100+
git clone https://github.com/pandora-next/deploy.git
101+
```
102+
103+
2. Get your PandoraNext license id here: [PandoraNext Dashboard](https://dash.pandoranext.com/)
104+
105+
3. **Configure `config.json`:**
106+
Within the cloned repository, in the `data` folder, edit `config.json`. Specify your `license_id` and `proxy_api_prefix`. For the `proxy_api_prefix`, use at least 8 characters, avoid characters that can't be used in a URL and make sure it's unique.
107+
108+
Here's the `config.json` for your reference:
109+
110+
```json
111+
{
112+
"bind": "0.0.0.0:8181",
113+
"tls": {
114+
"enabled": false,
115+
"cert_file": "",
116+
"key_file": ""
117+
},
118+
"timeout": 600,
119+
"proxy_url": "",
120+
"license_id": "",
121+
"public_share": false,
122+
"site_password": "",
123+
"setup_password": "",
124+
"server_tokens": true,
125+
"proxy_api_prefix": "",
126+
"isolated_conv_title": "*",
127+
"captcha": {
128+
"provider": "",
129+
"site_key": "",
130+
"site_secret": "",
131+
"site_login": false,
132+
"setup_login": false,
133+
"oai_username": false,
134+
"oai_password": false
135+
},
136+
"whitelist": null
137+
}
138+
```
139+
140+
4. **Set Up the LibreChat `.env` Filer:**
141+
In the `.env` file within your LibreChat directory, you'll need to set the `CHATGPT_REVERSE_PROXY` variable:
142+
143+
```bash
144+
CHATGPT_REVERSE_PROXY=http://host.docker.internal:8181/your_proxy_api_prefix_here/backend-api/conversation
145+
```
146+
- Replace `your_proxy_api_prefix_here` with the actual proxy API prefix.
147+
148+
4. **Start Docker Containers:**
149+
From the PandoraNext directory, run the following command to launch the Docker containers:
150+
151+
```bash
152+
docker-compose up -d
153+
```
154+
155+
## Final Notes
156+
157+
- The `proxy_api_prefix` should be sufficiently random and unique to prevent errors.
158+
- Ensure you have obtained a license ID from the [PandoraNext Dashboard](https://dash.pandoranext.com/).

docs/install/apis_and_tokens.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ To get your OpenAI API key, you need to:
1313

1414
## ChatGPT Free Access token
1515

16-
To get your Access token for ChatGPT 'Free Version', you need to:
16+
> Note that this is disabled by default and requires additional configuration to work.
17+
> See: [ChatGPT Reverse Proxy](../features/pandoranext.md)
18+
19+
To get your Access token for ChatGPT 'Web Version', you need to:
1720

1821
- Go to [https://chat.openai.com](https://chat.openai.com)
1922
- Create an account or log in with your existing one

docs/install/dotenv.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,22 @@ BINGAI_HOST=
148148
### ChatGPT
149149
see: [ChatGPT Free Access token](./apis_and_tokens.md#chatgpt-free-access-token)
150150

151-
> **Warning**: The default reverse proxy (based on [PandoraNext](https://github.com/pandora-next/deploy)) needs to be updated and is not working anymore. To use this endpoint you'll have to set up your own.
152-
> For more information: [https://github.com/waylaidwanderer/node-chatgpt-api#using-a-reverse-proxy](https://github.com/waylaidwanderer/node-chatgpt-api#using-a-reverse-proxy)
151+
> **Warning**: To use this endpoint you'll have to set up your own reverse proxy. Here is the installation guide to deploy your own (based on [PandoraNext](https://github.com/pandora-next/deploy)): **[PandoraNext Deployment Guide](../features/pandoranext.md)**
153152
154153
```bash
155154
CHATGPT_REVERSE_PROXY=<YOUR-REVERSE-PROXY>
156155
```
157156

158-
> Note: If you're a GPT plus user you can add gpt-4-plugins, gpt-4-code-interpreter, and gpt-4-browsing to the list above and use the models for these features; however, the view/display portion of these features are not supported, but you can use the underlying models, which have higher token context
157+
> ~~Note: If you're a GPT plus user you can add gpt-4, gpt-4-plugins, gpt-4-code-interpreter, and gpt-4-browsing to the list above and use the models for these features; however, the view/display portion of these features are not supported, but you can use the underlying models, which have higher token context~~
158+
> **Note:** The current method only works with `text-davinci-002-render-sha`
159159
160160
- Leave `CHATGPT_TOKEN=` blank to disable this endpoint
161161
- Set `CHATGPT_TOKEN=` to "user_provided" to allow users to provide their own API key from the WebUI
162+
- It is not recommended to provide your token in the `.env` file since it expires often and sharing it could get you banned.
162163

163164
```bash
164165
CHATGPT_TOKEN=
165-
CHATGPT_MODELS=text-davinci-002-render-sha,gpt-4
166+
CHATGPT_MODELS=text-davinci-002-render-sha
166167
```
167168

168169
### OpenAI

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ nav:
106106
- Make Your Own Plugin: 'features/plugins/make_your_own.md'
107107
- Using official ChatGPT Plugins: 'features/plugins/chatgpt_plugins_openapi.md'
108108
- Automated Moderation: 'features/mod_system.md'
109-
- Manage Your Database: 'features/manage_your_database.md'
110109
- Token Usage: 'features/token_usage.md'
110+
- Manage Your Database: 'features/manage_your_database.md'
111+
- PandoraNext Deployment Guide: 'features/pandoranext.md'
111112
- Third-Party Tools: 'features/third_party.md'
112113
- Proxy: 'features/proxy.md'
113114
- Bing Jailbreak: 'features/bing_jailbreak.md'

0 commit comments

Comments
 (0)