Skip to content

Commit ee91c86

Browse files
committed
Update README.md
1 parent 48c08f4 commit ee91c86

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugins/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
**Table of Content**
22

33
- [插件化初衷](#插件化初衷)
4-
- [插件安装方法](#插件化安装方法)
4+
- [插件安装方法](#插件安装方法)
55
- [插件化实现](#插件化实现)
66
- [插件编写示例](#插件编写示例)
77
- [插件设计建议](#插件设计建议)
@@ -52,6 +52,8 @@
5252

5353
以下是它们的默认处理逻辑(太长不看,可跳到[插件编写示例](#插件编写示例)):
5454

55+
**注意以下包含的代码是`v1.1.0`中的片段,已过时,只可用于理解事件,最新的默认代码逻辑请参考[chat_channel](https://github.com/zhayujie/chatgpt-on-wechat/blob/master/channel/chat_channel.py)**
56+
5557
#### 1. 收到消息
5658

5759
负责接收用户消息,根据用户的配置,判断本条消息是否触发机器人。如果触发,则会判断该消息的类型(声音、文本、画图命令等),将消息包装成如下的`Context`交付给下一个步骤。
@@ -91,9 +93,9 @@
9193
if context.type == ContextType.TEXT or context.type == ContextType.IMAGE_CREATE:
9294
reply = super().build_reply_content(context.content, context) #文字跟画图交付给chatgpt
9395
elif context.type == ContextType.VOICE: # 声音先进行语音转文字后,修改Context类型为文字后,再交付给chatgpt
94-
msg = context['msg']
95-
file_name = TmpDir().path() + context.content
96-
msg.download(file_name)
96+
cmsg = context['msg']
97+
cmsg.prepare()
98+
file_name = context.content
9799
reply = super().build_voice_to_text(file_name)
98100
if reply.type != ReplyType.ERROR and reply.type != ReplyType.INFO:
99101
context.content = reply.content # 语音转文字后,将文字内容作为新的context

0 commit comments

Comments
 (0)