-
-
- Copilot
-
-
- {
- inputEdited.current = true;
- setShowSamplePrompts(true);
- }}
- onKeyDown={(e) => {
- if (e.key === "Enter") {
- inputEdited.current = true;
- startGenerateQueryProcess();
- }
- }}
- style={{ lineHeight: 30 }}
- styles={{ root: { width: "95%" } }}
- disabled={isGeneratingQuery}
- autoComplete="off"
- />
- {copilotTeachingBubbleVisible && (
-
- Write a prompt here and Copilot will generate the query for you. You can also choose from our{" "}
- {
- setShowSamplePrompts(true);
- toggleCopilotTeachingBubbleVisible();
- }}
- style={{ color: "white", fontWeight: 600 }}
- >
- sample prompts
- {" "}
- or write your own query
-
- )}
- startGenerateQueryProcess()}
- />
- {isGeneratingQuery && }
- {showSamplePrompts && (
- setShowSamplePrompts(false)}
- directionalHintFixed={true}
- directionalHint={DirectionalHint.bottomLeftEdge}
- alignTargetEdge={true}
- gapSpace={4}
- >
-
- {filteredHistories?.length > 0 && (
-
-
- Recent
-
- {filteredHistories.map((history, i) => (
- {
- setUserPrompt(history);
- setShowSamplePrompts(false);
- inputEdited.current = true;
- }}
- onRenderIcon={() => }
- styles={promptStyles}
- >
- {history}
-
- ))}
-
- )}
- {filteredSuggestedPrompts?.length > 0 && (
-
-
- Suggested Prompts
-
- {filteredSuggestedPrompts.map((prompt) => (
- {
- setUserPrompt(prompt.text);
- setShowSamplePrompts(false);
- inputEdited.current = true;
- }}
- onRenderIcon={() => }
- styles={promptStyles}
- >
- {prompt.text}
-
- ))}
-
- )}
- {(filteredHistories?.length > 0 || filteredSuggestedPrompts?.length > 0) && (
-
-
-
- Learn about{" "}
-
- writing effective prompts
-
-
-
- )}
-
-
- )}
-
-
-
-
- AI-generated content can have mistakes. Make sure it's accurate and appropriate before using it.{" "}
-
- Read preview terms
-
- {showErrorMessageBar && (
-
- We ran into an error and were not able to execute query.
-
- )}
- {showInvalidQueryMessageBar && (
-
- We were unable to generate a query based upon the prompt provided. Please modify the prompt and try
- again. For examples of how to write a good prompt, please read
-
- this article.
- {" "}
- Our content guidelines can be found
-
- here.
-
-
- )}
-
-
-
- {showFeedbackBar && (
-
- Provide feedback on the query generated
- {showCallout && !hideFeedbackModalForLikedQueries && (
- {
- setShowCallout(false);
- SubmitFeedback({
- params: {
- generatedQuery: generatedQuery,
- likeQuery: likeQuery,
- description: "",
- userPrompt: userPrompt,
- },
- explorer: explorer,
- });
- }}
- directionalHint={DirectionalHint.topCenter}
- >
-
- Thank you. Need to give{" "}
- {
- setShowCallout(false);
- useQueryCopilot.getState().openFeedbackModal(generatedQuery, true, userPrompt);
- }}
- >
- more feedback?
-
-
-
- )}
- {
- setShowCallout(!likeQuery);
- setLikeQuery(!likeQuery);
- if (dislikeQuery) {
- setDislikeQuery(!dislikeQuery);
- }
- }}
- />
- {
- if (!dislikeQuery) {
- useQueryCopilot.getState().openFeedbackModal(generatedQuery, false, userPrompt);
- setLikeQuery(false);
- }
- setDislikeQuery(!dislikeQuery);
- setShowCallout(false);
- }}
- />
-
-
- Copy code
-
- {
- setShowDeletePopup(true);
- }}
- iconProps={{ iconName: "Delete" }}
- style={{ margin: "0 10px", backgroundColor: "#FFF8F0", transition: "background-color 0.3s ease" }}
- >
- Delete code
-
-
+ {copilotActive && (
+
)}
-
= ({ explorer }: Query
-
- {isSamplePromptsOpen && }
- {query !== "" && query.trim().length !== 0 && (
-
- )}
-
);
diff --git a/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts b/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts
index 3074e7ac1..f38d9be39 100644
--- a/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts
+++ b/src/Explorer/QueryCopilot/Shared/QueryCopilotClient.ts
@@ -21,6 +21,7 @@ import { userContext } from "UserContext";
import { queryPagesUntilContentPresent } from "Utils/QueryUtils";
import { useQueryCopilot } from "hooks/useQueryCopilot";
import { useTabs } from "hooks/useTabs";
+import * as StringUtility from "../../../Shared/StringUtility";
export const SendQueryRequest = async ({
userPrompt,
@@ -165,7 +166,7 @@ export const OnExecuteQueryClick = async (): Promise