From b2a9275bbece2504ba56bf7fa4b49da6174d831a Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 7 Mar 2025 10:54:14 -0600 Subject: [PATCH 1/2] add agent metrics --- src/lib/helpers/store.js | 11 +++++ src/lib/helpers/types/pluginTypes.js | 1 + src/routes/VerticalLayout/Index.svelte | 17 +++---- src/routes/page/agent/+page.svelte | 14 +++--- .../agent-components/agent-utility.svelte | 36 ++++++++------- src/routes/page/agent/metrics/+page.svelte | 45 +++++++++++++++++++ svelte.config.js | 1 + 7 files changed, 93 insertions(+), 32 deletions(-) create mode 100644 src/routes/page/agent/metrics/+page.svelte diff --git a/src/lib/helpers/store.js b/src/lib/helpers/store.js index 4d886565..075d677b 100644 --- a/src/lib/helpers/store.js +++ b/src/lib/helpers/store.js @@ -20,6 +20,17 @@ const createGlobalEventStore = () => { export const globalEventStore = createGlobalEventStore(); +/** @type {Writable} */ +const createGlobalMenuStore = () => { + const { set, subscribe } = writable([]); + return { + set, + subscribe + }; +} + +export const globalMenuStore = createGlobalMenuStore(); + /** @type {Writable} */ export const userStore = writable({ id: "", full_name: "", expires: 0, token: null }); diff --git a/src/lib/helpers/types/pluginTypes.js b/src/lib/helpers/types/pluginTypes.js index 4727cec9..0e8fcc78 100644 --- a/src/lib/helpers/types/pluginTypes.js +++ b/src/lib/helpers/types/pluginTypes.js @@ -16,6 +16,7 @@ * @property {string} label * @property {string} icon * @property {string} link + * @property {string?} [iFrameUrl] * @property {boolean} isHeader */ diff --git a/src/routes/VerticalLayout/Index.svelte b/src/routes/VerticalLayout/Index.svelte index 3bb24bf4..1bc6ea9a 100644 --- a/src/routes/VerticalLayout/Index.svelte +++ b/src/routes/VerticalLayout/Index.svelte @@ -1,18 +1,18 @@ + + + + +{#if iFrameUrl} + + + + + + + + + +{/if} \ No newline at end of file diff --git a/svelte.config.js b/svelte.config.js index 03780c3c..08d6f844 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -49,6 +49,7 @@ const config = { "/page/agent", "/page/agent/router", "/page/agent/evaluator", + "/page/agent/metrics", "/page/agent/[agentId]", "/page/agent/[agentId]/build", "/page/agent/[agentId]/train", From 51dc51752b54b4b60603db50cd79bd577812c2f0 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 7 Mar 2025 10:59:35 -0600 Subject: [PATCH 2/2] rename --- src/lib/helpers/types/pluginTypes.js | 2 +- src/routes/page/agent/metrics/+page.svelte | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/helpers/types/pluginTypes.js b/src/lib/helpers/types/pluginTypes.js index 0e8fcc78..9f13826f 100644 --- a/src/lib/helpers/types/pluginTypes.js +++ b/src/lib/helpers/types/pluginTypes.js @@ -16,7 +16,7 @@ * @property {string} label * @property {string} icon * @property {string} link - * @property {string?} [iFrameUrl] + * @property {string?} [embedUrl] * @property {boolean} isHeader */ diff --git a/src/routes/page/agent/metrics/+page.svelte b/src/routes/page/agent/metrics/+page.svelte index 81a85029..d00f5d96 100644 --- a/src/routes/page/agent/metrics/+page.svelte +++ b/src/routes/page/agent/metrics/+page.svelte @@ -8,12 +8,12 @@ import { globalMenuStore } from '$lib/helpers/store'; /** @type {string} */ - let iFrameUrl = ''; + let embedUrl = ''; const unsubscriber = globalMenuStore.subscribe((/** @type {import('$pluginTypes').PluginMenuDefModel[]} */ menu) => { const url = $page.url.pathname; const pageInfo = menu.find(x => x.link === url) || null; - iFrameUrl = pageInfo?.iFrameUrl || ''; + embedUrl = pageInfo?.embedUrl || ''; }); onDestroy(() => { @@ -24,7 +24,7 @@ -{#if iFrameUrl} +{#if embedUrl} @@ -33,7 +33,7 @@ title="agent-metrics" height="100%" width="100%" - src={iFrameUrl} + src={embedUrl} frameborder="0" allowfullscreen >