🐛 (chat.py): fix issue where end_all_traces method was not being called correctly with the required arguments

💡 (chat.py): improve error handling by passing error message to end_all_traces method and ensure it is called with the correct arguments
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-06-20 17:59:39 -03:00
commit 3cba1380de

View file

@ -202,7 +202,7 @@ async def build_vertex(
logs = {output_label: Log(message=message, type="error")}
result_data_response = ResultDataResponse(results={}, logs=logs)
artifacts = {}
graph.end_all_traces(outputs=message)
background_tasks.add_task(graph.end_all_traces, error=message["errorMessage"])
# If there's an error building the vertex
# we need to clear the cache
await chat_service.clear_cache(flow_id_str)
@ -240,7 +240,7 @@ async def build_vertex(
next_runnable_vertices = [graph.stop_vertex]
if not next_runnable_vertices:
graph.end_all_traces()
background_tasks.add_task(graph.end_all_traces)
build_response = VertexBuildResponse(
inactivated_vertices=inactivated_vertices,