v0.4增加对视频的支持

This commit is contained in:
aixianling
2024-08-06 10:07:07 +08:00
parent ef5d720157
commit 1741c8fcdf
2 changed files with 8 additions and 3 deletions

View File

@@ -6,7 +6,7 @@
+ 增加分段发送消息,分割符为markdown语法中的换行标签`<br>`
+ 针对触发绘画的有loading消息触发
+ 支持图文消息拆分发送,Dify兼容性更好了
+ 增加对视频的支持
**安装方法:**

View File

@@ -12,7 +12,7 @@ from plugins import *
name="dow_markdown",
desire_priority=66,
desc="优化markdown返回结果中的图片和网址链接。",
version="0.3",
version="0.4",
author="Kubbo",
hidden=False
)
@@ -31,7 +31,7 @@ class dow_markdown(Plugin):
send_msg = e_context["context"]
try:
text = send_msg["content"]
if any(word in send_msg["content"] for word in ["", "/sd"]):
if any(word in send_msg["content"] for word in ["", ".sd"]):
receiver = send_msg.get("receiver")
itchat.send("我正在绘画中,可能需要多等待一会,请稍后...", toUserName=receiver)
logger.info("[WX] sendMsg={}, receiver={}".format(text, receiver))
@@ -80,6 +80,11 @@ class dow_markdown(Plugin):
reply.content = part[:-1].strip()
if not part.startswith('http'):
reply.content = host + reply.content
elif re.search(r"\.(mp4)", part):
reply.type = ReplyType.VIDEO_URL
reply.content = part[:-1].strip()
if not part.startswith('http'):
reply.content = host + reply.content
if index == len(parts) - 1 and is_last:
e_context["reply"] = reply
e_context.action = EventAction.BREAK_PASS