fix: avoid crash on zero-arg tool calls in glm4 parser (#32321)

Signed-off-by: seekskyworld <djh1813553759@gmail.com>
This commit is contained in:
seeksky
2026-01-15 16:45:59 +08:00
committed by GitHub
parent 1e584823f8
commit a52d1396a7

View File

@@ -115,9 +115,15 @@ class Glm4MoeModelToolParser(ToolParser):
tool_calls = []
for match in matched_tool_calls:
tc_detail = self.func_detail_regex.search(match)
if not tc_detail:
logger.warning(
"Failed to parse tool call details from: %s",
match,
)
continue
tc_name = tc_detail.group(1)
tc_args = tc_detail.group(2)
pairs = self.func_arg_regex.findall(tc_args)
pairs = self.func_arg_regex.findall(tc_args) if tc_args else []
arg_dct = {}
for key, value in pairs:
arg_key = key.strip()