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.

Tokens
19K
Snippets
133
Records
175
Agent score
44%

What's inside chatgpt-plugin

  1. Overview of ChatGPT-Plugin for Yunzai-Bot

    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.
  2. 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.
  3. Deploy ChatGPT API reverse proxy using a single Docker container

    For a quick setup, you can run the node-chatgpt-proxy image 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-proxy
  4. Obtain a ChatGPT AccessToken from OpenAI

    To use ChatGPT features, you must have a valid, non-banned OpenAI account. To retrieve your AccessToken:

    1. Log in to your account at https://chat.openai.com/chat in a web browser.
    2. While logged in, navigate to https://chat.openai.com/api/auth/session.
    3. The page will display a JSON object. Locate the value associated with the accessToken key; this string is your ChatGPT AccessToken.
    {
      "user": {
        "id": "AAA",
        "name": "BBB",
        "email": "CCC",
        "image": "DDD",
        "picture": "EEE",
        "groups": []
      },
      "expires": "FFF",
      "accessToken": "XXX"
    }
  5. 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.
  6. Launch the application via VNC client

    After starting the VNC server, connect using a VNC client. Once the cloud desktop is visible:

    1. Navigate to the Yunzai directory.
    2. Right-click and select Applications > Shells > Bash to open a terminal.
    3. Run the application using the command node app.
    node app
  7. Update chatgpt-plugin

    There are three ways to update the plugin:

    1. Release Update: Download the latest version from GitHub and replace the existing folder.
    2. Bot Command: Send #chatgpt更新 in the chat. The bot will update and restart automatically. (Ensure you have environment access in case of crashes).
    3. 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 pop
  8. Configure 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 clash
  9. 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, or 1024x1024. Default: 1 image at 512x512.

    # Basic usage:
    #chatgpt画图[prompt]
    
    # Advanced usage (prompt / count / size):
    #chatgpt画图[prompt]/3/512x512
  10. Configure 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设置必应token to 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.
  11. 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