From ad64327849adcf56c28421c298c1c9806832a993 Mon Sep 17 00:00:00 2001 From: Samyak Jain <56000318+samyakkkk@users.noreply.github.com> Date: Sat, 29 Jun 2024 18:08:43 +0530 Subject: [PATCH 01/37] (rel) 0.4.9 --- vscode/CHANGELOG.md | 3 +++ vscode/package-lock.json | 6 +++--- vscode/package.json | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index b88e3ee5..f10817c4 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to the "commanddash" extension will be documented in this fi Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +## [0.4.9] +- Set minimum VSCode engine to 1.77.0 + ## [0.4.8] - Don't ask for Gemini API Key - Removed google generative ai package dependencies diff --git a/vscode/package-lock.json b/vscode/package-lock.json index 982f823a..1544ed5b 100644 --- a/vscode/package-lock.json +++ b/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "fluttergpt", - "version": "0.4.8", + "version": "0.4.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fluttergpt", - "version": "0.4.8", + "version": "0.4.9", "dependencies": { "@vscode/extension-telemetry": "^0.8.1", "axios": "^1.4.0", @@ -32,7 +32,7 @@ "typescript": "^5.0.4" }, "engines": { - "vscode": "^1.82.0" + "vscode": "^1.77.0" } }, "node_modules/@alloc/quick-lru": { diff --git a/vscode/package.json b/vscode/package.json index 66415a08..8f24a2cd 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -2,11 +2,11 @@ "name": "fluttergpt", "displayName": "CommandDash: AI Agents for APIs, SDKs and more", "description": "AI assist to integrate 1000+ libraries with expert agents from marketplace", - "version": "0.4.8", + "version": "0.4.9", "publisher": "WelltestedAI", "icon": "media/icon.png", "engines": { - "vscode": "^1.82.0" + "vscode": "^1.77.0" }, "repository": { "url": "https://github.com/CommandDash/commanddash" From 308f830743c341cf44331c17f8afacc88ea4e278 Mon Sep 17 00:00:00 2001 From: Samyak Jain <56000318+samyakkkk@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:47:35 +0530 Subject: [PATCH 02/37] (feat): rel 0.5.0 --- vscode/CHANGELOG.md | 3 +++ vscode/README.md | 12 ++++++------ vscode/package-lock.json | 8 +++----- vscode/package.json | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index f10817c4..e1f8e00d 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to the "commanddash" extension will be documented in this fi Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +## [0.5.0] +- User Experience Improvements + ## [0.4.9] - Set minimum VSCode engine to 1.77.0 diff --git a/vscode/README.md b/vscode/README.md index 12c61a32..427c2742 100644 --- a/vscode/README.md +++ b/vscode/README.md @@ -1,12 +1,12 @@
-

Integrate APIs, SDKs or Packages with AI Agents

+

Integrate Packages and SDKs with AI Agents

