@@ -570,10 +570,7 @@ async def _exec_select_conditions_to_pydantic(
570
570
raise e
571
571
return None
572
572
573
- async def get_prompts_with_output (self , prompt_ids : List [str ]) -> List [GetPromptWithOutputsRow ]:
574
- if not prompt_ids :
575
- return []
576
-
573
+ async def get_prompts_with_output (self , workpace_id : str ) -> List [GetPromptWithOutputsRow ]:
577
574
sql = text (
578
575
"""
579
576
SELECT
@@ -587,12 +584,11 @@ async def get_prompts_with_output(self, prompt_ids: List[str]) -> List[GetPrompt
587
584
o.output_cost
588
585
FROM prompts p
589
586
LEFT JOIN outputs o ON p.id = o.prompt_id
590
- WHERE (p.id IN :prompt_ids)
587
+ WHERE p.workspace_id = :workspace_id
591
588
ORDER BY o.timestamp DESC
592
589
"""
593
- ).bindparams (bindparam ("prompt_ids" , expanding = True ))
594
-
595
- conditions = {"prompt_ids" : prompt_ids if prompt_ids else None }
590
+ )
591
+ conditions = {"workspace_id" : workpace_id }
596
592
prompts = await self ._exec_select_conditions_to_pydantic (
597
593
GetPromptWithOutputsRow , sql , conditions , should_raise = True
598
594
)
@@ -680,11 +676,7 @@ async def _exec_select_count(self, sql_command: str, conditions: dict) -> int:
680
676
return 0 # Return 0 in case of failure to avoid crashes
681
677
682
678
async def get_alerts_by_workspace (
683
- self ,
684
- workspace_id : str ,
685
- trigger_category : Optional [str ] = None ,
686
- limit : int = API_DEFAULT_PAGE_SIZE ,
687
- offset : int = 0 ,
679
+ self , workspace_id : str , trigger_category : Optional [str ] = None
688
680
) -> List [Alert ]:
689
681
sql = text (
690
682
"""
@@ -707,13 +699,12 @@ async def get_alerts_by_workspace(
707
699
sql = text (sql .text + " AND a.trigger_category = :trigger_category" )
708
700
conditions ["trigger_category" ] = trigger_category
709
701
710
- sql = text (sql .text + " ORDER BY a.timestamp DESC LIMIT :limit OFFSET :offset" )
711
- conditions ["limit" ] = limit
712
- conditions ["offset" ] = offset
702
+ sql = text (sql .text + " ORDER BY a.timestamp DESC" )
713
703
714
- return await self ._exec_select_conditions_to_pydantic (
704
+ prompts = await self ._exec_select_conditions_to_pydantic (
715
705
Alert , sql , conditions , should_raise = True
716
706
)
707
+ return prompts
717
708
718
709
async def get_workspaces (self ) -> List [WorkspaceWithSessionInfo ]:
719
710
sql = text (
0 commit comments