From 32122019421a642b0e1929ed45d532cf992729b4 Mon Sep 17 00:00:00 2001 From: zkpepe Date: Wed, 26 Mar 2025 16:29:24 +0300 Subject: [PATCH] chore: fix unsafe access to `result[1].msgs` --- community_usecase/OWL Interview Preparation Assistant/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/community_usecase/OWL Interview Preparation Assistant/main.py b/community_usecase/OWL Interview Preparation Assistant/main.py index 6e3519914..ab1636988 100644 --- a/community_usecase/OWL Interview Preparation Assistant/main.py +++ b/community_usecase/OWL Interview Preparation Assistant/main.py @@ -65,7 +65,7 @@ def limited_step(*args, **kwargs): logger.info(f"Reached round limit of {round_limit}, forcibly terminating.") # Force a TASK_DONE in the user response to trigger termination result = original_step(*args, **kwargs) - if len(result) >= 2 and hasattr(result[1], 'msgs') and result[1].msgs and len(result[1].msgs) > 0: + if len(result) >= 2 and hasattr(result[1], 'msgs') and result[1].msgs: result[1].msgs[0].content += "\n\nTASK_DONE" result[1].terminated = True return result @@ -332,4 +332,4 @@ def create_interview_prep_plan( print(f"Answer: {result['answer']}") print(f"Generated files: {result['generated_files']}") print(f"Execution time: {result['duration_seconds']:.2f} seconds") - print(f"Conversation rounds: {len(result['chat_history'])}") \ No newline at end of file + print(f"Conversation rounds: {len(result['chat_history'])}")