(() => { const badges = Array.from(document.querySelectorAll(".global-mode-hint")); if (!badges.length) return; function setText(text) { badges.forEach((el) => { el.textContent = text; }); } async function run() { try { const res = await fetch("/api/auth/me"); const data = await res.json(); if (!res.ok || !data || !data.logged_in) return; const vip = data.vip || {}; const now = Math.floor(Date.now() / 1000); const enabled = Boolean(vip.vip_enabled); const hasActiveSubscription = Number(vip.cycle_started_at || 0) > 0 && Number(vip.cycle_expires_at || 0) > now; const activeModel = data.active_ai_model || {}; const hasSelfModel = Boolean(String(activeModel.api_key || "").trim()) && Boolean(String(activeModel.model || "").trim()); const hasTrialCredits = Number(vip.total_available_credits || 0) > 0; if (enabled && hasActiveSubscription) { setText("当前模型模式:平台模型"); } else if (enabled && !hasSelfModel && hasTrialCredits) { setText("当前模型模式:平台模型(体验版)"); } else { setText("当前模型模式:自由模型"); } } catch { // ignore } } run(); })();