mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2025-09-04 10:20:45 +00:00
🐛 修复重复发送消息给llm的问题
This commit is contained in:
parent
5014d3014b
commit
ea635fd147
2 changed files with 3 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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}]超时"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue