🐛 fix(chat.py): change event name from "node" to "message" in stream_build function
The event name was changed from "node" to "message" to better reflect the nature of the data being sent. The data being sent is a message response from the server, not a node in the graph.
This commit is contained in:
parent
0a1ceba765
commit
d3d33162e8
1 changed files with 2 additions and 2 deletions
|
|
@ -118,14 +118,14 @@ async def stream_build(flow_id: str):
|
||||||
"progress": round(i / number_of_nodes, 2),
|
"progress": round(i / number_of_nodes, 2),
|
||||||
}
|
}
|
||||||
|
|
||||||
yield str(StreamData(event="node", data=response))
|
yield str(StreamData(event="message", data=response))
|
||||||
|
|
||||||
chat_manager.set_cache(flow_id, graph.build())
|
chat_manager.set_cache(flow_id, graph.build())
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error("Error while building the flow: %s", exc)
|
logger.error("Error while building the flow: %s", exc)
|
||||||
yield str(StreamData(event="error", data={"error": str(exc)}))
|
yield str(StreamData(event="error", data={"error": str(exc)}))
|
||||||
finally:
|
finally:
|
||||||
yield str(StreamData(event="end", data=final_response))
|
yield str(StreamData(event="message", data=final_response))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return StreamingResponse(event_stream(flow_id), media_type="text/event-stream")
|
return StreamingResponse(event_stream(flow_id), media_type="text/event-stream")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue