chatgpt-plugin Documentation
website·Indexed 31 days ago
https://chatgpt-docs.err0r.top/Documentation for chatgpt-plugin, an intelligent chat plugin based on Yunzai-Bot. It supports integration with OpenAI ChatGPT, Microsoft New Bing API, and ChatGLM. The guide covers installation via Docker, configuration of API keys and AccessTokens, reverse proxy setup for API3, and management of conversation queues, reply modes (text, image, voice), and custom character settings.
What's inside chatgpt-plugin
- ChatGPT-Plugin is a powerful plugin developed for the Yunzai-Bot framework. It enables intelligent chat functionality by integrating with OpenAI's ChatGPT (Browser or API), Microsoft's New Bing API, or self-hosted ChatGLM. Users must provide their own OpenAI account or a Bing account with New Bing access.
Use custom personas to personalize AI interactions
Custom settings (personas) allow the AI to simulate specific characters, engage in roleplay, or act as a specific companion (e.g., a partner). This personalization helps the AI better align with user needs and specific interaction styles. For users of Bing/Sydney, using 'Custom' settings is recommended to reinforce specific requirements through repetitive prompting (often referred to as 'brainwashing' in the community) to ensure the AI adheres strictly to the desired persona.Deploy ChatGPT API reverse proxy using a single Docker container
For a quick setup, you can run thenode-chatgpt-proxyimage directly. This requires a server with at least 1GB of RAM located in a region where ChatGPT is accessible.# Start the container docker run -d -p [PORT]:3000 --name node-chatgpt-proxy --shm-size=1gb geyinchi/node-chatgpt-proxy # View logs docker exec -it node-chatgpt-proxy tail -100f /var/log/node-chatgpt-proxy.log # Update the container docker pull geyinchi/node-chatgpt-proxy && \ docker stop node-chatgpt-proxy && \ docker rm node-chatgpt-proxy && \ docker run -d -p [PORT]:3000 --name node-chatgpt-proxy --shm-size=1gb geyinchi/node-chatgpt-proxyObtain a ChatGPT AccessToken from OpenAI
To use ChatGPT features, you must have a valid, non-banned OpenAI account. To retrieve your AccessToken:
- Log in to your account at
https://chat.openai.com/chatin a web browser. - While logged in, navigate to
https://chat.openai.com/api/auth/session. - The page will display a JSON object. Locate the value associated with the
accessTokenkey; this string is your ChatGPT AccessToken.
{ "user": { "id": "AAA", "name": "BBB", "email": "CCC", "image": "DDD", "picture": "EEE", "groups": [] }, "expires": "FFF", "accessToken": "XXX" }- Log in to your account at
Manage Question Confirmation for bot response tracking
The Question Confirmation feature allows users to monitor the bot's response status, understand the current response queue, and diagnose potential network or bot-related issues. When enabled, the bot sends a temporary reply indicating it is thinking and provides the number of pending questions in the queue before eventually withdrawing that notification message.Launch the application via VNC client
After starting the VNC server, connect using a VNC client. Once the cloud desktop is visible:
- Navigate to the Yunzai directory.
- Right-click and select Applications > Shells > Bash to open a terminal.
- Run the application using the command
node app.
node appUpdate chatgpt-plugin
There are three ways to update the plugin:
- Release Update: Download the latest version from GitHub and replace the existing folder.
- Bot Command: Send
#chatgpt更新in the chat. The bot will update and restart automatically. (Ensure you have environment access in case of crashes). - Source Code Update: Use git to stash local changes, pull the latest code, and restore changes.
# Source code update method git stash -p # (Interact with y/n to save specific changes, e.g., config/config.js) git pull git stash popConfigure Clash proxy on host machine
Set up Clash on the host machine to provide network proxying for the bot. This involves installing the binary, configuring the MMDB database for IP geolocation, and setting up a systemd service for persistence.# Download and install Clash wget -O clash.gz https://github.com/Dreamacro/clash/releases/download/v1.13.0/clash-linux-amd64-v1.13.0.gz gzip -dc clash.gz > /usr/local/bin/clash chmod +x /usr/local/bin/clash # Setup config directory and MMDB mkdir /etc/clash wget -O /etc/clash/Country.mmdb https://www.sub-speeder.com/client-download/Country.mmdb # Create systemd service sudo echo "[Unit] Description=clash daemon [Service] Type=simple User=root ExecStart=/usr/local/bin/clash -d /etc/clash/ Restart=on-failure [Install] WantedBy=multi-user.target" > /etc/systemd/system/clash.service # Start and enable sudo systemctl daemon-reload systemctl start clash systemctl enable clashObtain an OpenAI API Key
To use the plugin with OpenAI, you need an API key. You can create a new secret key in the OpenAI account dashboard at https://platform.openai.com/account/api-keys. If you do not have an account, you must register at https://chat.openai.com/ using an IP address from a supported country/region.Generate images using the #chatgpt画图 command
Generate images by sending the
#chatgpt画图command followed by a prompt. You can optionally specify the number of images and the image dimensions. This feature requires a valid OpenAI Dalle API Key and consumes account balance.Supported image sizes:
256x256,512x512, or1024x1024. Default: 1 image at512x512.# Basic usage: #chatgpt画图[prompt] # Advanced usage (prompt / count / size): #chatgpt画图[prompt]/3/512x512Configure Bing Token via bot command
To enable Bing mode, you must have access to New Bing and provide a Bing token. This is configured by sending the command
#chatgpt设置必应tokento the bot.How to retrieve the token:
- Method 1 (JavaScript): Log in to www.bing.com, open the browser console (F12), and run the following code to copy the token to your clipboard:
copy(document.cookie.split(";").find(cookie=>cookie.trim().startsWith("_U=")).split("=")[1]);- Method 2 (Manual): Log in to www.bing.com, open Developer Tools (F12) -> Application -> Cookies -> https://www.bing.com. Find the cookie named
_U; its value is the Bing token.
Install chatgpt-plugin using git
To install the chatgpt-plugin in Yunzai-Bot, navigate to the Yunzai root directory and clone the repository into the plugins folder. Use pnpm to install local dependencies.# Navigate to Yunzai root (Example for Linux) cd ~/Yunzai-Bot/ # Clone the plugin git clone --depth=1 https://github.com/ikechan8370/chatgpt-plugin.git ./plugins/chatgpt-plugin/ # Install dependencies cd plugins/chatgpt-plugin pnpm i # If pnpm is not installed, run: npm install -g pnpm