[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:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
597bc15936
commit
f0204358d9
@@ -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"] = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user