From f208a51bbd1a24be31876e3160a6fe76dffd3333 Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 21 May 2025 11:10:45 +0800 Subject: [PATCH] =?UTF-8?q?dify=20=E6=94=AF=E6=8C=81=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=8F=91=E9=80=81=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/dify/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/dify/main.py b/plugins/dify/main.py index 33eb753..53eacdc 100644 --- a/plugins/dify/main.py +++ b/plugins/dify/main.py @@ -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,