mirror of
https://github.com/dataforcanada/d4c-service-geo-assistant.git
synced 2026-06-13 14:31:01 +02:00
Fix frontend and api state handling (#11)
* Fix frontend and api state handling * Increase timeout to 6 mins * Fix test
This commit is contained in:
@@ -94,6 +94,8 @@ async def stream_chat(
|
|||||||
payload = update[agent]
|
payload = update[agent]
|
||||||
if "place" not in payload: # TODO: why is this needed?
|
if "place" not in payload: # TODO: why is this needed?
|
||||||
payload["place"] = None
|
payload["place"] = None
|
||||||
|
if "search_area" not in payload: # TODO: why is this needed?
|
||||||
|
payload["search_area"] = None
|
||||||
state_payload = GeoAssistantState(**payload)
|
state_payload = GeoAssistantState(**payload)
|
||||||
|
|
||||||
resp = ChatResponse(thread_id=str(thread_id), state=state_payload)
|
resp = ChatResponse(thread_id=str(thread_id), state=state_payload)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ def stream_chat(user_message: str):
|
|||||||
"agent_state_input": {
|
"agent_state_input": {
|
||||||
"messages": [{"type": "human", "content": user_message}],
|
"messages": [{"type": "human", "content": user_message}],
|
||||||
"place": None,
|
"place": None,
|
||||||
|
"search_area": None,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ def stream_chat(user_message: str):
|
|||||||
"POST",
|
"POST",
|
||||||
f"{API_BASE_URL}/chat",
|
f"{API_BASE_URL}/chat",
|
||||||
json=request_body,
|
json=request_body,
|
||||||
timeout=60.0,
|
timeout=360.0,
|
||||||
) as response:
|
) as response:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ async def test_hello_world(initialized_app):
|
|||||||
"agent_state_input": {
|
"agent_state_input": {
|
||||||
"messages": [{"content": "Hello, world!", "type": "human"}],
|
"messages": [{"content": "Hello, world!", "type": "human"}],
|
||||||
"place": None,
|
"place": None,
|
||||||
|
"search_area": None,
|
||||||
},
|
},
|
||||||
"thread_id": str(thread_id),
|
"thread_id": str(thread_id),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user