@gooddata/sdk-ui-gen-ai 11.65.0-alpha.0 → 11.65.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +72077 -4
- package/esm/components/CustomizationContext.d.ts +2 -1
- package/esm/components/CustomizationContext.d.ts.map +1 -1
- package/esm/components/CustomizationProvider.d.ts.map +1 -1
- package/esm/components/CustomizationProvider.js +10 -0
- package/esm/components/GenAIChatDialogConnected.d.ts +12 -3
- package/esm/components/GenAIChatDialogConnected.d.ts.map +1 -1
- package/esm/components/GenAIChatDialogConnected.js +17 -6
- package/esm/components/Messages.d.ts.map +1 -1
- package/esm/components/Messages.js +7 -3
- package/esm/components/customized/VisualizationMenu.d.ts +8 -0
- package/esm/components/customized/VisualizationMenu.d.ts.map +1 -0
- package/esm/components/customized/VisualizationMenu.js +47 -0
- package/esm/components/customized/types.d.ts +76 -1
- package/esm/components/customized/types.d.ts.map +1 -1
- package/esm/components/hooks/usePublisherDocumentSavedSync.d.ts +2 -0
- package/esm/components/hooks/usePublisherDocumentSavedSync.d.ts.map +1 -1
- package/esm/components/messages/AssistantItem.d.ts.map +1 -1
- package/esm/components/messages/AssistantItem.js +26 -1
- package/esm/components/messages/AssistantItemFeedback.d.ts.map +1 -1
- package/esm/components/messages/AssistantItemFeedback.js +4 -3
- package/esm/components/messages/FeedbackPopup.d.ts +3 -2
- package/esm/components/messages/FeedbackPopup.d.ts.map +1 -1
- package/esm/components/messages/FeedbackPopup.js +7 -3
- package/esm/components/messages/ItemsGroup.d.ts.map +1 -1
- package/esm/components/messages/ItemsGroup.js +1 -1
- package/esm/components/messages/contents/CustomHyperlink.js +1 -1
- package/esm/components/messages/conversationContents/ConversationDashboardContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationDashboardContent.js +2 -2
- package/esm/components/messages/conversationContents/ConversationMultipartContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationMultipartContent.js +3 -2
- package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.d.ts +3 -5
- package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.js +18 -7
- package/esm/components/messages/conversationContents/ConversationVisualizationContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationVisualizationContent.js +30 -67
- package/esm/context/addContextReference.d.ts.map +1 -1
- package/esm/context/addContextReference.js +2 -1
- package/esm/context/build.d.ts.map +1 -1
- package/esm/context/build.js +2 -0
- package/esm/context/collectContextReferences.d.ts.map +1 -1
- package/esm/context/collectContextReferences.js +2 -2
- package/esm/context/removeContextReference.d.ts.map +1 -1
- package/esm/context/removeContextReference.js +3 -2
- package/esm/context/selectContextReferences.js +2 -2
- package/esm/context/viewedPublisherDocument.d.ts +3 -1
- package/esm/context/viewedPublisherDocument.d.ts.map +1 -1
- package/esm/context/viewedPublisherDocument.js +10 -1
- package/esm/index.d.ts +3 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -1
- package/esm/localization/bundles/de-DE.localization-bundle.js +5 -5
- package/esm/localization/bundles/en-GB.localization-bundle.js +1 -1
- package/esm/localization/bundles/en-US.localization-bundle.d.ts +8 -0
- package/esm/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-US.localization-bundle.js +8 -0
- package/esm/localization/bundles/fr-FR.localization-bundle.js +7 -7
- package/esm/publisherDocumentPart.d.ts +20 -0
- package/esm/publisherDocumentPart.d.ts.map +1 -0
- package/esm/publisherDocumentPart.js +42 -0
- package/esm/sdk-ui-gen-ai.d.ts +125 -3
- package/esm/store/chatWindow/chatWindowSelectors.d.ts.map +1 -1
- package/esm/store/chatWindow/chatWindowSelectors.js +3 -3
- package/esm/store/chatWindow/chatWindowSlice.d.ts +3 -3
- package/esm/store/chatWindow/chatWindowSlice.d.ts.map +1 -1
- package/esm/store/events.d.ts +34 -4
- package/esm/store/events.d.ts.map +1 -1
- package/esm/store/events.js +7 -0
- package/esm/store/messages/messagesSelectors.js +1 -1
- package/esm/store/messages/messagesSlice.d.ts +7 -4
- package/esm/store/messages/messagesSlice.d.ts.map +1 -1
- package/esm/store/messages/messagesSlice.js +16 -5
- package/esm/store/queues/queue.activateConversationAction.d.ts +3 -0
- package/esm/store/queues/queue.activateConversationAction.d.ts.map +1 -0
- package/esm/store/queues/queue.activateConversationAction.js +36 -0
- package/esm/store/sideEffects/onDefinitionReceivedTrigger.d.ts.map +1 -1
- package/esm/store/sideEffects/onDefinitionReceivedTrigger.js +15 -1
- package/esm/store/sideEffects/onEvent.d.ts +10 -2
- package/esm/store/sideEffects/onEvent.d.ts.map +1 -1
- package/esm/store/sideEffects/onEvent.js +18 -9
- package/esm/store/sideEffects/onPublisherDocumentSaved.d.ts.map +1 -1
- package/esm/store/sideEffects/onPublisherDocumentSaved.js +13 -2
- package/esm/store/sideEffects/onUserMessage.d.ts +1 -1
- package/esm/store/sideEffects/onUserMessage.d.ts.map +1 -1
- package/esm/store/sideEffects/onUserMessage.js +27 -2
- package/esm/store/store.d.ts.map +1 -1
- package/esm/store/store.js +2 -0
- package/esm/utils.d.ts +7 -5
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js +16 -11
- package/package.json +22 -22
- package/styles/css/conversations.css +3 -3
- package/styles/css/input.css +2 -2
- package/styles/css/intelligence.css +2 -2
- package/styles/css/main.css +259 -85
- package/styles/css/main.css.map +1 -1
- package/styles/css/messages.css +219 -45
- package/styles/css/messages.css.map +1 -1
- package/styles/css/tooltip.css +1 -1
- package/styles/scss/conversations.scss +2 -2
- package/styles/scss/intelligence.scss +2 -2
- package/styles/scss/messages.scss +9 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType } from "react";
|
|
2
|
-
import { type IGenAIAssistantAgentChooserProps, type IGenAIAssistantAgentItemProps, type IGenAIAssistantAssistantMessageProps, type IGenAIAssistantConversationDateGroupingProps, type IGenAIAssistantConversationDrawerHeaderProps, type IGenAIAssistantConversationFooterProps, type IGenAIAssistantConversationHeaderProps, type IGenAIAssistantConversationItemProps, type IGenAIAssistantConversationKdaContentProps, type IGenAIAssistantConversationVisualizationContentProps, type IGenAIAssistantFeedbackProps, type IGenAIAssistantFollowUpButtonsProps, type IGenAIAssistantFollowUpQuestionProps, type IGenAIAssistantMessageErrorContentProps, type IGenAIAssistantMessageMultipartContentProps, type IGenAIAssistantMessageReasoningContentProps, type IGenAIAssistantMessageTextContentProps, type IGenAIAssistantSlots, type IGenAIAssistantUserMessageProps } from "./customized/types.js";
|
|
2
|
+
import { type IGenAIAssistantAgentChooserProps, type IGenAIAssistantAgentItemProps, type IGenAIAssistantAssistantMessageProps, type IGenAIAssistantConversationDateGroupingProps, type IGenAIAssistantConversationDrawerHeaderProps, type IGenAIAssistantConversationFooterProps, type IGenAIAssistantConversationHeaderProps, type IGenAIAssistantConversationItemProps, type IGenAIAssistantConversationKdaContentProps, type IGenAIAssistantConversationVisualizationContentProps, type IGenAIAssistantFeedbackProps, type IGenAIAssistantFollowUpButtonsProps, type IGenAIAssistantFollowUpQuestionProps, type IGenAIAssistantMessageErrorContentProps, type IGenAIAssistantMessageMultipartContentProps, type IGenAIAssistantMessageReasoningContentProps, type IGenAIAssistantMessageTextContentProps, type IGenAIAssistantSlots, type IGenAIAssistantUserMessageProps, type IGenAIAssistantVisualizationMenuProps } from "./customized/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -19,6 +19,7 @@ export interface IGenAIAssistantComponents {
|
|
|
19
19
|
MessageReasoningContentComponent: ComponentType<IGenAIAssistantMessageReasoningContentProps>;
|
|
20
20
|
MessageMultipartContentComponent: ComponentType<IGenAIAssistantMessageMultipartContentProps>;
|
|
21
21
|
ConversationVisualizationContentComponent: ComponentType<IGenAIAssistantConversationVisualizationContentProps>;
|
|
22
|
+
VisualizationMenuComponent: ComponentType<IGenAIAssistantVisualizationMenuProps>;
|
|
22
23
|
ConversationKdaContentComponent: ComponentType<IGenAIAssistantConversationKdaContentProps>;
|
|
23
24
|
FollowUpButtonsComponent: ComponentType<IGenAIAssistantFollowUpButtonsProps>;
|
|
24
25
|
FollowUpQuestionComponent: ComponentType<IGenAIAssistantFollowUpQuestionProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomizationContext.d.ts","sourceRoot":"","sources":["../../src/components/CustomizationContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAA6B,MAAM,OAAO,CAAC;AAEtE,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,oCAAoC,EACzC,KAAK,4CAA4C,EACjD,KAAK,4CAA4C,EACjD,KAAK,sCAAsC,EAC3C,KAAK,sCAAsC,EAC3C,KAAK,oCAAoC,EACzC,KAAK,0CAA0C,EAC/C,KAAK,oDAAoD,EACzD,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EACzC,KAAK,uCAAuC,EAC5C,KAAK,2CAA2C,EAChD,KAAK,2CAA2C,EAChD,KAAK,sCAAsC,EAC3C,KAAK,oBAAoB,EACzB,KAAK,+BAA+B,
|
|
1
|
+
{"version":3,"file":"CustomizationContext.d.ts","sourceRoot":"","sources":["../../src/components/CustomizationContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAA6B,MAAM,OAAO,CAAC;AAEtE,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,oCAAoC,EACzC,KAAK,4CAA4C,EACjD,KAAK,4CAA4C,EACjD,KAAK,sCAAsC,EAC3C,KAAK,sCAAsC,EAC3C,KAAK,oCAAoC,EACzC,KAAK,0CAA0C,EAC/C,KAAK,oDAAoD,EACzD,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EACzC,KAAK,uCAAuC,EAC5C,KAAK,2CAA2C,E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,gCAAgC,CAAC,CAAC;CAC1E;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,UAAU,CAAC,EAAE,yBAAyB,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,+CAE/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,iCAM5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomizationProvider.d.ts","sourceRoot":"","sources":["../../src/components/CustomizationProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAsBpE,OAAO,EAkBH,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"CustomizationProvider.d.ts","sourceRoot":"","sources":["../../src/components/CustomizationProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAsBpE,OAAO,EAkBH,KAAK,oBAAoB,EAG5B,MAAM,uBAAuB,CAAC;AAK/B,MAAM,MAAM,0BAA0B,GAAG;IACrC,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAChC,CAAC;AAqOF,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,iBAAiB,CAAC,0BAA0B,CAAC,2CAqCvG"}
|
|
@@ -22,6 +22,7 @@ import { DefaultMessageMultipartContent } from "./customized/MessageMultipartCon
|
|
|
22
22
|
import { DefaultMessageReasoningContent } from "./customized/MessageReasoningContent.js";
|
|
23
23
|
import { DefaultMessageTextContent } from "./customized/MessageTextContent.js";
|
|
24
24
|
import { DefaultUserMessage } from "./customized/UserMessage.js";
|
|
25
|
+
import { DefaultVisualizationMenu } from "./customized/VisualizationMenu.js";
|
|
25
26
|
import { useFullscreenCheck } from "./hooks/useFullscreenCheck.js";
|
|
26
27
|
function LandingScreenSlotRenderer() {
|
|
27
28
|
const { slots } = useContext(customizationContext);
|
|
@@ -148,6 +149,14 @@ function ConversationVisualizationContentSlotRenderer(props) {
|
|
|
148
149
|
}
|
|
149
150
|
return _jsx(DefaultConversationVisualizationContent, { ...props });
|
|
150
151
|
}
|
|
152
|
+
function VisualizationMenuSlotRenderer(props) {
|
|
153
|
+
const { slots } = useContext(customizationContext);
|
|
154
|
+
const VisualizationMenuSlot = slots?.VisualizationMenu;
|
|
155
|
+
if (VisualizationMenuSlot) {
|
|
156
|
+
return _jsx(VisualizationMenuSlot, { Default: DefaultVisualizationMenu, defaultProps: props });
|
|
157
|
+
}
|
|
158
|
+
return _jsx(DefaultVisualizationMenu, { ...props });
|
|
159
|
+
}
|
|
151
160
|
function ConversationKdaContentSlotRenderer(props) {
|
|
152
161
|
const { slots } = useContext(customizationContext);
|
|
153
162
|
const ConversationKdaContentSlot = slots?.ConversationKdaContent;
|
|
@@ -205,6 +214,7 @@ export function CustomizationProvider({ children, slots }) {
|
|
|
205
214
|
MessageReasoningContentComponent: MessageReasoningContentSlotRenderer,
|
|
206
215
|
MessageMultipartContentComponent: MessageMultipartContentSlotRenderer,
|
|
207
216
|
ConversationVisualizationContentComponent: ConversationVisualizationContentSlotRenderer,
|
|
217
|
+
VisualizationMenuComponent: VisualizationMenuSlotRenderer,
|
|
208
218
|
ConversationKdaContentComponent: ConversationKdaContentSlotRenderer,
|
|
209
219
|
FollowUpButtonsComponent: FollowUpButtonsSlotRenderer,
|
|
210
220
|
FollowUpQuestionComponent: FollowUpQuestionSlotRenderer,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
2
|
import { type IAnalyticalBackend, type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
|
|
3
3
|
import type { GenAIChatEffort, GenAIObjectType, IColorPalette, IGenAIUserContext } from "@gooddata/sdk-model";
|
|
4
|
-
import { type ChatAssistantMessageEvent, type ChatClarificationQuestionsEvent, type ChatClosedEvent, type ChatCopyToClipboardEvent, type ChatDefinitionReceivedEvent, type ChatEvent, type ChatFeedbackErrorEvent, type ChatFeedbackEvent, type ChatModeChangeEvent, type ChatOpenedEvent, type ChatResetEvent, type ChatSaveVisualizationErrorEvent, type ChatSaveVisualizationSuccessEvent, type ChatUserMessageEvent } from "../store/events.js";
|
|
4
|
+
import { type ChatAssistantMessageEvent, type ChatClarificationQuestionsEvent, type ChatClosedEvent, type ChatConversationChangedEvent, type ChatCopyToClipboardEvent, type ChatDefinitionReceivedEvent, type ChatEvent, type ChatFeedbackErrorEvent, type ChatFeedbackEvent, type ChatModeChangeEvent, type ChatOpenedEvent, type ChatReasoningEvent, type ChatResetEvent, type ChatSaveVisualizationErrorEvent, type ChatSaveVisualizationSuccessEvent, type ChatUserMessageEvent } from "../store/events.js";
|
|
5
5
|
import { type GenAIAssistantDisplayMode, type LinkHandlerEvent } from "./ConfigContext.js";
|
|
6
6
|
import { type GenAIChatDialogProps } from "./GenAIChatDialog.js";
|
|
7
7
|
import { type IDashboardSaved } from "./hooks/useDashboardSavedSync.js";
|
|
@@ -25,12 +25,18 @@ export type GenAIChatConnectedEvent = {
|
|
|
25
25
|
} | {
|
|
26
26
|
name: "reset";
|
|
27
27
|
payload: ChatResetEvent;
|
|
28
|
+
} | {
|
|
29
|
+
name: "conversation-changed";
|
|
30
|
+
payload: ChatConversationChangedEvent;
|
|
28
31
|
} | {
|
|
29
32
|
name: "user-message";
|
|
30
33
|
payload: ChatUserMessageEvent;
|
|
31
34
|
} | {
|
|
32
35
|
name: "assistant-message";
|
|
33
36
|
payload: ChatAssistantMessageEvent;
|
|
37
|
+
} | {
|
|
38
|
+
name: "reasoning";
|
|
39
|
+
payload: ChatReasoningEvent;
|
|
34
40
|
} | {
|
|
35
41
|
name: "feedback";
|
|
36
42
|
payload: ChatFeedbackEvent;
|
|
@@ -65,6 +71,7 @@ type SeedAction = Parameters<Dispatch>[0];
|
|
|
65
71
|
* @internal
|
|
66
72
|
*/
|
|
67
73
|
export type SeedInput = {
|
|
74
|
+
conversationId?: string;
|
|
68
75
|
agentId?: string;
|
|
69
76
|
effort?: GenAIChatEffort;
|
|
70
77
|
askedQuestion?: string | null;
|
|
@@ -83,7 +90,7 @@ export type SeedInput = {
|
|
|
83
90
|
*
|
|
84
91
|
* @internal
|
|
85
92
|
*/
|
|
86
|
-
export declare function buildSeedActions({ agentId, effort, askedQuestion, userContext, replaceUserContext, appendToChat, }: SeedInput): SeedAction[];
|
|
93
|
+
export declare function buildSeedActions({ conversationId, agentId, effort, askedQuestion, userContext, replaceUserContext, appendToChat, }: SeedInput): SeedAction[];
|
|
87
94
|
/**
|
|
88
95
|
* Props for {@link GenAIChatDialogConnected}.
|
|
89
96
|
*
|
|
@@ -121,6 +128,8 @@ export interface IGenAIChatDialogConnectedProps {
|
|
|
121
128
|
displayMode?: GenAIAssistantDisplayMode;
|
|
122
129
|
/** A question to seed into the chat when it opens. */
|
|
123
130
|
askedQuestion?: string | null;
|
|
131
|
+
/** Existing conversation to activate for this request, without clearing or seeding it. */
|
|
132
|
+
conversationId?: string;
|
|
124
133
|
/**
|
|
125
134
|
* Monotonic counter bumped on every ask. Keying the seeding effect on it re-seeds the chat
|
|
126
135
|
* (clear thread + send message) even when `askedQuestion` is identical to the previous ask.
|
|
@@ -187,6 +196,6 @@ export interface IGenAIChatDialogConnectedProps {
|
|
|
187
196
|
*
|
|
188
197
|
* @internal
|
|
189
198
|
*/
|
|
190
|
-
export declare function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, effort, isOpen, isDisabled, displayMode, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, ambientUserContextLoading, publisherDocumentSaved, dashboardSaved, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks, onLinkClick, returnFocusTo, }: IGenAIChatDialogConnectedProps): import("react/jsx-runtime").JSX.Element;
|
|
199
|
+
export declare function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, effort, isOpen, isDisabled, displayMode, onOpen, onClose, askedQuestion, conversationId, askSeq, userContext, ambientUserContext, ambientUserContextLoading, publisherDocumentSaved, dashboardSaved, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks, onLinkClick, returnFocusTo, }: IGenAIChatDialogConnectedProps): import("react/jsx-runtime").JSX.Element;
|
|
191
200
|
export {};
|
|
192
201
|
//# sourceMappingURL=GenAIChatDialogConnected.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIChatDialogConnected.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatDialogConnected.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"GenAIChatDialogConnected.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatDialogConnected.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAQ9G,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,SA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, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { makeUserItem } from "../model.js";
|
|
5
|
-
import { setAmbientUserContextAction, setUserContextAction } from "../store/chatWindow/chatWindowSlice.js";
|
|
6
|
-
import { isChatAssistantMessageEvent, isChatClarificationQuestionsEvent, isChatClosedEvent, isChatCopyToClipboardEvent, isChatDefinitionReceivedEvent, isChatFeedbackErrorEvent, isChatFeedbackEvent, isChatModeChangeEvent, isChatOpenedEvent, isChatResetEvent, isChatSaveVisualizationErrorEvent, isChatSaveVisualizationSuccessEvent, isChatUserMessageEvent, } from "../store/events.js";
|
|
7
|
-
import { clearThreadAction, newMessageAction, setSelectedAgentAction, setSelectedEffortAction, } from "../store/messages/messagesSlice.js";
|
|
5
|
+
import { setAmbientUserContextAction, setHistoryAction, setUserContextAction, } from "../store/chatWindow/chatWindowSlice.js";
|
|
6
|
+
import { isChatAssistantMessageEvent, isChatClarificationQuestionsEvent, isChatClosedEvent, isChatConversationChangedEvent, isChatCopyToClipboardEvent, isChatDefinitionReceivedEvent, isChatFeedbackErrorEvent, isChatFeedbackEvent, isChatModeChangeEvent, isChatOpenedEvent, isChatReasoningEvent, isChatResetEvent, isChatSaveVisualizationErrorEvent, isChatSaveVisualizationSuccessEvent, isChatUserMessageEvent, } from "../store/events.js";
|
|
7
|
+
import { activateConversationAction, clearThreadAction, newMessageAction, setSelectedAgentAction, setSelectedEffortAction, } from "../store/messages/messagesSlice.js";
|
|
8
8
|
import { GenAIChatDialog } from "./GenAIChatDialog.js";
|
|
9
9
|
import { useDashboardSavedSync } from "./hooks/useDashboardSavedSync.js";
|
|
10
10
|
import { usePublisherDocumentSavedSync, } from "./hooks/usePublisherDocumentSavedSync.js";
|
|
@@ -19,12 +19,18 @@ export function toGenAIChatConnectedEvent(event) {
|
|
|
19
19
|
else if (isChatResetEvent(event)) {
|
|
20
20
|
return { name: "reset", payload: event };
|
|
21
21
|
}
|
|
22
|
+
else if (isChatConversationChangedEvent(event)) {
|
|
23
|
+
return { name: "conversation-changed", payload: event };
|
|
24
|
+
}
|
|
22
25
|
else if (isChatUserMessageEvent(event)) {
|
|
23
26
|
return { name: "user-message", payload: event };
|
|
24
27
|
}
|
|
25
28
|
else if (isChatAssistantMessageEvent(event)) {
|
|
26
29
|
return { name: "assistant-message", payload: event };
|
|
27
30
|
}
|
|
31
|
+
else if (isChatReasoningEvent(event)) {
|
|
32
|
+
return { name: "reasoning", payload: event };
|
|
33
|
+
}
|
|
28
34
|
else if (isChatFeedbackEvent(event)) {
|
|
29
35
|
return { name: "feedback", payload: event };
|
|
30
36
|
}
|
|
@@ -62,7 +68,10 @@ export function toGenAIChatConnectedEvent(event) {
|
|
|
62
68
|
*
|
|
63
69
|
* @internal
|
|
64
70
|
*/
|
|
65
|
-
export function buildSeedActions({ agentId, effort, askedQuestion, userContext, replaceUserContext, appendToChat, }) {
|
|
71
|
+
export function buildSeedActions({ conversationId, agentId, effort, askedQuestion, userContext, replaceUserContext, appendToChat, }) {
|
|
72
|
+
if (conversationId) {
|
|
73
|
+
return [activateConversationAction({ conversationId }), setHistoryAction({ isHistory: false })];
|
|
74
|
+
}
|
|
66
75
|
const actions = [];
|
|
67
76
|
const seeding = Boolean(askedQuestion || userContext);
|
|
68
77
|
if (seeding) {
|
|
@@ -93,7 +102,7 @@ export function buildSeedActions({ agentId, effort, askedQuestion, userContext,
|
|
|
93
102
|
*
|
|
94
103
|
* @internal
|
|
95
104
|
*/
|
|
96
|
-
export function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, effort, isOpen, isDisabled = true, displayMode, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, ambientUserContextLoading, publisherDocumentSaved, dashboardSaved, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks = true, onLinkClick, returnFocusTo, }) {
|
|
105
|
+
export function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, effort, isOpen, isDisabled = true, displayMode, onOpen, onClose, askedQuestion, conversationId, askSeq, userContext, ambientUserContext, ambientUserContextLoading, publisherDocumentSaved, dashboardSaved, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks = true, onLinkClick, returnFocusTo, }) {
|
|
97
106
|
const defaultLinkClick = useCallback(({ itemUrl, newTab, preventDefault, type, dashboardStatus, }) => {
|
|
98
107
|
// NOTE: If dashboard is draft, do nothing for now
|
|
99
108
|
if (type === "dashboard" && dashboardStatus === "draft") {
|
|
@@ -159,12 +168,13 @@ export function GenAIChatDialogConnected({ backend, workspace, locale, canManage
|
|
|
159
168
|
if (!isOpen || !chatDispatcher || !settings) {
|
|
160
169
|
return;
|
|
161
170
|
}
|
|
162
|
-
const seedToken = askSeq ?? askedQuestion ?? JSON.stringify(userContext ?? {});
|
|
171
|
+
const seedToken = askSeq ?? conversationId ?? askedQuestion ?? JSON.stringify(userContext ?? {});
|
|
163
172
|
if (lastSeedTokenRef.current === seedToken) {
|
|
164
173
|
return;
|
|
165
174
|
}
|
|
166
175
|
lastSeedTokenRef.current = seedToken;
|
|
167
176
|
buildSeedActions({
|
|
177
|
+
conversationId,
|
|
168
178
|
agentId,
|
|
169
179
|
effort,
|
|
170
180
|
askedQuestion,
|
|
@@ -178,6 +188,7 @@ export function GenAIChatDialogConnected({ backend, workspace, locale, canManage
|
|
|
178
188
|
effort,
|
|
179
189
|
chatDispatcher,
|
|
180
190
|
askedQuestion,
|
|
191
|
+
conversationId,
|
|
181
192
|
askSeq,
|
|
182
193
|
userContext,
|
|
183
194
|
appendToChat,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Messages.d.ts","sourceRoot":"","sources":["../../src/components/Messages.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Messages.d.ts","sourceRoot":"","sources":["../../src/components/Messages.tsx"],"names":[],"mappings":"AAgCA,KAAK,sBAAsB,GAAG;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EAAE,YAAY,EAAE,EAAE,sBAAsB,2CAkDhE"}
|
|
@@ -4,8 +4,9 @@ import { useMemo } from "react";
|
|
|
4
4
|
import cx from "classnames";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { useSelector } from "react-redux";
|
|
7
|
+
import { GOODSTRAP_SCROLLED_EVENT } from "@gooddata/sdk-ui-kit";
|
|
7
8
|
import { agentSwitchingActiveSelector, catalogItemsSelector, } from "../store/chatWindow/chatWindowSelectors.js";
|
|
8
|
-
import { asyncProcessSelector, conversationMessagesSelector, conversationSelector, } from "../store/messages/messagesSelectors.js";
|
|
9
|
+
import { asyncProcessSelector, conversationMessagesSelector, conversationSelector, loadedSelector, } from "../store/messages/messagesSelectors.js";
|
|
9
10
|
import { ChatSkeleton } from "./ChatSkeleton.js";
|
|
10
11
|
import { parseReferences } from "./completion/references.js";
|
|
11
12
|
import { useCustomization } from "./CustomizationContext.js";
|
|
@@ -17,6 +18,7 @@ import { ToolItemComponent } from "./messages/ToolItem.js";
|
|
|
17
18
|
import { groupMessages } from "./utils/groupUtility.js";
|
|
18
19
|
export function Messages({ initializing }) {
|
|
19
20
|
const loading = useSelector(asyncProcessSelector);
|
|
21
|
+
const loaded = useSelector(loadedSelector);
|
|
20
22
|
const conversation = useSelector(conversationSelector);
|
|
21
23
|
const conversationMessages = useSelector(conversationMessagesSelector);
|
|
22
24
|
const catalogItems = useSelector(catalogItemsSelector);
|
|
@@ -25,7 +27,7 @@ export function Messages({ initializing }) {
|
|
|
25
27
|
const { LandingScreenComponent } = useCustomization();
|
|
26
28
|
const { isBigScreen, isSmallScreen, isFullscreen } = useFullscreenCheck();
|
|
27
29
|
const intl = useIntl();
|
|
28
|
-
const isLoading = loading === "loading" || loading === "clearing" || initializing;
|
|
30
|
+
const isLoading = loading === "loading" || loading === "clearing" || initializing || !loaded;
|
|
29
31
|
const isEmpty = !conversationMessages.length && !isLoading;
|
|
30
32
|
return (_jsx("div", { className: cx("gd-gen-ai-chat__messages", {
|
|
31
33
|
"gd-gen-ai-chat__messages--fullscreen": isFullscreen,
|
|
@@ -33,7 +35,9 @@ export function Messages({ initializing }) {
|
|
|
33
35
|
"gd-gen-ai-chat__messages--small-screen": isSmallScreen,
|
|
34
36
|
"gd-gen-ai-chat__messages--empty": isEmpty,
|
|
35
37
|
"gd-gen-ai-chat__messages--agent-switching": agentSwitchingActive,
|
|
36
|
-
}), ref: scrollerRef,
|
|
38
|
+
}), ref: scrollerRef, onScroll: (event) => {
|
|
39
|
+
event.currentTarget.dispatchEvent(new CustomEvent(GOODSTRAP_SCROLLED_EVENT, { bubbles: true }));
|
|
40
|
+
}, children: _jsxs("div", { className: "gd-gen-ai-chat__messages__scroll", role: "log", "aria-relevant": isEmpty || isLoading ? undefined : "additions", "aria-label": intl.formatMessage({ id: "gd.gen-ai.messages.label" }), children: [isEmpty ? _jsx(LandingScreenComponent, {}) : null, isLoading ? _jsx(ChatSkeleton, {}) : null, isLoading ? null : (_jsx(ConversationMessages, { catalogItems: catalogItems, conversation: conversation, messages: conversationMessages }))] }) }));
|
|
37
41
|
}
|
|
38
42
|
function ConversationMessages({ messages, catalogItems }) {
|
|
39
43
|
const currentMessages = useMemo(() => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IGenAIAssistantVisualizationMenuProps } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default implementation of the VisualizationMenu slot.
|
|
4
|
+
*
|
|
5
|
+
* @alpha
|
|
6
|
+
*/
|
|
7
|
+
export declare function DefaultVisualizationMenu({ items, isDisabled, ariaDescribedBy, }: IGenAIAssistantVisualizationMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
//# sourceMappingURL=VisualizationMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisualizationMenu.d.ts","sourceRoot":"","sources":["../../../src/components/customized/VisualizationMenu.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAEH,KAAK,qCAAqC,EAC7C,MAAM,YAAY,CAAC;AAOpB;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EACrC,KAAK,EACL,UAAU,EACV,eAAe,GAClB,EAAE,qCAAqC,kDAiFvC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2026 GoodData Corporation
|
|
3
|
+
import { useCallback, useId, useRef, useState } from "react";
|
|
4
|
+
import cx from "classnames";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
import { Overlay, UiFocusManager, UiIconButton, UiMenu, UiTooltip, } from "@gooddata/sdk-ui-kit";
|
|
7
|
+
const MORE_MENU_BUTTON_ID = "gd-gen-ai-chat__conversation__visualization__save__more-menu-button";
|
|
8
|
+
const overlayAlignPoints = [{ align: "br tr" }];
|
|
9
|
+
/**
|
|
10
|
+
* Default implementation of the VisualizationMenu slot.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export function DefaultVisualizationMenu({ items, isDisabled, ariaDescribedBy, }) {
|
|
15
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
16
|
+
const intl = useIntl();
|
|
17
|
+
const id = useId();
|
|
18
|
+
const menuId = `menu-${id}`;
|
|
19
|
+
const anchorRef = useRef(null);
|
|
20
|
+
const moreLabel = intl.formatMessage({ id: "gd.gen-ai.visualisation.menu" });
|
|
21
|
+
const close = useCallback(() => setIsOpen(false), []);
|
|
22
|
+
if (items.length === 0) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const menuItems = items.map((item) => ({
|
|
26
|
+
type: "interactive",
|
|
27
|
+
id: item.id,
|
|
28
|
+
stringTitle: item.title,
|
|
29
|
+
data: item,
|
|
30
|
+
iconLeft: item.icon,
|
|
31
|
+
isDisabled: item.isDisabled ?? false,
|
|
32
|
+
ariaAttributes: item.ariaAttributes,
|
|
33
|
+
}));
|
|
34
|
+
return (_jsxs("div", { ref: anchorRef, id: MORE_MENU_BUTTON_ID, className: cx("gd-gen-ai-chat__conversation__visualization__save", {
|
|
35
|
+
active: isOpen,
|
|
36
|
+
}), children: [_jsx(UiTooltip, { disabled: !moreLabel, triggerBy: ["focus", "hover"], arrowPlacement: "bottom", anchor: _jsx(UiIconButton, { dataTestId: "gen-ai-visualization-menu-button", onClick: () => setIsOpen(!isOpen), icon: "ellipsis", isDisabled: isDisabled, accessibilityConfig: {
|
|
37
|
+
role: "button",
|
|
38
|
+
ariaLabel: moreLabel,
|
|
39
|
+
ariaDescribedBy,
|
|
40
|
+
isExpanded: isOpen,
|
|
41
|
+
popupId: menuId,
|
|
42
|
+
ariaHaspopup: "menu",
|
|
43
|
+
}, isActive: isOpen }), content: moreLabel }), isOpen ? (_jsx(Overlay, { closeOnMouseDrag: true, closeOnOutsideClick: true, alignTo: anchorRef.current, alignPoints: overlayAlignPoints, onClose: close, className: "gd-gen-ai-chat__conversation__visualization__menu_overlay", children: _jsx(UiFocusManager, { enableAutofocus: true, enableReturnFocusOnUnmount: true, enableFocusTrap: true, children: _jsx(UiMenu, { dataTestId: "gen-ai-visualization-menu-list", items: menuItems, ariaAttributes: { id: menuId }, onSelect: (item, e) => {
|
|
44
|
+
item.data.onSelect(e);
|
|
45
|
+
close();
|
|
46
|
+
}, onClose: close }) }) })) : null] }));
|
|
47
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentType } from "react";
|
|
1
|
+
import { type AriaAttributes, type ComponentType, type KeyboardEvent, type MouseEvent, type ReactNode } from "react";
|
|
2
2
|
import { type IChatConversationVisualisationContent, type IChatKdaDefinition, type IChatSuggestion } from "@gooddata/sdk-backend-spi";
|
|
3
3
|
import { type GenAIChatEffort } from "@gooddata/sdk-model";
|
|
4
4
|
import { type ISlotProps, type IUiMenuGroupItemProps, type IUiMenuInteractiveItemProps, type IUiMenuInteractiveItemWrapperProps, type IUiMenuItem } from "@gooddata/sdk-ui-kit";
|
|
@@ -264,6 +264,75 @@ export type IGenAIAssistantConversationVisualizationContentProps = {
|
|
|
264
264
|
*/
|
|
265
265
|
enableKeyDriverAnalysis?: boolean;
|
|
266
266
|
};
|
|
267
|
+
/**
|
|
268
|
+
* Item of the visualization menu.
|
|
269
|
+
* @alpha
|
|
270
|
+
*/
|
|
271
|
+
export type IGenAIAssistantVisualizationMenuItem = {
|
|
272
|
+
/**
|
|
273
|
+
* Unique identifier of the item.
|
|
274
|
+
* Built-in items use the ids "button-save", "button-open" and "button-copy".
|
|
275
|
+
*/
|
|
276
|
+
id: string;
|
|
277
|
+
/**
|
|
278
|
+
* Title displayed in the menu.
|
|
279
|
+
*/
|
|
280
|
+
title: string;
|
|
281
|
+
/**
|
|
282
|
+
* Icon displayed before the title.
|
|
283
|
+
*/
|
|
284
|
+
icon?: ReactNode;
|
|
285
|
+
/**
|
|
286
|
+
* Whether the item is disabled.
|
|
287
|
+
*/
|
|
288
|
+
isDisabled?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Additional ARIA attributes of the item.
|
|
291
|
+
*/
|
|
292
|
+
ariaAttributes?: AriaAttributes;
|
|
293
|
+
/**
|
|
294
|
+
* Callback when the item is selected. The menu closes after the callback.
|
|
295
|
+
*/
|
|
296
|
+
onSelect: (event: MouseEvent | KeyboardEvent) => void;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Properties for the VisualizationMenu slot.
|
|
300
|
+
* @alpha
|
|
301
|
+
*/
|
|
302
|
+
export type IGenAIAssistantVisualizationMenuProps = {
|
|
303
|
+
/**
|
|
304
|
+
* The message containing the visualization content.
|
|
305
|
+
*/
|
|
306
|
+
message: IChatConversationLocalItem;
|
|
307
|
+
/**
|
|
308
|
+
* The multipart part containing the visualization.
|
|
309
|
+
*/
|
|
310
|
+
part: IChatConversationMultipartLocalPart;
|
|
311
|
+
/**
|
|
312
|
+
* The what-if scenario context for this visualization.
|
|
313
|
+
*/
|
|
314
|
+
scenario?: IWhatIfRenderableScenario;
|
|
315
|
+
/**
|
|
316
|
+
* The visualization the menu belongs to.
|
|
317
|
+
*/
|
|
318
|
+
visualization: NonNullable<IChatConversationVisualisationContent["visualization"]>;
|
|
319
|
+
/**
|
|
320
|
+
* Items of the menu. The menu button is hidden when the list is empty.
|
|
321
|
+
*/
|
|
322
|
+
items: IGenAIAssistantVisualizationMenuItem[];
|
|
323
|
+
/**
|
|
324
|
+
* Whether the visualization is saved in the workspace.
|
|
325
|
+
*/
|
|
326
|
+
isVisualizationSaved: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Whether the menu button is disabled.
|
|
329
|
+
*/
|
|
330
|
+
isDisabled?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Id of the element that describes the menu button.
|
|
333
|
+
*/
|
|
334
|
+
ariaDescribedBy?: string;
|
|
335
|
+
};
|
|
267
336
|
/**
|
|
268
337
|
* Properties for the ConversationKdaContent slot.
|
|
269
338
|
* @alpha
|
|
@@ -467,6 +536,12 @@ export interface IGenAIAssistantSlots {
|
|
|
467
536
|
* Custom React component rendered for a visualization part in multipart content.
|
|
468
537
|
*/
|
|
469
538
|
ConversationVisualizationContent?: ComponentType<ISlotProps<IGenAIAssistantConversationVisualizationContentProps>>;
|
|
539
|
+
/**
|
|
540
|
+
* @alpha
|
|
541
|
+
* Custom React component rendered for the menu of a visualization in multipart content.
|
|
542
|
+
* Change the `items` of `defaultProps` to add, remove or reorder the menu items.
|
|
543
|
+
*/
|
|
544
|
+
VisualizationMenu?: ComponentType<ISlotProps<IGenAIAssistantVisualizationMenuProps>>;
|
|
470
545
|
/**
|
|
471
546
|
* @alpha
|
|
472
547
|
* Custom React component rendered for a key driver analysis part in multipart content.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/customized/types.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/customized/types.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EACH,KAAK,qCAAqC,EAC1C,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACH,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,kCAAkC,EACvC,KAAK,WAAW,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,KAAK,UAAU,EACf,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,mCAAmC,EACxC,KAAK,iBAAiB,EACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC5C;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG;IACxC;;OAEG;IACH,KAAK,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,UAAU,EAAE,OAAO,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AAC,EAAE,aAAa,CAAC,UAAU,CAAC,2CAA2C,CAAC,CAAC,CAAC;IAEjG;;;OAGG;IACH,gCAAgC,CAAC,EAAE,aAAa,CAC5C,UAAU,CAAC,oDAAoD,CAAC,CACnE,CAAC;IAEF;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,qCAAqC,CAAC,CAAC,CAAC;IAErF;;;OAGG;IACH,sBAAsB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,0CAA0C,CAAC,CAAC,CAAC;IAE/F;;;OAGG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAEjF;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAEnE;;;OAGG;IACH,gBAAgB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,oCAAoC,CAAC,CAAC,CAAC;IAEnF;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,gCAAgC,CAAC,CAAC,CAAC;CAC9E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type GenAIPublisherDocumentFormat } from "@gooddata/sdk-backend-spi";
|
|
1
2
|
import { publisherDocumentSavedAction } from "../../store/messages/messagesSlice.js";
|
|
2
3
|
/**
|
|
3
4
|
* A document of the chat that an application saved. `seq` tells one save from the next, so saving the
|
|
@@ -9,6 +10,7 @@ export interface IPublisherDocumentSaved {
|
|
|
9
10
|
itemId: string;
|
|
10
11
|
documentRef?: string;
|
|
11
12
|
savedDocumentId: string;
|
|
13
|
+
format?: GenAIPublisherDocumentFormat;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* Tells the chat store about a document an application saved, so the document in the chat reads as saved
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePublisherDocumentSavedSync.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/usePublisherDocumentSavedSync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"usePublisherDocumentSavedSync.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/usePublisherDocumentSavedSync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAE9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,4BAA4B,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,EACpF,aAAa,EAAE,uBAAuB,GAAG,SAAS,QAYrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantItem.d.ts","sourceRoot":"","sources":["../../../src/components/messages/AssistantItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AssistantItem.d.ts","sourceRoot":"","sources":["../../../src/components/messages/AssistantItem.tsx"],"names":[],"mappings":"AAUA,OAAO,EACH,KAAK,0BAA0B,EAGlC,MAAM,gBAAgB,CAAC;AASxB,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAQnE,KAAK,kBAAkB,GAAG;IACtB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,OAAO,EAAE,0BAA0B,CAAC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,kBAAkB,kDA4FrF"}
|
|
@@ -4,13 +4,16 @@ import { useState } from "react";
|
|
|
4
4
|
import cx from "classnames";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { useSelector } from "react-redux";
|
|
7
|
+
import { insightTitle } from "@gooddata/sdk-model";
|
|
7
8
|
import { interactionIntelligenceEnabledSelector } from "../../store/chatWindow/chatWindowSelectors.js";
|
|
8
9
|
import { isClarificationQuestionsItem } from "../../utils.js";
|
|
10
|
+
import { replaceReferences } from "../completion/references.js";
|
|
9
11
|
import { useToolsReferences } from "../completion/useToolsReferences.js";
|
|
10
12
|
import { useCustomization } from "../CustomizationContext.js";
|
|
11
13
|
import { useInteractionIntelligenceTotals } from "../intelligence/data/useInteractionIntelligenceTotals.js";
|
|
12
14
|
import { GenAiInteractionIntelligence } from "../intelligence/GenAiInteractionIntelligence.js";
|
|
13
15
|
import { InteractionIntelligenceTrigger } from "../intelligence/InteractionIntelligenceTrigger.js";
|
|
16
|
+
import { removeMarkdown } from "../utils/markdownUtils.js";
|
|
14
17
|
import { AssistantItemSuggestions } from "./AssistantItemSuggestions.js";
|
|
15
18
|
import { ReasoningIcon } from "./contents/ReasoningIcon.js";
|
|
16
19
|
import { ConversationItemContents } from "./ConversationItemContents.js";
|
|
@@ -42,5 +45,27 @@ export function AssistantItemComponent({ message, groups, isLast }) {
|
|
|
42
45
|
return (_jsxs("div", { className: classNames, "data-state": messageState, "data-testid": "gen-ai-conversation-assistant-message", children: [_jsx("span", { className: "gd-gen-ai-chat__visually__hidden", children: intl.formatMessage({ id: "gd.gen-ai.message.label.assistant" }) }), _jsx(ReasoningIcon, { content: message.content }), _jsx(ConversationItemContents, { role: "assistant", message: message, groups: groups, references: references, isLoading: messageState === "loading", isLast: isLast }), _jsx(AssistantItemSuggestions, { type: "followUp", message: message, showSuggestions: true, references: references }), _jsxs("div", { className: "gd-gen-ai-chat__conversation__item__actions", children: [group.type === "assistant" &&
|
|
43
46
|
message.content.type !== "reasoning" &&
|
|
44
47
|
message.content.type !== "skillsActivated" &&
|
|
45
|
-
!isFilledClarificationQuestion ? (_jsx(FeedbackComponent, { group: group, message: message, isLast: Boolean(isLast), isComplete: Boolean(message.complete), isHidden: Boolean(hasInteractionIntelligenceTrigger && !isLast) })) : null, showInteractionIntelligence ? (_jsx(InteractionIntelligenceTrigger, { totals: interactionIntelligenceTotals, isOpen: isInteractionIntelligenceOpen, onToggle: () => setIsInteractionIntelligenceOpen((current) => !current) })) : null] }), showInteractionIntelligence && isInteractionIntelligenceOpen ? (_jsx(GenAiInteractionIntelligence, { responseId: message.responseId, onClose: () => setIsInteractionIntelligenceOpen(false) })) : null, _jsx(AssistantItemSuggestions, { type: "actions", message: message, showSuggestions: isLast })] }));
|
|
48
|
+
!isFilledClarificationQuestion ? (_jsx(FeedbackComponent, { group: group, message: message, isLast: Boolean(isLast), isComplete: Boolean(message.complete), isHidden: Boolean(hasInteractionIntelligenceTrigger && !isLast) })) : null, showInteractionIntelligence ? (_jsx(InteractionIntelligenceTrigger, { totals: interactionIntelligenceTotals, isOpen: isInteractionIntelligenceOpen, onToggle: () => setIsInteractionIntelligenceOpen((current) => !current) })) : null] }), showInteractionIntelligence && isInteractionIntelligenceOpen ? (_jsx(GenAiInteractionIntelligence, { responseId: message.responseId, onClose: () => setIsInteractionIntelligenceOpen(false) })) : null, _jsx(AssistantItemSuggestions, { type: "actions", message: message, showSuggestions: isLast }), _jsx(AssistantItemAnnouncement, { message: message, references: references, isLast: isLast })] }));
|
|
49
|
+
}
|
|
50
|
+
function AssistantItemAnnouncement({ message, references, isLast }) {
|
|
51
|
+
if (!isLast) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const isStreamedAnswer = getItemState(message) === "complete" && message.streaming === false;
|
|
55
|
+
return (_jsx("span", { className: "gd-gen-ai-chat__visually__hidden", "aria-live": "polite", "aria-atomic": "true", children: isStreamedAnswer ? getAnswerText(message.content, references) : "" }));
|
|
56
|
+
}
|
|
57
|
+
function getAnswerText(content, references) {
|
|
58
|
+
const parts = content.type === "multipart" ? (content.parts ?? []) : [content];
|
|
59
|
+
return parts
|
|
60
|
+
.map((part) => {
|
|
61
|
+
if (part.type === "text") {
|
|
62
|
+
return removeMarkdown(replaceReferences(part.text, [...(part.objects ?? []), ...references]));
|
|
63
|
+
}
|
|
64
|
+
if (part.type === "visualization" && part.visualization) {
|
|
65
|
+
return insightTitle(part.visualization);
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
})
|
|
69
|
+
.filter(Boolean)
|
|
70
|
+
.join(" ");
|
|
46
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantItemFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/messages/AssistantItemFeedback.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAKnE,MAAM,WAAW,2BAA2B;IACxC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,0BAA0B,CAAC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,qBAAqB,CAAC,EAClC,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,GACb,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"AssistantItemFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/messages/AssistantItemFeedback.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAKnE,MAAM,WAAW,2BAA2B;IACxC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,0BAA0B,CAAC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,qBAAqB,CAAC,EAClC,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,GACb,EAAE,2BAA2B,kDAmF7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2024-2026 GoodData Corporation
|
|
3
|
-
import { useCallback } from "react";
|
|
3
|
+
import { useCallback, useRef } from "react";
|
|
4
4
|
import cx from "classnames";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { useDispatch } from "react-redux";
|
|
@@ -11,6 +11,7 @@ import { useUserFeedback } from "./useUserFeedback.js";
|
|
|
11
11
|
export function AssistantItemFeedback({ message, isLast, isHidden, isComplete, }) {
|
|
12
12
|
const intl = useIntl();
|
|
13
13
|
const dispatch = useDispatch();
|
|
14
|
+
const containerRef = useRef(null);
|
|
14
15
|
const setUserFeedbackAction = useCallback((payload) => {
|
|
15
16
|
dispatch(setUserFeedback(payload));
|
|
16
17
|
}, [dispatch]);
|
|
@@ -25,14 +26,14 @@ export function AssistantItemFeedback({ message, isLast, isHidden, isComplete, }
|
|
|
25
26
|
if (isHidden && !isAssigned) {
|
|
26
27
|
return null;
|
|
27
28
|
}
|
|
28
|
-
return (_jsxs("div", { className: cx({
|
|
29
|
+
return (_jsxs("div", { ref: containerRef, className: cx({
|
|
29
30
|
"gd-gen-ai-chat__conversation__item__feedback": true,
|
|
30
31
|
"gd-gen-ai-chat__conversation__item__feedback--assigned": isAssigned,
|
|
31
32
|
"gd-gen-ai-chat__conversation__item__feedback--last": isLast,
|
|
32
33
|
}), children: [_jsx(UiTooltip, { triggerBy: ["focus", "hover"], arrowPlacement: "bottom", anchor: _jsx(UiIconButton, { icon: "thumbsUp", variant: "tertiary", size: "small", isActive: type === "POSITIVE", onClick: handlePositiveFeedbackClick, accessibilityConfig: {
|
|
33
34
|
ariaLabel: thumbsUpLabel,
|
|
34
35
|
ariaPressed: type === "POSITIVE" ? "true" : "false",
|
|
35
|
-
} }), content: thumbsUpLabel }), _jsx(FeedbackPopup, { anchor: (opened) => {
|
|
36
|
+
} }), content: thumbsUpLabel }), _jsx(FeedbackPopup, { containerRef: containerRef, anchor: (opened) => {
|
|
36
37
|
return (_jsx(UiTooltip, { triggerBy: ["focus", "hover"], arrowPlacement: "bottom", anchor: _jsx(UiIconButton, { icon: "thumbsDown", variant: "tertiary", size: "small", isActive: type === "NEGATIVE" || opened, onClick: handleNegativeFeedbackClick, accessibilityConfig: {
|
|
37
38
|
ariaLabel: thumbsDownLabel,
|
|
38
39
|
ariaPressed: type === "NEGATIVE" ? "true" : "false",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type ReactElement } from "react";
|
|
1
|
+
import { type ReactElement, type RefObject } from "react";
|
|
2
2
|
export interface IFeedbackPopupProps {
|
|
3
3
|
anchor: (opened: boolean) => ReactElement<any>;
|
|
4
|
+
containerRef: RefObject<HTMLElement | null>;
|
|
4
5
|
onSubmit?: (feedback: IFeedbackData) => void;
|
|
5
6
|
}
|
|
6
7
|
export interface IFeedbackData {
|
|
@@ -10,5 +11,5 @@ export interface IFeedbackData {
|
|
|
10
11
|
/**
|
|
11
12
|
* @internal
|
|
12
13
|
*/
|
|
13
|
-
export declare function FeedbackPopup({ anchor, onSubmit }: IFeedbackPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function FeedbackPopup({ anchor, containerRef, onSubmit }: IFeedbackPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
//# sourceMappingURL=FeedbackPopup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackPopup.d.ts","sourceRoot":"","sources":["../../../src/components/messages/FeedbackPopup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FeedbackPopup.d.ts","sourceRoot":"","sources":["../../../src/components/messages/FeedbackPopup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAkB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAapF,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,YAAY,CAAC,GAAG,CAAC,CAAC;IAC/C,YAAY,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CA6IpF"}
|