Skip to content

Commit

Permalink
Delete message evaluations on chat delete (#3424)
Browse files Browse the repository at this point in the history
  • Loading branch information
someone13574 authored Jun 13, 2023
1 parent c25f2a8 commit fff7272
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ async def delete_chat(self, chat_id: str) -> models.DbChat:
message_ids = [message.id for message in chat.messages]
# delete reports associated with messages
await self.session.exec(sqlmodel.delete(models.DbReport).where(models.DbReport.message_id.in_(message_ids)))
# delete message evaluations associated with message
await self.session.exec(
sqlmodel.delete(models.DbMessageEval).where(models.DbMessageEval.selected_message_id.in_(message_ids))
)
# delete messages
await self.session.exec(sqlmodel.delete(models.DbMessage).where(models.DbMessage.chat_id == chat_id))
# delete chat
Expand Down

0 comments on commit fff7272

Please sign in to comment.