🐛 fix(chat.py): fix node to vertex variable name in stream_build function
✨ feat(chat.py): add progress logging to stream_build function The variable node was renamed to vertex to improve semantics and consistency with the naming conventions. Progress logging was added to the stream_build function to provide feedback to the user on the progress of the build process. 🐛 fix(index.tsx): fix typo in setSuccessData function call ✨ feat(index.tsx): add success logging to handleBuild function A typo in the setSuccessData function call was fixed. Success logging was added to the handleBuild function to provide feedback to the user on the success of the build process.
This commit is contained in:
parent
98f3c708e4
commit
825f2798c3
2 changed files with 21 additions and 9 deletions
|
|
@ -87,10 +87,16 @@ async def stream_build(flow_id: str):
|
|||
|
||||
logger.debug("Building langchain object")
|
||||
graph = Graph.from_payload(graph_data)
|
||||
for node in graph.generator_build():
|
||||
number_of_nodes = len(graph.nodes)
|
||||
for i, vertex in enumerate(graph.generator_build(), 1):
|
||||
try:
|
||||
node.build()
|
||||
params = node._built_object_repr()
|
||||
log_dict = {
|
||||
"log": f"Building node {vertex.vertex_type}",
|
||||
"progress": round(i / number_of_nodes, 2),
|
||||
}
|
||||
yield f"data: {json.dumps(log_dict)}\n\n"
|
||||
vertex.build()
|
||||
params = vertex._built_object_repr()
|
||||
valid = True
|
||||
logger.debug(
|
||||
f"Building node {params[:50]}{'...' if len(params) > 50 else ''}"
|
||||
|
|
@ -103,7 +109,7 @@ async def stream_build(flow_id: str):
|
|||
{
|
||||
"valid": valid,
|
||||
"params": params,
|
||||
"id": node.id,
|
||||
"id": vertex.id,
|
||||
}
|
||||
)
|
||||
yield f"data: {response}\n\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue