From 7f078a3c4966987a9639387701c7c89e5143d45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=B4=E5=A4=A9?= Date: Fri, 15 May 2026 18:54:13 +0800 Subject: [PATCH] fix(ui): import term tooltip helpers in config pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gateway 配置页和模型配置页都会在 label 中渲染术语帮助按钮,并在页面渲染后调用 tooltip 绑定逻辑。 这两个页面之前引用了 termHelpHtml / attachTermTooltips,但没有导入对应 helper,导致 Gateway 配置页加载配置后直接抛出 ReferenceError,页面停在加载失败状态。 ## 修复 - Gateway 配置页补充 term-tooltip helper import - 模型配置页补充同一 helper import,避免进入编辑服务商弹窗时触发同类运行时错误 ## 验证 - npm run build:PASS --- src/pages/gateway.js | 1 + src/pages/models.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/pages/gateway.js b/src/pages/gateway.js index 39f4859..9f29e95 100644 --- a/src/pages/gateway.js +++ b/src/pages/gateway.js @@ -6,6 +6,7 @@ import { toast } from '../components/toast.js' import { humanizeError } from '../lib/humanize-error.js' import { tryShowEngagement } from '../components/engagement.js' import { t } from '../lib/i18n.js' +import { termHelpHtml, attachTermTooltips } from '../lib/term-tooltip.js' // 兼容新版 SecretRef:token 可能是 string 或 { $env: "VAR" } / { $ref: "x/y" } function _tokenDisplayStr(token) { diff --git a/src/pages/models.js b/src/pages/models.js index f085694..e30ccb6 100644 --- a/src/pages/models.js +++ b/src/pages/models.js @@ -10,6 +10,7 @@ import { icon, statusIcon } from '../lib/icons.js' import { API_TYPES, PROVIDER_PRESETS, QTCOOL, MODEL_PRESETS, fetchQtcoolModels } from '../lib/model-presets.js' import { t } from '../lib/i18n.js' import { scheduleGatewayRestart, fireRestartNow, cancelPendingRestart, onRestartState } from '../lib/gateway-restart-queue.js' +import { termHelpHtml, attachTermTooltips } from '../lib/term-tooltip.js' // HTML 转义,防止错误信息中的特殊字符破坏页面或被注入 function escapeHtml(str) {