@@ -6,6 +6,7 @@ import VarReferencePicker from '../_base/components/variable/var-reference-picke
6
6
import Editor from '../_base/components/prompt/editor'
7
7
import ResultPanel from '../../run/result-panel'
8
8
import ConfigVision from '../_base/components/config-vision'
9
+ import { findVariableWhenOnLLMVision } from '../utils'
9
10
import useConfig from './use-config'
10
11
import type { ParameterExtractorNodeType } from './types'
11
12
import ExtractParameter from './components/extract-parameter/list'
@@ -21,6 +22,7 @@ import Tooltip from '@/app/components/base/tooltip'
21
22
import BeforeRunForm from '@/app/components/workflow/nodes/_base/components/before-run-form'
22
23
import { VarType } from '@/app/components/workflow/types'
23
24
import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse'
25
+ import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form'
24
26
25
27
const i18nPrefix = 'workflow.nodes.parameterExtractor'
26
28
const i18nCommonPrefix = 'workflow.common'
@@ -51,6 +53,7 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
51
53
handleReasoningModeChange,
52
54
availableVars,
53
55
availableNodesWithParent,
56
+ availableVisionVars,
54
57
inputVarValues,
55
58
varInputs,
56
59
isVisionModel,
@@ -63,10 +66,50 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
63
66
handleStop,
64
67
runResult,
65
68
setInputVarValues,
69
+ visionFiles,
70
+ setVisionFiles,
66
71
} = useConfig ( id , data )
67
72
68
73
const model = inputs . model
69
74
75
+ const singleRunForms = ( ( ) => {
76
+ const forms : FormProps [ ] = [ ]
77
+
78
+ forms . push (
79
+ {
80
+ label : t ( 'workflow.nodes.llm.singleRun.variable' ) ! ,
81
+ inputs : [ {
82
+ label : t ( `${ i18nPrefix } .inputVar` ) ! ,
83
+ variable : 'query' ,
84
+ type : InputVarType . paragraph ,
85
+ required : true ,
86
+ } , ...varInputs ] ,
87
+ values : inputVarValues ,
88
+ onChange : setInputVarValues ,
89
+ } ,
90
+ )
91
+
92
+ if ( isVisionModel && data . vision . enabled && data . vision . configs ?. variable_selector ) {
93
+ const currentVariable = findVariableWhenOnLLMVision ( data . vision . configs . variable_selector , availableVisionVars )
94
+
95
+ forms . push (
96
+ {
97
+ label : t ( 'workflow.nodes.llm.vision' ) ! ,
98
+ inputs : [ {
99
+ label : currentVariable ?. variable as any ,
100
+ variable : '#files#' ,
101
+ type : currentVariable ?. formType as any ,
102
+ required : false ,
103
+ } ] ,
104
+ values : { '#files#' : visionFiles } ,
105
+ onChange : keyValue => setVisionFiles ( ( keyValue as any ) [ '#files#' ] ) ,
106
+ } ,
107
+ )
108
+ }
109
+
110
+ return forms
111
+ } ) ( )
112
+
70
113
return (
71
114
< div className = 'pt-2' >
72
115
< div className = 'px-4 space-y-4' >
@@ -213,18 +256,7 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
213
256
< BeforeRunForm
214
257
nodeName = { inputs . title }
215
258
onHide = { hideSingleRun }
216
- forms = { [
217
- {
218
- inputs : [ {
219
- label : t ( `${ i18nPrefix } .inputVar` ) ! ,
220
- variable : 'query' ,
221
- type : InputVarType . paragraph ,
222
- required : true ,
223
- } , ...varInputs ] ,
224
- values : inputVarValues ,
225
- onChange : setInputVarValues ,
226
- } ,
227
- ] }
259
+ forms = { singleRunForms }
228
260
runningStatus = { runningStatus }
229
261
onRun = { handleRun }
230
262
onStop = { handleStop }
0 commit comments