Skip to content

Commit

Permalink
Fixed new/save/execute_plan
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninoLorenzo committed Jul 2, 2024
1 parent 464d182 commit ef0bd3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ai-ops-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def new_session(self):
response.raise_for_status()

self.current_session = {'sid': response.json()['sid'], 'name': session_name}
self.chat()
self.chat(print_name=True)

def save_session(self):
"""Save the current session"""
Expand All @@ -87,7 +87,6 @@ def save_session(self):
self.console.print(f'[!] Failed: {response.status_code}')
else:
self.console.print(f'[+] Saved')
self.chat()

def rename_session(self):
"""Renames the current session"""
Expand All @@ -102,7 +101,7 @@ def rename_session(self):
)
response.raise_for_status()
self.current_session['name'] = session_name
self.chat()
self.chat(print_name=True)

def delete_session(self):
"""Deletes the current session"""
Expand Down Expand Up @@ -199,6 +198,8 @@ def execute_plan(self):
for task_str in resp.iter_content():
if task_str:
self.console.print(task_str.decode(), end='')
print()
self.chat()

def list_plans(self):
"""Retrieve the plans in the current session and
Expand Down
1 change: 1 addition & 0 deletions src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def new_session(name: str):
else:
new_id = max(sorted(sessions.keys())) + 1
agent.new_session(new_id)
agent.get_session(new_id).name = name

return {'sid': new_id}

Expand Down

0 comments on commit ef0bd3f

Please sign in to comment.