Skip to content

Commit

Permalink
Docs/gewechat voice docs (#175)
Browse files Browse the repository at this point in the history
* temp: test audio player

* docs: add gewechat voice and design docs
  • Loading branch information
hanfangyuan4396 authored Dec 29, 2024
1 parent 7ae1ae2 commit 7b58b3b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ Dify接入微信生态的**详细教程**请查看文章 [**手摸手教你把 D
> 1. gewechat要求必须搭建服务到**同省服务器**或者电脑里方可正常使用
> 2. 此项目仅用于个人娱乐场景,请勿用于任何商业场景
dify-on-wechat、dify、gewechat服务的调用关系

<div align="center">
<img width="700" src="./docs/gewechat/gewechat_service_design.png">
</div>

### 快速启动gewechat机器人

#### 部署gewechat服务
Expand Down Expand Up @@ -282,6 +288,14 @@ dify语音相关配置如下,另外需要在dify应用中开启语音转文字
}
```

搭配 gewechat_channel 可以实现发送语音条功能,gewechat服务只能获取到**20s**以内的语音,所以**你只能给bot发送20s以内的语音**,但**bot给你发送语音时无此限制**[**请查看gewechat接入文档**](./docs/gewechat/README.md)
<div align="center">
<img width="700" src="./docs/gewechat/gewechat_voice.jpg">
</div>

[点击下载语音文件](./docs/audios/gewechat_voice.mp3)


## 9. 支持dify图片识别

dify图片识别配置如下,另外需要在dify应用中开启图片上传与图片理解功能。使用方法为,**先发送图片**,然后**在3分钟内发送关于图片的问题**,注意先后顺序。
Expand Down Expand Up @@ -427,11 +441,7 @@ docker logs -f dify-on-wechat # 查看二维码并登录
<img src="https://contrib.rocks/image?repo=hanfangyuan4396/dify-on-wechat" />
</a>

# 开发计划
- [ ] **Notice插件**: 识别到特定消息,通知指定好友,详情请查看[#18](https://github.com/hanfangyuan4396/dify-on-wechat/issues/18)。为了鼓励各位多参与此项目,在pr中留下联系方式,我会点咖啡或奶茶表示感谢,一点心意~
- [ ] **测试合并原项目PR:** 原项目有很多比较好的PR没有通过,之后会把一些比较好的feature测试合并进这个仓库
- [ ] **优化对接Dify:** 目前对接dify的很多代码写的还很潦草,以后逐步优化
- [ ] **支持:** 企业微信个人号


也请各位大佬多多提PR,我社畜打工人,精力实在有限~

Expand Down
Binary file added docs/audios/gewechat_voice.mp3
Binary file not shown.
35 changes: 35 additions & 0 deletions docs/gewechat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Gewechat channel是基于[Gewechat](https://github.com/Devo919/Gewechat)项目

api文档地址为:[gewechat api](https://apifox.com/apidoc/shared-69ba62ca-cb7d-437e-85e4-6f3d3df271b1/api-197179336)

首先可以简单了解 dify-on-wechat、dify、gewechat服务的调用关系,如下图所示

<div align="center">
<img width="700" src="./gewechat_service_design.png">
</div>


# 2. gewechat 服务部署教程

gewechat 服务需要自行部署,[dify-on-wechat](https://github.com/hanfangyuan4396/dify-on-wechat) 项目只负责对接gewechat服务,请参考下方教程部署gewechat服务。
Expand Down Expand Up @@ -125,6 +132,34 @@ python app.py
<img width="700" src="./gewechat_login.jpg">
</div>

## 3.4 利用gewechat发送语音条消息

语音相关配置如下,另外需要在dify应用中开启语音转文字以及文字转语音功能,注意语音功能需要**安装ffmpeg依赖**

```bash
{
"dify_api_base": "https://api.dify.ai/v1",
"dify_api_key": "app-xxx",
"dify_app_type": "chatbot",
"channel_type": "gewechat", # 通道类型设置为gewechat
"model": "dify",
"speech_recognition": true, # 是否开启语音识别
"voice_reply_voice": true, # 是否使用语音回复语音
"always_reply_voice": false, # 是否一直使用语音回复
"voice_to_text": "dify", # 语音识别引擎
"text_to_voice": "dify" # 语音合成引擎
}
```

gewechat支持**发送语音条消息**,但是gewechat服务只能获取到**20s**以内的语音,所以**你只能给bot发送20s以内的语音**,而**bot给你发送语音时无此限制**

<div align="center">
<img width="700" src="./gewechat_voice.jpg">
</div>

[点击下载语音文件](./docs/audios/gewechat_voice.mp3)


# 4. gewechat_channel 服务的限制
1. gewechat 要求必须搭建服务到**同省**服务器或者电脑里方可正常使用,即登录微信的手机与gewechat服务必须在同一省
2. gewechat 开源框架**只支持**下载接收到的图片,不支持下载文件
Expand Down
Binary file added docs/gewechat/gewechat_service_design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/gewechat/gewechat_voice.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7b58b3b

Please sign in to comment.