Skip to content

Commit

Permalink
Update monitor.py
Browse files Browse the repository at this point in the history
Clearing should be about clearing all conversations, not restricting the deletion of only certain ones.
  • Loading branch information
zh19990906 authored Sep 24, 2024
1 parent ed53fcd commit 6e61554
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/backend/base/langflow/api/v1/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ async def get_messages(

@router.delete("/messages", status_code=204)
async def delete_messages(
message_ids: list[UUID],
message_ids: list[UUID] | None,
flow_id: str | None = Query(None),
session: Session = Depends(get_session),
current_user: User = Depends(get_current_active_user),
):
try:
session.exec(delete(MessageTable).where(MessageTable.id.in_(message_ids))) # type: ignore
if flow_id:
session.exec(delete(MessageTable).where(MessageTable.flow_id == flow_id))
else:
session.exec(delete(MessageTable).where(MessageTable.id.in_(message_ids))) # type: ignore
session.commit()
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
Expand Down

0 comments on commit 6e61554

Please sign in to comment.