mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: enhance input handling for custom sources in form fields
--bug=1054775 --user=刘瑞斌 【应用编排】MCP调用节点,自定义工具参数建议支持选择数据类型 https://www.tapd.cn/57709429/s/1685483
This commit is contained in:
parent
c781c11d26
commit
f9cb0e24d6
|
|
@ -97,11 +97,24 @@
|
|||
</div>
|
||||
</template>
|
||||
<el-input
|
||||
v-if="item.source === 'custom'"
|
||||
v-if="item.source === 'custom' && item.input_type === 'TextInput'"
|
||||
v-model="form_data.tool_params[form_data.params_nested][item.label.label]"
|
||||
/>
|
||||
<el-input-number
|
||||
v-else-if="item.source === 'custom' && item.input_type === 'NumberInput'"
|
||||
v-model="form_data.tool_params[form_data.params_nested][item.label.label]"
|
||||
/>
|
||||
<el-switch
|
||||
v-else-if="item.source === 'custom' && item.input_type === 'SwitchInput'"
|
||||
v-model="form_data.tool_params[form_data.params_nested][item.label.label]"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="item.source === 'custom' && item.input_type === 'JsonInput'"
|
||||
v-model="form_data.tool_params[form_data.params_nested][item.label.label]"
|
||||
type="textarea"
|
||||
/>
|
||||
<NodeCascader
|
||||
v-else
|
||||
v-if="item.source === 'referencing'"
|
||||
ref="nodeCascaderRef2"
|
||||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
|
|
@ -148,11 +161,24 @@
|
|||
</div>
|
||||
</template>
|
||||
<el-input
|
||||
v-if="item.source === 'custom'"
|
||||
v-if="item.source === 'custom' && item.input_type === 'TextInput'"
|
||||
v-model="form_data.tool_params[item.label.label]"
|
||||
/>
|
||||
<el-input-number
|
||||
v-else-if="item.source === 'custom' && item.input_type === 'NumberInput'"
|
||||
v-model="form_data.tool_params[item.label.label]"
|
||||
/>
|
||||
<el-switch
|
||||
v-else-if="item.source === 'custom' && item.input_type === 'SwitchInput'"
|
||||
v-model="form_data.tool_params[item.label.label]"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="item.source === 'custom' && item.input_type === 'JsonInput'"
|
||||
v-model="form_data.tool_params[item.label.label]"
|
||||
type="textarea"
|
||||
/>
|
||||
<NodeCascader
|
||||
v-else
|
||||
v-if="item.source === 'referencing'"
|
||||
ref="nodeCascaderRef2"
|
||||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
|
|
@ -244,6 +270,19 @@ function changeTool() {
|
|||
if (params) {
|
||||
form_data.value.params_nested = item
|
||||
for (const item2 in params) {
|
||||
let input_type = 'TextInput'
|
||||
if (params[item2].type === 'string') {
|
||||
input_type = 'TextInput'
|
||||
} else if (params[item2].type === 'number') {
|
||||
input_type = 'NumberInput'
|
||||
} else if (params[item2].type === 'boolean') {
|
||||
input_type = 'SwitchInput'
|
||||
} else if (params[item2].type === 'array') {
|
||||
input_type = 'JsonInput'
|
||||
} else if (params[item2].type === 'object') {
|
||||
input_type = 'JsonInput'
|
||||
}
|
||||
console.log(params[item2])
|
||||
form_data.value.tool_form_field.push({
|
||||
field: item2,
|
||||
label: {
|
||||
|
|
@ -252,7 +291,7 @@ function changeTool() {
|
|||
attrs: { tooltip: params[item2].description },
|
||||
props_info: {}
|
||||
},
|
||||
input_type: 'TextInput',
|
||||
input_type: input_type,
|
||||
source: 'referencing',
|
||||
required: args_schema.properties[item].required?.indexOf(item2) !== -1,
|
||||
props_info: {
|
||||
|
|
@ -268,6 +307,19 @@ function changeTool() {
|
|||
}
|
||||
} else {
|
||||
form_data.value.params_nested = ''
|
||||
let input_type = 'TextInput'
|
||||
if (args_schema.properties[item].type === 'string') {
|
||||
input_type = 'TextInput'
|
||||
} else if (args_schema.properties[item].type === 'number') {
|
||||
input_type = 'NumberInput'
|
||||
} else if (args_schema.properties[item].type === 'boolean') {
|
||||
input_type = 'SwitchInput'
|
||||
} else if (args_schema.properties[item].type === 'array') {
|
||||
input_type = 'JsonInput'
|
||||
} else if (args_schema.properties[item].type === 'object') {
|
||||
input_type = 'JsonInput'
|
||||
}
|
||||
console.log(args_schema.properties[item]);
|
||||
form_data.value.tool_form_field.push({
|
||||
field: item,
|
||||
label: {
|
||||
|
|
@ -276,7 +328,7 @@ function changeTool() {
|
|||
attrs: { tooltip: args_schema.properties[item].description },
|
||||
props_info: {}
|
||||
},
|
||||
input_type: 'TextInput',
|
||||
input_type: input_type,
|
||||
source: 'referencing',
|
||||
required: args_schema.required?.indexOf(item) !== -1,
|
||||
props_info: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue