2023-12-22 08:36:42 -05:00
---
title: 📦 PandoraNext
2023-12-28 17:10:06 -05:00
description: How to deploy PandoraNext to enable the `CHATGPT_REVERSE_PROXY` for use with LibreChat.
🔥🚀 feat: CDN (Firebase) & feat: account section (#1438)
* localization + api-endpoint
* docs: added firebase documentation
* chore: icons
* chore: SettingsTabs
* feat: account pannel; fix: gear icons
* docs: position update
* feat: firebase
* feat: plugin support
* route
* fixed bugs with firebase and moved a lot of files
* chore(DALLE3): using UUID v4
* feat: support for social strategies; moved '/images' path
* fix: data ignored
* gitignore update
* docs: update firebase guide
* refactor: Firebase
- use singleton pattern for firebase initialization, initially on server start
- reorganize imports, move firebase specific files to own service under Files
- rename modules to remove 'avatar' redundancy
- fix imports based on changes
* ci(DALLE/DALLE3): fix tests to use logger and new expected outputs, add firebase tests
* refactor(loadToolWithAuth): pass userId to tool as field
* feat(images/parse): feat: Add URL Image Basename Extraction
Implement a new module to extract the basename of an image from a given URL. This addition includes the function, which parses the URL and retrieves the basename using the Node.js 'url' and 'path' modules. The function is documented with JSDoc comments for better maintainability and understanding. This feature enhances the application's ability to handle and process image URLs efficiently.
* refactor(addImages): function to use a more specific regular expression for observedImagePath based on the generated image markdown standard across the app
* refactor(DALLE/DALLE3): utilize `getImageBasename` and `this.userId`; fix: pass correct image path to firebase url helper
* fix(addImages): make more general to match any image markdown descriptor
* fix(parse/getImageBasename): test result of this function for an actual image basename
* ci(DALLE3): mock getImageBasename
* refactor(AuthContext): use Recoil atom state for user
* feat: useUploadAvatarMutation, react-query hook for avatar upload
* fix(Toast): stack z-order of Toast over all components (1000)
* refactor(showToast): add optional status field to avoid importing NotificationSeverity on each use of the function
* refactor(routes/avatar): remove unnecessary get route, get userId from req.user.id, require auth on POST request
* chore(uploadAvatar): TODO: remove direct use of Model, `User`
* fix(client): fix Spinner imports
* refactor(Avatar): use react-query hook, Toast, remove unnecessary states, add optimistic UI to upload
* fix(avatar/localStrategy): correctly save local profile picture and cache bust for immediate rendering; fix: firebase init info message (only show once)
* fix: use `includes` instead of `endsWith` for checking manual query of avatar image path in case more queries are appended (as is done in avatar/localStrategy)
---------
Co-authored-by: Danny Avila <messagedaniel@protonmail.com>
2023-12-30 03:42:19 +01:00
weight: -3
2023-12-22 08:36:42 -05:00
---
2023-12-06 06:57:10 -05:00
# PandoraNext Deployment Guide
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.
2023-12-07 22:44:26 -05:00
> Using this method you will only be able to use `text-davinci-002-render-sha` with PandoraNext in LibreChat. Other models offered with the `plus` subscription do not work.
2023-12-06 06:57:10 -05:00
You can use it locally in docker or deploy it onthe web for remote access.
2023-12-22 08:36:42 -05:00
---
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
## Deploy Locally Using Docker
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
For local deployment using Docker, the steps are as follows:
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
### 1. **Clone or Download the Repository:**
2023-12-28 17:10:06 -05:00
Get the latest release from the [PandoraNext GitHub repository ](https://github.com/pandora-next/deploy ).
2023-12-06 06:57:10 -05:00
2023-12-28 17:10:06 -05:00
```bash
git clone https://github.com/pandora-next/deploy.git
```
2023-12-06 06:57:10 -05:00
2023-12-28 17:10:06 -05:00
### 2. Get your PandoraNext `License ID`
Visit the ** [PandoraNext Dashboard ](https://dash.pandoranext.com/ )** to get your `license ID`
2023-12-22 08:36:42 -05:00
### 3. **Configure `config.json`:**
2023-12-28 17:10:06 -05:00
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.
Here's the `config.json` for your reference:
```json
{
"bind": "0.0.0.0:8181",
"tls": {
"enabled": false,
"cert_file": "",
"key_file": ""
},
"timeout": 600,
"proxy_url": "",
"license_id": "",
"public_share": false,
"site_password": "",
"setup_password": "",
"server_tokens": true,
"proxy_api_prefix": "",
"isolated_conv_title": "*",
"captcha": {
"provider": "",
"site_key": "",
"site_secret": "",
"site_login": false,
"setup_login": false,
"oai_username": false,
"oai_password": false
},
"whitelist": null
}
```
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
### 4. **Set Up the LibreChat `.env` Filer:**
2023-12-28 17:10:06 -05:00
In the `.env` file within your LibreChat directory, you'll need to set the `CHATGPT_REVERSE_PROXY` variable:
2023-12-06 06:57:10 -05:00
2023-12-28 17:10:06 -05:00
```bash
CHATGPT_REVERSE_PROXY=http://host.docker.internal:8181/your_proxy_api_prefix_here/backend-api/conversation
```
- Replace `your_proxy_api_prefix_here` with the actual proxy API prefix.
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
### 5. **Start Docker Containers:**
2023-12-28 17:10:06 -05:00
From the PandoraNext directory, run the following command to launch the Docker containers:
2023-12-06 06:57:10 -05:00
2023-12-28 17:10:06 -05:00
```bash
docker-compose up -d
```
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
---
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
## Deploy Online on Hugging Face
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
To deploy PandoraNext online by duplicating the Hugging Face Space, follow these steps:
2023-12-06 06:57:10 -05:00
2023-12-28 17:10:06 -05:00
### 1. Get your PandoraNext `License ID`
Visit the ** [PandoraNext Dashboard ](https://dash.pandoranext.com/ )** to get your `license ID`
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
### 2. **Configure `config.json`:**
2023-12-28 17:10:06 -05:00
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.
Here's the `config.json` for your reference:
```json
{
"bind": "0.0.0.0:8181",
"tls": {
"enabled": false,
"cert_file": "",
"key_file": ""
},
"timeout": 600,
"proxy_url": "",
"license_id": "",
"public_share": false,
"site_password": "",
"setup_password": "",
"server_tokens": true,
"proxy_api_prefix": "",
"isolated_conv_title": "*",
"captcha": {
"provider": "",
"site_key": "",
"site_secret": "",
"site_login": false,
"setup_login": false,
"oai_username": false,
"oai_password": false
},
"whitelist": null
}
```
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
### 3. **Hugging Face Space:**
2023-12-28 17:10:06 -05:00
Visit the [PandoraNext LibreChat Space ](https://huggingface.co/spaces/LibreChat/PandoraNext ) on Hugging Face.
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
### 4. **Duplicate the Space:**
2023-12-28 17:10:06 -05:00
Utilize the available options to duplicate or fork the space into your own Hugging Face account.
2023-12-06 06:57:10 -05:00
2023-12-22 08:36:42 -05:00
### 5. **Fill the required secrets**
2023-12-28 17:10:06 -05:00
When asked for the `SECRETS` ,
- for `CONFIG_JSON` use the whole content of the `config.json` you just modified,
- for `TOKENS_JSON` use the following default `token.json` :
```json
{
"test-1": {
"token": "access token / session token / refresh token",
"shared": true,
"show_user_info": false
},
"test-2": {
"token": "access token / session token / refresh token",
"shared": true,
"show_user_info": true,
"plus": true
},
"test2": {
"token": "access token / session token / refresh token / share token",
"password": "12345"
2023-12-22 08:36:42 -05:00
}
2023-12-28 17:10:06 -05:00
}
```
2023-12-22 08:36:42 -05:00
### 6. **Configure LibreChat:**
2023-12-28 17:10:06 -05:00
In the .env file (or secrets settings if you host LibreChat on Hugging Face), set the `CHATGPT_REVERSE_PROXY` variable using the following format:
2023-12-06 06:57:10 -05:00
2023-12-28 17:10:06 -05:00
```bash
CHATGPT_REVERSE_PROXY=http://your_server_domain.com/your_proxy_api_prefix_here/backend-api/conversation
```
2023-12-06 06:57:10 -05:00
2023-12-28 17:10:06 -05:00
- Replace `your_server_domain.com` with the domain of your deployed space.
- you can use this format: `https://username-pandoranext.hf.space` (replace `username` with your Huggingface username)
- Replace `your_proxy_api_prefix_here` with the `proxy_api_prefix` you have set in your `config.json` .
- The resulting URL should look similar to:
`https://username-pandoranext.hf.space/your_proxy_api_prefix_here/backend-api/conversation`
2023-12-22 08:36:42 -05:00
2023-12-06 06:57:10 -05:00
## Final Notes
- The `proxy_api_prefix` should be sufficiently random and unique to prevent errors.
2023-12-07 22:44:26 -05:00
- The default `token.json` doesn't need to be modified to use with LibreChat
2023-12-06 06:57:10 -05:00
- Ensure you have obtained a license ID from the [PandoraNext Dashboard ](https://dash.pandoranext.com/ ).