Git Product home page Git Product logo

wechatrobot's Introduction

weChatRobot

一个基于微信公众号的智能聊天机器人项目,支持图灵机器人(V2)和ChatGPT对话模式回复内容

本项目还有Go实现的版本:https://github.com/MartinDai/weChatRobot-go

qrcode

项目介绍:

本项目是一个微信公众号项目,需配合微信公众号使用,在微信公众号配置本项目运行的服务器域名,用户关注公众号后,向公众号发送任意信息,公众号会根据用户发送的内容自动回复。

涉及框架及技术

Tips:1.2版本开始使用Vert.x替换SpringBoot

支持的功能

  • 自定义关键字回复内容
  • 调用ChatGPT接口回复内容(需配置启动参数或者环境变量:OPENAI_API_KEY
  • 调用图灵机器人(V2)接口回复内容(需配置启动参数或者环境变量:TULING_API_KEY

使用说明:

  1. 使用之前需要有微信公众号的帐号,没有的请戳微信公众号申请
  2. 如果需要使用图灵机器人的回复内容则需要注册图灵机器人帐号获取相应的ApiKey并配置在启动参数或者环境变量中
  3. 如果需要使用ChatGPT的回复内容则需要创建OpenAI的API Key并配置在启动参数或者环境变量中
  4. 可以通过配置启动参数或者环境变量OPENAI_BASE_DOMAIN更换访问OpenAI的域名
  5. 可以通过配置启动参数或者环境变量OPENAI_PROXY使用代理服务访问OpenAI
  6. 内容响应来源的优先级自定义关键 > ChatGPT > 图灵机器人
  7. 在微信公众号后台配置回调URL为https://wechatrobot.doodl6.com/weChat/receiveMessage,其中wechatrobot.doodl6.com是你自己的域名,token与config.yml里面配置的保持一致即可

开发部署

本地启动

直接运行类com.doodl6.wechatrobot.MainVerticle

jar包运行

maven编译打包

mvn clean package

打包完成后,在robot-web/target目录会生成weChatRobot.jar

启动执行

java -jar weChatRobot.jar

使用-D指定配置文件,支持相对路径和绝对路径

java -Dconfig=config-deploy.yml -jar weChatRobot.jar

服务器部署后台运行

nohup java -jar weChatRobot.jar > ./console.log 2>&1 &

在执行命令的当前目录查看console日志

native-image运行

构建native-image(需要graalvm版本的jdk)

mvn clean package -P native-image

构建完成后,在robot-web/target目录会生成weChatRobot可执行文件,可以直接运行

./weChatRobot

注意:native-image不支持通过-D指定配置

Docker运行

构建适用于当前操作系统架构的镜像

docker build -f docker/Dockerfile --no-cache -t wechatrobot:latest .

构建指定架构的镜像

docker buildx build -f docker/Dockerfile --no-cache -t wechatrobot:latest --platform=linux/amd64 -o type=docker .

如果需要构建native-image的镜像,替换上面命令中的docker/Dockerfiledocker/native-image-Dockerfile即可

后台运行镜像

docker run --name wechatrobot -p 8080:8080 -d wechatrobot:latest

感谢赞助

jetbrains

wechatrobot's People

Contributors

martindai avatar dependabot[bot] avatar devfozgul 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.