同步工具异步化处理

This commit is contained in:
Sakura-RanChen
2026-07-07 14:45:50 +08:00
parent d8c97a9f81
commit 59f6566cfb
12 changed files with 156 additions and 184 deletions
@@ -1,5 +1,6 @@
"""服务端插件工具执行器"""
import asyncio
from typing import Dict, Any, TYPE_CHECKING
if TYPE_CHECKING:
@@ -41,6 +42,10 @@ class ServerPluginExecutor(ToolExecutor):
# 默认不传conn参数
result = func_item.func(**arguments)
# 兼容 async def 工具函数
if asyncio.iscoroutine(result):
result = await result
return result
except Exception as e: