feat: wechatmp channel support voice/image reply

This commit is contained in:
JS00000
2023-04-20 10:26:58 +08:00
parent 34209021c8
commit a7772316f9
6 changed files with 164 additions and 44 deletions

View File

@@ -5,6 +5,7 @@ import web
from channel.wechatmp.wechatmp_message import parse_xml
from channel.wechatmp.passive_reply_message import TextMsg
from bridge.context import *
from bridge.reply import ReplyType
from channel.wechatmp.common import *
from channel.wechatmp.wechatmp_channel import WechatMPChannel
from common.log import logger
@@ -29,7 +30,7 @@ class Query:
# or wechatmp_msg.msg_type == "image"
):
from_user = wechatmp_msg.from_user_id
message = wechatmp_msg.content.decode("utf-8")
message = wechatmp_msg.content
message_id = wechatmp_msg.msg_id
logger.info(
@@ -41,8 +42,9 @@ class Query:
message,
)
)
rtype = ReplyType.VOICE if wechatmp_msg.msg_type == "voice" else None
context = channel._compose_context(
ContextType.TEXT, message, isgroup=False, msg=wechatmp_msg
ContextType.TEXT, message, isgroup=False, desire_rtype=rtype, msg=wechatmp_msg
)
if context:
# set private openai_api_key