[![VScode Downloads](https://img.shields.io/visual-studio-marketplace/d/WelltestedAI.fluttergpt)](https://marketplace.visualstudio.com/items?itemName=WelltestedAI.fluttergpt&ssr=false#overview) [![VScode version](https://img.shields.io/visual-studio-marketplace/v/WelltestedAI.fluttergpt)](https://marketplace.visualstudio.com/items?itemName=WelltestedAI.fluttergpt&ssr=false#overview) [![License: APACHE](https://img.shields.io/badge/License-APACHE%202.0-yellow)](/LICENSE)
----------------- -CommandDash is a marketplace of AI agents that are expert at integrating APIs and SDKs. +CommandDash is a marketplace of AI agents that are expert at integrating Packages and SDKs. Dash Agents are trained on the latest documentation, examples and issues enabling you to integrate any library without reading its docs by generating integration code contextualized to your codebase. @@ -14,7 +14,7 @@ Dash Agents are trained on the latest documentation, examples and issues enablin ##### 🤝 Supports all languages ##### 👨🏼‍💻 Free for every developer -Currently in Beta, CommandDash is being built in [open-sourced](https://github.com/CommandDash/commanddash) with the community. +CommandDash is being built in [open-sourced](https://github.com/CommandDash/commanddash) with the community. ----------------- @@ -54,7 +54,7 @@ Note: Commands are optionally offered by agents depending on the usecase. ## Contributing -CommanDash is hub of AI agents on docs of any APIs, SDKs and more. +CommanDash is hub of AI agents on docs of any Packages, SDKs and Github Libraries. You can suggest agents to add to the marketplace, or contribute to the VSCODE or IntelliJ extension or also to the shared [engine](https://github.com/CommandDash/packages). @@ -62,11 +62,11 @@ You can suggest agents to add to the marketplace, or contribute to the VSCODE or - **Pick up open issues**: Pick up and fix existing issues open to the community in [issues board](https://github.com/CommandDash/commanddash/issues). -- **Request agents in the marketplace**: You can submit requests to add agents for your most used APIs or SDKs. [Fill Form](https://airtable.com/app22SBaii3xYD5aR/shrLv4mDsEtnFjmtj). +- **Create agents in the marketplace**: You can create agents for any Packages or SDKs in one-click. [Create Here](https://app.commanddash.io/?create=true). ## Community -Do you love devtools but hate documentation? Join our community and help developers build without leaving their IDE: [Join Now](https://join.slack.com/t/welltested-ai/shared_invite/zt-25u09fty8-gaggH9HbmopB~4tialTrlA) 👋🏼 +Do you love devtools but hate documentation? Join our community and help developers build without leaving their IDE: [Join Now](https://discord.gg/szUCAnrsHQ) 👋🏼 ## License diff --git a/vscode/package-lock.json b/vscode/package-lock.json index 2338026b..8bbf02e5 100644 --- a/vscode/package-lock.json +++ b/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "fluttergpt", - "version": "0.4.9", + "version": "0.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fluttergpt", - "version": "0.4.9", + "version": "0.5.0", "dependencies": { "@vscode/extension-telemetry": "^0.8.1", "axios": "^1.4.0", @@ -3776,8 +3776,7 @@ "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/tsutils": { "version": "3.21.0", @@ -3822,7 +3821,6 @@ "version": "5.0.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", - "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/vscode/package.json b/vscode/package.json index 8f24a2cd..84a986cf 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -1,8 +1,8 @@ { "name": "fluttergpt", - "displayName": "CommandDash: AI Agents for APIs, SDKs and more", - "description": "AI assist to integrate 1000+ libraries with expert agents from marketplace", - "version": "0.4.9", + "displayName": "CommandDash: Assist for Packages, SDKs, APIs and Github", + "description": "Only AI Copilot to integrate libraries with expert agents", + "version": "0.5.0", "publisher": "WelltestedAI", "icon": "media/icon.png", "engines": { From 9120d90766bac849855deac1e5923000dd467b06 Mon Sep 17 00:00:00 2001 From: Yash Wadhia <45955091+wadhia-yash@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:49:32 +0530 Subject: [PATCH 03/37] fix(Toast): Made toast theme color more visible (#336) --- web/src/lib/components/Toast.svelte | 4 ++-- web/src/lib/components/chat/ChatIntroduction.svelte | 2 +- web/src/lib/components/chat/ChatWindow.svelte | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/src/lib/components/Toast.svelte b/web/src/lib/components/Toast.svelte index 66287638..cf7cf187 100644 --- a/web/src/lib/components/Toast.svelte +++ b/web/src/lib/components/Toast.svelte @@ -18,7 +18,7 @@ class="pointer-events-none fixed right-0 top-12 z-30 bg-gradient-to-bl from-red-500/20 via-red-500/0 to-red-500/0 pb-36 pl-36 pr-2 pt-2 md:top-0 md:pr-8 md:pt-5" >
{#if ToastType.SUCCESS === toastType} @@ -27,6 +27,6 @@ {:else if ToastType.ERROR === toastType} {/if} -

{message}

+

{message}

diff --git a/web/src/lib/components/chat/ChatIntroduction.svelte b/web/src/lib/components/chat/ChatIntroduction.svelte index b6d2ade1..95d8a294 100644 --- a/web/src/lib/components/chat/ChatIntroduction.svelte +++ b/web/src/lib/components/chat/ChatIntroduction.svelte @@ -58,7 +58,7 @@ } toastStore.set({ - message: "Notification sent successfully", + message: "Notification will be sent successfully", type: ToastType.SUCCESS, }); diff --git a/web/src/lib/components/chat/ChatWindow.svelte b/web/src/lib/components/chat/ChatWindow.svelte index 141edc64..3ede7d15 100644 --- a/web/src/lib/components/chat/ChatWindow.svelte +++ b/web/src/lib/components/chat/ChatWindow.svelte @@ -156,7 +156,7 @@ } toastStore.set({ - message: "Notification sent successfully", + message: "Notification will be sent successfully", type: ToastType.SUCCESS, }); From 036f96ddfc119d9c98922e6e012fbc90eabd5a78 Mon Sep 17 00:00:00 2001 From: Aarush-wadhia Date: Mon, 9 Sep 2024 16:39:38 +0530 Subject: [PATCH 04/37] (rel)v0.5.1 --- vscode/CHANGELOG.md | 4 ++++ vscode/package-lock.json | 8 +++++--- vscode/package.json | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index e1f8e00d..79f6fe01 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to the "commanddash" extension will be documented in this fi Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +## [0.5.1] +- Replacing CLI with REST APIs to interact with model +- Crashing fixes + ## [0.5.0] - User Experience Improvements diff --git a/vscode/package-lock.json b/vscode/package-lock.json index 8bbf02e5..e6dcd20a 100644 --- a/vscode/package-lock.json +++ b/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "fluttergpt", - "version": "0.5.0", + "version": "0.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fluttergpt", - "version": "0.5.0", + "version": "0.5.1", "dependencies": { "@vscode/extension-telemetry": "^0.8.1", "axios": "^1.4.0", @@ -3776,7 +3776,8 @@ "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true }, "node_modules/tsutils": { "version": "3.21.0", @@ -3821,6 +3822,7 @@ "version": "5.0.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/vscode/package.json b/vscode/package.json index 84a986cf..ec054fa0 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -2,7 +2,7 @@ "name": "fluttergpt", "displayName": "CommandDash: Assist for Packages, SDKs, APIs and Github", "description": "Only AI Copilot to integrate libraries with expert agents", - "version": "0.5.0", + "version": "0.5.1", "publisher": "WelltestedAI", "icon": "media/icon.png", "engines": { From 0b6560a60789a5a96400ec68ae73f9522b6d4c1f Mon Sep 17 00:00:00 2001 From: Aarush-wadhia Date: Wed, 11 Sep 2024 14:26:50 +0530 Subject: [PATCH 05/37] WIP: Private agent dialog --- vscode/media/command-deck/command-deck.js | 1 - vscode/media/onboarding/onboarding.js | 1 - vscode/src/providers/chat_view_provider.ts | 46 ++++++++----------- .../lib/components/CreateAgentDialog.svelte | 14 ++++-- .../lib/components/PrivateAgentDialog.svelte | 20 ++++++++ .../lib/components/icons/IconInternet.svelte | 28 +++++++++++ web/src/routes/+page.svelte | 8 ++++ 7 files changed, 86 insertions(+), 32 deletions(-) create mode 100644 web/src/lib/components/PrivateAgentDialog.svelte create mode 100644 web/src/lib/components/icons/IconInternet.svelte diff --git a/vscode/media/command-deck/command-deck.js b/vscode/media/command-deck/command-deck.js index 23feeec0..8ed0cd0b 100644 --- a/vscode/media/command-deck/command-deck.js +++ b/vscode/media/command-deck/command-deck.js @@ -133,7 +133,6 @@ class CommandDeck { this.ref.innerHTML = textContent.substring(0, atIndex) + textContent.substring(atIndex + 1); } if (option?.name.startsWith('@')) { - console.log('agents options', option?.metadata); activeAgentAttach.style = "color: #497BEF; !important"; agentName = option?.metadata.display_name; diff --git a/vscode/media/onboarding/onboarding.js b/vscode/media/onboarding/onboarding.js index 1b64c84c..138bf32c 100644 --- a/vscode/media/onboarding/onboarding.js +++ b/vscode/media/onboarding/onboarding.js @@ -1047,7 +1047,6 @@ function handleSubmit(event) { } else { matchingItems = getAgents().filter(item => { - console.log('name', item); return item.search?.toLowerCase().startsWith(query.toLowerCase()); }); } diff --git a/vscode/src/providers/chat_view_provider.ts b/vscode/src/providers/chat_view_provider.ts index 8776b72c..dc8eb504 100644 --- a/vscode/src/providers/chat_view_provider.ts +++ b/vscode/src/providers/chat_view_provider.ts @@ -174,7 +174,6 @@ export class FlutterGPTViewProvider implements vscode.WebviewViewProvider { // StorageManager.instance.deleteAgents(); webviewView.onDidChangeVisibility(() => { - console.log("webview", webviewView.visible); if (webviewView.visible && this._view) { this._view?.webview.postMessage({ type: "focusChatInput" }); } @@ -454,6 +453,7 @@ export class FlutterGPTViewProvider implements vscode.WebviewViewProvider { private: false, }; try { + console.log(JSON.stringify(data)); const modelResponse = await makeHttpRequest<{ response: string, references: Array }>({ url: "https://api.commanddash.dev/v2/ai/agent/answer", method: "post", @@ -468,19 +468,15 @@ export class FlutterGPTViewProvider implements vscode.WebviewViewProvider { value: this._publicConversationHistory, }); } catch (error) { - this._publicConversationHistory.push({ - [this._activeAgent]: { - role: "error", - text: - error instanceof Error - ? (error as Error).message - : (error as any).toString(), - }, - }); - this._view?.webview.postMessage({ - type: "displayMessages", - value: this._publicConversationHistory, - }); + // this._publicConversationHistory.push({ + // [this._activeAgent]: { + // role: "error", + // text: + // error instanceof Error + // ? (error as Error).message + // : (error as any).toString(), + // }, + // }); } finally { this?._view?.webview?.postMessage({ type: "hideLoadingIndicator" }); } @@ -730,19 +726,15 @@ export class FlutterGPTViewProvider implements vscode.WebviewViewProvider { } catch (error) { console.error(error); logError("command-deck-conversation-error", error); - this._publicConversationHistory.push({ - [this._activeAgent]: { - role: "error", - text: - error instanceof Error - ? (error as Error).message - : (error as any).toString(), - }, - }); - this._view?.webview.postMessage({ - type: "displayMessages", - value: this._publicConversationHistory, - }); + // this._publicConversationHistory.push({ + // [this._activeAgent]: { + // role: "error", + // text: + // error instanceof Error + // ? (error as Error).message + // : (error as any).toString(), + // }, + // }); } finally { this._view?.webview.postMessage({ type: "hideLoadingIndicator" }); this._view?.webview.postMessage({ diff --git a/web/src/lib/components/CreateAgentDialog.svelte b/web/src/lib/components/CreateAgentDialog.svelte index a709b2a1..6c5ed0b6 100644 --- a/web/src/lib/components/CreateAgentDialog.svelte +++ b/web/src/lib/components/CreateAgentDialog.svelte @@ -4,12 +4,13 @@ import { toastStore } from "$lib/stores/ToastStores"; import { ToastType } from "$lib/types/Toast"; import appInsights from "$lib/utils/appInsights"; - import IconClose from "~icons/carbon/close"; import CarbonGithub from "~icons/carbon/logo-github"; import { validateURL } from "$lib/utils/validateURL"; + import IconInternet from "$lib/components/icons/IconInternet.svelte"; export let showModal: boolean; export let onClose: () => void; + export let onPrivateAgent: () => void; let value: string = ""; let selectedPlatform: string = "github"; @@ -68,8 +69,9 @@

Create Agent with URL

-
@@ -118,6 +120,12 @@ > Submit +
{/if} diff --git a/web/src/lib/components/PrivateAgentDialog.svelte b/web/src/lib/components/PrivateAgentDialog.svelte new file mode 100644 index 00000000..cfb66422 --- /dev/null +++ b/web/src/lib/components/PrivateAgentDialog.svelte @@ -0,0 +1,20 @@ + + +{#if showPrivateModal} +
+ + + +
+{/if} diff --git a/web/src/lib/components/icons/IconInternet.svelte b/web/src/lib/components/icons/IconInternet.svelte new file mode 100644 index 00000000..c05abaac --- /dev/null +++ b/web/src/lib/components/icons/IconInternet.svelte @@ -0,0 +1,28 @@ + + + diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 39253d42..369070f8 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -11,12 +11,14 @@ import { debounce } from "$lib/utils/debounce"; import { base } from "$app/paths"; import CreateAgentDialog from "$lib/components/CreateAgentDialog.svelte"; + import PrivateAgentDialog from "$lib/components/PrivateAgentDialog.svelte"; const SEARCH_DEBOUNCE_DELAY = 400; let agents: Agent[] = []; let filteredAgents: Agent[] = []; let searchValue: string = ""; let showModal: boolean = false; + let showPrivateModal: boolean = false; let currentAgent: Agent; let sections: { [key: string]: Agent[] } = {}; @@ -304,7 +306,13 @@ onClose={() => { showModal = false; }} + onPrivateAgent={() => { + showModal = false; + showPrivateModal = true; + }} /> + + \ No newline at end of file + .promoted-card { + border: 2px solid #1e90ff; /* Blue border */ + background-color: #e6f7ff; /* Light blue background */ + } + + .promoted-indicator { + position: absolute; + top: 0; + right: 0; + background-color: #1e90ff; /* Blue background */ + color: #fff; /* White text */ + padding: 0.2em 0.5em; + font-size: 0.75em; + font-weight: bold; + border-bottom-left-radius: 0.5em; + } + + .promoted-text { + color: #003366; /* Dark blue text */ + text-shadow: 0.5px 0.5px 1px rgba(0, 0, 0, 0.1); /* Subtle text shadow */ + } + From d135c9fd7f737927340b53bb0587c9ac848f687a Mon Sep 17 00:00:00 2001 From: Aarush-wadhia Date: Tue, 17 Sep 2024 14:16:50 +0530 Subject: [PATCH 08/37] fix(Create Agent, REST): Removed unnecessary fields from create agents modals and REST API migration from prod to stage --- .../lib/components/PrivateAgentDialog.svelte | 255 ++++++++++-------- web/src/lib/components/SettingsAgent.svelte | 2 +- .../components/chat/ChatIntroduction.svelte | 2 +- web/src/lib/components/chat/ChatWindow.svelte | 6 +- web/src/routes/+page.svelte | 4 +- web/src/routes/agent/+page.svelte | 2 +- web/src/routes/agent/[id]/+page.svelte | 2 +- 7 files changed, 145 insertions(+), 128 deletions(-) diff --git a/web/src/lib/components/PrivateAgentDialog.svelte b/web/src/lib/components/PrivateAgentDialog.svelte index 27e52456..c0af4bcc 100644 --- a/web/src/lib/components/PrivateAgentDialog.svelte +++ b/web/src/lib/components/PrivateAgentDialog.svelte @@ -11,6 +11,8 @@ import CarbonWorld from "~icons/carbon/wikis"; import IconInternet from "./icons/IconInternet.svelte"; + import { ToastType } from "$lib/types/Toast"; + import { goto } from "$app/navigation"; type ActionData = { error: boolean; @@ -49,15 +51,9 @@ "https://stage.commanddash.dev/account/github/url/web?override_uri=http://localhost:5173" ); const _response = await response.json(); - console.log("response", _response); if (response.ok) { const oauthWindow = window.open(_response.github_oauth_url, "_blank"); - console.log("oatuhwidnwo", oauthWindow?.location.origin); - - window.addEventListener('message', (event) => { - console.log('event', event); - }) const interval = setInterval(() => { try { @@ -68,7 +64,6 @@ accessToken = urlParams.get("access_token"); refreshToken = urlParams.get("refresh_token"); if (accessToken && refreshToken) { - localStorage.setItem("accessToken", accessToken); localStorage.setItem("refreshToken", refreshToken); // Close the OAuth window @@ -88,11 +83,8 @@ } async function handleSubmitDataSources() { - debugger; if (urlType === "github") { - await validatingRepositoryAccess( - "https://github.com/wadhia-yash/shopping-demo" - ); + await validatingRepositoryAccess(url); } else { agentDataSources = [...agentDataSources, { uri: url, type: urlType }]; } @@ -113,7 +105,7 @@ agentDataSources = [...agentDataSources, { uri: url, type: urlType }]; } - if (response.status === 422) { + if (response.status === 422 || response.status === 404) { openPopup( "https://github.com/apps/staging-commanddash/installations/select_target" ); @@ -135,39 +127,54 @@ } } - async function handleSubmitAgentCreation(e: any) { - const ACTION_URL = e.target.action; - + async function handleSubmitAgentCreation() { const body = { - agent_info: { - agent_id: "x_test", - metadata: { - display_name: agentName, - avatar_profile: agentAvatar, - tags: [], - description: agentDescription, - }, - chat_mode: { - system_prompt: agentSystemPrompt, - data_source: agentDataSources, - }, + name: agentName.toLowerCase().replace(/ /g, "_"), + metadata: { + display_name: agentName, + avatar_profile: agentAvatar, + tags: [], + description: agentDescription, }, - testing: false, + chat_mode: { + system_prompt: agentSystemPrompt, + }, + is_private: false, data_sources: agentDataSources, }; - const response = await fetch(ACTION_URL, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - }); + try { + const response = await fetch( + "https://stage.commanddash.dev/agent/deploy-agent/web", + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: "Bearer " + accessToken, + }, + body: JSON.stringify(body), + } + ); + const _response = await response.json(); + + if (!response.ok) { + toastStore.set({ + message: _response.message, + type: ToastType.ERROR, + }); + return; + } + onClose(); + goto(`/agent/${agentName.toLowerCase().replace(/ /g, "_")}`); + } catch (error) { + console.log("error", error); + } } function onFilesChange(e: Event) { const inputEl = e.target as HTMLInputElement; if (inputEl.files?.length && inputEl.files[0].size > 0) { + const file = inputEl.files[0]; if (!inputEl.files[0].type.includes("image")) { inputEl.files = null; files = null; @@ -178,6 +185,14 @@ }; return; } + + const reader = new FileReader(); + reader.onloadend = () => { + const base64String = reader.result as string; + agentAvatar = base64String; + }; + reader.readAsDataURL(file); + files = inputEl.files; resetErrors(); deleteExistingAvatar = false; @@ -194,16 +209,7 @@ // Fetch tokens from localStorage when the component mounts accessToken = localStorage.getItem("accessToken"); refreshToken = localStorage.getItem("refreshToken"); - - if (accessToken && refreshToken) { - console.log("Access Token:", accessToken); - console.log("Refresh Token:", refreshToken); - } else { - console.log("No tokens found in local storage."); - } }); - - console.log('files', files) {#if showPrivateModal} @@ -214,22 +220,18 @@ -
+

Create new agent

Create and share your own AI Agents.

-
+ -
- {#if !!accessToken && !!refreshToken} -
-
- - Add data sources - -
-
- { + urlType = target?.value; + }} + > + + + + + + +
+ +
+ Data sources + {#each agentDataSources as sourceData} + - - - - - - -
+
+ {sourceData.uri} +
+
+ {#if sourceData.type === "github"} + + {:else if sourceData.type === "web_page"} + + {:else} + + {/if} +
+
+ {/each} +
+
- + Cancel + +
+
+
- +
{/if} diff --git a/web/src/lib/components/SettingsAgent.svelte b/web/src/lib/components/SettingsAgent.svelte index 6bdc09d1..0ebd6a7f 100644 --- a/web/src/lib/components/SettingsAgent.svelte +++ b/web/src/lib/components/SettingsAgent.svelte @@ -214,7 +214,7 @@ method="POST" on:submit|preventDefault={handleSubmitContribution} class="w-full" - action="https://api.commanddash.dev/agent/contribute-source" + action="https://stage.commanddash.dev/agent/contribute-source" >
p.id === selectedPlatform).placeholder} - class="w-full pl-10 pr-3 py-2 bg-gray-800 border border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-100 placeholder-gray-500" +
+ {#each platforms as platform} + + {:else} + {platform.label} + {/if}
+ {platform.label} + + {/each} +
- - +
+
+ {#if selectedPlatform === "github"} + + {:else} + p.id === selectedPlatform).icon} + alt={selectedPlatform} + class="w-5 h-5" + /> + {/if}
+ p.id === selectedPlatform) + .placeholder} + class="w-full pl-10 pr-3 py-2 bg-gray-800 border border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-100 placeholder-gray-500" + /> +
+ + + {/if} \ No newline at end of file + .selected { + transform: scale(1.1); + } + .selected span { + color: #60a5fa; /* blue-400 */ + font-weight: bold; + } + diff --git a/web/src/lib/components/PrivateAgentDialog.svelte b/web/src/lib/components/PrivateAgentDialog.svelte index 3fdbb7e3..ef78d4d4 100644 --- a/web/src/lib/components/PrivateAgentDialog.svelte +++ b/web/src/lib/components/PrivateAgentDialog.svelte @@ -35,6 +35,7 @@ let agentSystemPrompt: string = ""; let agentAvatar: string = ""; let agentDataSources: Array<{ uri: string; type: string }> = []; + let agentIsPrivate: string = "private"; let accessToken: string | null = ""; let refreshToken: string | null = ""; @@ -96,12 +97,12 @@ ...options, headers: { ...options.headers, - 'Authorization': 'Bearer ' + accessToken - } - }) + Authorization: "Bearer " + accessToken, + }, + }); if (response.status === 401) { - const refreshed = await refreshAccessToken() + const refreshed = await refreshAccessToken(); if (refreshed) { // Retry the request with the refreshed token options.headers = { @@ -114,13 +115,13 @@ return response; } catch (error) { - throw error + throw error; } } async function refreshAccessToken() { try { - const refreshToken = localStorage.getItem("refreshToken") + const refreshToken = localStorage.getItem("refreshToken"); debugger; const response = await fetch( "https://stage.commanddash.dev/account/github/refresh", @@ -128,7 +129,7 @@ method: "POST", headers: { Authorization: `Bearer ${refreshToken}`, - } + }, } ); const _response = await response.json(); @@ -146,7 +147,7 @@ console.error("refreshAccessToken: error", error); return false; } - }; + } async function validatingRepositoryAccess(url: string) { try { @@ -197,13 +198,13 @@ chat_mode: { system_prompt: agentSystemPrompt, }, - is_private: false, + is_private: agentIsPrivate === "private", data_sources: agentDataSources, }; try { const response = await apiRequest( - "https://stage.commanddash.dev/agent/deploy-agent/web", + "https://stage.commanddash.dev/agent/deploy-agent/webw", { method: "POST", headers: { @@ -376,59 +377,61 @@ {getError("description", form)}

--> +
+
+ + Add data sources + +
+
+ + +
+ +
Internet access
-
- - Add data sources - -
-
- - -
- -
+
Data sources {#each agentDataSources as sourceData} Date: Wed, 18 Sep 2024 17:21:43 +0530 Subject: [PATCH 12/37] feat(Repo access): When creating agents if the repo is not accessible instead of directly navigating to github showing pop up button to configure with github --- .../lib/components/PrivateAgentDialog.svelte | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/web/src/lib/components/PrivateAgentDialog.svelte b/web/src/lib/components/PrivateAgentDialog.svelte index ef78d4d4..11773d41 100644 --- a/web/src/lib/components/PrivateAgentDialog.svelte +++ b/web/src/lib/components/PrivateAgentDialog.svelte @@ -35,7 +35,8 @@ let agentSystemPrompt: string = ""; let agentAvatar: string = ""; let agentDataSources: Array<{ uri: string; type: string }> = []; - let agentIsPrivate: string = "private"; + let agentIsPrivate: boolean = false; + let isRepoAccessible: boolean = true; let accessToken: string | null = ""; let refreshToken: string | null = ""; @@ -160,14 +161,14 @@ }, } ); + const _response = await response.json(); + agentIsPrivate = _response.private; if (response.ok) { agentDataSources = [...agentDataSources, { uri: url, type: urlType }]; } if (response.status === 422 || response.status === 404) { - openPopup( - "https://github.com/apps/staging-commanddash/installations/select_target" - ); + isRepoAccessible = false; } } catch (error) { console.log("validatingRepositoryAccess: error", error); @@ -186,6 +187,12 @@ } } + function adjustGithubPermissions() { + openPopup( + "https://github.com/apps/staging-commanddash/installations/select_target" + ); + } + async function handleSubmitAgentCreation() { const body = { name: agentName.toLowerCase().replace(/ /g, "_"), @@ -198,7 +205,7 @@ chat_mode: { system_prompt: agentSystemPrompt, }, - is_private: agentIsPrivate === "private", + is_private: agentIsPrivate, data_sources: agentDataSources, }; @@ -406,12 +413,23 @@ bind:value={url} />
- + {#if !isRepoAccessible} + + {/if} +
-
+
Data sources {#each agentDataSources as sourceData} From c1b1ad87a09f756f3cc62f25fa65e4e024b59413 Mon Sep 17 00:00:00 2001 From: Aarush-wadhia Date: Thu, 19 Sep 2024 09:43:33 +0530 Subject: [PATCH 13/37] feat(Create agent): Authenticate while creating quick agent, and allow private agent to be in create agent --- .../lib/components/CreateAgentDialog.svelte | 188 +++++++++++++++++- .../lib/components/PrivateAgentDialog.svelte | 8 +- web/src/routes/agent/[id]/+page.svelte | 5 + 3 files changed, 188 insertions(+), 13 deletions(-) diff --git a/web/src/lib/components/CreateAgentDialog.svelte b/web/src/lib/components/CreateAgentDialog.svelte index 316b309d..c47b0459 100644 --- a/web/src/lib/components/CreateAgentDialog.svelte +++ b/web/src/lib/components/CreateAgentDialog.svelte @@ -1,4 +1,5 @@ {#if showModal} @@ -157,13 +308,32 @@ class="w-full pl-10 pr-3 py-2 bg-gray-800 border border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-100 placeholder-gray-500" />
- - + {#if !isRepoAccessible} + + {/if} + {#if !!accessToken && !!refreshToken} + + {:else} + + {/if}
{/if} diff --git a/web/src/lib/components/PrivateAgentDialog.svelte b/web/src/lib/components/PrivateAgentDialog.svelte index 11773d41..0d5e956d 100644 --- a/web/src/lib/components/PrivateAgentDialog.svelte +++ b/web/src/lib/components/PrivateAgentDialog.svelte @@ -37,8 +37,8 @@ let agentDataSources: Array<{ uri: string; type: string }> = []; let agentIsPrivate: boolean = false; let isRepoAccessible: boolean = true; - let accessToken: string | null = ""; - let refreshToken: string | null = ""; + let accessToken: string | null = "Hi"; + let refreshToken: string | null = "Hi"; function resetErrors() { if (form) { @@ -231,7 +231,7 @@ return; } onClose(); - goto(`/agent/${agentName.toLowerCase().replace(/ /g, "_")}`); + goto(`/agent/${agentName.toLowerCase().replace(/ /g, "_")}?private=${agentIsPrivate}`); } catch (error) { console.log("error", error); } @@ -271,7 +271,7 @@ ); } - onMount(() => { + onMount(async () => { // Fetch tokens from localStorage when the component mounts accessToken = localStorage.getItem("accessToken"); refreshToken = localStorage.getItem("refreshToken"); diff --git a/web/src/routes/agent/[id]/+page.svelte b/web/src/routes/agent/[id]/+page.svelte index 3a4ecadf..8a6196c7 100644 --- a/web/src/routes/agent/[id]/+page.svelte +++ b/web/src/routes/agent/[id]/+page.svelte @@ -20,6 +20,7 @@ loading = true; const id: string = $page.params?.id; const ref: string = $page.url.searchParams.get("github") || ""; + const private: string = $page.url.searchParams.get("private") || ""; const response = await fetch( "https://stage.commanddash.dev/agent/get-latest-agent", @@ -44,6 +45,10 @@ loading = false; }); + const getLatestAgent = () => { + + } + const extractUris = ( data: { id: string; uri: { type: string; uri: string }[] }[], ): { type: string; uri: string }[] => { From 1f9ebea5c2ad62d94ebcbac7f95367556c72f8fb Mon Sep 17 00:00:00 2001 From: Aarush-wadhia Date: Thu, 19 Sep 2024 10:46:14 +0530 Subject: [PATCH 14/37] fix(Github login): using reactive declaration to get the access token from local storage instead of just depending on onMount function --- .../lib/components/CreateAgentDialog.svelte | 20 +- .../lib/components/PrivateAgentDialog.svelte | 21 +- web/src/routes/+page.svelte | 1 + web/src/routes/agent/[id]/+page.svelte | 215 +++++++++++------- 4 files changed, 170 insertions(+), 87 deletions(-) diff --git a/web/src/lib/components/CreateAgentDialog.svelte b/web/src/lib/components/CreateAgentDialog.svelte index c47b0459..f88e0fbe 100644 --- a/web/src/lib/components/CreateAgentDialog.svelte +++ b/web/src/lib/components/CreateAgentDialog.svelte @@ -16,8 +16,8 @@ let value: string = ""; let selectedPlatform: string = "github"; - let accessToken: string | null = ""; - let refreshToken: string | null = ""; + let accessToken: string = ""; + let refreshToken: string = ""; let isRepoAccessible: boolean = true; const platforms = [ @@ -205,8 +205,8 @@ const urlParams = new URLSearchParams( oauthWindow.location.search ); - accessToken = urlParams.get("access_token"); - refreshToken = urlParams.get("refresh_token"); + accessToken = urlParams.get("access_token") ?? ""; + refreshToken = urlParams.get("refresh_token") ?? ""; if (accessToken && refreshToken) { localStorage.setItem("accessToken", accessToken); localStorage.setItem("refreshToken", refreshToken); @@ -226,15 +226,21 @@ } } + function getStorageData() { + accessToken = localStorage.getItem("accessToken") ?? ""; + refreshToken = localStorage.getItem("refreshToken") ?? ""; + } + $: if (showModal) { appInsights.trackEvent({ name: "CreateAgentDialogOpened" }); + getStorageData(); } onMount(() => { // Fetch tokens from localStorage when the component mounts - accessToken = localStorage.getItem("accessToken"); - refreshToken = localStorage.getItem("refreshToken"); + getStorageData(); }); + {#if showModal} @@ -318,7 +324,7 @@ > {/if} - {#if !!accessToken && !!refreshToken} + {#if accessToken?.length > 0 && refreshToken?.length > 0} {/if} - {#if accessToken?.length > 0 && refreshToken?.length > 0} - - {:else} + {#if !isRepoAccessible && !accessToken} + {:else} + {/if} diff --git a/web/src/lib/components/PrivateAgentDialog.svelte b/web/src/lib/components/PrivateAgentDialog.svelte index 6709042a..afbb49ae 100644 --- a/web/src/lib/components/PrivateAgentDialog.svelte +++ b/web/src/lib/components/PrivateAgentDialog.svelte @@ -164,7 +164,7 @@ async function validatingRepositoryAccess(_url: string) { try { const response = await apiRequest( - `https://stage.commanddash.dev/github/repo/verify-access?repo=${_url}`, + `https://stage.commanddash.dev/github/repo/verify-access-auth?repo=${_url}`, { method: "GET", headers: { From 43f053cfa8a1b1a0f447383a62fca9e3d9f74c64 Mon Sep 17 00:00:00 2001 From: Aarush-wadhia Date: Fri, 20 Sep 2024 11:44:14 +0530 Subject: [PATCH 20/37] fix: API's auth token is now used based on the availablity of accessToken --- .../lib/components/CreateAgentDialog.svelte | 41 +++++++---------- web/src/routes/agent/+page.svelte | 41 +++++++---------- web/src/routes/agent/[id]/+page.svelte | 44 ++++++++----------- 3 files changed, 48 insertions(+), 78 deletions(-) diff --git a/web/src/lib/components/CreateAgentDialog.svelte b/web/src/lib/components/CreateAgentDialog.svelte index 7deab882..2464c6e1 100644 --- a/web/src/lib/components/CreateAgentDialog.svelte +++ b/web/src/lib/components/CreateAgentDialog.svelte @@ -90,9 +90,21 @@ }; async function validatingRepositoryAccess(url: string) { + const headers = { + "Content-Type": "application/json", + }; + if (accessToken) { + headers.Authorization = "Bearer " + accessToken; + } try { - const response = await getVerifyAccess(url); - + const response = await apiRequest( + `https://stage.commanddash.dev/github/repo/verify-access?repo=${url}`, + { + method: "GET", + headers: headers, + } + ); + if (response.ok) { goto(`${base}/agent?${selectedPlatform}=${url}`); } @@ -105,34 +117,12 @@ } } - async function getVerifyAccess(_url: string) { - if (accessToken?.length === 0 || accessToken === null || accessToken === undefined) { - return await apiRequest( - `https://stage.commanddash.dev/github/repo/verify-access?repo=${_url}`, - { - method: "GET", - } - ); - } else { - return await apiRequest( - `https://stage.commanddash.dev/github/repo/verify-access-auth?repo=${_url}`, - { - method: "GET", - headers: { - Authorization: "Bearer " + accessToken, - }, - } - ) - } - } - async function apiRequest(url: string, options: RequestInit) { try { const response = await fetch(url, { ...options, headers: { ...options.headers, - Authorization: "Bearer " + accessToken, }, }); @@ -253,7 +243,6 @@ // Fetch tokens from localStorage when the component mounts getStorageData(); }); - {#if showModal} @@ -346,7 +335,7 @@ Sign in with GitHub {:else} -
{/if} diff --git a/web/src/lib/components/PrivateAgentDialog.svelte b/web/src/lib/components/PrivateAgentDialog.svelte index 5fa6947e..13ab2813 100644 --- a/web/src/lib/components/PrivateAgentDialog.svelte +++ b/web/src/lib/components/PrivateAgentDialog.svelte @@ -38,6 +38,7 @@ let accessToken: string | null = "Hi"; let refreshToken: string | null = "Hi"; let agentPurpose: string = ""; + let isLoading: boolean = false; // Add a reactive variable for loading state function resetErrors() { if (form) { @@ -49,26 +50,16 @@ async function onSigninGithub() { try { const response = await fetch( - "https://stage.commanddash.dev/account/github/url/web?override_uri=http://localhost:5173" + "https://api.commanddash.dev/account/github/url/web?override_uri=https://app.commanddash.io" ); const _response = await response.json(); if (response.ok) { const oauthWindow = window.open(_response.github_oauth_url, "_blank"); - // if (!oauthWindow) { - // const isAllow = window.confirm("Popup blocked! Please allow popups for this site."); - // if (isAllow) { - // const a = document.createElement('a'); - // a.href = _response.github_oauth_url; - // a.target = "_blank"; - // a.click(); - // } - // } - const interval = setInterval(() => { try { - if (oauthWindow?.location.origin === "http://localhost:5173") { + if (oauthWindow?.location.origin === "https://app.commanddash.io") { const urlParams = new URLSearchParams( oauthWindow.location.search ); @@ -133,9 +124,8 @@ async function refreshAccessToken() { try { const refreshToken = localStorage.getItem("refreshToken"); - debugger; const response = await fetch( - "https://stage.commanddash.dev/account/github/refresh", + "https://api.commanddash.dev/account/github/refresh", { method: "POST", headers: { @@ -169,14 +159,14 @@ } try { const response = await apiRequest( - `https://stage.commanddash.dev/github/repo/verify-access?repo=${_url}`, + `https://api.commanddash.dev/github/repo/verify-access?repo=${_url}`, { method: "GET", headers: headers } ); const _response = await response.json(); - + if (response.ok) { agentDataSources = [...agentDataSources, { uri: _url, type: urlType, is_private: _response.private }]; url = "" @@ -204,7 +194,7 @@ function adjustGithubPermissions() { openPopup( - "https://github.com/apps/staging-commanddash/installations/select_target" + "https://github.com/apps/commanddash/installations/select_target" ); } @@ -213,8 +203,8 @@ name: agentName, metadata: { display_name: agentName, - avatar_profile: agentAvatar, tags: [], + description: agentPurpose }, chat_mode: { system_prompt: agentPurpose, @@ -222,11 +212,10 @@ is_private: agentDataSources.some(({is_private}) => is_private === true), data_sources: agentDataSources, }; - - debugger; + try { const response = await apiRequest( - "https://stage.commanddash.dev/agent/deploy-agent/web", + "https://api.commanddash.dev/agent/deploy-agent/web", { method: "POST", headers: { @@ -237,7 +226,7 @@ } ); const _response = await response.json(); - debugger; + if (!response.ok) { toastStore.set({ message: _response.message, @@ -246,6 +235,9 @@ return; } onClose(); + isLoading = true; // Set loading state to true + await new Promise(resolve => setTimeout(resolve, 2000)); // Add a 5-second delay + isLoading = false; // Set loading state to false goto(`/agent/${_response.agent_id}`); } catch (error) { console.log("error", error); @@ -315,252 +307,139 @@

Create and share your own AI Code Agents.

-
+ {/if} -{/if} +{/if} \ No newline at end of file diff --git a/web/src/lib/components/SettingsAgent.svelte b/web/src/lib/components/SettingsAgent.svelte index 0ebd6a7f..6bdc09d1 100644 --- a/web/src/lib/components/SettingsAgent.svelte +++ b/web/src/lib/components/SettingsAgent.svelte @@ -214,7 +214,7 @@ method="POST" on:submit|preventDefault={handleSubmitContribution} class="w-full" - action="https://stage.commanddash.dev/agent/contribute-source" + action="https://api.commanddash.dev/agent/contribute-source" >