File tree 2 files changed +11
-14
lines changed
web/app/components/workflow/nodes/tool
2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -61,20 +61,12 @@ const InputVarList: FC<Props> = ({
61
61
const newValue = produce ( value , ( draft : ToolVarInputs ) => {
62
62
const target = draft [ variable ]
63
63
if ( target ) {
64
- if ( ! isSupportConstantValue || varKindType === VarKindType . variable ) {
65
- if ( isSupportConstantValue )
66
- target . type = VarKindType . variable
67
-
68
- target . value = varValue as ValueSelector
69
- }
70
- else {
71
- target . type = VarKindType . constant
72
- target . value = varValue as string
73
- }
64
+ target . type = varKindType
65
+ target . value = varValue
74
66
}
75
67
else {
76
68
draft [ variable ] = {
77
- type : VarKindType . variable ,
69
+ type : varKindType ,
78
70
value : varValue ,
79
71
}
80
72
}
@@ -173,7 +165,7 @@ const InputVarList: FC<Props> = ({
173
165
value = { varInput ?. type === VarKindType . constant ? ( varInput ?. value || '' ) : ( varInput ?. value || [ ] ) }
174
166
onChange = { handleNotMixedTypeChange ( variable ) }
175
167
onOpen = { handleOpen ( index ) }
176
- defaultVarKindType = { isNumber ? VarKindType . constant : VarKindType . variable }
168
+ defaultVarKindType = { varInput ?. type || ( isNumber ? VarKindType . constant : VarKindType . variable ) }
177
169
isSupportConstantValue = { isSupportConstantValue }
178
170
filterVar = { isNumber ? filterVar : undefined }
179
171
availableVars = { isSelect ? availableVars : undefined }
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
132
132
draft . tool_parameters = { }
133
133
} )
134
134
setInputs ( inputsWithDefaultValue )
135
- // eslint-disable-next-line react-hooks/exhaustive-deps
135
+ // eslint-disable-next-line react-hooks/exhaustive-deps
136
136
} , [ currTool ] )
137
137
138
138
// setting when call
@@ -214,8 +214,13 @@ const useConfig = (id: string, payload: ToolNodeType) => {
214
214
. map ( k => inputs . tool_parameters [ k ] )
215
215
216
216
const varInputs = getInputVars ( hadVarParams . map ( ( p ) => {
217
- if ( p . type === VarType . variable )
217
+ if ( p . type === VarType . variable ) {
218
+ // handle the old wrong value not crash the page
219
+ if ( ! ( p . value as any ) . join )
220
+ return `{{#${ p . value } #}}`
221
+
218
222
return `{{#${ ( p . value as ValueSelector ) . join ( '.' ) } #}}`
223
+ }
219
224
220
225
return p . value as string
221
226
} ) )
You can’t perform that action at this time.
0 commit comments