pyspur icon indicating copy to clipboard operation
pyspur copied to clipboard

feat: add get_node_title_output_map function to map node titles to ou…

Open srijanpatel opened this issue 9 months ago • 0 comments

This pull request includes changes to the backend/pyspur/api/workflow_run.py file to improve the handling of node outputs in workflow runs. The primary focus is on refactoring the code to use a new helper function for mapping node titles to their outputs.

Refactoring and code simplification:

  • Added import for BaseNodeOutput in backend/pyspur/api/workflow_run.py to support the new helper function.
  • Introduced the get_node_title_output_map function to create a dictionary mapping node titles to their outputs.
  • Updated async def run_workflow_blocking_v2 to use the new get_node_title_output_map function, simplifying the code for creating the outputs dictionary. [1] [2]
  • Modified async def run_workflow_blocking to use the new helper function for setting the outputs.
  • Updated async def run_workflow_task and _handle_pause_exception to use the get_node_title_output_map function, ensuring consistency in how outputs are handled. [1] [2]

[!IMPORTANT] Introduces get_node_title_output_map for mapping node titles to outputs and updates frontend to use UUIDs for node IDs and readable titles.

  • Backend Changes:
    • Added get_node_title_output_map in workflow_run.py to map node titles to outputs.
    • Updated run_workflow_blocking_v2, run_workflow_blocking, run_workflow_task, and _handle_pause_exception to use get_node_title_output_map.
  • Frontend Changes:
    • Updated createDynamicGroupNodeWithChildren in groupNodeUtils.ts to use UUIDs for node IDs and readable titles.
    • Modified addToolToAgent and duplicateNode in flowSlice.ts to generate readable titles and use UUIDs for IDs.
    • Updated createNodeAtCenter and duplicateNode in flowUtils.tsx to use UUIDs for IDs and generate readable titles.

This description was created by Ellipsis for 544201d3419b049b5de8099303427abd0cdd0d86. It will automatically update as commits are pushed.

srijanpatel avatar Mar 19 '25 19:03 srijanpatel