From 38c2b20e3d4cc0449c60bb71cc2e93d151d9c513 Mon Sep 17 00:00:00 2001 From: ypshidifu Date: Mon, 19 Oct 2026 12:18:37 +0800 Subject: [PATCH] =?UTF-8?q?tui.js=EF=BC=9A=E4=BF=AE=20/manage=20catalog=20?= =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E8=A7=A3=E5=8C=85=E2=80=94=E2=80=94models-de?= =?UTF-8?q?v:catalog=20=E5=A4=96=E5=B1=82=E6=98=AF=20{updatedAt,digest,bod?= =?UTF-8?q?y}=EF=BC=8Cbody=20=E6=89=8D=E6=98=AF=20provider=20JSON=EF=BC=9B?= =?UTF-8?q?=E6=AD=A4=E5=89=8D=E5=8F=AA=E8=A7=A3=E4=B8=80=E5=B1=82=E5=8F=AA?= =?UTF-8?q?=E6=8B=BF=E5=88=B03=E4=B8=AAkey=E8=87=B4=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E6=81=92=E7=A9=BA=EF=BC=88=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=AE=9E=E8=AF=81=20catalogProviders=3D3=20=E5=91=BD=E4=B8=AD[?= =?UTF-8?q?]=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tui-plugins/oc-session-all.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tui-plugins/oc-session-all.js b/tui-plugins/oc-session-all.js index 5269d04..54b31a1 100644 --- a/tui-plugins/oc-session-all.js +++ b/tui-plugins/oc-session-all.js @@ -508,7 +508,13 @@ async function openModelManager(context) { if (cat && cat.catalog && cat.credentials) { let body = {} try { - body = JSON.parse(cat.catalog) + // 坑:models-dev:catalog 的 value 是外层包装 {updatedAt, digest, body}, + // body 才是真正的 provider JSON 字符串(provider→models)——必须二次解包, + // 否则 Object.keys 只有 3 个(updatedAt/digest/body),循环命不中任何 provider。 + const outer = JSON.parse(cat.catalog) + if (outer && typeof outer.body === "string") body = JSON.parse(outer.body) + else if (outer && outer.body && typeof outer.body === "object") body = outer.body + else body = outer } catch (e) { log("[oc-session-all] /manage catalog body parse 失败: " + e.message) }