From b1356efbd0add409a12213d9ff226ad4f325b207 Mon Sep 17 00:00:00 2001 From: Schwa Aresty Date: Mon, 12 Aug 2024 05:40:25 -0700 Subject: [PATCH] When the thread is empty and you try to open a window this throws an error (#155) --- lib/modelConfirmationGUI.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/modelConfirmationGUI.py b/lib/modelConfirmationGUI.py index 53f03046..c056e83c 100644 --- a/lib/modelConfirmationGUI.py +++ b/lib/modelConfirmationGUI.py @@ -15,6 +15,10 @@ def update(cls): cls.display_thread = ( "USER" in GPTState.text_to_confirm and "GPT" in GPTState.text_to_confirm ) + if len(GPTState.thread) == 0: + cls.last_item_text = "" + return + last_message_item = GPTState.thread[-1]["content"][0] cls.last_item_text = last_message_item.get("text", "")