97
97
</div >
98
98
</template >
99
99
<el-input
100
- v-if =" item.source === 'custom'"
100
+ v-if =" item.source === 'custom' && item.input_type === 'TextInput' "
101
101
v-model =" form_data.tool_params[form_data.params_nested][item.label.label]"
102
102
/>
103
+ <el-input-number
104
+ v-else-if =" item.source === 'custom' && item.input_type === 'NumberInput'"
105
+ v-model =" form_data.tool_params[form_data.params_nested][item.label.label]"
106
+ />
107
+ <el-switch
108
+ v-else-if =" item.source === 'custom' && item.input_type === 'SwitchInput'"
109
+ v-model =" form_data.tool_params[form_data.params_nested][item.label.label]"
110
+ />
111
+ <el-input
112
+ v-else-if =" item.source === 'custom' && item.input_type === 'JsonInput'"
113
+ v-model =" form_data.tool_params[form_data.params_nested][item.label.label]"
114
+ type =" textarea"
115
+ />
103
116
<NodeCascader
104
- v-else
117
+ v-if = " item.source === 'referencing' "
105
118
ref =" nodeCascaderRef2"
106
119
:nodeModel =" nodeModel"
107
120
class =" w-full"
148
161
</div >
149
162
</template >
150
163
<el-input
151
- v-if =" item.source === 'custom'"
164
+ v-if =" item.source === 'custom' && item.input_type === 'TextInput'"
165
+ v-model =" form_data.tool_params[item.label.label]"
166
+ />
167
+ <el-input-number
168
+ v-else-if =" item.source === 'custom' && item.input_type === 'NumberInput'"
169
+ v-model =" form_data.tool_params[item.label.label]"
170
+ />
171
+ <el-switch
172
+ v-else-if =" item.source === 'custom' && item.input_type === 'SwitchInput'"
173
+ v-model =" form_data.tool_params[item.label.label]"
174
+ />
175
+ <el-input
176
+ v-else-if =" item.source === 'custom' && item.input_type === 'JsonInput'"
152
177
v-model =" form_data.tool_params[item.label.label]"
178
+ type =" textarea"
153
179
/>
154
180
<NodeCascader
155
- v-else
181
+ v-if = " item.source === 'referencing' "
156
182
ref =" nodeCascaderRef2"
157
183
:nodeModel =" nodeModel"
158
184
class =" w-full"
@@ -244,6 +270,19 @@ function changeTool() {
244
270
if (params ) {
245
271
form_data .value .params_nested = item
246
272
for (const item2 in params ) {
273
+ let input_type = ' TextInput'
274
+ if (params [item2 ].type === ' string' ) {
275
+ input_type = ' TextInput'
276
+ } else if (params [item2 ].type === ' number' ) {
277
+ input_type = ' NumberInput'
278
+ } else if (params [item2 ].type === ' boolean' ) {
279
+ input_type = ' SwitchInput'
280
+ } else if (params [item2 ].type === ' array' ) {
281
+ input_type = ' JsonInput'
282
+ } else if (params [item2 ].type === ' object' ) {
283
+ input_type = ' JsonInput'
284
+ }
285
+ console .log (params [item2 ])
247
286
form_data .value .tool_form_field .push ({
248
287
field: item2 ,
249
288
label: {
@@ -252,7 +291,7 @@ function changeTool() {
252
291
attrs: { tooltip: params [item2 ].description },
253
292
props_info: {}
254
293
},
255
- input_type: ' TextInput ' ,
294
+ input_type: input_type ,
256
295
source: ' referencing' ,
257
296
required: args_schema .properties [item ].required ?.indexOf (item2 ) !== - 1 ,
258
297
props_info: {
@@ -268,6 +307,19 @@ function changeTool() {
268
307
}
269
308
} else {
270
309
form_data .value .params_nested = ' '
310
+ let input_type = ' TextInput'
311
+ if (args_schema .properties [item ].type === ' string' ) {
312
+ input_type = ' TextInput'
313
+ } else if (args_schema .properties [item ].type === ' number' ) {
314
+ input_type = ' NumberInput'
315
+ } else if (args_schema .properties [item ].type === ' boolean' ) {
316
+ input_type = ' SwitchInput'
317
+ } else if (args_schema .properties [item ].type === ' array' ) {
318
+ input_type = ' JsonInput'
319
+ } else if (args_schema .properties [item ].type === ' object' ) {
320
+ input_type = ' JsonInput'
321
+ }
322
+ console .log (args_schema .properties [item ]);
271
323
form_data .value .tool_form_field .push ({
272
324
field: item ,
273
325
label: {
@@ -276,7 +328,7 @@ function changeTool() {
276
328
attrs: { tooltip: args_schema .properties [item ].description },
277
329
props_info: {}
278
330
},
279
- input_type: ' TextInput ' ,
331
+ input_type: input_type ,
280
332
source: ' referencing' ,
281
333
required: args_schema .required ?.indexOf (item ) !== - 1 ,
282
334
props_info: {
0 commit comments