wecom-backend

module
v0.0.0-...-ac3c55a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: MIT

README

企业微信ChatGPT聊天应用

本项目是一个基于Go开发的企业微信聊天应用,目前只支持OpenAI的Chat服务,用户通过企业微信的应用发送聊天后,后端服务会通过SSE异步推流的方式和OpenAI交互,直到所有数据接收完后,将OpenAI的生成结果推送给企业微信的用户,如下:

image

Usage

  1. 编译
$git clone https://github.com/walkerdu/wecom-backend.git
$cd wecom-backend
$make
  1. 基于configs/config.json修改实际参数
{
    "open_ai": {
        "api_key": "sk-xxxxxxx"
    },
    "we_com": {
        "agent_config": {
            "corp_id": "ww123456",
            "agent_id": 1000004,
            "agent_secret": "Vitug6o-xxxx",
            "agent_token": "8kxL1xxxxxx",
            "agent_encoding_aes_key": "nxyGtXNFKzj7OHytzWkEV9awgxxxxxx"
        },
        "addr": ":9001"
    }
}
  1. 启动服务
$bin/wecom-backend -f configs/config.json

也可以直接通过命令行传入服务参数,如下:

$bin/wecom-backend --corp_id ww2712xxx --agent_id 1000004 --agent_secret Vitug6o-xxxx --agent_token 8kxLxxxxx --agent_encoding_aes_key nxyGtXNFKzj7xxxxxxxxx --addr :9001 --openai_apikey sk-80apwArF4xxxxxxx

Directories

Path Synopsis
cmd
wecom-backend command
internal
pkg
openai-v1
参考:https://github.com/walkerdu/go-openai/blob/master/stream_reader.go
参考:https://github.com/walkerdu/go-openai/blob/master/stream_reader.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL