diff --git a/docs/demo/v1/observability-panel.js b/docs/demo/v1/observability-panel.js index 5831a75..ba9415e 100644 --- a/docs/demo/v1/observability-panel.js +++ b/docs/demo/v1/observability-panel.js @@ -88,6 +88,11 @@ async function fetchJson(url, options = {}) { return data; } +function isLocalHost() { + const h = globalThis.location?.hostname ?? ""; + return h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h === ""; +} + export function initObservabilityPanel({ root, mount, @@ -98,6 +103,7 @@ export function initObservabilityPanel({ /** Start with body collapsed (v2/v3 compact companions). */ defaultCollapsed = false, } = {}) { + if (!isLocalHost()) return null; const host = mount ?? root?.querySelector("[data-nr-observability]"); if (!host) return null; diff --git a/docs/demo/v5/script-runner.js b/docs/demo/v5/script-runner.js index 7c8f0f2..b8e67b7 100644 --- a/docs/demo/v5/script-runner.js +++ b/docs/demo/v5/script-runner.js @@ -518,7 +518,13 @@ function isRunnerStep(stepId, skipSteps) { return !skipSteps.has(stepId); } +function isLocalHost() { + const h = globalThis.location?.hostname ?? ""; + return h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h === ""; +} + async function checkProxyHealth(proxyUrl) { + if (!isLocalHost()) return "offline"; try { const health = await fetchJson(`${proxyUrl}/api/health`, { signal: AbortSignal.timeout(8_000), diff --git a/tests/demo-scenario-consistency.spec.ts b/tests/demo-scenario-consistency.spec.ts index 8add420..1fb2dac 100644 --- a/tests/demo-scenario-consistency.spec.ts +++ b/tests/demo-scenario-consistency.spec.ts @@ -206,7 +206,7 @@ test.describe('demo scenario consistency', () => { expect(stepDBefore.yamlPanel?.title).toContain('direct MaaS'); const snippet = stepDBefore.yamlPanel?.snippet ?? ''; expect(snippet).toContain('maas-direct'); - expect(snippet).toContain('inference.local → MaaS'); + expect(snippet).toContain('inference.local → GW → MaaS'); expect(snippet).not.toContain('maas-guardrailed'); expect(stepDBefore.yamlPanel?.defaultOpen).toBe(false); });