Git Product home page Git Product logo

wechat-bot's Introduction

Wechat Bot

一个 基于 OpenAI + Wechat 智能回复、支持上下文回复的微信机器人,可以用来帮助你自动回复微信消息。

准备

本地部署

仅支持window系统

  1. 安装Gitnodejs

  2. 支持的微信版本下载 WeChatSetup3.6.0.18.exe 并安装、登录。

  3. 下载 funtool_3.6.0.18-1.0.0015非注入版.exe 并运行 。

funtool_3.6.0.18-1.0.0015非注入版.exe

  1. 安装pm2方便进程守护
npm install pm2 -g
  1. 拉取项目并修改.env 文件
git clone https://github.com/x-dr/wechat-bot.git

#国内加速clone
#git clone https://ghproxy.com/https://github.com/x-dr/wechat-bot.git

修改.env 文件

# openai的key,需要自己去获取 ,地址:https://beta.openai.com/account/api-keys
OPENAI_API_KEY ='sk-xxxxxxxxxxxxxxx'

# 反代的api,为空时为默认值 https://api.openai.com 
PROXY_API = 'https://openai.1rmb.tk/v1'

# # OpenAI API Model - https://platform.openai.com/docs/models
OPENAI_API_MODEL= 'gpt-3.5-turbo-16k'

#运行微信服务的ip+端口
SERVER_HOST = '127.0.0.1:5555'

#星火认知大模型
#服务接口认证信息
#获取地址https://console.xfyun.cn/services/bm3
#APIKey
sparkAPIKey = 'xxxxxxxxxxxxx'
#APISecret
sparkAPISecret = 'xxxxxxxxxxxxxx'
#APPID
sparkAPPID = 'xxxxxxxxxxxxxx'
#UID任意填写
sparkUID = 'wx'

  1. 运行
npm i
pm2 start pm2.json

使用Docker部署

  • 拉取镜像
docker pull gindex/wechat-box:latest
  • 运行
docker run -itd  --name wechat-service  \
    -e TARGET_AUTO_RESTART="yes" \
    -e TARGET_WECHAT_BOT="yes" \
    -e UPDATE_WECHAT_BOT="yes" \
    -e OPENAI_API_KEY="sk-xxxxxxxxxxxx" \
    -e PROXY_API="https://openai.1rmb.tk/v1" \
    -e SERVER_HOST='127.0.0.1:5555' \
    -e TARGET_CMD=wechat-start \
    -e VNC_PASSWORD=password \
    -p 8080:8080 -p 5555:5555 -p 5900:5900 \
    --add-host=dldir1.qq.com:127.0.0.1 \
    gindex/wechat-box:latest
  • 登录微信 打开http://your-ip:8080/vnc.html,登录微信并启动hook软件(参考本地部署)

  • 运行bot

docker exec -it wechat-service bash
startbot

wechat

环境变量

Env Default Example Description
TARGET_AUTO_RESTART no yes TARGET_LOG_FILE
TARGET_WECHAT_BOT no yes 是否启用微信机器人
UPDATE_WECHAT_BOT no yes 是否自动更新微信机器人
OPENAI_API_KEY null sk-xxxx OPENAI_API_KEY
PROXY_API https://api.openai.com/v1 https://openai.1rmb.tk/v1 反代接口地址
SERVER_HOST null 127.0.0.1:5555 Clients IP address range.
TARGET_CMD null wechat-start 重启时执行的命令
VNC_PASSWORD password bot 访问VNC密码

使用

  • 智能回复
/c xxxx   #对话 chatgpt

/s xxx    #对话 星火认知大模型

/c 结束对话  #结束本轮对话

机器人体验

感谢

@cixingguangming55555

wechat-bot's People

Contributors

x-dr avatar yuanwangz 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.