Giter Club home page Giter Club logo

wecom-chatgpt-bot's Introduction

企业微信 ChatGPT 聊天机器人

为什么使用企业微信接入 ChatGPT 聊天机器人?

  • 企业微信相比其他平台,聊天功能与微信更接近,使用更习惯
  • 可把服务部署在海外机房,相比于网页版更为安全稳定
  • 可以自行增加频次限制、聊天内容留存等功能,方便团队/企业内部多人同时使用

如果你有新功能需求,可以在 issues 里提出;如果你希望为项目做贡献,可以直接提交 pull request。

操作系统:Ubuntu 20.04

  1. 前置准备:
  • OPENAI API 账号申请
  • 企业认证的企业微信账号
  • 企业名下备案的域名
  1. 修改 supervisor 配置,将wechat.conf中的wecom-chatgpt-bot所在目录修改为实际目录位置;修改 nginx 配置,将bot.conf中的yourdomain.com修改为实际域名(包含二级域名,如果有)。

  2. 安装软件:

apt install python3-pip redis-server nginx supervisor
cp conf/bot.conf /etc/nginx/conf.d/
cp conf/wechat.conf /etc/supervisor/conf.d/
nginx -s reload
supervisorctl reload
cd wechat_auto_reply && pip3 install -r requirements.txt
  1. 修改配置文件

上线前,你需要在settings.py中填入对应的信息,具体如下表所示:

字段 含义 是否必须修改
WEWORK_TOKEN 企业微信创建应用内随机生成的Token
WEWORK_AES_KEY 企业微信创建应用内随机生成的EncodingAESKey
WEWORK_CORP_ID 企业微信后台显示的企业 ID
WEWORK_CORP_SECRET 企业微信创建应用内获取的Secret
OPENAI_API_KEY OpenAI 后台获取的 API_KEY
OPENAI_GPT_ENGINE 使用的 OpenAI 模型,可选列表详见settings.py文件
OPENAI_SYSTEM_PROMPT 发送的 system prompt 信息,可用来定制企业专属的 chatbot
CHAT_RESET_MESSAGE 触发重置对话的消息内容,全文匹配
CHAT_RESET_MESSAGE_RESULT 重置对话后返回的结果
CHAT_ERROR_MESSAGE 请求错误(如超出频率限制、欠费等)后返回的结果
  1. 初始化
python3 manage.py migrate
  1. 启动/重启服务:
supervisorctl restart all
  1. 修改你的域名 DNS 解析,到部署机器所在 IP。
  2. 进入企业微信应用后台的「API 接收消息」设置,填入对应信息,点击保存。
  3. 进入企业微信应用后台的「企业可信 IP」设置,填入部署机器所在 IP。
  4. 在企业微信中找到对应的应用,发送消息,完成部署。

wecom-chatgpt-bot's People

Contributors

buaabarty 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.