mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2026-06-28 00:02:04 +00:00
🐛 修复工具调用处理逻辑,确保每个工具调用的回复消息被正确添加
This commit is contained in:
parent
5ac0597278
commit
42f60625ca
1 changed files with 2 additions and 2 deletions
|
|
@ -475,6 +475,8 @@ async def process_messages(context_id: int, is_group: bool = True):
|
||||||
await send_split_messages(handler, message.content)
|
await send_split_messages(handler, message.content)
|
||||||
|
|
||||||
# 处理每个工具调用
|
# 处理每个工具调用
|
||||||
|
new_messages.append(llm_reply)
|
||||||
|
|
||||||
for tool_call in message.tool_calls:
|
for tool_call in message.tool_calls:
|
||||||
tool_name = tool_call.function.name
|
tool_name = tool_call.function.name
|
||||||
tool_args = json.loads(tool_call.function.arguments)
|
tool_args = json.loads(tool_call.function.arguments)
|
||||||
|
|
@ -496,8 +498,6 @@ async def process_messages(context_id: int, is_group: bool = True):
|
||||||
bot_id=str(event.self_id)
|
bot_id=str(event.self_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
new_messages.append(llm_reply)
|
|
||||||
|
|
||||||
new_messages.append({
|
new_messages.append({
|
||||||
"role": "tool",
|
"role": "tool",
|
||||||
"tool_call_id": tool_call.id,
|
"tool_call_id": tool_call.id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue