diff --git a/backend/agentpress/thread_manager.py b/backend/agentpress/thread_manager.py index 8a120f0b..66c6f8c6 100644 --- a/backend/agentpress/thread_manager.py +++ b/backend/agentpress/thread_manager.py @@ -172,6 +172,10 @@ class ThreadManager: result: List[Dict[str, Any]] = [] for msg in messages: msg_content = msg.get('content') + # Try to parse msg_content as JSON if it's a string + if isinstance(msg_content, str): + try: msg_content = json.loads(msg_content) + except json.JSONDecodeError: pass if isinstance(msg_content, dict): # Create a copy to avoid modifying the original msg_content_copy = msg_content.copy()