Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/fixing-lint-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Oct 18, 2024
2 parents 2fc9e59 + a9a382b commit 1b5c6f7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/dispatch/plugins/dispatch_slack/case/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,18 @@ def create_genai_signal_analysis_message(
"""
)
message = json.loads(
response["choices"][0]["message"]["content"]
.replace("```json", "")
.replace("```", "")
.strip()
)

try:
message = json.loads(
response["choices"][0]["message"]["content"]
.replace("```json", "")
.replace("```", "")
.strip()
)
except json.JSONDecodeError as e:
message = "Unable to generate GenAI signal analysis. Error decoding response from the artificial-intelligence plugin."
log.warning(f"{message} Error: {e}")
return message, create_genai_signal_message_metadata_blocks(signal_metadata_blocks, message)

# we check if the response is empty
if not message:
Expand Down

0 comments on commit 1b5c6f7

Please sign in to comment.