feat(config): 模型 vision 缺省改 true——现在模型基本都带视觉
- normalizePlatforms/旧格式迁移两处判定 === true → !== false(显式配 vision: false 才关) - 设置页新建平台/加模型行的「图片输入」勾选默认开;新增行保存极性翻转: 勾上靠缺省不落键,取消勾选显式写 vision: false(否则键省略解析成 true,幽灵回勾) - 已有行显示/diff 不受影响:effective 视图经规范化,vision 恒 bool,无冗余键注入 - README/ARCHITECTURE 配置说明同步
This commit is contained in:
@@ -171,7 +171,7 @@ function migrateLegacyModels(models) {
|
||||
byKey.set(gk, p);
|
||||
groups.push(p);
|
||||
}
|
||||
p.models.push({ id: m.id, display_name: m.display_name || m.id, vision: m.vision === true });
|
||||
p.models.push({ id: m.id, display_name: m.display_name || m.id, vision: m.vision !== false });
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ function normalizePlatforms(rawPlatforms, profileNames) {
|
||||
models.push({
|
||||
id: String(m.id),
|
||||
display_name: m.display_name ? String(m.display_name) : String(m.id), // 缺省 = id
|
||||
vision: m.vision === true, // 支持时 read_file 读图会回传图片内容
|
||||
vision: m.vision !== false, // 缺省支持(现在模型基本都带视觉);不支持时配 vision: false 显式关——关后 read_file 读图不回传像素
|
||||
enable: m.enable !== false, // 选填,默认启用;禁用后不进模型池,不参与分配/绑定(重启生效)
|
||||
// 选填:模型特有的请求体参数对象。发往上游时整体合并进 body 顶层。
|
||||
extra_params: (m.extra_params && typeof m.extra_params === 'object' && !Array.isArray(m.extra_params)) ? m.extra_params : {},
|
||||
|
||||
@@ -1155,7 +1155,7 @@
|
||||
$('mpe-title').textContent = add ? '新增平台' : '编辑平台';
|
||||
$('mpe-name').value = add ? '' : (p.name || '');
|
||||
$('mpe-url').value = add ? '' : (p.url || '');
|
||||
if (add) { pfEdit.keys.push({ ref: null, api_key: '' }); pfEdit.models.push({ ref: null, id: '', vision: false, enable: true }); }
|
||||
if (add) { pfEdit.keys.push({ ref: null, api_key: '' }); pfEdit.models.push({ ref: null, id: '', vision: true, enable: true }); }
|
||||
$('mpe-del-btn').classList.toggle('hidden', add);
|
||||
renderPfRows();
|
||||
$('model-edit-modal').classList.remove('hidden');
|
||||
@@ -1191,7 +1191,7 @@
|
||||
$('mpe-models').innerHTML = pfEdit.models.map(pfModelsRowHtml).join('') || '<div class="model-group-empty">至少保留一个模型</div>';
|
||||
}
|
||||
function addPfKey() { if (!pfEdit) return; pfEdit.keys.push({ ref: null, api_key: '' }); renderPfRows(); }
|
||||
function addPfModel() { if (!pfEdit) return; pfEdit.models.push({ ref: null, id: '', vision: false, enable: true }); renderPfRows(); }
|
||||
function addPfModel() { if (!pfEdit) return; pfEdit.models.push({ ref: null, id: '', vision: true, enable: true }); renderPfRows(); }
|
||||
function delPfKey(i) {
|
||||
if (!pfEdit) return;
|
||||
if (pfEdit.keys.length <= 1) return toast('至少保留一个 Key');
|
||||
@@ -1244,7 +1244,7 @@
|
||||
} else {
|
||||
const id = String(r.id || '').trim();
|
||||
const nv = { id };
|
||||
if (r.vision) nv.vision = true;
|
||||
if (r.vision === false) nv.vision = false; // 后端缺省已改 true:勾上靠缺省不落键,取消勾选必须显式写 false
|
||||
if (r.enable === false) nv.enable = false;
|
||||
edits.push({ op: 'append', path: ['platforms', pfEdit.idx, 'models'], value: nv });
|
||||
}
|
||||
@@ -1278,7 +1278,7 @@
|
||||
models: pfEdit.models.map(r => {
|
||||
const id = String(r.id).trim();
|
||||
const nv = { id };
|
||||
if (r.vision) nv.vision = true;
|
||||
if (r.vision === false) nv.vision = false; // 同上:缺省 true,只在取消勾选时显式落键
|
||||
if (r.enable === false) nv.enable = false;
|
||||
return nv;
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user