Code Monkey home page Code Monkey logo

openai's Introduction

基于GPT-3.5的公众号自动回复机器人

一、介绍

通过openaiwechat官方的api搭建公众号自动回复的项目.

二、Feature

  • 解决微信被动回复限制问题。(设定超时时间,滚动返回)
  • 支持用户语音输入。(要主动开启,设置与开发->接口权限->接收语音识别结果。已关注用户可能24小时内生效,可重新关注尝试)
  • 设置代理
  • prompt 提示、max_tokens、temperature 参数调节
  • 正则关键词回复(微信在开启服务器配置后,自带的关键字回复就不能用了)。
  • 上下文(可以配置记录上下文对话数量上限)

三、配置&部署

前置准备

  1. 获取API_KEYOpenAI
  2. 获取微信公众号令牌Token微信公众平台->基本配置->服务器配置->令牌(Token)(令牌是自定义的,保持一致即可)
  3. 下载Release中的二进制执行文件robot
mkdir openai
wget https://github.com/hinak0/openai/releases/latest/download/robot
chmod 555 ./robot
  1. 修改配置文件
vim config.yaml

配置文件

配置文件实例&&文档

启动测试

./robot

常驻服务

使用systemd实现常驻启动

vim /etc/systemd/system/robot.service
systemd脚本
[Unit]
Description=chatgpt with wechat

[Service]
# the user
User=root
Type=simple
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_ADMIN
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_ADMIN
# 执行文件和配置文件路径
WorkingDirectory=/root/openai/
ExecStart=/root/openai/robot
# 挂掉自动重启
Restart=on-failure
# 重启间隔
RestartSec=20s

[Install]
WantedBy=multi-user.target
设置开机自动启动&&启动服务
sudo systemctl start robot
sudo systemctl enable robot

服务器地址(URL)填写 http://服务器IP或者域名/,设置明文方式传输,提交后,点击「启用」。

四、二次开发

  1. 克隆项目
git clone https://github.com/hinak0/openai.git
  1. 安装依赖
go mod tidy
  1. 编译
go build -o robot
# 运行缺少依赖
export CGO_ENABLED=0
go build -o robot main.go

Q&A

有问题请提issue,会看的.

openai's People

Contributors

tomatocuke avatar hinak0 avatar

Stargazers

czzzzzzzzzzzzzc avatar AiPaiSeng 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.