mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2026-02-05 11:38:05 +00:00
🐛 更新工具列表缓存机制,修复工具调用问题
This commit is contained in:
parent
e082f7db9f
commit
a47ae8ef16
2 changed files with 51 additions and 43 deletions
|
|
@ -278,7 +278,7 @@ async def handle_message(event: GroupMessageEvent | PrivateMessageEvent):
|
|||
task.add_done_callback(tasks.discard)
|
||||
tasks.add(task)
|
||||
|
||||
async def process_images(event: GroupMessageEvent) -> list[str]:
|
||||
async def process_images(event: GroupMessageEvent | PrivateMessageEvent) -> list[str]:
|
||||
base64_images = []
|
||||
for segement in event.get_message():
|
||||
if segement.type == "image":
|
||||
|
|
@ -478,12 +478,19 @@ async def process_messages(context_id: int, is_group: bool = True):
|
|||
# 发送工具调用提示
|
||||
await handler.send(Message(f"正在使用{mcp_client.get_friendly_name(tool_name)}"))
|
||||
|
||||
result = await mcp_client.call_tool(
|
||||
tool_name,
|
||||
tool_args,
|
||||
group_id=event.group_id,
|
||||
bot_id=str(event.self_id)
|
||||
)
|
||||
if is_group:
|
||||
result = await mcp_client.call_tool(
|
||||
tool_name,
|
||||
tool_args,
|
||||
group_id=event.group_id,
|
||||
bot_id=str(event.self_id)
|
||||
)
|
||||
else:
|
||||
result = await mcp_client.call_tool(
|
||||
tool_name,
|
||||
tool_args,
|
||||
bot_id=str(event.self_id)
|
||||
)
|
||||
|
||||
new_messages.append({
|
||||
"role": "tool",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue