Introduction#
In the hustle and bustle of life and bricklaying, the ChatGPT official website often goes offline. Fortunately, both locations have OpenWrt routers, so I deployed ChatGPT on the routers. The gateways in both locations are 192.168.2.1, and I added ChatGPT on the router to Google Chrome bookmarks, allowing quick access from both locations.
Project#
This time, I used Pandora, an open-source project that implements a web version of ChatGPT using an Access Token. It has backend optimization, bypasses Cloudflare, and has impressive speed.
Project | Address |
---|---|
Pandora | https://github.com/pengzhile/pandora |
Access Token | http://chat.openai.com/api/auth/session |
The Access Token is valid for 14 days, and during this period, no VPN is required for access.
Deployment#
Install Docker#
Open the OpenWrt firmware I'm using, which can be found at https://supes.top/. Go to "System" - "Software" and click on "Update lists".
After the update, install the following:
- luci-lib-jsonc
- luci-lib-docker
- luci-app-dockerman
Once installed, Docker can be found in the left column.
The following operations are recommended to be completed via SSH, as Docker on OpenWrt is difficult to use!
Connect to the OpenWrt gateway 192.168.2.1 using an SSH tool. The username and password are the same as the ones for OpenWrt. Recommended tool: electerm
Pull the image#
docker pull pengzhile/pandora
Run the image#
docker run -e PANDORA_CLOUD=cloud -e PANDORA_SERVER=0.0.0.0:8899 -p 8899:8899 -d pengzhile/pandora
For more Docker environment variables, please refer to: pandora environment variables
Get the Access Token#
-
Log in to the official website and then visit here to obtain the Access Token, which is valid for 14 days.
-
Alternatively, you can directly use your OpenAI account to log in.
Open http://gateway:8899/
I use theAccess Token
Done! Using the cloud mode is no different from the ChatGPT official website. Chat logs are synchronized and the experience is stable and efficient.
Set up auto-start (optional)#
-
Use the
/etc/rc.local
file to execute custom startup scripts. -
Find the
/etc/rc.local
file. -
Add the following content to the end of the file:
#!/bin/sh
/etc/init.d/dockerd restart # Restart Docker service
sleep 10 # Wait for 10 seconds to ensure Docker service has started
docker start my_container # Start Docker container
Replace docker start my_container
with the container ID in the OpenWrt Docker, for example, mine is 3c3ab7807401
.
docker start 3c3ab7807401
- Save and close the file.
Grant execution permission to the /etc/rc.local
file:
chmod +x /etc/rc.local