diff --git a/nonebot_plugin_llmchat/__init__.py b/nonebot_plugin_llmchat/__init__.py index d0d5857..0d0feae 100755 --- a/nonebot_plugin_llmchat/__init__.py +++ b/nonebot_plugin_llmchat/__init__.py @@ -315,7 +315,7 @@ async def process_messages(group_id: int): # 将机器人错过的消息推送给LLM past_events_snapshot = list(state.past_events) for ev in past_events_snapshot: - text_content = ",".join([format_message(ev) for ev in past_events_snapshot]) + text_content = format_message(ev) content.append({"type": "text", "text": text_content}) # 将消息中的图片转成 base64 diff --git a/nonebot_plugin_llmchat/mcpclient.py b/nonebot_plugin_llmchat/mcpclient.py index 9ed9fe0..a6c6ff3 100644 --- a/nonebot_plugin_llmchat/mcpclient.py +++ b/nonebot_plugin_llmchat/mcpclient.py @@ -1,5 +1,5 @@ -from contextlib import AsyncExitStack import asyncio +from contextlib import AsyncExitStack from mcp import ClientSession, StdioServerParameters from mcp.client.sse import sse_client @@ -66,9 +66,7 @@ class MCPClient: logger.info(f"正在服务器[{server_name}]上调用工具[{real_tool_name}]") session = self.sessions[server_name] try: - response = await asyncio.wait_for( - session.call_tool(real_tool_name, tool_args), timeout=10 - ) + response = await asyncio.wait_for(session.call_tool(real_tool_name, tool_args), timeout=10) except asyncio.TimeoutError: logger.error(f"调用工具[{real_tool_name}]超时") return f"调用工具[{real_tool_name}]超时"