fix:修复了"模型配置"问题

This commit is contained in:
CGD
2025-04-12 22:53:41 +08:00
parent 5d69ba0796
commit e3928ffbcc
2 changed files with 25 additions and 26 deletions
@@ -94,14 +94,6 @@
<script>
import Api from '@/apis/api';
const DEFAULT_CONFIG_JSON = {
type: "",
base_url: "",
model_name: "",
api_key: "",
empty: false
};
export default {
name: "ModelEditDialog",
props: {
@@ -132,7 +124,7 @@ export default {
docLink: "",
remark: "",
sort: 0,
configJson: JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON))
configJson: {}
}
};
},
@@ -183,8 +175,11 @@ export default {
docLink: "",
remark: "",
sort: 0,
configJson: JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON))
configJson: {}
};
this.dynamicCallInfoFields.forEach(field => {
this.$set(this.form.configJson, field.prop, '');
});
},
resetProviders() {
this.providers = [];
@@ -266,6 +261,8 @@ export default {
this.dynamicCallInfoFields.forEach(field => {
if (!configJson.hasOwnProperty(field.prop)) {
configJson[field.prop] = '';
} else if (typeof configJson[field.prop] !== 'string') {
configJson[field.prop] = String(configJson[field.prop]);
}
});
@@ -280,7 +277,6 @@ export default {
remark: model.remark,
sort: Number(model.sort) || 0,
configJson: {
...DEFAULT_CONFIG_JSON,
...configJson
}
};