[Bugfix] fix crash in postprocess for null tool args (#43862)

Signed-off-by: William-Rom <william.rom@intility.no>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
William Rom
2026-06-02 22:17:26 -07:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 597bc15936
commit f0204358d9
2 changed files with 30 additions and 1 deletions
+2 -1
View File
@@ -1854,7 +1854,8 @@ def _postprocess_messages(messages: list[ConversationMessage]) -> None:
# if arguments is None or empty string, set to {}
if content := function.get("arguments"):
if not isinstance(content, (dict, list)):
function["arguments"] = json.loads(content)
parsed = json.loads(content)
function["arguments"] = parsed if parsed is not None else {}
else:
function["arguments"] = {}