Giter VIP home page Giter VIP logo

chatgpt-wechat-bot's Introduction

ChatGPT-wechat-bot🤖

Version License: ISC

Get a WeChat robot 🤖 based on ChatGPT in a few step. 中文文档 | English

Support

  • Support conversation.
  • Can set keywords to reset the previous conversation.
  • Support replying message when mentioning your bot in the group.
  • Set the keywords to wake up the WeChat robot in the group.
  • Support Dockerfile to deploy.
  • Support set retry times when request ChatGPT.
  • Catch conversation error and retry.
  • Other

Default config

{
  // Fill up with session token
  chatGPTSessionToken: '',
  // Setting the number of retries when API error occurs
  retryTimes: 3,
  // Setting keyword to wake up in group chat
  groupKey: '',
  // Setting keyword to wake up in private chat
  privateKey: '',
  // Setting keyword to reset context
  resetKey: 'reset',
  // Enabling auto replies from ChatGPT
  autoReply: true,
  // Using regular expression to automatically pass friends verification
  friendShipRule: /chatgpt|chat/,
  // Using reply mode in group chat
  groupReplyMode: true,
  // Using reply mode in private chat
  privateReplyMode: false,
}

Use with docker

// build
docker build --pull --rm -f "Dockerfile" -t wechatbot:latest "."

// run, and then you will see some logs
docker run --name wechatbot wechatbot:latest

How to start?

  1. Firstly, you should have an OpenAI account, then follow the steps below to get your token.

    Refer to this article: transitive-bullshit/chatgpt-api.

To get a session token:

  • Go to chat.openai.com/chat and log in or sign up.
  • Open dev tools.
  • Open Application > Cookies. image.png
  • Copy the value for __Secure-next-auth.session-token and save it to your environment.
  1. Now, you should fill your Token value into the ChatGPTSessionToken in the directory src/config.js, then run this project on local.

    If necessary, configure other customization variables in src/config.js.

// install dependencies
npm i

// start:
// dev
npm run dev

//or
// build
npm run build
// run lib
node lib/bundle.esm.js
  1. you can see your logs, and scan qrcode to log in wechat.

    image.png

  2. Send a message to your WeChat and you will receive a reply from ChatGPT.

    image.pngimage.png

QA

  1. If your WeChat cannot log in Please check the root directory of your project, whether there is a file —— WechatEveryDay.memory-card, if so, please delete it and try it again.

  2. This package is ESM-only. It supports: Node.js >= 16.8

  3. how to get all response? you can say "continue".

image

  1. Error: Failed to launch the browser process puppeteer refer to https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
// ubuntu
sudo apt-get install chromium-browser
sudo apt-get install  ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils

👏🏻Contributions

Welcome to contribute your code and ideas🍵.

chatgpt-wechat-bot's People

Contributors

autumnwhj avatar soamiba avatar snapdragonlee avatar sumanpaikdev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.