banner
JackYoung

JackYoung

生活、摄影、写作、代码。
github
bilibili
email

Pandora Localization GPT

Share a recently popular project on Github, although the principle is relatively simple, it is very useful!

Pandora#

This project implements the web version of ChatGPT by using API forwarding, which can be considered as a workaround.

Installation - Local Python Version#

Follow the author's recommendation to install the Python environment first. It is recommended to use conda to create a new environment.
conda create -n gpt python=3.7
Next, you can install this project. This project has two modes, one is command line and the other is web-based.

conda activate gpt
pip install pandora  # This is for the command line mode
pip install pandora-cloud # This is for the web version

Get Token#

This project achieves local deployment by using the login token of a registered account on the web. (Of course, API can also be used, but for the situation where credit cards in China cannot be used, this method is temporarily better.)
Use the service set up by the author here to obtain the token for your own account (first log in to your official account, and then visit here to obtain your own access token). Save your own token, which can be used for one month, reportedly.

Start#

Go back to the command line

pandora -t <token_file> # Start the local command line version of chatGPT, press Enter to send a message
pandora-cloud # Start the web version, visit http://127.0.0.1:8018, and log in with the token file

Installation - Docker Version#

I have only successfully used the command line version of the Docker version so far.

docker pull pengzhile/pandora
docker run -it -e PANDORA_ACCESS_TOKEN="token" -name pandora pengzhile/pandora

If you suspect that the author's proxy API is banned on your local machine#

Use Cloudflare for proxy.

  • Log in to Cloudflare
  • Go to Workers and click Create a Worker
  • Paste the following code into the new interface
export default {
  async fetch(request, env) {
    const url = new URL(request.url);
    url.host = 'ai.fakeopen.com';
    return fetch(new Request(url, request))
  }
}
  • Click Save and deploy
  • Then, when creating with Docker, you can use the following parameters:
docker run -it -e PANDORA_ACCESS_TOKEN="token" -e CHATGPT_API_PREFIX="https://your.worker.address" -name pandora pengzhile/pandora

It may be a problem with my Mac. When creating a web version service using Docker, I always can't connect to the container internally. If there are any solutions, please let me know.

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.