diff --git a/web/src/lib/components/CreateAgentDialog.svelte b/web/src/lib/components/CreateAgentDialog.svelte index 2464c6e..884bd84 100644 --- a/web/src/lib/components/CreateAgentDialog.svelte +++ b/web/src/lib/components/CreateAgentDialog.svelte @@ -98,7 +98,7 @@ } 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, @@ -147,9 +147,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: { @@ -176,7 +175,7 @@ function adjustGithubPermissions() { openPopup( - "https://github.com/apps/staging-commanddash/installations/select_target" + "https://github.com/apps/commanddash/installations/select_target" ); } @@ -195,7 +194,7 @@ 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(); @@ -204,7 +203,7 @@ 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 ); @@ -316,13 +315,13 @@ 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 accessToken && !isRepoAccessible } {/if} diff --git a/web/src/lib/components/PrivateAgentDialog.svelte b/web/src/lib/components/PrivateAgentDialog.svelte index 5fa6947..13ab281 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.

-
-
- + +
+
+ + Add Data Sources +
-
-
--> - - - - - - -
-
- - Add Data Sources - -
-
- - -
- {#if !isRepoAccessible} + Missing access to the repository.Provide Github Permissions ➜ + + {/if} - Missing Git repository?Adjust Github App Permissions ➜ +
+ Data Sources + {#each agentDataSources as sourceData} + - - {/if} - + {sourceData.uri} +
+
+ {#if sourceData.type === "github"} + + {:else if sourceData.type === "web_page"} + + {:else} + + {/if} +
+
+ {/each} +
+
-
- - -
- {#if !!accessToken && !!refreshToken} - - - {:else} - - {/if} + Cancel + + + {:else} + + {/if} +
- -
+ {/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 0ebd6a7..6bdc09d 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" >