Project Refactoring
Image/Model
When modifying, ensure that no nodes using the Image/Model are overlooked.
Tip
Make good use of global search.
Pipeline
Sub Node
Here, nodes with the deprecated is_sub
value set to true
are referred to as sub nodes
.
Refactoring sub nodes
involves the following steps:
- Determine whether the
sub node
is of the lowest priority in thenext
list of the current node (i.e., directly moving it to theinterrupt
list of the current node has no impact on the actual effect). - If the
sub node
is not of the lowest priority, the refactoring method is to add thenext
andinterrupt
of the current node to thesub node
(if the originalnext
andinterrupt
are empty, this can be done directly; otherwise, consider potential conflicts). If thesub node
is of the lowest priority, the refactoring method is to directly move it to theinterrupt
of the current node. - If the
sub node
is not of the lowest priority and the changes in step 2 cause conflicts, reconsider the task logic. - Remove the
is_sub
attribute from thesub node
.
Warning
All the above changes must consider all nodes using the sub node
. Do not overlook any!
Other Nodes
Next, refactor other nodes based on their specific purposes.
Standardizing Node Names
If the goal is merely to standardize node names, use VSCode’s global search and replace functionality.
However, ensure that replacements include double quotes to avoid modifying other nodes containing the node name.
Simplifying Task Flows and Reducing Coupling
First, read Node Connections and refactor towards adhering to connection principles.
Some nodes can be moved to the interrupt
of the ancestor node of the current node.
After moving, remove unnecessary next
nodes to avoid continuing the main task chain in the interrupt
, which could cause errors in subsequent tasks and return to the ancestor node.
Merging Nodes with Similar Functions
If multiple nodes perform the same function, consider merging them into a single node.
Steps:
- Before merging, check whether there are unrelated nodes in the
next
of the node. If so, separate them first. - During merging, all nodes should adopt the same standardized name.
- After merging, check whether the node’s position in all tasks is correct. For example, ensure nodes that should be in the
interrupt
are not in the main task chain’snext
section.