Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/demo/v1/observability-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions docs/demo/v5/script-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion tests/demo-scenario-consistency.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
Loading