-
Notifications
You must be signed in to change notification settings - Fork 2.9k
【backup】feat: Add a new node empty-node as a placeholder node
#6203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
wangliang181230
wants to merge
1
commit into
1Panel-dev:v2
from
wangliang181230:PR/36-feat-addNewNode-emptyNode
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from .impl import BaseEmptyNode |
39 changes: 39 additions & 0 deletions
39
apps/application/flow/step_node/empty_node/i_empty_node.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # coding=utf-8 | ||
| """ | ||
| @project: MaxKB | ||
| @Author:AI Assistant | ||
| @file: i_empty_node.py | ||
| @date:2026/06/10 | ||
| @desc: 空节点接口定义 - 用于流程判断的ELSE分支占位 | ||
| """ | ||
| from typing import Type | ||
|
|
||
| from rest_framework import serializers | ||
|
|
||
| from application.flow.common import WorkflowMode | ||
| from application.flow.i_step_node import INode, NodeResult | ||
|
|
||
|
|
||
| class EmptyNodeParamsSerializer(serializers.Serializer): | ||
| """空节点参数序列化器 - 无需任何参数""" | ||
|
|
||
| def is_valid(self, *, raise_exception=False): | ||
| # 空节点不需要验证任何参数,直接返回 True | ||
| return True | ||
|
|
||
|
|
||
| class IEmptyNode(INode): | ||
| """空节点接口""" | ||
| type = 'empty-node' | ||
| support = [WorkflowMode.APPLICATION, WorkflowMode.APPLICATION_LOOP, WorkflowMode.KNOWLEDGE_LOOP, | ||
| WorkflowMode.KNOWLEDGE, WorkflowMode.TOOL, WorkflowMode.TOOL_LOOP] | ||
|
|
||
| def get_node_params_serializer_class(self) -> Type[serializers.Serializer]: | ||
| return EmptyNodeParamsSerializer | ||
|
|
||
| def _run(self): | ||
| return self.execute() | ||
|
|
||
| def execute(self, **kwargs) -> NodeResult: | ||
| """执行空节点 - 不产生任何输出""" | ||
| return NodeResult({}, {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from .base_empty_node import BaseEmptyNode |
37 changes: 37 additions & 0 deletions
37
apps/application/flow/step_node/empty_node/impl/base_empty_node.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # coding=utf-8 | ||
| """ | ||
| @project: MaxKB | ||
| @Author:AI Assistant | ||
| @file: base_empty_node.py | ||
| @date:2026/06/10 | ||
| @desc: 空节点实现 - 用于流程判断的ELSE分支占位 | ||
| """ | ||
| from application.flow.i_step_node import NodeResult | ||
| from application.flow.step_node.empty_node.i_empty_node import IEmptyNode | ||
|
|
||
|
|
||
| class BaseEmptyNode(IEmptyNode): | ||
| """空节点实现类""" | ||
|
|
||
| def save_context(self, details, workflow_manage): | ||
| """保存上下文 - 空节点无需保存任何内容""" | ||
| self.context['exception_message'] = details.get('err_message') | ||
|
|
||
| def execute(self, **kwargs) -> NodeResult: | ||
| """ | ||
| 执行空节点 | ||
| 空节点不产生任何输出,仅作为流程占位符 | ||
| """ | ||
| return NodeResult({}, {}) | ||
|
|
||
| def get_details(self, index: int, **kwargs): | ||
| """获取节点执行详情""" | ||
| return { | ||
| 'name': self.node.properties.get('stepName'), | ||
| "index": index, | ||
| 'run_time': self.context.get('run_time'), | ||
| 'type': self.node.type, | ||
| 'status': self.status, | ||
| 'err_message': self.err_message, | ||
| 'enableException': self.node.properties.get('enableException'), | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <template> | ||
| <el-avatar shape="square" style="background: #9CA3AF"> | ||
| <img src="@/assets/workflow/icon_empty.svg" style="width: 75%" alt="" /> | ||
| </el-avatar> | ||
| </template> | ||
| <script setup lang="ts"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import EmptyNodeVue from './index.vue' | ||
| import { AppNode, AppNodeModel } from '@/workflow/common/app-node' | ||
|
|
||
| class EmptyNode extends AppNode { | ||
| constructor(props: any) { | ||
| super(props, EmptyNodeVue) | ||
| } | ||
| } | ||
|
|
||
| export default { | ||
| type: 'empty-node', | ||
| model: AppNodeModel, | ||
| view: EmptyNode | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
顺便优化:移除节点左侧标题的宽度
width: 69%,固定右侧按钮的宽度(注:使用min-width更保险)使左侧标题能够显示出更多字来。