dify 支持图片发送,
This commit is contained in:
@@ -5,6 +5,8 @@ import time
|
||||
import re # 添加re模块导入
|
||||
from typing import Dict, Any, List, Optional, Tuple
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from plugin_common.message_plugin_interface import MessagePluginInterface
|
||||
from plugin_common.plugin_interface import PluginStatus
|
||||
from utils.decorator.plugin_decorators import plugin_stats_decorator
|
||||
@@ -146,7 +148,7 @@ class DifyPlugin(MessagePluginInterface):
|
||||
# 判断是否为本地文件路径
|
||||
if os.path.isfile(response):
|
||||
# 如果是文件路径,使用发送文件方法
|
||||
await bot.send_image_message(roomid, response)
|
||||
await bot.send_image_message(roomid, Path(response))
|
||||
else:
|
||||
# 如果是普通文本,使用发送文本方法
|
||||
await bot.send_at_message((roomid if roomid else sender), response, [sender])
|
||||
@@ -201,7 +203,7 @@ class DifyPlugin(MessagePluginInterface):
|
||||
# 判断是否为本地文件路径
|
||||
if os.path.isfile(response):
|
||||
# 如果是文件路径,使用发送文件方法
|
||||
await bot.send_image_message((roomid if roomid else sender), response)
|
||||
await bot.send_image_message((roomid if roomid else sender), Path(response))
|
||||
else:
|
||||
# 如果是普通文本,使用发送文本方法
|
||||
await bot.send_at_message((roomid if roomid else sender), response,
|
||||
|
||||
Reference in New Issue
Block a user