diff --git a/.github/workflows/TOC.yml b/.github/workflows/TOC.yml index 879fd73..5425bbb 100644 --- a/.github/workflows/TOC.yml +++ b/.github/workflows/TOC.yml @@ -8,4 +8,4 @@ jobs: - uses: technote-space/toc-generator@v4 with: TOC_TITLE: "**目录**" - MAX_HEADER_LEVEL: 3 \ No newline at end of file + MAX_HEADER_LEVEL: 4 \ No newline at end of file diff --git a/README.md b/README.md index 8e4b60f..40ec9fd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@

ChatGPT Dingtalk

- [![Auth](https://img.shields.io/badge/Auth-eryajf-ff69b4)](https://github.com/eryajf) [![Go Version](https://img.shields.io/github/go-mod/go-version/eryajf/chatgpt-dingtalk)](https://github.com/eryajf/chatgpt-dingtalk) [![GitHub Pull Requests](https://img.shields.io/github/issues-pr/eryajf/chatgpt-dingtalk)](https://github.com/eryajf/chatgpt-dingtalk/pulls) @@ -10,7 +9,7 @@ [![Docker Pulls](https://img.shields.io/docker/pulls/eryajf/chatgpt-dingtalk)](https://hub.docker.com/r/eryajf/chatgpt-dingtalk) [![GitHub license](https://img.shields.io/github/license/eryajf/chatgpt-dingtalk)](https://github.com/eryajf/chatgpt-dingtalk/blob/main/LICENSE) -

🌉 在钉钉群聊中添加ChatGPT机器人 🌉

+

🌉 基于GO语言实现的钉钉集成ChatGPT机器人 🌉


@@ -41,7 +40,7 @@ -## 前言 +## 🥳 前言 本项目可以助你将GPT机器人集成到钉钉群聊当中。当前默认模型为 gpt-3.5。 @@ -58,26 +57,29 @@ ⚗️ openai官方提供了一个[状态页](https://status.openai.com/)来呈现当前openAI服务的状态,同时如果有问题发布公告也会在这个页面,如果你感觉它有问题了,可以在这个页面看看。 -## 功能简介 +## 🤖 功能介绍 -- 支持在钉钉群聊中添加机器人,通过@机器人进行聊天交互。 -- 提问支持单聊与串聊两种模式,通过@机器人发关键字切换。 -- 支持添加代理,通过配置化指定。 -- 支持自定义api域名,通过配置化指定。 -- 支持自定义指定的模型,通过配置化指定。 -- 支持自定义默认的聊天模式,通过配置化指定。 -- 支持自定义单个用户单日对话次数,通过配置化指定。 -- 支持生成图片,通过发送 `#图片`关键字开头的内容进行生成。 -- 支持通过内置prompt进行对话。欢迎提交你认为不错的prompt,请通过编辑[此文件](https://github.com/eryajf/chatgpt-dingtalk/blob/main/prompt.yml)来提交PR。 +- 🚀 帮助菜单:通过发送 `帮助` 将看到帮助列表 +- 🥷 私聊:支持与机器人单独私聊(无需艾特) +- 💬 群聊:支持在群里艾特机器人进行对话 +- 🙋 单聊模式:每次对话都是一次新的对话,没有历史聊天上下文联系 +- 🗣 串聊模式:带上下文理解的对话模式 +- 🎨 图片生成:通过发送 `#图片`关键字开头的内容进行生成图片,[查看示例]() +- 🎭 角色扮演:支持场景模式,通过 `#周报` 的方式触发内置prompt模板 +- 🧑‍💻 频率限制:通过配置指定,自定义单个用户单日最大对话次数 +- 💵 余额查询:通过发送 `余额` 关键字查询当前key所剩额度 +- 🔗 自定义api域名:通过配置指定,解决国内服务器无法直接访问openai的问题 +- 🪜 添加代理:通过配置指定,通过给应用注入代理解决国内服务器无法访问的问题 +- 👐 默认模式:支持自定义默认的聊天模式,通过配置化指定 -## 使用前提 +## 🥸 使用前提 * 有Openai账号,并且创建好`api_key`,注册相关事项可以参考[此文章](https://juejin.cn/post/7173447848292253704) 。访问[这里](https://beta.openai.com/account/api-keys),申请个人秘钥。 * 在钉钉开发者后台创建机器人,配置应用程序回调。 -## 使用教程 +## 🚜 使用教程 -### 第一步,先创建机器人 +### 🤖 第一步,创建机器人 创建步骤参考文档:[企业内部开发机器人](https://open.dingtalk.com/document/robots/enterprise-created-chatbot),或者根据如下步骤进行配置。 @@ -103,7 +105,9 @@ ![image_20221209_163724](https://cdn.staticaly.com/gh/eryajf/tu/main/img/image_20221209_163724.png) -### 第二步,部署应用 +### 🪜 第二步,部署应用 + +#### 🛣 docker部署 你可以使用docker快速运行本项目。 @@ -197,7 +201,7 @@ $ curl --location --request POST 'http://chat.eryajf.net/' \ 如果手动请求没有问题,那么就可以在钉钉群里与机器人进行对话了。 ---- +#### 🧶 二进制部署 如果你想通过命令行直接部署,可以直接下载release中的[压缩包](https://github.com/eryajf/chatgpt-dingtalk/releases) ,请根据自己系统以及架构选择合适的压缩包,下载之后直接解压运行。 @@ -215,9 +219,9 @@ $ nohup ./chatgpt-dingtalk &> run.log & $ tail -f run.log ``` -## 亮点特色 +## 👉 亮点特色 -### 与机器人单聊 +### 🙋 与机器人单聊 `2023-03-08`补充,我发现也可以不在群里艾特机器人聊天,还可点击机器人,然后点击发消息,通过与机器人直接对话进行聊天: @@ -225,13 +229,13 @@ $ tail -f run.log ![image](https://user-images.githubusercontent.com/33259379/223607306-2ac836a2-7ce5-4a12-a16e-bec40b22d8d6.png) -### 帮助列表 +### 🚀 帮助列表 > 艾特机器人发送空内容或者帮助,会返回帮助列表。 ![image_20230216_221253](https://cdn.staticaly.com/gh/eryajf/tu/main/img/image_20230216_221253.png) -### 切换模式 +### 🔄 切换模式 > 发送指定关键字,可以切换不同的模式。 @@ -240,17 +244,17 @@ $ tail -f run.log > 📢 注意:串聊模式下,群里每个人的聊天上下文是独立的。 > 📢 注意:默认对话模式为单聊,因此不必发送单聊即可进入单聊模式,而要进入串聊,则需要发送串聊关键字进行切换,当串聊内容超过最大限制的时候,你可以发送重置,然后再次进入串聊模式。 -### 查询余额 +### 💵 查询余额 > 艾特机器人发送 `余额` 二字,会返回当前key对应的账号的剩余额度以及可用日期。 ![image_20230304_222522](https://cdn.staticaly.com/gh/eryajf/tu/main/img/image_20230304_222522.jpg) -### 日常问题 +### 🤯 日常问题 ![image_20221209_163739](https://cdn.staticaly.com/gh/eryajf/tu/main/img/image_20221209_163739.png) -### 通过内置prompt聊天 +### 🌈 通过内置prompt聊天 > 发送模板两个字,会返回当前内置支持的prompt列表。 @@ -258,7 +262,7 @@ $ tail -f run.log > 如果你发现有比较优秀的prompt,欢迎PR。注意:一些与钉钉使用场景不是很匹配的,就不要提交了。 -### 生成图片 +### 🎨 生成图片 > 发送以 `#图片`开头的内容,将会触发绘画能力,图片生成之后,将会保存在程序根目录下的`images目录`下。 > @@ -266,7 +270,7 @@ $ tail -f run.log ![image_20230323_150547](https://cdn.staticaly.com/gh/eryajf/tu/main/img/image_20230323_150547.jpg) -## 本地开发 +## 🧑‍💻 本地开发 ```sh # 获取项目 @@ -282,7 +286,7 @@ $ cp config.dev.json config.json $ go run main.go ``` -## 配置文件说明 +## ⚙️ 配置文件说明 ```json { @@ -297,17 +301,28 @@ $ go run main.go } ``` -## 常见问题 +## 🙋 常见问题 如何更好地使用ChatGPT:这里有[许多案例](https://github.com/f/awesome-chatgpt-prompts)可供参考。 `🗣 重要重要` 一些常见的问题,我单独开issue放在这里:[👉点我👈](https://github.com/eryajf/chatgpt-dingtalk/issues/44),可以查看这里辅助你解决问题,如果里边没有,请对历史issue进行搜索(不要提交重复的issue),也欢迎大家补充。 -## 高光时刻 +## 🎉 高光时刻 > 本项目曾在 | [2022-12-12](https://github.com/bonfy/github-trending/blob/master/2022/2022-12-12.md#go) | [2022-12-18](https://github.com/bonfy/github-trending/blob/master/2022/2022-12-18.md#go) | [2022-12-19](https://github.com/bonfy/github-trending/blob/master/2022/2022-12-19.md#go) | [2022-12-20](https://github.com/bonfy/github-trending/blob/master/2022/2022-12-20.md#go) | [2023-02-09](https://github.com/bonfy/github-trending/blob/master/2023-02-09.md#go) | [2023-02-10](https://github.com/bonfy/github-trending/blob/master/2023-02-10.md#go) | [2023-02-11](https://github.com/bonfy/github-trending/blob/master/2023-02-11.md#go) | [2023-02-12](https://github.com/bonfy/github-trending/blob/master/2023-02-12.md#go) | [2023-02-13](https://github.com/bonfy/github-trending/blob/master/2023-02-13.md#go) | [2023-02-14](https://github.com/bonfy/github-trending/blob/master/2023-02-14.md#go) | [2023-02-15](https://github.com/bonfy/github-trending/blob/master/2023-02-15.md#go) | [2023-03-04](https://github.com/bonfy/github-trending/blob/master/2023-03-04.md#go) | [2023-03-05](https://github.com/bonfy/github-trending/blob/master/2023-03-05.md#go) | [2023-03-19](https://github.com/bonfy/github-trending/blob/master/2023-03-19.md#go) | [2023-03-22](https://github.com/bonfy/github-trending/blob/master/2023-03-22.md#go), 这些天里,登上GitHub Trending。而且还在持续登榜中,可见最近openai的热度。 > ![image_20230316_114915](https://cdn.staticaly.com/gh/eryajf/tu/main/img/image_20230316_114915.jpg) -## 赞赏 +## 🥰 感谢 + +这个项目能够成立,离不开这些开源项目: + +- [go-resty/resty](https://github.com/go-resty/resty) +- [patrickmn/go-cache](https://github.com/patrickmn/go-cache) +- [solywsh/chatgpt](https://github.com/solywsh/chatgpt) +- [xgfone/ship](https://github.com/xgfone/ship) +- [avast/retry-go](https://github.com/avast/retry-go) +- [sashabaranov/go-openapi](https://github.com/sashabaranov/go-openai) + +## 🤑 赞赏 如果觉得这个项目对你有帮助,你可以请作者[喝杯咖啡 ☕️](https://wiki.eryajf.net/reward/) \ No newline at end of file