Compare commits

..

2 Commits

Author SHA1 Message Date
Victor Meng
91c9c8fee7 Remove extra / in url 2023-08-08 12:30:15 -07:00
Victor Meng
5c21e9d5ee Switch to tools federation endpoints for query copilot 2023-08-08 12:21:37 -07:00
10 changed files with 2862 additions and 5120 deletions

7884
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -148,7 +148,7 @@
"eslint-cli": "1.1.1",
"eslint-plugin-no-null": "1.0.2",
"eslint-plugin-prefer-arrow": "1.2.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-hooks": "4.2.0",
"expect-playwright": "0.3.3",
"fast-glob": "3.2.5",
"file-loader": "2.0.0",

View File

@@ -358,6 +358,7 @@ export enum ContainerStatusType {
export enum PoolIdType {
DefaultPoolId = "default",
QueryCopilot = "query-copilot",
}
export const EmulatorMasterKey =

View File

@@ -283,18 +283,18 @@ export default class Explorer {
isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", ONE_DAY_IN_MS) &&
this.getRandomInt(100) < 25
) {
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
sendMessage(MessageTypes.DisplayNPSSurvey);
}
} else {
// An existing account is lesser than 90 days old. For existing account show to random 10 % of users in Data Explorer.
if (isAccountNewerThanNinetyDays) {
if (this.getRandomInt(100) < 10) {
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
sendMessage(MessageTypes.DisplayNPSSurvey);
}
} else {
// An existing account is greater than 90 days. For existing account show to random 25 % of users in Data Explorer.
if (this.getRandomInt(100) < 25) {
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
sendMessage(MessageTypes.DisplayNPSSurvey);
}
}
}
@@ -395,7 +395,7 @@ export default class Explorer {
) {
const provisionData: IProvisionData = {
cosmosEndpoint: userContext?.databaseAccount?.properties?.documentEndpoint,
poolId: PoolIdType.DefaultPoolId,
poolId: PoolIdType.QueryCopilot,
};
const connectionStatus: ContainerConnectionInfo = {
status: ConnectionStatusType.Connecting,
@@ -1335,5 +1335,7 @@ export default class Explorer {
const sampleDataResourceTokenCollection = new ResourceTokenCollection(this, databaseId, collection, true);
useDatabases.setState({ sampleDataResourceTokenCollection });
await this.allocateContainer();
}
}

View File

@@ -78,13 +78,11 @@ export const QueryCopilotFeedbackModal: React.FC = (): JSX.Element => {
}}
></ChoiceGroup>
<Text style={{ fontSize: 12, marginBottom: 14 }}>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the{" "}
{
<Link href="https://privacy.microsoft.com/privacystatement" target="_blank">
Privacy statement
</Link>
}{" "}
for more information.
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your
organization will be able to view and manage your feedback data.{" "}
<Link href="https://privacy.microsoft.com/privacystatement" target="_blank">
Privacy statement
</Link>
</Text>
{likeQuery && (
<Checkbox

View File

@@ -42,8 +42,8 @@ export const WelcomeModal = ({ visible }: { visible: boolean }): JSX.Element =>
</Stack>
</Stack>
<Stack horizontalAlign="center">
<Stack.Item align="center" style={{ textAlign: "center" }}>
<Text className="title bold">Welcome to Query Copilot for Azure Cosmos DB (Private Preview)</Text>
<Stack.Item align="center">
<Text className="title bold">Welcome to Copilot in CosmosDB</Text>
</Stack.Item>
<Stack.Item align="center" className="text">
<Stack horizontal>
@@ -52,7 +52,7 @@ export const WelcomeModal = ({ visible }: { visible: boolean }): JSX.Element =>
</StackItem>
<StackItem align="start">
<Text className="bold">
Let Query Copilot do the work for you
Let copilot do the work for you
<br />
</Text>
</StackItem>
@@ -88,14 +88,13 @@ export const WelcomeModal = ({ visible }: { visible: boolean }): JSX.Element =>
</StackItem>
<StackItem align="start">
<Text className="bold">
Query Copilot works on a sample database.
Copilot currently works only a sample database
<br />
</Text>
</StackItem>
</Stack>
<Text>
While in Private Preview, Query Copilot is setup to work on sample database we have configured for you
at no cost.
Copilot is setup on a sample database we have configured for you at no cost
<br />
<Link href="http://aka.ms/cdb-copilot-learn-more">Learn more</Link>
</Text>

View File

@@ -118,7 +118,7 @@ exports[`Query Copilot Feedback Modal snapshot test shoud render and match snaps
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -126,8 +126,6 @@ exports[`Query Copilot Feedback Modal snapshot test shoud render and match snaps
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<Stack
horizontal={true}
@@ -273,7 +271,7 @@ exports[`Query Copilot Feedback Modal snapshot test should cancel submission 1`]
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -281,8 +279,6 @@ exports[`Query Copilot Feedback Modal snapshot test should cancel submission 1`]
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<Stack
horizontal={true}
@@ -428,7 +424,7 @@ exports[`Query Copilot Feedback Modal snapshot test should close on cancel click
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -436,8 +432,6 @@ exports[`Query Copilot Feedback Modal snapshot test should close on cancel click
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<Stack
horizontal={true}
@@ -583,7 +577,7 @@ exports[`Query Copilot Feedback Modal snapshot test should get user unput 1`] =
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -591,8 +585,6 @@ exports[`Query Copilot Feedback Modal snapshot test should get user unput 1`] =
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<Stack
horizontal={true}
@@ -738,7 +730,7 @@ exports[`Query Copilot Feedback Modal snapshot test should not render dont show
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -746,8 +738,6 @@ exports[`Query Copilot Feedback Modal snapshot test should not render dont show
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<Stack
horizontal={true}
@@ -893,7 +883,7 @@ exports[`Query Copilot Feedback Modal snapshot test should record user contact c
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -901,8 +891,6 @@ exports[`Query Copilot Feedback Modal snapshot test should record user contact c
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<Stack
horizontal={true}
@@ -1048,7 +1036,7 @@ exports[`Query Copilot Feedback Modal snapshot test should record user contact c
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -1056,8 +1044,6 @@ exports[`Query Copilot Feedback Modal snapshot test should record user contact c
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<Stack
horizontal={true}
@@ -1203,7 +1189,7 @@ exports[`Query Copilot Feedback Modal snapshot test should render dont show agai
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -1211,8 +1197,6 @@ exports[`Query Copilot Feedback Modal snapshot test should render dont show agai
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<StyledCheckboxBase
checked={true}
@@ -1373,7 +1357,7 @@ exports[`Query Copilot Feedback Modal snapshot test should submit submission 1`]
}
}
>
By pressing submit, your feedback will be used to improve Microsoft products and services. Please see the
By pressing submit, your feedback will be used to improve Microsoft products and services. IT admins for your organization will be able to view and manage your feedback data.
<StyledLinkBase
href="https://privacy.microsoft.com/privacystatement"
@@ -1381,8 +1365,6 @@ exports[`Query Copilot Feedback Modal snapshot test should submit submission 1`]
>
Privacy statement
</StyledLinkBase>
for more information.
</Text>
<Stack
horizontal={true}

View File

@@ -60,16 +60,11 @@ exports[`Query Copilot Welcome Modal snapshot test should render when isOpen is
>
<StackItem
align="center"
style={
Object {
"textAlign": "center",
}
}
>
<Text
className="title bold"
>
Welcome to Query Copilot for Azure Cosmos DB (Private Preview)
Welcome to Copilot in CosmosDB
</Text>
</StackItem>
<StackItem
@@ -93,7 +88,7 @@ exports[`Query Copilot Welcome Modal snapshot test should render when isOpen is
<Text
className="bold"
>
Let Query Copilot do the work for you
Let copilot do the work for you
<br />
</Text>
</StackItem>
@@ -165,13 +160,13 @@ exports[`Query Copilot Welcome Modal snapshot test should render when isOpen is
<Text
className="bold"
>
Query Copilot works on a sample database.
Copilot currently works only a sample database
<br />
</Text>
</StackItem>
</Stack>
<Text>
While in Private Preview, Query Copilot is setup to work on sample database we have configured for you at no cost.
Copilot is setup on a sample database we have configured for you at no cost
<br />
<StyledLinkBase
href="http://aka.ms/cdb-copilot-learn-more"

View File

@@ -27,6 +27,7 @@ import { CommandButtonComponentProps } from "Explorer/Controls/CommandButton/Com
import { EditorReact } from "Explorer/Controls/Editor/EditorReact";
import Explorer from "Explorer/Explorer";
import { useCommandBar } from "Explorer/Menus/CommandBar/CommandBarComponentAdapter";
import { useNotebook } from "Explorer/Notebook/useNotebook";
import { SaveQueryPane } from "Explorer/Panes/SaveQueryPane/SaveQueryPane";
import { WelcomeModal } from "Explorer/QueryCopilot/Modal/WelcomeModal";
import { CopyPopup } from "Explorer/QueryCopilot/Popup/CopyPopup";
@@ -191,7 +192,8 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({ explorer }: Qu
};
setShowDeletePopup(false);
useQueryCopilot.getState().refreshCorrelationId();
const response = await fetch("https://copilotorchestrater.azurewebsites.net/generateSQLQuery", {
const serverInfo = useNotebook.getState().notebookServerInfo;
const response = await fetch(`${serverInfo.notebookServerEndpoint}generateSQLQuery`, {
method: "POST",
headers: {
"content-type": "application/json",

View File

@@ -1,18 +1,18 @@
import { useDialog } from "Explorer/Controls/Dialog";
import promiseRetry, { AbortError } from "p-retry";
import { Action } from "Shared/Telemetry/TelemetryConstants";
import { allowedJunoOrigins, validateEndpoint } from "Utils/EndpointValidation";
import promiseRetry, { AbortError } from "p-retry";
import {
Areas,
ConnectionStatusType,
ContainerStatusType,
HttpHeaders,
HttpStatusCodes,
JunoEndpoints,
Notebook,
} from "../Common/Constants";
import { getErrorMessage, getErrorStack } from "../Common/ErrorHandlingUtils";
import * as Logger from "../Common/Logger";
import { configContext } from "../ConfigContext";
import {
ContainerConnectionInfo,
ContainerInfo,
@@ -28,7 +28,6 @@ import {
} from "../Contracts/DataModels";
import { useNotebook } from "../Explorer/Notebook/useNotebook";
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
import { userContext } from "../UserContext";
import { getAuthorizationHeader } from "../Utils/AuthorizationUtils";
export class PhoenixClient {
@@ -231,8 +230,8 @@ export class PhoenixClient {
throw new Error("The Phoenix client was not initialized properly: missing ARM resourcce id");
}
const toolsEndpoint =
userContext.features.phoenixEndpoint ?? userContext.features.junoEndpoint ?? configContext.JUNO_ENDPOINT;
const toolsEndpoint = JunoEndpoints.Test2;
// userContext.features.phoenixEndpoint ?? userContext.features.junoEndpoint ?? configContext.JUNO_ENDPOINT;
if (!validateEndpoint(toolsEndpoint, allowedJunoOrigins)) {
const error = `${toolsEndpoint} not allowed as tools endpoint`;