diff --git a/src/ui/ManagementPortal/.env.example b/src/ui/ManagementPortal/.env.example index 105e29936f..5f681725a4 100644 --- a/src/ui/ManagementPortal/.env.example +++ b/src/ui/ManagementPortal/.env.example @@ -1,2 +1,3 @@ APP_CONFIG_ENDPOINT="" # A connection string for the App Config service. LOCAL_API_URL="" # The URL of the local Management API service (https://localhost:63267). IMPORTANT! Only set this value if you wish to debug the entire solution locally and bypass the App Config service value for the MANAGEMENT API URL. +API_URL= diff --git a/src/ui/ManagementPortal/js/api.ts b/src/ui/ManagementPortal/js/api.ts index 9d399125e2..e71aa134fa 100644 --- a/src/ui/ManagementPortal/js/api.ts +++ b/src/ui/ManagementPortal/js/api.ts @@ -4,7 +4,7 @@ import type { AgentDataSource, AgentIndex, AgentGatekeeper, - MockCreateAgentRequest + CreateAgentRequest } from './types'; import { mockGetAgentIndexesResponse, mockGetAgentDataSourcesResponse } from './mock'; @@ -13,7 +13,17 @@ async function wait(milliseconds: number = 1000): Promise { } export default { - mockLoadTime: 2000, + mockLoadTime: 1000, + + apiUrl: null, + setApiUrl(apiUrl) { + this.apiUrl = apiUrl; + }, + + instanceId: null, + setInstanceId(instanceId) { + this.instanceId = instanceId; + }, async getConfigValue(key: string) { return await $fetch(`/api/config/`, { @@ -29,8 +39,7 @@ export default { }, async getAgentIndexes(): Promise { - await wait(this.mockLoadTime); - return mockGetAgentIndexesResponse; + return await $fetch(`${this.apiUrl}/instances/${this.instanceId}/providers/FoundationaLLM.Vectorization/indexingprofiles`); }, async getAgentGatekeepers(): Promise { @@ -38,10 +47,10 @@ export default { return []; }, - async createAgent(request: MockCreateAgentRequest): Promise { - console.log('Mock create agent started:', request); - const waitPromise = await wait(this.mockLoadTime); - console.log('Mock create agent completed.'); - return waitPromise; + async createAgent(request: CreateAgentRequest): Promise { + return await $fetch(`/instances/${this.instanceId}/providers/FoundationaLLM.Agent/agents?api-version=1.0`, { + method: 'POST', + body: request, + }); }, } diff --git a/src/ui/ManagementPortal/js/types.ts b/src/ui/ManagementPortal/js/types.ts index fcc53aae09..c4fceb7a59 100644 --- a/src/ui/ManagementPortal/js/types.ts +++ b/src/ui/ManagementPortal/js/types.ts @@ -44,3 +44,36 @@ export type MockCreateAgentRequest = { }; prompt: string; }; + +export type CreateAgentRequest = { + name: string; + type: 'knowledge-management' | 'analytics'; + // description: string; + // "language_model": { + // "type": "openai", + // "provider": "microsoft", + // "temperature": 0, + // "use_chat": true, + // "api_endpoint": "FoundationaLLM:AzureOpenAI:API:Endpoint", + // "api_key": "FoundationaLLM:AzureOpenAI:API:Key", + // "api_version": "FoundationaLLM:AzureOpenAI:API:Version", + // "version": "FoundationaLLM:AzureOpenAI:API:Completions:ModelVersion", + // "deployment": "FoundationaLLM:AzureOpenAI:API:Completions:DeploymentName" + // }, + indexing_profile: string; + embedding_profile: string; + sessions_enabled: boolean; + orchestrator: string; + conversation_history: { + enabled: boolean; + max_history: number; + }; + gatekeeper: { + use_system_setting: boolean; + options: { + content_safety: number; + data_protection: number; + }; + }; + prompt: string; +}; \ No newline at end of file diff --git a/src/ui/ManagementPortal/nuxt.config.ts b/src/ui/ManagementPortal/nuxt.config.ts index c24048c22e..6c0c41f00d 100644 --- a/src/ui/ManagementPortal/nuxt.config.ts +++ b/src/ui/ManagementPortal/nuxt.config.ts @@ -45,11 +45,14 @@ export default defineNuxtConfig({ ...(buildLoadingTemplate ? { loadingTemplate: () => buildLoadingTemplate, - } + } : {}), port: 3001, }, runtimeConfig: { APP_CONFIG_ENDPOINT: process.env.APP_CONFIG_ENDPOINT, + public: { + apiUrl: process.env.API_URL, + } }, }); diff --git a/src/ui/ManagementPortal/pages/agents/create.vue b/src/ui/ManagementPortal/pages/agents/create.vue index 1c06aae980..da2f774dd0 100644 --- a/src/ui/ManagementPortal/pages/agents/create.vue +++ b/src/ui/ManagementPortal/pages/agents/create.vue @@ -1,4 +1,4 @@ - +