From d155407b587dfcdf3e797e05e014eb239c6f7bce Mon Sep 17 00:00:00 2001 From: Predrag Klepic <60631598+Klepic95@users.noreply.github.com> Date: Fri, 1 Sep 2023 02:01:11 +0200 Subject: [PATCH] [Query Copilot] Phoenix Gateway flag true by default (#1595) * Phoenix Gateway flag true by default * Additional changes for clearness * removal of console log --------- Co-authored-by: Predrag Klepic --- src/Explorer/QueryCopilot/QueryCopilotTab.tsx | 8 ++++---- .../Shared/QueryCopilotClient.test.ts | 6 +++--- .../QueryCopilot/Shared/QueryCopilotClient.ts | 16 ++++++++-------- src/Platform/Hosted/extractFeatures.ts | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Explorer/QueryCopilot/QueryCopilotTab.tsx b/src/Explorer/QueryCopilot/QueryCopilotTab.tsx index d5c37c013..265d8dfed 100644 --- a/src/Explorer/QueryCopilot/QueryCopilotTab.tsx +++ b/src/Explorer/QueryCopilot/QueryCopilotTab.tsx @@ -184,7 +184,7 @@ export const QueryCopilotTab: React.FC = ({ explorer }: Query useTabs.getState().setIsQueryErrorThrown(false); if ( useQueryCopilot.getState().containerStatus.status !== ContainerStatusType.Active && - userContext.features.enableCopilotPhoenixGateaway + !userContext.features.disableCopilotPhoenixGateaway ) { await explorer.allocateContainer(PoolIdType.QueryCopilot); } @@ -196,9 +196,9 @@ export const QueryCopilotTab: React.FC = ({ explorer }: Query }; useQueryCopilot.getState().refreshCorrelationId(); const serverInfo = useQueryCopilot.getState().notebookServerInfo; - const queryUri = userContext.features.enableCopilotPhoenixGateaway - ? createUri(serverInfo.notebookServerEndpoint, "generateSQLQuery") - : createUri("https://copilotorchestrater.azurewebsites.net/", "generateSQLQuery"); + const queryUri = userContext.features.disableCopilotPhoenixGateaway + ? createUri("https://copilotorchestrater.azurewebsites.net/", "generateSQLQuery") + : createUri(serverInfo.notebookServerEndpoint, "generateSQLQuery"); const response = await fetch(queryUri, { method: "POST", headers: { diff --git a/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.test.ts b/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.test.ts index ff9b08c21..8c874e160 100644 --- a/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.test.ts +++ b/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.test.ts @@ -50,9 +50,9 @@ describe("Query Copilot Client", () => { forwardingId: "mocked-forwarding-id", }; - const feedbackUri = userContext.features.enableCopilotPhoenixGateaway - ? createUri(useQueryCopilot.getState().notebookServerInfo.notebookServerEndpoint, "feedback") - : createUri("https://copilotorchestrater.azurewebsites.net/", "feedback"); + const feedbackUri = userContext.features.disableCopilotPhoenixGateaway + ? createUri("https://copilotorchestrater.azurewebsites.net/", "feedback") + : createUri(useQueryCopilot.getState().notebookServerInfo.notebookServerEndpoint, "feedback"); it("should call fetch with the payload with like", async () => { const mockFetch = jest.fn().mockResolvedValueOnce({}); diff --git a/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts b/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts index 06bb70e04..8f5276c0e 100644 --- a/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts +++ b/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts @@ -32,7 +32,7 @@ export const SendQueryRequest = async ({ try { if ( useQueryCopilot.getState().containerStatus.status !== ContainerStatusType.Active && - userContext.features.enableCopilotPhoenixGateaway + !userContext.features.disableCopilotPhoenixGateaway ) { await explorer.allocateContainer(PoolIdType.QueryCopilot); } @@ -40,9 +40,9 @@ export const SendQueryRequest = async ({ useQueryCopilot.getState().refreshCorrelationId(); const serverInfo = useQueryCopilot.getState().notebookServerInfo; - const queryUri = userContext.features.enableCopilotPhoenixGateaway - ? createUri(serverInfo.notebookServerEndpoint, "generateSQLQuery") - : createUri("https://copilotorchestrater.azurewebsites.net/", "generateSQLQuery"); + const queryUri = userContext.features.disableCopilotPhoenixGateaway + ? createUri("https://copilotorchestrater.azurewebsites.net/", "generateSQLQuery") + : createUri(serverInfo.notebookServerEndpoint, "generateSQLQuery"); const payload = { containerSchema: userContext.features.enableCopilotFullSchema @@ -113,14 +113,14 @@ export const SubmitFeedback = async ({ }; if ( useQueryCopilot.getState().containerStatus.status !== ContainerStatusType.Active && - userContext.features.enableCopilotPhoenixGateaway + !userContext.features.disableCopilotPhoenixGateaway ) { await explorer.allocateContainer(PoolIdType.QueryCopilot); } const serverInfo = useQueryCopilot.getState().notebookServerInfo; - const feedbackUri = userContext.features.enableCopilotPhoenixGateaway - ? createUri(serverInfo.notebookServerEndpoint, "feedback") - : createUri("https://copilotorchestrater.azurewebsites.net/", "feedback"); + const feedbackUri = userContext.features.disableCopilotPhoenixGateaway + ? createUri("https://copilotorchestrater.azurewebsites.net/", "feedback") + : createUri(serverInfo.notebookServerEndpoint, "feedback"); await fetch(feedbackUri, { method: "POST", headers: { diff --git a/src/Platform/Hosted/extractFeatures.ts b/src/Platform/Hosted/extractFeatures.ts index b48a161e0..0ca6b6397 100644 --- a/src/Platform/Hosted/extractFeatures.ts +++ b/src/Platform/Hosted/extractFeatures.ts @@ -38,7 +38,7 @@ export type Features = { readonly enableCopilot: boolean; readonly enablePriorityBasedThrottling: boolean; readonly copilotVersion?: string; - readonly enableCopilotPhoenixGateaway: boolean; + readonly disableCopilotPhoenixGateaway: boolean; readonly enableCopilotFullSchema: boolean; // can be set via both flight and feature flag @@ -110,7 +110,7 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear enablePriorityBasedThrottling: "true" === get("enableprioritybasedthrottling"), enableCopilot: "true" === get("enablecopilot"), copilotVersion: get("copilotversion") ?? "v1.0", - enableCopilotPhoenixGateaway: "true" === get("enablecopilotphoenixgateaway"), + disableCopilotPhoenixGateaway: "true" === get("disablecopilotphoenixgateaway"), enableCopilotFullSchema: "true" === get("enablecopilotfullschema"), }; }