fix: unpacking non json values (#2684)

This commit is contained in:
Andy Li
2025-06-09 11:11:56 -07:00
committed by GitHub
parent 2823e4447a
commit 3e11bb2910

View File

@@ -218,11 +218,13 @@ def get_token_limit_warning():
return json_dumps(packaged_message)
def unpack_message(packed_message) -> str:
def unpack_message(packed_message: str) -> str:
"""Take a packed message string and attempt to extract the inner message content"""
try:
message_json = json.loads(packed_message)
if type(message_json) is not dict:
return packed_message
except:
return packed_message