|
| 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/). |
0 commit comments