From b587065ca1f4cc2491ab76fb089ac36dcf0e8521 Mon Sep 17 00:00:00 2001 From: dougollerenshaw Date: Thu, 19 Sep 2024 09:36:30 -0700 Subject: [PATCH] Fixed retry logic in chat handler --- codeaide/logic/chat_handler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/codeaide/logic/chat_handler.py b/codeaide/logic/chat_handler.py index 5d57138..eefc68e 100644 --- a/codeaide/logic/chat_handler.py +++ b/codeaide/logic/chat_handler.py @@ -41,6 +41,10 @@ def process_input(self, user_input): self.cost_tracker.log_request(response) try: + parsed_response = parse_response(response) + if parsed_response[0] is None: # If parsing failed + raise ValueError("Failed to parse JSON response") + ( text, questions, @@ -48,7 +52,7 @@ def process_input(self, user_input): code_version, version_description, requirements, - ) = parse_response(response) + ) = parsed_response if ( code