fix: validate tool_call_id pairing #2690

This commit is contained in:
zhayujie
2026-03-10 14:52:07 +08:00
parent 9d8df10dcf
commit 4e32f67eeb
4 changed files with 191 additions and 53 deletions

View File

@@ -13,6 +13,7 @@ from bridge.reply import Reply, ReplyType
from common.log import logger
from config import conf, load_config
from common import const
from agent.protocol.message_utils import drop_orphaned_tool_results_openai
# MiniMax对话模型API
@@ -356,7 +357,7 @@ class MinimaxBot(Bot):
converted.append(openai_msg)
return converted
return drop_orphaned_tool_results_openai(converted)
def _convert_tools_to_openai_format(self, tools):
"""

View File

@@ -10,6 +10,7 @@ This includes: OpenAI, LinkAI, Azure OpenAI, and many third-party providers.
import json
import openai
from common.log import logger
from agent.protocol.message_utils import drop_orphaned_tool_results_openai
class OpenAICompatibleBot:
@@ -300,5 +301,5 @@ class OpenAICompatibleBot:
else:
# Other formats, keep as is
openai_messages.append(msg)
return openai_messages
return drop_orphaned_tool_results_openai(openai_messages)