Stores GenAI case analysis in JSON format in the database while preserving format on the Slack side #5300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several changes to enhance the
Case
model and improve the handling of GenAI signal analysis messages in the Slack plugin. The most significant updates include adding a new JSONB column to theCase
model, updating the Alembic migration script, and modifying the Slack plugin to handle JSON responses for GenAI analysis.Enhancements to
Case
Model:genai_analysis
column of typeJSONB
to theCase
model, with default values and non-null constraints (src/dispatch/case/models.py
).CaseRead
schema to include thegenai_analysis
field (src/dispatch/case/models.py
).Alembic Migration:
genai_analysis
column in thecase
table (src/dispatch/database/revisions/tenant/versions/2024-10-08_b057c079c2d5.py
).Slack Plugin Enhancements:
json_to_slack_format
to convert JSON dictionaries to Slack markup format (src/dispatch/plugins/dispatch_slack/case/messages.py
) [1] [2].create_genai_signal_analysis_message
function to return a tuple containing the GenAI analysis message and Slack message blocks (src/dispatch/plugins/dispatch_slack/case/messages.py
) [1] [2] [3] [4] [5].create_threaded
method to store the GenAI analysis message in thegenai_analysis
field of theCase
model (src/dispatch/plugins/dispatch_slack/plugin.py
).These changes collectively improve the data structure and processing of GenAI analysis within the case management and Slack communication workflows.