[Query Copilot] Explanation bubble implementation (#1586)

* Explanation bubble implementation

* Explanation bubble unit tests

* Merged with main

* updated snapshot

---------

Co-authored-by: Predrag Klepic <v-prklepic@microsoft.com>
This commit is contained in:
Predrag Klepic
2023-08-30 13:08:58 +02:00
committed by GitHub
parent 0207f3cc04
commit b992742e20
7 changed files with 247 additions and 234 deletions

View File

@@ -34,6 +34,8 @@ export interface QueryCopilotState {
chatMessages: CopilotMessage[];
shouldAllocateContainer: boolean;
shouldIncludeInMessages: boolean;
showExplanationBubble: boolean;
showQueryExplanation: boolean;
openFeedbackModal: (generatedQuery: string, likeQuery: boolean, userPrompt: string) => void;
closeFeedbackModal: () => void;
@@ -63,9 +65,10 @@ export interface QueryCopilotState {
setShowWelcomeSidebar: (showWelcomeSidebar: boolean) => void;
setShowCopilotSidebar: (showCopilotSidebar: boolean) => void;
setChatMessages: (chatMessages: CopilotMessage[]) => void;
setShouldAllocateContainer: (shouldAllocateContainer: boolean) => void;
setShouldIncludeInMessages: (shouldIncludeInMessages: boolean) => void;
setShowExplanationBubble: (showExplanationBubble: boolean) => void;
setShowQueryExplanation: (showQueryExplanation: boolean) => void;
resetQueryCopilotStates: () => void;
}
@@ -102,6 +105,8 @@ export const useQueryCopilot: QueryCopilotStore = create((set) => ({
chatMessages: [],
shouldAllocateContainer: true,
shouldIncludeInMessages: true,
showExplanationBubble: false,
showQueryExplanation: false,
openFeedbackModal: (generatedQuery: string, likeQuery: boolean, userPrompt: string) =>
set({ generatedQuery, likeQuery, userPrompt, showFeedbackModal: true }),
@@ -135,6 +140,8 @@ export const useQueryCopilot: QueryCopilotStore = create((set) => ({
setChatMessages: (chatMessages: CopilotMessage[]) => set({ chatMessages }),
setShouldAllocateContainer: (shouldAllocateContainer: boolean) => set({ shouldAllocateContainer }),
setShouldIncludeInMessages: (shouldIncludeInMessages: boolean) => set({ shouldIncludeInMessages }),
setShowExplanationBubble: (showExplanationBubble: boolean) => set({ showExplanationBubble }),
setShowQueryExplanation: (showQueryExplanation: boolean) => set({ showQueryExplanation }),
resetQueryCopilotStates: () => {
set((state) => ({
@@ -167,6 +174,8 @@ export const useQueryCopilot: QueryCopilotStore = create((set) => ({
chatMessages: [],
shouldAllocateContainer: true,
shouldIncludeInMessages: true,
showExplanationBubble: false,
showQueryExplanation: false,
}));
},
}));