From 92f6d31f3322c0ea827bffce019c1cf9cf34afe3 Mon Sep 17 00:00:00 2001 From: Mir Adnan ALI Date: Fri, 24 Jan 2025 05:25:21 -0500 Subject: [PATCH] Updated patch to avoid KeyError on malformed dict --- aider/sendchat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/sendchat.py b/aider/sendchat.py index 5e75ff584..837b3b853 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -60,7 +60,7 @@ def ensure_alternating_roles(messages): prev_role = None for msg in messages: - current_role = msg['role'] + current_role = msg.get('role') # Get 'role', None if missing # If the current role is the same as the previous, insert an empty message of the opposite role if current_role == prev_role: