Skip to content

Commit b0731f4

Browse files
authored
Merge pull request m-cmp#156 from GreenScreen410/add-missed-function
fix: add method to delete all chat sessions
2 parents 0d1f76a + 81efcff commit b0731f4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • python/insight/app/api/log_analysis/utils

python/insight/app/api/log_analysis/utils/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ def delete_chat_session(self, path: SessionIdPath):
6262
else:
6363
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Session Not Found")
6464

65+
def delete_all_chat_sessions(self):
66+
sessions = self.repo.delete_all_sessions()
67+
if sessions:
68+
return [self.map_session_to_res(session) for session in sessions]
69+
else:
70+
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="No Sessions Found")
71+
6572
async def get_chat_session_history(self, path: SessionIdPath):
6673
session_id = path.sessionId
6774
session_info = self.repo.get_session_by_id(session_id)

0 commit comments

Comments
 (0)