Skip to content

Commit

Permalink
Feat: get all sessions and session by id endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
manthanguptaa committed Sep 19, 2024
1 parent 7e5ed79 commit c99ef1e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions phi/playground/playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@ def agent_chat(body: AgentRunRequest):
run_response = cast(RunResponse, agent.run(body.message, stream=False))
return run_response.model_dump_json()

@playground_routes.post("/agent/sessions/all")
def get_agent_sessions():
session_data = []
for agent in self.agents:
session_data.append(agent.get_session_data())
return session_data

@playground_routes.post("/agent/sessions/{session_id}")
def get_agent_session(session_id):
for agent in self.agents:
if agent.session_id == session_id:
return agent.get_session_data()
return JSONResponse(status=404, content=f"couldn't find {session_id} session")

@playground_routes.post("/agent/rename")
def agent_rename(body: AgentRenameRequest):
for agent in self.agents:
Expand Down

0 comments on commit c99ef1e

Please sign in to comment.