This repository was archived by the owner on Jun 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -390,7 +390,6 @@ async def get_workspace_alerts(workspace_name: str) -> List[Optional[v1_models.A
390
390
391
391
try :
392
392
alerts = await dbreader .get_alerts_by_workspace (ws .id , AlertSeverity .CRITICAL .value )
393
- alerts = v1_processing .remove_duplicate_alerts (alerts )
394
393
prompts_outputs = await dbreader .get_prompts_with_output (ws .id )
395
394
return await v1_processing .parse_get_alert_conversation (alerts , prompts_outputs )
396
395
except Exception :
Original file line number Diff line number Diff line change @@ -392,7 +392,8 @@ async def match_conversations(
392
392
qa = _get_question_answer_from_partial (selected_partial_qa )
393
393
qa .question .message = parse_question_answer (qa .question .message )
394
394
questions_answers .append (qa )
395
- alerts .extend (selected_partial_qa .alerts )
395
+ deduped_alerts = await remove_duplicate_alerts (selected_partial_qa .alerts )
396
+ alerts .extend (deduped_alerts )
396
397
token_usage_agg .add_model_token_usage (selected_partial_qa .model_token_usage )
397
398
398
399
# only add conversation if we have some answers
@@ -480,10 +481,11 @@ async def parse_get_alert_conversation(
480
481
The rows contain the raw request and output strings from the pipeline.
481
482
"""
482
483
_ , map_q_id_to_conversation = await parse_messages_in_conversations (prompts_outputs )
484
+ dedup_alerts = await remove_duplicate_alerts (alerts )
483
485
async with asyncio .TaskGroup () as tg :
484
486
tasks = [
485
487
tg .create_task (parse_row_alert_conversation (row , map_q_id_to_conversation ))
486
- for row in alerts
488
+ for row in dedup_alerts
487
489
]
488
490
return [task .result () for task in tasks if task .result () is not None ]
489
491
@@ -501,7 +503,7 @@ async def parse_workspace_token_usage(
501
503
return token_usage_agg
502
504
503
505
504
- def remove_duplicate_alerts (alerts ) :
506
+ async def remove_duplicate_alerts (alerts : List [ v1_models . Alert ]) -> List [ v1_models . Alert ] :
505
507
unique_alerts = []
506
508
seen = defaultdict (list )
507
509
You can’t perform that action at this time.
0 commit comments