mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-30 05:13:59 +08:00
Merge pull request #742 from xinnan-tech/web-vue-modify
fix:修复“模型配置编辑”功能
This commit is contained in:
@@ -99,18 +99,6 @@ const DEFAULT_CONFIG_JSON = {
|
|||||||
base_url: "",
|
base_url: "",
|
||||||
model_name: "",
|
model_name: "",
|
||||||
api_key: "",
|
api_key: "",
|
||||||
raw: {},
|
|
||||||
config: {
|
|
||||||
keyComparator: {},
|
|
||||||
ignoreError: false,
|
|
||||||
ignoreCase: false,
|
|
||||||
dateFormat: "",
|
|
||||||
ignoreNullValue: false,
|
|
||||||
transientSupport: false,
|
|
||||||
stripTrailingZeros: false,
|
|
||||||
checkDuplicate: false,
|
|
||||||
order: false
|
|
||||||
},
|
|
||||||
empty: false
|
empty: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -194,7 +182,7 @@ export default {
|
|||||||
isEnabled: false,
|
isEnabled: false,
|
||||||
docLink: "",
|
docLink: "",
|
||||||
remark: "",
|
remark: "",
|
||||||
sort: "",
|
sort: 0,
|
||||||
configJson: JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON))
|
configJson: JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON))
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -221,9 +209,8 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSave() {
|
handleSave() {
|
||||||
const provideCode = this.form.configJson.type;
|
const provideCode = this.form.configJson.type;
|
||||||
const { provider, ...restConfigJson } = this.form.configJson;
|
|
||||||
const formData = {
|
const formData = {
|
||||||
id: this.form.id,
|
id: this.modelData.id,
|
||||||
modelCode: this.form.modelCode,
|
modelCode: this.form.modelCode,
|
||||||
modelName: this.form.modelName,
|
modelName: this.form.modelName,
|
||||||
isDefault: this.form.isDefault ? 1 : 0,
|
isDefault: this.form.isDefault ? 1 : 0,
|
||||||
@@ -232,12 +219,7 @@ export default {
|
|||||||
remark: this.form.remark,
|
remark: this.form.remark,
|
||||||
sort: this.form.sort || 0,
|
sort: this.form.sort || 0,
|
||||||
configJson: {
|
configJson: {
|
||||||
...restConfigJson,
|
...this.form.configJson,
|
||||||
config: {
|
|
||||||
...restConfigJson.config,
|
|
||||||
ignoreError: !!restConfigJson.config?.ignoreError,
|
|
||||||
ignoreCase: !!restConfigJson.config?.ignoreCase,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$emit("save", { provideCode, formData });
|
this.$emit("save", { provideCode, formData });
|
||||||
@@ -249,7 +231,7 @@ export default {
|
|||||||
Api.model.getModelProviders(this.modelType, (data) => {
|
Api.model.getModelProviders(this.modelType, (data) => {
|
||||||
this.providers = data.map(item => ({
|
this.providers = data.map(item => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.providerCode
|
value: String(item.providerCode)
|
||||||
}));
|
}));
|
||||||
this.providersLoaded = true;
|
this.providersLoaded = true;
|
||||||
|
|
||||||
@@ -288,26 +270,21 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.form = {
|
this.form = {
|
||||||
id: model.id || "",
|
id: model.id,
|
||||||
modelType: model.modelType || "",
|
modelType: model.modelType,
|
||||||
modelCode: model.modelCode || "",
|
modelCode: model.modelCode,
|
||||||
modelName: model.modelName || "",
|
modelName: model.modelName,
|
||||||
isDefault: model.isDefault || 0,
|
isDefault: model.isDefault,
|
||||||
isEnabled: model.isEnabled || 0,
|
isEnabled: model.isEnabled,
|
||||||
docLink: model.docLink || "",
|
docLink: model.docLink,
|
||||||
remark: model.remark || "",
|
remark: model.remark,
|
||||||
sort: Number(model.sort) || 0,
|
sort: Number(model.sort) || 0,
|
||||||
configJson: {
|
configJson: {
|
||||||
...JSON.parse(JSON.stringify(DEFAULT_CONFIG_JSON)),
|
...DEFAULT_CONFIG_JSON,
|
||||||
...configJson,
|
...configJson
|
||||||
config: {
|
|
||||||
...DEFAULT_CONFIG_JSON.config,
|
|
||||||
...(configJson.config || {})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user