mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
fix: 缓存开关仅 qwen/豆包显示,消除 openai provider 的按钮泄漏
缓存字段挂在共享的 openai provider 上,导致智谱/DeepSeek/讯飞/LMStudio/ 火山网关等所有 openai 兼容模型都带出了「是否开启缓存」按钮,但它们并不支持。 ModelEditDialog.vue / AddModelDialog.vue:openai provider 下 cache 字段仅当 base_url 含 aliyuncs(即 qwen)时渲染;豆包走 doubao_cache provider,不受影响。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
330d3a20ca
commit
1516820dfe
2 changed files with 36 additions and 14 deletions
|
|
@ -143,7 +143,15 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
dynamicCallInfoFields() {
|
dynamicCallInfoFields() {
|
||||||
return this.providerFields;
|
// 缓存开关仅 qwen(aliyuncs) 显示;豆包走 doubao_cache provider,不在此过滤
|
||||||
|
const baseUrl = (this.formData.configJson && this.formData.configJson.base_url) || "";
|
||||||
|
const supplier = this.formData.supplier;
|
||||||
|
return this.providerFields.filter((f) => {
|
||||||
|
if (f.prop === "cache" && supplier === "openai") {
|
||||||
|
return String(baseUrl).includes("aliyuncs");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
chunkedCallInfoFields() {
|
chunkedCallInfoFields() {
|
||||||
const chunkSize = 2;
|
const chunkSize = 2;
|
||||||
|
|
|
||||||
|
|
@ -324,19 +324,33 @@ export default {
|
||||||
(p) => p.providerCode === providerCode
|
(p) => p.providerCode === providerCode
|
||||||
);
|
);
|
||||||
if (provider) {
|
if (provider) {
|
||||||
this.dynamicCallInfoFields = JSON.parse(provider.fields || "[]").map((f) => ({
|
const baseUrl =
|
||||||
label: f.label,
|
(this.pendingModelData &&
|
||||||
prop: f.key,
|
this.pendingModelData.configJson &&
|
||||||
type:
|
this.pendingModelData.configJson.base_url) ||
|
||||||
f.type === "dict"
|
this.form.configJson.base_url ||
|
||||||
? "json-textarea"
|
"";
|
||||||
: f.type === "boolean"
|
this.dynamicCallInfoFields = JSON.parse(provider.fields || "[]")
|
||||||
? "boolean"
|
.map((f) => ({
|
||||||
: f.type === "password"
|
label: f.label,
|
||||||
? "password"
|
prop: f.key,
|
||||||
: "text",
|
type:
|
||||||
placeholder: `请输入${f.key}`,
|
f.type === "dict"
|
||||||
}));
|
? "json-textarea"
|
||||||
|
: f.type === "boolean"
|
||||||
|
? "boolean"
|
||||||
|
: f.type === "password"
|
||||||
|
? "password"
|
||||||
|
: "text",
|
||||||
|
placeholder: `请输入${f.key}`,
|
||||||
|
}))
|
||||||
|
.filter((f) => {
|
||||||
|
// 缓存开关仅 qwen(aliyuncs) 显示;豆包走 doubao_cache provider,不在此过滤
|
||||||
|
if (f.prop === "cache" && providerCode === "openai") {
|
||||||
|
return String(baseUrl).includes("aliyuncs");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
if (this.pendingModelData && this.pendingProviderType === providerCode) {
|
if (this.pendingModelData && this.pendingProviderType === providerCode) {
|
||||||
this.processModelData(this.pendingModelData);
|
this.processModelData(this.pendingModelData);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue