From 425e375d50a51a09d7daa259afd592955af8264f Mon Sep 17 00:00:00 2001 From: Predrag Klepic <60631598+Klepic95@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:56:13 +0200 Subject: [PATCH] Reintroduce feature flags (#1590) Co-authored-by: Predrag Klepic --- .../QueryCopilot/Shared/QueryCopilotClient.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts b/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts index e27a93386..149e02df0 100644 --- a/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts +++ b/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts @@ -27,16 +27,22 @@ export const SendQueryRequest = async ({ .getState() .setChatMessages([...useQueryCopilot.getState().chatMessages, { source: 0, message: userPrompt }]); try { - if (useQueryCopilot.getState().shouldAllocateContainer) { + if (useQueryCopilot.getState().shouldAllocateContainer && userContext.features.enableCopilotPhoenixGateaway) { await explorer.allocateContainer(PoolIdType.DefaultPoolId); useQueryCopilot.getState().setShouldAllocateContainer(false); } useQueryCopilot.getState().refreshCorrelationId(); const serverInfo = useNotebook.getState().notebookServerInfo; - const queryUri = createUri(serverInfo.notebookServerEndpoint, "generateSQLQuery"); + + const queryUri = userContext.features.enableCopilotPhoenixGateaway + ? createUri(serverInfo.notebookServerEndpoint, "generateSQLQuery") + : createUri("https://copilotorchestrater.azurewebsites.net/", "generateSQLQuery"); + const payload = { - containerSchema: ShortenedQueryCopilotSampleContainerSchema, + containerSchema: userContext.features.enableCopilotFullSchema + ? QueryCopilotSampleContainerSchema + : ShortenedQueryCopilotSampleContainerSchema, userPrompt: userPrompt, }; const response = await fetch(queryUri, {