fix issue
This commit is contained in:
parent
e478ae95f2
commit
18c934b983
@ -20,9 +20,16 @@
|
|||||||
<el-switch v-else-if="property.type === 'boolean'" active-text="true" inactive-text="false"
|
<el-switch v-else-if="property.type === 'boolean'" active-text="true" inactive-text="false"
|
||||||
v-model="tabStorage.formData[name]" />
|
v-model="tabStorage.formData[name]" />
|
||||||
|
|
||||||
|
<el-input-tag
|
||||||
|
v-else-if="property.type === 'array'"
|
||||||
|
v-model="tabStorage.formData[name]"
|
||||||
|
:placeholder="property.description || t('enter') + ' ' + (property.title || name) + ' (逗号分隔)'"
|
||||||
|
/>
|
||||||
|
|
||||||
<k-input-object v-else-if="property.type === 'object'" v-model="tabStorage.formData[name]"
|
<k-input-object v-else-if="property.type === 'object'" v-model="tabStorage.formData[name]"
|
||||||
:schema="property"
|
:schema="property"
|
||||||
:placeholder="property.description || t('enter') + ' ' + (property.title || name)" />
|
:placeholder="property.description || t('enter') + ' ' + (property.title || name)" />
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -38,7 +45,6 @@
|
|||||||
{{ 'mook' }}
|
{{ 'mook' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
|
|
||||||
<el-popover placement="top" width="350" trigger="click" v-model:visible="aiPromptVisible">
|
<el-popover placement="top" width="350" trigger="click" v-model:visible="aiPromptVisible">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button :loading="aiMockLoading" :disabled="loading || aiMockLoading || mockLoading">
|
<el-button :loading="aiMockLoading" :disabled="loading || aiMockLoading || mockLoading">
|
||||||
@ -150,7 +156,8 @@ const initFormData = () => {
|
|||||||
|
|
||||||
Object.entries(currentTool.value.inputSchema.properties).forEach(([name, property]) => {
|
Object.entries(currentTool.value.inputSchema.properties).forEach(([name, property]) => {
|
||||||
newSchemaDataForm[name] = getDefaultValue(property);
|
newSchemaDataForm[name] = getDefaultValue(property);
|
||||||
const originType = normaliseJavascriptType(typeof tabStorage.formData[name]);
|
const rawType = Array.isArray(tabStorage.formData[name]) ? 'array' : typeof tabStorage.formData[name];
|
||||||
|
const originType = normaliseJavascriptType(rawType);
|
||||||
|
|
||||||
if (tabStorage.formData[name] !== undefined && originType === property.type) {
|
if (tabStorage.formData[name] !== undefined && originType === property.type) {
|
||||||
newSchemaDataForm[name] = tabStorage.formData[name];
|
newSchemaDataForm[name] = tabStorage.formData[name];
|
||||||
@ -300,4 +307,9 @@ watch(() => tabStorage.currentToolName, () => {
|
|||||||
transform: scale(0.95);
|
transform: scale(0.95);
|
||||||
transition: transform 0.08s;
|
transition: transform 0.08s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tag.el-tag--info {
|
||||||
|
background-color: var(--main-color);
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
@ -11,6 +11,8 @@ export function getDefaultValue(property: TypeAble): any {
|
|||||||
return false;
|
return false;
|
||||||
} else if (property.type === 'object') {
|
} else if (property.type === 'object') {
|
||||||
return {};
|
return {};
|
||||||
|
} else if (property.type === 'array') {
|
||||||
|
return [];
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -26,6 +28,8 @@ export function normaliseJavascriptType(type: string) {
|
|||||||
return 'boolean';
|
return 'boolean';
|
||||||
case 'string':
|
case 'string':
|
||||||
return 'string';
|
return 'string';
|
||||||
|
case 'array':
|
||||||
|
return 'array';
|
||||||
default:
|
default:
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user