This repository was archived by the owner on Jun 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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
390390
391391 try :
392392 alerts = await dbreader .get_alerts_by_workspace (ws .id , AlertSeverity .CRITICAL .value )
393- alerts = v1_processing .remove_duplicate_alerts (alerts )
394393 prompts_outputs = await dbreader .get_prompts_with_output (ws .id )
395394 return await v1_processing .parse_get_alert_conversation (alerts , prompts_outputs )
396395 except Exception :
Original file line number Diff line number Diff line change @@ -392,7 +392,8 @@ async def match_conversations(
392392 qa = _get_question_answer_from_partial (selected_partial_qa )
393393 qa .question .message = parse_question_answer (qa .question .message )
394394 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 )
396397 token_usage_agg .add_model_token_usage (selected_partial_qa .model_token_usage )
397398
398399 # only add conversation if we have some answers
@@ -480,10 +481,11 @@ async def parse_get_alert_conversation(
480481 The rows contain the raw request and output strings from the pipeline.
481482 """
482483 _ , map_q_id_to_conversation = await parse_messages_in_conversations (prompts_outputs )
484+ dedup_alerts = await remove_duplicate_alerts (alerts )
483485 async with asyncio .TaskGroup () as tg :
484486 tasks = [
485487 tg .create_task (parse_row_alert_conversation (row , map_q_id_to_conversation ))
486- for row in alerts
488+ for row in dedup_alerts
487489 ]
488490 return [task .result () for task in tasks if task .result () is not None ]
489491
@@ -501,7 +503,7 @@ async def parse_workspace_token_usage(
501503 return token_usage_agg
502504
503505
504- def remove_duplicate_alerts (alerts ) :
506+ async def remove_duplicate_alerts (alerts : List [ v1_models . Alert ]) -> List [ v1_models . Alert ] :
505507 unique_alerts = []
506508 seen = defaultdict (list )
507509
You can’t perform that action at this time.
0 commit comments