Skip to content

Commit

Permalink
Fix: delete session and load session
Browse files Browse the repository at this point in the history
- delete session previously deleted the current session, now requires to specify the id of the session to delete.
- load session request used current session id to load a session even if it required to specify an id.
  • Loading branch information
antoninoLorenzo committed Nov 25, 2024
1 parent dd49c22 commit cbcb7a5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ai_ops_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,16 @@ def rename_session(self):
self.chat(print_name=True)

def delete_session(self):
"""Deletes the current session"""
"""Deletes a session"""
session_id = Prompt.ask(
'Enter session ID',
console=self.console
)
if not session_id.isdigit():
self.console.print('[-] Not a number', style='bold red')

response = self.client.delete(
f'{self.api_url}/sessions/{self.current_session["sid"]}'
f'{self.api_url}/sessions/{session_id}'
)
response.raise_for_status()
body = response.json()
Expand Down Expand Up @@ -182,8 +189,7 @@ def load_session(self):
self.load_session()

response = self.client.get(
f'{self.api_url}/sessions/{self.current_session["sid"]}/chat',
params={'sid': int(session_id)}
f'{self.api_url}/sessions/{int(session_id)}/chat',
)
response.raise_for_status()

Expand Down

0 comments on commit cbcb7a5

Please sign in to comment.