mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
fix:修复“模型配置编辑”功能
This commit is contained in:
parent
835c9deb28
commit
5882dec23a
1 changed files with 54 additions and 77 deletions
|
|
@ -99,18 +99,6 @@ const DEFAULT_CONFIG_JSON = {
|
|||
base_url: "",
|
||||
model_name: "",
|
||||
api_key: "",
|
||||
raw: {},
|
||||
config: {
|
||||
keyComparator: {},
|
||||
ignoreError: false,
|
||||
ignoreCase: false,
|
||||
dateFormat: "",
|
||||
ignoreNullValue: false,
|
||||
transientSupport: false,
|
||||
stripTrailingZeros: false,
|
||||
checkDuplicate: false,
|
||||
order: false
|
||||
},
|
||||
empty: false
|
||||
};
|
||||
|
||||
|
|
@ -194,7 +182,7 @@ export default {
|
|||
isEnabled: false,
|
||||
docLink: "",
|
||||
remark: "",
|
||||
sort: "",
|
||||
sort: 0,
|
||||
configJson: JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON))
|
||||
};
|
||||
},
|
||||
|
|
@ -221,9 +209,8 @@ export default {
|
|||
},
|
||||
handleSave() {
|
||||
const provideCode = this.form.configJson.type;
|
||||
const { provider, ...restConfigJson } = this.form.configJson;
|
||||
const formData = {
|
||||
id: this.form.id,
|
||||
id: this.modelData.id,
|
||||
modelCode: this.form.modelCode,
|
||||
modelName: this.form.modelName,
|
||||
isDefault: this.form.isDefault ? 1 : 0,
|
||||
|
|
@ -232,12 +219,7 @@ export default {
|
|||
remark: this.form.remark,
|
||||
sort: this.form.sort || 0,
|
||||
configJson: {
|
||||
...restConfigJson,
|
||||
config: {
|
||||
...restConfigJson.config,
|
||||
ignoreError: !!restConfigJson.config?.ignoreError,
|
||||
ignoreCase: !!restConfigJson.config?.ignoreCase,
|
||||
}
|
||||
...this.form.configJson,
|
||||
}
|
||||
};
|
||||
this.$emit("save", { provideCode, formData });
|
||||
|
|
@ -249,7 +231,7 @@ export default {
|
|||
Api.model.getModelProviders(this.modelType, (data) => {
|
||||
this.providers = data.map(item => ({
|
||||
label: item.name,
|
||||
value: item.providerCode
|
||||
value: String(item.providerCode)
|
||||
}));
|
||||
this.providersLoaded = true;
|
||||
|
||||
|
|
@ -288,26 +270,21 @@ export default {
|
|||
});
|
||||
|
||||
this.form = {
|
||||
id: model.id || "",
|
||||
modelType: model.modelType || "",
|
||||
modelCode: model.modelCode || "",
|
||||
modelName: model.modelName || "",
|
||||
isDefault: model.isDefault || 0,
|
||||
isEnabled: model.isEnabled || 0,
|
||||
docLink: model.docLink || "",
|
||||
remark: model.remark || "",
|
||||
id: model.id,
|
||||
modelType: model.modelType,
|
||||
modelCode: model.modelCode,
|
||||
modelName: model.modelName,
|
||||
isDefault: model.isDefault,
|
||||
isEnabled: model.isEnabled,
|
||||
docLink: model.docLink,
|
||||
remark: model.remark,
|
||||
sort: Number(model.sort) || 0,
|
||||
configJson: {
|
||||
...JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON)),
|
||||
...configJson,
|
||||
config: {
|
||||
...DEFAULT_CONFIG_JSON.config,
|
||||
...(configJson.config || {})
|
||||
}
|
||||
...DEFAULT_CONFIG_JSON,
|
||||
...configJson
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue