{"id":19075209,"url":"https://github.com/martindai/wechatrobot-go","last_synced_at":"2025-04-29T23:28:54.033Z","repository":{"id":64320808,"uuid":"374256346","full_name":"MartinDai/weChatRobot-go","owner":"MartinDai","description":"一个基于微信公众号的智能聊天机器人项目，支持根据关键字或者调用OpenAI、通义千问、豆包等大语言模型服务回复内容","archived":false,"fork":false,"pushed_at":"2025-01-14T10:09:03.000Z","size":137,"stargazers_count":28,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-18T19:41:44.287Z","etag":null,"topics":["go","wechat"],"latest_commit_sha":null,"homepage":"https://wechatrobot.doodl6.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MartinDai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-06-06T03:07:56.000Z","updated_at":"2025-02-07T07:41:04.000Z","dependencies_parsed_at":"2023-11-27T04:24:46.355Z","dependency_job_id":"46803c24-4ab1-4053-a452-162dce9d7ab3","html_url":"https://github.com/MartinDai/weChatRobot-go","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinDai%2FweChatRobot-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinDai%2FweChatRobot-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinDai%2FweChatRobot-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinDai%2FweChatRobot-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MartinDai","download_url":"https://codeload.github.com/MartinDai/weChatRobot-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251599050,"owners_count":21615461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","wechat"],"created_at":"2024-11-09T01:53:53.227Z","updated_at":"2025-04-29T23:28:54.008Z","avatar_url":"https://github.com/MartinDai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# weChatRobot\n\n一个基于微信公众号的智能聊天机器人项目，支持根据关键字或者调用OpenAI、通义千问等大语言模型服务回复内容。\n\n本项目还有Java实现的版本：\u003chttps://github.com/MartinDai/weChatRobot\u003e\n\n![qrcode](cmd/static/images/qrcode.jpg \"扫码关注，体验智能机器人\")\n\n## 项目介绍\n\n本项目是一个微信公众号项目，需配合微信公众号使用，在微信公众号配置本项目运行的服务器域名，用户关注公众号后，向公众号发送任意信息，公众号会根据用户发送的内容自动回复。\n  \n## 第三方依赖\n\n- [gin](https://github.com/gin-gonic/gin)\n- [gjson](https://github.com/tidwall/gjson)\n- [yaml](https://gopkg.in/yaml.v3)\n- [openaigo](https://github.com/otiai10/openaigo)\n- [volcengine-go-sdk](https://github.com/volcengine/volcengine-go-sdk)\n\n## 支持的功能\n\n+ [x] 自定义关键字回复内容\n+ [x] 调用火山方舟（豆包）接口回复内容（需配置环境变量：`ARK_API_KEY`,`ARK_ENDPOINT_ID`）\n+ [x] 调用OpenAI接口回复内容（需配置环境变量：`OPENAI_API_KEY`）\n+ [x] 调用通义千问接口回复内容（需配置环境变量：`DASHSCOPE_API_KEY`）\n+ [x] 调用图灵机器人(V2)接口回复内容（需配置环境变量：`TULING_API_KEY`）\n\n## 使用说明\n\n需要有微信公众号的帐号，没有的请戳[微信公众号申请](https://mp.weixin.qq.com/cgi-bin/readtemplate?t=register/step1_tmpl\u0026lang=zh_CN)\n\n内容响应来源的优先级`自定义关键字 \u003e OpenAI \u003e 通义千问 \u003e 图灵机器人`\n\n在微信公众号后台配置回调URL为\u003chttps://\u003cyour.domain\u003e/weChat/receiveMessage\u003e，其中`\u003cyour.domain\u003e`替换成你自己的域名，token与`config.yml`里面配置的保持一致即可\n\n### 火山方舟（豆包）\n\n如果需要使用火山方舟的回复内容则需要\n[创建火山方舟的API Key](https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey)\n和\n[创建接入点](https://console.volcengine.com/ark/region:ark+cn-beijing/endpoint/create)\n并配置在启动参数或者环境变量中\n\n### OpenAI\n\n1. 如果需要使用OpenAI的回复内容则需要[创建OpenAI的API Key](https://platform.openai.com/account/api-keys)并配置在启动参数或者环境变量中\n2. 可以通过配置启动参数或者环境变量`OPENAI_SERVER_URL`指定访问OpenAI服务的baseUrl\n3. 可以通过配置启动参数或者环境变量`OPENAI_PROXY`使用代理服务访问OpenAI\n\n### 通义千问\n\n如果需要使用通义千问的回复内容则需要[创建通义千问的API Key](https://bailian.console.aliyun.com/#/api_key)并配置在启动参数或者环境变量中\n\n### 图灵机器人\n\n如果需要使用图灵机器人的回复内容则需要[注册图灵机器人帐号](http://tuling123.com/register/email.jhtml)获取相应的ApiKey并配置在启动参数或者环境变量中\n\n## 本地开发\n\n### GoLand\n\n需要配置Program Arguments为`-config config.yml`，然后运行main.go\n\n### VS Code\n\n可以直接使用`launch.json`的配置，里面还包含了环境变量的配置直接设置即可\n\n## 编译运行\n\n### 通过Makefile构建\n\n构建适合当前系统的可执行文件\n\n```shell\nmake\n```\n\n构建指定平台架构的可执行文件\n\n```shell\nmake linux_amd64\n```\n\n编译全平台的可执行文件\n\n```shell\nmake all\n```\n\n生成的可执行文件在`bin`目录下，执行`./bin/weChatRobot_darwin_arm64 -config config.yml`启动运行，其中`_darwin_arm64`后缀不同系统架构不一样\n\n## Docker运行\n\n构建适用于当前操作系统架构的镜像\n\n```shell\ndocker build --no-cache -t wechatrobot-go:latest .\n```\n\n构建指定架构的镜像\n\n```shell\ndocker buildx build --no-cache -t wechatrobot-go:latest --platform=linux/amd64 -o type=docker .\n```\n\n后台启动镜像\n\n```shell\ndocker run --name wechatrobot-go -p 8080:8080 -d wechatrobot-go:latest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartindai%2Fwechatrobot-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartindai%2Fwechatrobot-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartindai%2Fwechatrobot-go/lists"}