Skip to content

Commit 9d5fd24

Browse files
authored
feat: plugin input type add select and custom var (labring#2571)
* feat: plugin input type add select and custom var * fix * fix ui * fix * fix
1 parent 903f39f commit 9d5fd24

File tree

29 files changed

+577
-353
lines changed

29 files changed

+577
-353
lines changed

packages/global/core/workflow/node/constant.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export enum FlowNodeInputTypeEnum { // render ui
1515

1616
// special input
1717
selectApp = 'selectApp',
18+
customVariable = 'customVariable',
1819

1920
// ai model select
2021
selectLLMModel = 'selectLLMModel',
@@ -44,7 +45,7 @@ export const FlowNodeInputMap: Record<
4445
icon: 'core/workflow/inputType/numberInput'
4546
},
4647
[FlowNodeInputTypeEnum.select]: {
47-
icon: 'core/workflow/inputType/input'
48+
icon: 'core/workflow/inputType/option'
4849
},
4950
[FlowNodeInputTypeEnum.switch]: {
5051
icon: 'core/workflow/inputType/switch'
@@ -79,8 +80,11 @@ export const FlowNodeInputMap: Record<
7980
[FlowNodeInputTypeEnum.hidden]: {
8081
icon: 'core/workflow/inputType/select'
8182
},
83+
[FlowNodeInputTypeEnum.customVariable]: {
84+
icon: 'core/workflow/inputType/customVariable'
85+
},
8286
[FlowNodeInputTypeEnum.custom]: {
83-
icon: 'core/workflow/inputType/select'
87+
icon: 'core/workflow/inputType/custom'
8488
}
8589
};
8690

packages/global/core/workflow/utils.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,17 @@ export const pluginData2FlowNodeIO = ({
173173
const pluginOutput = nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginOutput);
174174

175175
return {
176-
inputs: pluginInput
177-
? pluginInput.inputs.map((item) => ({
178-
...item,
179-
...getModuleInputUiField(item),
180-
value: getOrInitModuleInputValue(item),
181-
canEdit: false
182-
}))
183-
: [],
176+
inputs:
177+
pluginInput?.inputs.map((item) => ({
178+
...item,
179+
...getModuleInputUiField(item),
180+
value: getOrInitModuleInputValue(item),
181+
canEdit: false,
182+
renderTypeList:
183+
item.renderTypeList[0] === FlowNodeInputTypeEnum.customVariable
184+
? [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.input]
185+
: item.renderTypeList
186+
})) || [],
184187
outputs: pluginOutput
185188
? [
186189
...pluginOutput.inputs.map((item) => ({

packages/web/components/common/Icon/constants.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ export const iconPaths = {
88
collectionLight: () => import('./icons/collectionLight.svg'),
99
collectionSolid: () => import('./icons/collectionSolid.svg'),
1010
'common/add2': () => import('./icons/common/add2.svg'),
11-
'common/setting': () => import('./icons/common/setting.svg'),
12-
'common/addUser': () => import('./icons/common/addUser.svg'),
13-
'common/monitor': () => import('./icons/common/monitor.svg'),
14-
'common/list': () => import('./icons/common/list.svg'),
1511
'common/addCircleLight': () => import('./icons/common/addCircleLight.svg'),
1612
'common/addLight': () => import('./icons/common/addLight.svg'),
13+
'common/addUser': () => import('./icons/common/addUser.svg'),
14+
'common/arrowLeft': () => import('./icons/common/arrowLeft.svg'),
1715
'common/backFill': () => import('./icons/common/backFill.svg'),
1816
'common/backLight': () => import('./icons/common/backLight.svg'),
1917
'common/check': () => import('./icons/common/check.svg'),
@@ -29,6 +27,7 @@ export const iconPaths = {
2927
'common/errorFill': () => import('./icons/common/errorFill.svg'),
3028
'common/file/move': () => import('./icons/common/file/move.svg'),
3129
'common/folderFill': () => import('./icons/common/folderFill.svg'),
30+
'common/folderImport': () => import('./icons/common/folderImport.svg'),
3231
'common/fullScreenLight': () => import('./icons/common/fullScreenLight.svg'),
3332
'common/gitFill': () => import('./icons/common/gitFill.svg'),
3433
'common/gitInlight': () => import('./icons/common/gitInlight.svg'),
@@ -41,12 +40,12 @@ export const iconPaths = {
4140
'common/language/en': () => import('./icons/common/language/en.svg'),
4241
'common/language/zh': () => import('./icons/common/language/zh.svg'),
4342
'common/leftArrowLight': () => import('./icons/common/leftArrowLight.svg'),
44-
'common/arrowLeft': () => import('./icons/common/arrowLeft.svg'),
4543
'common/lineChange': () => import('./icons/common/lineChange.svg'),
4644
'common/linkBlue': () => import('./icons/common/linkBlue.svg'),
47-
'common/folderImport': () => import('./icons/common/folderImport.svg'),
45+
'common/list': () => import('./icons/common/list.svg'),
4846
'common/loading': () => import('./icons/common/loading.svg'),
4947
'common/logLight': () => import('./icons/common/logLight.svg'),
48+
'common/monitor': () => import('./icons/common/monitor.svg'),
5049
'common/navbar/pluginFill': () => import('./icons/common/navbar/pluginFill.svg'),
5150
'common/navbar/pluginLight': () => import('./icons/common/navbar/pluginLight.svg'),
5251
'common/openai': () => import('./icons/common/openai.svg'),
@@ -67,6 +66,7 @@ export const iconPaths = {
6766
'common/searchLight': () => import('./icons/common/searchLight.svg'),
6867
'common/select': () => import('./icons/common/select.svg'),
6968
'common/selectLight': () => import('./icons/common/selectLight.svg'),
69+
'common/setting': () => import('./icons/common/setting.svg'),
7070
'common/settingLight': () => import('./icons/common/settingLight.svg'),
7171
'common/subtract': () => import('./icons/common/subtract.svg'),
7272
'common/text/t': () => import('./icons/common/text/t.svg'),
@@ -176,12 +176,16 @@ export const iconPaths = {
176176
'core/workflow/debugResult': () => import('./icons/core/workflow/debugResult.svg'),
177177
'core/workflow/edgeArrow': () => import('./icons/core/workflow/edgeArrow.svg'),
178178
'core/workflow/grout': () => import('./icons/core/workflow/grout.svg'),
179+
'core/workflow/inputType/customVariable': () =>
180+
import('./icons/core/workflow/inputType/customVariable.svg'),
179181
'core/workflow/inputType/dynamic': () => import('./icons/core/workflow/inputType/dynamic.svg'),
182+
'core/workflow/inputType/file': () => import('./icons/core/workflow/inputType/file.svg'),
180183
'core/workflow/inputType/input': () => import('./icons/core/workflow/inputType/input.svg'),
181184
'core/workflow/inputType/jsonEditor': () =>
182185
import('./icons/core/workflow/inputType/jsonEditor.svg'),
183186
'core/workflow/inputType/numberInput': () =>
184187
import('./icons/core/workflow/inputType/numberInput.svg'),
188+
'core/workflow/inputType/option': () => import('./icons/core/workflow/inputType/option.svg'),
185189
'core/workflow/inputType/reference': () =>
186190
import('./icons/core/workflow/inputType/reference.svg'),
187191
'core/workflow/inputType/select': () => import('./icons/core/workflow/inputType/select.svg'),
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 2 additions & 4 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)