fix: accept blank tool call arguments
Treat blank OpenAI-compatible tool call arguments as an empty dict so parameterless tools such as finish can execute with providers that return an empty string. Also trim model identifiers during config normalization to avoid leading whitespace leaking into requests and snapshots.
This commit is contained in:
@@ -351,6 +351,7 @@ class ModelInfo(ConfigBase):
|
||||
Gemini 客户端会按自身支持的字段筛选并映射到 GenerateContentConfig、EmbedContentConfig 或音频请求配置中。"""
|
||||
|
||||
def model_post_init(self, context: Any = None):
|
||||
self.model_identifier = self.model_identifier.strip()
|
||||
if not self.model_identifier:
|
||||
raise ValueError(t("config.model_identifier_empty_generic"))
|
||||
if not self.name:
|
||||
|
||||
@@ -585,6 +585,9 @@ def _parse_tool_arguments(
|
||||
Raises:
|
||||
RespParseException: 当参数无法解析为字典时抛出。
|
||||
"""
|
||||
if not raw_arguments.strip():
|
||||
return {}
|
||||
|
||||
try:
|
||||
if parse_mode == ToolArgumentParseMode.STRICT:
|
||||
arguments: Any = json.loads(raw_arguments)
|
||||
|
||||
Reference in New Issue
Block a user