From e08bb05899e9d97b8ebaa4536827bd7b7ee7efe6 Mon Sep 17 00:00:00 2001 From: Marc Vilanova <39573146+mvilanova@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:16:20 -0700 Subject: [PATCH] Checks if the message is a dict before saving it to the genai analysis field in the case model (#5357) --- src/dispatch/plugins/dispatch_slack/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dispatch/plugins/dispatch_slack/plugin.py b/src/dispatch/plugins/dispatch_slack/plugin.py index dd93e2c22c7a..e2968d94cd48 100644 --- a/src/dispatch/plugins/dispatch_slack/plugin.py +++ b/src/dispatch/plugins/dispatch_slack/plugin.py @@ -107,7 +107,9 @@ def create_threaded(self, case: Case, conversation_id: str, db_session: Session) client=client, config=self.configuration, ) - if message: + if message and isinstance(message, dict): + # we update the genai_analysis field in the case model with the message if it's a dict + # if the message is a string, it means there was an error generating the analysis case.genai_analysis = message if message_blocks: