From eb6f78eea5a02385db325255f40d63744fbcf40b Mon Sep 17 00:00:00 2001 From: wadhia-yash Date: Mon, 22 Jul 2024 13:43:43 +0530 Subject: [PATCH 1/9] fix(Notify): Added email input to notify the user once the indexing is completed --- .../components/chat/ChatIntroduction.svelte | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/web/src/lib/components/chat/ChatIntroduction.svelte b/web/src/lib/components/chat/ChatIntroduction.svelte index cfac8f0c..91050134 100644 --- a/web/src/lib/components/chat/ChatIntroduction.svelte +++ b/web/src/lib/components/chat/ChatIntroduction.svelte @@ -7,6 +7,8 @@ export let agentLogo: string = ""; export let agentIsDataSourceIndexed: boolean = true; + let emailValue: string = ""; + const questionnaires: Array<{ id: string; message: string; @@ -41,6 +43,22 @@ }, }, ]; + + async function notify() { + try { + const response = await fetch("", { + method: "POST", + body: "", + headers: { + "Content-Type": "application/json", + }, + }); + + await response.json(); + } catch (error) { + console.log("error", error); + } + }
@@ -76,13 +94,14 @@
- {#if !agentIsDataSourceIndexed} + {#if agentIsDataSourceIndexed}
- Data source is currently being indexed. Please visit us again later. Thank you for your patience. + Data source is currently being indexed. Please visit us + again later. Thank you for your patience.

+
+ + +
{/if}
From fcd30c80c89b58f2d9f783136685d5596720dbcf Mon Sep 17 00:00:00 2001 From: wadhia-yash Date: Mon, 22 Jul 2024 13:46:24 +0530 Subject: [PATCH 2/9] fix(Indexing info): Showing indexing info panel when indexing is in process --- web/src/lib/components/chat/ChatIntroduction.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/lib/components/chat/ChatIntroduction.svelte b/web/src/lib/components/chat/ChatIntroduction.svelte index 91050134..17ffec78 100644 --- a/web/src/lib/components/chat/ChatIntroduction.svelte +++ b/web/src/lib/components/chat/ChatIntroduction.svelte @@ -94,7 +94,7 @@
- {#if agentIsDataSourceIndexed} + {#if !agentIsDataSourceIndexed}
Date: Tue, 23 Jul 2024 11:06:37 +0530 Subject: [PATCH 3/9] feat(Create Agent): Added side nav which has the option of creating new agent --- web/src/lib/components/NavMenu.svelte | 14 +++++--- web/src/routes/+layout.svelte | 7 ++-- web/src/routes/agent/+page.svelte | 45 ++++++++++++----------- web/src/routes/agent/[id]/+page.svelte | 50 +++++++++++++------------- 4 files changed, 62 insertions(+), 54 deletions(-) diff --git a/web/src/lib/components/NavMenu.svelte b/web/src/lib/components/NavMenu.svelte index 061ee668..7dfbe2c7 100644 --- a/web/src/lib/components/NavMenu.svelte +++ b/web/src/lib/components/NavMenu.svelte @@ -9,22 +9,28 @@ > CommandDash + + New Chat +
-

Today

- + -->
- diff --git a/web/src/lib/components/MobileNav.svelte b/web/src/lib/components/MobileNav.svelte new file mode 100644 index 00000000..4076d9d1 --- /dev/null +++ b/web/src/lib/components/MobileNav.svelte @@ -0,0 +1,63 @@ + + + + + diff --git a/web/src/lib/components/NavMenu.svelte b/web/src/lib/components/NavMenu.svelte index 192fe5a3..6e1d93a6 100644 --- a/web/src/lib/components/NavMenu.svelte +++ b/web/src/lib/components/NavMenu.svelte @@ -2,19 +2,18 @@ import NavConversationItem from "./NavConversationItem.svelte"; -
- - CommandDash - +
+ + CommandDash + - Create Agent - + href="#" + class="flex rounded-lg border bg-white px-2 py-0.5 text-center shadow-sm hover:shadow-none sm:text-smd dark:border-gray-600 dark:bg-gray-700" + > + Create Agent +
+ - Assistants + Explore agents New - --> + + export let classNames = ""; + + + diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index e4b8ffed..216d000b 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -1,20 +1,44 @@ -
- + (isNavCollapsed = !isNavCollapsed)} + classNames="absolute z-10 my-auto {!isNavCollapsed + ? 'left-[280px]' + : 'left-0'} *:transition-transform" +/> + +
+ (isNavOpen = ev.detail)} + > + + + From 10b7f354c6e1fd1a71b17484a6ee96e5f3ad1c4b Mon Sep 17 00:00:00 2001 From: wadhia-yash Date: Thu, 25 Jul 2024 13:59:13 +0530 Subject: [PATCH 6/9] feat(Notify, Toast): Notification api integration, toast integration --- .../lib/components/ExpandNavigation.svelte | 16 ++-- web/src/lib/components/NavMenu.svelte | 8 +- web/src/lib/components/Toast.svelte | 32 ++++++++ .../components/chat/ChatIntroduction.svelte | 63 ++++++---------- web/src/lib/components/chat/ChatWindow.svelte | 4 + .../lib/components/icons/IconDazzled.svelte | 36 +++++++++ web/src/lib/stores/ToastStores.ts | 9 +++ web/src/lib/types/MarketPlace.ts | 5 ++ web/src/lib/types/Toast.ts | 5 ++ web/src/routes/+layout.svelte | 44 +++++++++-- web/src/routes/agent/+page.svelte | 1 + web/src/routes/agent/[id]/+page.svelte | 1 + web/src/routes/market-place/+page.svelte | 73 +++++++++++++++++++ 13 files changed, 238 insertions(+), 59 deletions(-) create mode 100644 web/src/lib/components/Toast.svelte create mode 100644 web/src/lib/components/icons/IconDazzled.svelte create mode 100644 web/src/lib/stores/ToastStores.ts create mode 100644 web/src/lib/types/MarketPlace.ts create mode 100644 web/src/lib/types/Toast.ts create mode 100644 web/src/routes/market-place/+page.svelte diff --git a/web/src/lib/components/ExpandNavigation.svelte b/web/src/lib/components/ExpandNavigation.svelte index 4ed07913..03bdf83f 100644 --- a/web/src/lib/components/ExpandNavigation.svelte +++ b/web/src/lib/components/ExpandNavigation.svelte @@ -1,18 +1,18 @@ diff --git a/web/src/lib/components/NavMenu.svelte b/web/src/lib/components/NavMenu.svelte index 6e1d93a6..f1402b75 100644 --- a/web/src/lib/components/NavMenu.svelte +++ b/web/src/lib/components/NavMenu.svelte @@ -1,5 +1,5 @@
--> Explore agents diff --git a/web/src/lib/components/Toast.svelte b/web/src/lib/components/Toast.svelte new file mode 100644 index 00000000..c628c441 --- /dev/null +++ b/web/src/lib/components/Toast.svelte @@ -0,0 +1,32 @@ + + +
+
+ {#if ToastType.SUCCESS === toastType} + + {:else if ToastType.INFO === toastType} + + {:else if ToastType.ERROR === toastType} + + {/if} +

{message}

+
+
diff --git a/web/src/lib/components/chat/ChatIntroduction.svelte b/web/src/lib/components/chat/ChatIntroduction.svelte index 17ffec78..068cfa86 100644 --- a/web/src/lib/components/chat/ChatIntroduction.svelte +++ b/web/src/lib/components/chat/ChatIntroduction.svelte @@ -1,62 +1,44 @@ @@ -122,11 +104,10 @@ class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded focus:ring-blue-500 focus:border-blue-500 block w-1/2 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" name="email" placeholder="Email address" - required="" type="text" /> diff --git a/web/src/lib/components/chat/ChatWindow.svelte b/web/src/lib/components/chat/ChatWindow.svelte index f58d3d91..5953b6de 100644 --- a/web/src/lib/components/chat/ChatWindow.svelte +++ b/web/src/lib/components/chat/ChatWindow.svelte @@ -13,6 +13,7 @@ export let loading = false; export let agentName: string = "dash"; export let agentDisplayName: string = "Dash"; + export let agentId: string = ""; export let agentDescription: string = "Default Agent Dash"; export let agentLogo: string = ""; export let agentVersion: string = "1.0.3"; @@ -65,6 +66,8 @@ ...messages, { role: "model", text: modelResponse.response, references: modelResponse.references }, ]; + + console.log('model response', modelResponse); } catch (error) { console.log("error", error); } @@ -113,6 +116,7 @@ {agentDisplayName} {agentLogo} {agentIsDataSourceIndexed} + {agentId} /> {/if}
diff --git a/web/src/lib/components/icons/IconDazzled.svelte b/web/src/lib/components/icons/IconDazzled.svelte new file mode 100644 index 00000000..a57479e3 --- /dev/null +++ b/web/src/lib/components/icons/IconDazzled.svelte @@ -0,0 +1,36 @@ + + + + + + + + + + + + diff --git a/web/src/lib/stores/ToastStores.ts b/web/src/lib/stores/ToastStores.ts new file mode 100644 index 00000000..ebe95560 --- /dev/null +++ b/web/src/lib/stores/ToastStores.ts @@ -0,0 +1,9 @@ +import type { ToastType } from "$lib/types/Toast"; +import { writable } from "svelte/store"; + +interface Toast { + message: string; + type: ToastType +} + +export const toastStore = writable(null); diff --git a/web/src/lib/types/MarketPlace.ts b/web/src/lib/types/MarketPlace.ts new file mode 100644 index 00000000..772e8312 --- /dev/null +++ b/web/src/lib/types/MarketPlace.ts @@ -0,0 +1,5 @@ +export enum SortKey { + POPULAR = "popular", + TRENDING = "trending", + NEW = "new" +} \ No newline at end of file diff --git a/web/src/lib/types/Toast.ts b/web/src/lib/types/Toast.ts new file mode 100644 index 00000000..9473ecd9 --- /dev/null +++ b/web/src/lib/types/Toast.ts @@ -0,0 +1,5 @@ +export enum ToastType { + ERROR = "error", + INFO = "info", + SUCCESS = "success" +} \ No newline at end of file diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index 216d000b..4525eff8 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -1,27 +1,56 @@ (isNavCollapsed = !isNavCollapsed)} - classNames="absolute z-10 my-auto {!isNavCollapsed - ? 'left-[280px]' - : 'left-0'} *:transition-transform" + isCollapsed={isNavCollapsed} + on:click={() => (isNavCollapsed = !isNavCollapsed)} + classNames="absolute z-10 my-auto {!isNavCollapsed + ? 'left-[280px]' + : 'left-0'} *:transition-transform" />
+ {#if toastMessage} + + {/if}
diff --git a/web/src/routes/agent/+page.svelte b/web/src/routes/agent/+page.svelte index 81aa5651..3cb99f74 100644 --- a/web/src/routes/agent/+page.svelte +++ b/web/src/routes/agent/+page.svelte @@ -48,6 +48,7 @@ agentDescription={currentAgentDetails?.metadata?.description} agentLogo={currentAgentDetails?.metadata?.avatar_id} agentIsDataSourceIndexed={currentAgentDetails.data_sources_indexed} + agentId={currentAgentDetails?.name} /> {/if} diff --git a/web/src/routes/agent/[id]/+page.svelte b/web/src/routes/agent/[id]/+page.svelte index da469323..c4f6b0bf 100644 --- a/web/src/routes/agent/[id]/+page.svelte +++ b/web/src/routes/agent/[id]/+page.svelte @@ -50,6 +50,7 @@ agentDisplayName={currentAgentDetails?.metadata?.display_name} agentDescription={currentAgentDetails?.metadata?.description} agentLogo={currentAgentDetails?.metadata?.avatar_id} + agentId={currentAgentDetails?.name} /> {/if} diff --git a/web/src/routes/market-place/+page.svelte b/web/src/routes/market-place/+page.svelte new file mode 100644 index 00000000..5e05acdc --- /dev/null +++ b/web/src/routes/market-place/+page.svelte @@ -0,0 +1,73 @@ + + + + CommandDash - Explore Agents + + + + + +
From e5a94eac8259cb389aeb3b7c87c1ccbc8401fb8a Mon Sep 17 00:00:00 2001 From: wadhia-yash Date: Thu, 25 Jul 2024 18:06:44 +0530 Subject: [PATCH 7/9] feat(Marketplace): Integration of the marketplace --- web/src/lib/types/Agent.ts | 6 ++ web/src/lib/utils/debounce.ts | 17 ++++ web/src/routes/+layout.svelte | 23 +++-- web/src/routes/market-place/+page.svelte | 113 ++++++++++++++++++----- 4 files changed, 128 insertions(+), 31 deletions(-) create mode 100644 web/src/lib/utils/debounce.ts diff --git a/web/src/lib/types/Agent.ts b/web/src/lib/types/Agent.ts index 816ae6a0..8c2b2de4 100644 --- a/web/src/lib/types/Agent.ts +++ b/web/src/lib/types/Agent.ts @@ -1,4 +1,10 @@ export type Agent = { + author: { + github_id: string, + id: string, + name: string, + source_url: string | null + }, chat_mode: { data_sources: string[], system_prompt: string, diff --git a/web/src/lib/utils/debounce.ts b/web/src/lib/utils/debounce.ts new file mode 100644 index 00000000..c8b7560a --- /dev/null +++ b/web/src/lib/utils/debounce.ts @@ -0,0 +1,17 @@ +/** + * A debounce function that works in both browser and Nodejs. + * For pure Nodejs work, prefer the `Debouncer` class. + */ +export function debounce( + callback: (...rest: T) => unknown, + limit: number +): (...rest: T) => void { + let timer: ReturnType; + + return function (...rest) { + clearTimeout(timer); + timer = setTimeout(() => { + callback(...rest); + }, limit); + }; +} diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index 4525eff8..7130b104 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -45,34 +45,37 @@ }); - + -
- --> + - + --> {#if toastMessage} {/if} - -
+
+ +
+ diff --git a/web/src/routes/market-place/+page.svelte b/web/src/routes/market-place/+page.svelte index 5e05acdc..c02b73ee 100644 --- a/web/src/routes/market-place/+page.svelte +++ b/web/src/routes/market-place/+page.svelte @@ -1,14 +1,51 @@ @@ -28,22 +65,28 @@

Marketplace

-

Explore the agents in the marketplace made by dev community

+

+ Explore the agents in the marketplace made by dev community +

-
search(e.currentTarget.value)} />
-