refactor estimation service to use structured agent
This commit is contained in:
parent
47cc1541ed
commit
96421b264c
7 changed files with 316 additions and 361 deletions
|
|
@ -26,7 +26,7 @@ class SessionService:
|
|||
"""List available agents from talestorm-ai"""
|
||||
async with await self.get_client() as client:
|
||||
try:
|
||||
response = await client.get("/agents/")
|
||||
response = await client.get("/agents")
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
else:
|
||||
|
|
@ -57,12 +57,11 @@ class SessionService:
|
|||
"""Create a new chat session in talestorm-ai"""
|
||||
async with await self.get_client() as client:
|
||||
if not agent_id:
|
||||
if self.agent_id:
|
||||
agent_id = self.agent_id
|
||||
else:
|
||||
agent_id = settings.TALESTORM_AGENT_ID
|
||||
# Use the default agent ID for backward compatibility
|
||||
agent_id = self.agent_id or settings.TALESTORM_AGENT_ID
|
||||
|
||||
response = await client.post("/sessions/", params={"agent_id": agent_id})
|
||||
print(response.request.url)
|
||||
session_data = response.json()
|
||||
return str(session_data["id"])
|
||||
|
||||
|
|
@ -82,7 +81,7 @@ class SessionService:
|
|||
"""List all sessions from talestorm-ai"""
|
||||
async with await self.get_client() as client:
|
||||
try:
|
||||
response = await client.get("/sessions/")
|
||||
response = await client.get("/sessions")
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
return []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue