@gooddata/sdk-ui-gen-ai 11.47.0 → 11.48.0-alpha.1
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 +1 -1
- package/esm/components/GenAIChatContextIndicator.d.ts +7 -0
- package/esm/components/GenAIChatContextIndicator.d.ts.map +1 -0
- package/esm/components/GenAIChatContextIndicator.js +35 -0
- package/esm/components/GenAIChatDialogConnected.d.ts +8 -1
- package/esm/components/GenAIChatDialogConnected.d.ts.map +1 -1
- package/esm/components/GenAIChatDialogConnected.js +10 -2
- package/esm/components/GenAiChatAgentSwitching.d.ts +14 -0
- package/esm/components/GenAiChatAgentSwitching.d.ts.map +1 -0
- package/esm/components/GenAiChatAgentSwitching.js +81 -0
- package/esm/components/GenAiChatContextChooser.d.ts +8 -0
- package/esm/components/GenAiChatContextChooser.d.ts.map +1 -0
- package/esm/components/GenAiChatContextChooser.js +43 -0
- package/esm/components/Input.d.ts.map +1 -1
- package/esm/components/Input.js +23 -54
- package/esm/components/hooks/useContextItems.d.ts +7 -0
- package/esm/components/hooks/useContextItems.d.ts.map +1 -0
- package/esm/components/hooks/useContextItems.js +31 -0
- package/esm/components/utils/icons.d.ts +7 -0
- package/esm/components/utils/icons.d.ts.map +1 -0
- package/esm/components/utils/icons.js +16 -0
- package/esm/context/addContextReference.d.ts +4 -0
- package/esm/context/addContextReference.d.ts.map +1 -0
- package/esm/context/addContextReference.js +19 -0
- package/esm/context/build.d.ts +7 -0
- package/esm/context/build.d.ts.map +1 -0
- package/esm/context/build.js +18 -0
- package/esm/context/collectContextReferences.d.ts +11 -0
- package/esm/context/collectContextReferences.d.ts.map +1 -0
- package/esm/context/collectContextReferences.js +29 -0
- package/esm/context/dashboard.d.ts +21 -0
- package/esm/context/dashboard.d.ts.map +1 -0
- package/esm/context/dashboard.js +144 -0
- package/esm/context/isReferenceChanged.d.ts +3 -0
- package/esm/context/isReferenceChanged.d.ts.map +1 -0
- package/esm/context/isReferenceChanged.js +7 -0
- package/esm/context/referencedObjects.d.ts +10 -0
- package/esm/context/referencedObjects.d.ts.map +1 -0
- package/esm/context/referencedObjects.js +19 -0
- package/esm/context/removeContextReference.d.ts +4 -0
- package/esm/context/removeContextReference.d.ts.map +1 -0
- package/esm/context/removeContextReference.js +26 -0
- package/esm/context.d.ts +5 -0
- package/esm/context.d.ts.map +1 -0
- package/esm/context.js +6 -0
- package/esm/internal.d.ts +2 -2
- package/esm/internal.d.ts.map +1 -1
- package/esm/internal.js +2 -2
- package/esm/localization/bundles/en-US.localization-bundle.d.ts +4 -0
- package/esm/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-US.localization-bundle.js +4 -0
- package/esm/store/chatWindow/chatWindowSelectors.d.ts +9 -1
- package/esm/store/chatWindow/chatWindowSelectors.d.ts.map +1 -1
- package/esm/store/chatWindow/chatWindowSelectors.js +14 -1
- package/esm/store/chatWindow/chatWindowSlice.d.ts +20 -7
- package/esm/store/chatWindow/chatWindowSlice.d.ts.map +1 -1
- package/esm/store/chatWindow/chatWindowSlice.js +34 -4
- package/esm/store/sideEffects/onUserMessage.d.ts.map +1 -1
- package/esm/store/sideEffects/onUserMessage.js +14 -10
- package/esm/types.d.ts +20 -1
- package/esm/types.d.ts.map +1 -1
- package/package.json +21 -20
- package/styles/css/input.css +7 -0
- package/styles/css/input.css.map +1 -1
- package/styles/css/main.css +19 -1
- package/styles/css/main.css.map +1 -1
- package/styles/scss/input.scss +8 -0
- package/styles/scss/main.scss +11 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isIdentifierRef, } from "@gooddata/sdk-model";
|
|
3
|
+
export function collectContextReferences(context, type) {
|
|
4
|
+
if (!context) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
const references = [];
|
|
8
|
+
// dashboard
|
|
9
|
+
const dashboard = context.view?.dashboard;
|
|
10
|
+
if (dashboard) {
|
|
11
|
+
const ref = dashboard.ref;
|
|
12
|
+
const id = isIdentifierRef(ref) ? ref.identifier : ref.uri;
|
|
13
|
+
references.push({
|
|
14
|
+
id,
|
|
15
|
+
ref,
|
|
16
|
+
type: "dashboard",
|
|
17
|
+
where: "view.dashboard",
|
|
18
|
+
title: dashboard.title ?? id,
|
|
19
|
+
nesting: 0,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//NOTE: For ambient we need to return only one object with
|
|
23
|
+
// most deep nesting level.
|
|
24
|
+
if (type === "ambient") {
|
|
25
|
+
return references.sort((a, b) => b.nesting - a.nesting).slice(0, 1);
|
|
26
|
+
}
|
|
27
|
+
//NOTE: For user we need to return all objects.
|
|
28
|
+
return references;
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type FilterContextItem, type GenAIUserContextFilter, type IAttributeDisplayFormMetadataObject, type IGenAIDashboardContext, type IGenAIObjectReference, type IGenAIUserContext, type IGenAIWidgetDescriptor, type IWidget, type ObjRef } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildDashboardContext(dashboard: IGenAIDashboardContext): IGenAIUserContext;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildWidgetContext(title: string, widgetRef: ObjRef, widgetType: "insight" | "visualizationSwitcher" | "richText", props?: Partial<Omit<IGenAIWidgetDescriptor, "title" | "widgetRef" | "widgetType">>): IGenAIWidgetDescriptor;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildFiltersContext(filters: FilterContextItem[], displayForms?: Pick<Map<ObjRef, IAttributeDisplayFormMetadataObject>, "get">): GenAIUserContextFilter[];
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildWidgetsContext(widgetsMap: Pick<Map<ObjRef, IWidget>, "values" | "get">, resultsIdMap?: Pick<Map<string, string | undefined>, "values" | "get">): {
|
|
18
|
+
widgets: IGenAIWidgetDescriptor[];
|
|
19
|
+
referencedObjects: IGenAIObjectReference[];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/context/dashboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mCAAmC,EACxC,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EAEtB,KAAK,sBAAsB,EAC3B,KAAK,OAAO,EACZ,KAAK,MAAM,EASd,MAAM,qBAAqB,CAAC;AAM7B;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,sBAAsB,GAAG,iBAAiB,CAM1F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,SAAS,GAAG,uBAAuB,GAAG,UAAU,EAC5D,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC,GACpF,sBAAsB,CAOxB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,iBAAiB,EAAE,EAC5B,YAAY,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,mCAAmC,CAAC,EAAE,KAAK,CAAC,GAC7E,sBAAsB,EAAE,CA2E1B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,EACxD,YAAY,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,GACvE;IAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAAC,iBAAiB,EAAE,qBAAqB,EAAE,CAAA;CAAE,CAkDnF"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isAttributeElementsByRef, isDashboardAttributeFilter, isDashboardDateFilter, isInsightWidget, isRichTextWidget, isVisualizationSwitcherWidget, objRefToString, serializeObjRef, } from "@gooddata/sdk-model";
|
|
3
|
+
import { DEFAULT_MESSAGES } from "@gooddata/sdk-ui";
|
|
4
|
+
import { DateFilterHelpers } from "@gooddata/sdk-ui-filters";
|
|
5
|
+
import { buildContext } from "./build.js";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export function buildDashboardContext(dashboard) {
|
|
10
|
+
return buildContext({
|
|
11
|
+
view: {
|
|
12
|
+
dashboard,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function buildWidgetContext(title, widgetRef, widgetType, props) {
|
|
20
|
+
return {
|
|
21
|
+
title,
|
|
22
|
+
widgetRef,
|
|
23
|
+
widgetType,
|
|
24
|
+
...props,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export function buildFiltersContext(filters, displayForms) {
|
|
31
|
+
const converted = [];
|
|
32
|
+
for (const filter of filters) {
|
|
33
|
+
if (isDashboardAttributeFilter(filter)) {
|
|
34
|
+
const { displayForm, negativeSelection, attributeElements, title } = filter.attributeFilter;
|
|
35
|
+
const elements = isAttributeElementsByRef(attributeElements)
|
|
36
|
+
? attributeElements.uris
|
|
37
|
+
: attributeElements.values;
|
|
38
|
+
const values = (elements ?? []).filter((value) => value != null);
|
|
39
|
+
if (values.length > 0) {
|
|
40
|
+
converted.push({
|
|
41
|
+
type: "attribute_filter",
|
|
42
|
+
using: objRefToString(displayForm),
|
|
43
|
+
state: negativeSelection ? { exclude: values } : { include: values },
|
|
44
|
+
title: title ?? displayForms?.get(displayForm)?.title,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (isDashboardDateFilter(filter)) {
|
|
49
|
+
const { type, granularity, from, to, dataSet } = filter.dateFilter;
|
|
50
|
+
const using = dataSet ? objRefToString(dataSet) : undefined;
|
|
51
|
+
if (type === "absolute" && typeof from === "string" && typeof to === "string") {
|
|
52
|
+
converted.push({
|
|
53
|
+
title: DateFilterHelpers.getDateFilterRepresentation({
|
|
54
|
+
...filter.dateFilter,
|
|
55
|
+
type: "absoluteForm",
|
|
56
|
+
visible: true,
|
|
57
|
+
localIdentifier: filter.dateFilter.localIdentifier,
|
|
58
|
+
from,
|
|
59
|
+
to,
|
|
60
|
+
}, "en-US", DEFAULT_MESSAGES["en-US"], "full"),
|
|
61
|
+
type: "date_filter",
|
|
62
|
+
using,
|
|
63
|
+
from,
|
|
64
|
+
to,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (type === "relative" && typeof from === "number" && typeof to === "number") {
|
|
68
|
+
const genAIGranularity = GRANULARITY_TO_GENAI[granularity];
|
|
69
|
+
if (genAIGranularity) {
|
|
70
|
+
converted.push({
|
|
71
|
+
title: DateFilterHelpers.getDateFilterRepresentation({
|
|
72
|
+
...filter.dateFilter,
|
|
73
|
+
type: "relativeForm",
|
|
74
|
+
visible: true,
|
|
75
|
+
localIdentifier: filter.dateFilter.localIdentifier,
|
|
76
|
+
from,
|
|
77
|
+
to,
|
|
78
|
+
}, "en-US", DEFAULT_MESSAGES["en-US"], "full"),
|
|
79
|
+
granularity: genAIGranularity,
|
|
80
|
+
type: "date_filter",
|
|
81
|
+
using,
|
|
82
|
+
from,
|
|
83
|
+
to,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return converted;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
export function buildWidgetsContext(widgetsMap, resultsIdMap) {
|
|
95
|
+
const widgets = [];
|
|
96
|
+
const referencedObjects = [];
|
|
97
|
+
const switcherChildRefs = new Set();
|
|
98
|
+
for (const widget of widgetsMap.values()) {
|
|
99
|
+
if (isVisualizationSwitcherWidget(widget)) {
|
|
100
|
+
for (const visualization of widget.visualizations) {
|
|
101
|
+
switcherChildRefs.add(serializeObjRef(visualization.ref));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
for (const widget of widgetsMap.values()) {
|
|
106
|
+
if (isInsightWidget(widget)) {
|
|
107
|
+
if (!switcherChildRefs.has(serializeObjRef(widget.ref))) {
|
|
108
|
+
widgets.push(buildWidgetContext(widget.title, widget.ref, "insight", {
|
|
109
|
+
insightRef: widget.insight,
|
|
110
|
+
resultId: resultsIdMap?.get(serializeObjRef(widget.ref)),
|
|
111
|
+
}));
|
|
112
|
+
referencedObjects.push({ type: "WIDGET", ref: widget.ref });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (isVisualizationSwitcherWidget(widget)) {
|
|
116
|
+
const activeVisualization = widget.visualizations[0];
|
|
117
|
+
widgets.push(buildWidgetContext(widget.title, widget.ref, "visualizationSwitcher", {
|
|
118
|
+
insightRef: activeVisualization?.insight,
|
|
119
|
+
resultId: activeVisualization
|
|
120
|
+
? resultsIdMap?.get(serializeObjRef(activeVisualization.ref))
|
|
121
|
+
: undefined,
|
|
122
|
+
// All child insights, so the BE can execute the non-active children
|
|
123
|
+
// (which have no cached result).
|
|
124
|
+
visualizationRefs: widget.visualizations.map((v) => v.insight),
|
|
125
|
+
}));
|
|
126
|
+
referencedObjects.push({ type: "WIDGET", ref: widget.ref });
|
|
127
|
+
}
|
|
128
|
+
if (isRichTextWidget(widget)) {
|
|
129
|
+
widgets.push(buildWidgetContext(widget.title, widget.ref, "richText", {
|
|
130
|
+
content: widget.content,
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { widgets, referencedObjects };
|
|
135
|
+
}
|
|
136
|
+
const GRANULARITY_TO_GENAI = {
|
|
137
|
+
"GDC.time.minute": "MINUTE",
|
|
138
|
+
"GDC.time.hour": "HOUR",
|
|
139
|
+
"GDC.time.date": "DAY",
|
|
140
|
+
"GDC.time.week_us": "WEEK_US",
|
|
141
|
+
"GDC.time.month": "MONTH",
|
|
142
|
+
"GDC.time.quarter": "QUARTER",
|
|
143
|
+
"GDC.time.year": "YEAR",
|
|
144
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isReferenceChanged.d.ts","sourceRoot":"","sources":["../../src/context/isReferenceChanged.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAE9E,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,iBAAiB,GAAG,SAAS,EACzC,UAAU,EAAE,iBAAiB,GAAG,SAAS,GAC1C,OAAO,CAKT"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { areObjRefsEqual } from "@gooddata/sdk-model";
|
|
3
|
+
export function isReferenceChanged(oldContext, newContext) {
|
|
4
|
+
const oldDashboardRef = oldContext?.view?.dashboard?.ref;
|
|
5
|
+
const newDashboardRef = newContext?.view?.dashboard?.ref;
|
|
6
|
+
return !areObjRefsEqual(oldDashboardRef, newDashboardRef);
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IGenAIObjectReference, IGenAIObjectReferenceGroup, IGenAIUserContext } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildReferencedContext(referencedObjects: IGenAIObjectReferenceGroup[]): IGenAIUserContext;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildReferenceContext(objects: IGenAIObjectReference[], context?: IGenAIObjectReference): IGenAIObjectReferenceGroup;
|
|
10
|
+
//# sourceMappingURL=referencedObjects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referencedObjects.d.ts","sourceRoot":"","sources":["../../src/context/referencedObjects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,EACpB,MAAM,qBAAqB,CAAC;AAI7B;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,iBAAiB,EAAE,0BAA0B,EAAE,GAAG,iBAAiB,CAIzG;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,qBAAqB,EAAE,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAChC,0BAA0B,CAK5B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { buildContext } from "./build.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export function buildReferencedContext(referencedObjects) {
|
|
7
|
+
return buildContext({
|
|
8
|
+
referencedObjects,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export function buildReferenceContext(objects, context) {
|
|
15
|
+
return {
|
|
16
|
+
context,
|
|
17
|
+
objects,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type IGenAIUserContext } from "@gooddata/sdk-model";
|
|
2
|
+
import type { IGenAIContextObject } from "./collectContextReferences.js";
|
|
3
|
+
export declare function removeContextReference(context: IGenAIUserContext | undefined, reference?: IGenAIContextObject): IGenAIUserContext | undefined;
|
|
4
|
+
//# sourceMappingURL=removeContextReference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeContextReference.d.ts","sourceRoot":"","sources":["../../src/context/removeContextReference.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,SAAS,CAAC,EAAE,mBAAmB,GAChC,iBAAiB,GAAG,SAAS,CA6B/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
export function removeContextReference(context, reference) {
|
|
3
|
+
if (!context) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
if (!reference) {
|
|
7
|
+
return context;
|
|
8
|
+
}
|
|
9
|
+
const newContext = { ...context };
|
|
10
|
+
// remove dashboard reference
|
|
11
|
+
if (reference.where === "view.dashboard" && newContext.view) {
|
|
12
|
+
newContext.view = { ...newContext.view };
|
|
13
|
+
delete newContext.view.dashboard;
|
|
14
|
+
}
|
|
15
|
+
// make clean context
|
|
16
|
+
if (newContext.view && Object.keys(newContext.view).length === 0) {
|
|
17
|
+
delete newContext.view;
|
|
18
|
+
}
|
|
19
|
+
if (newContext.referencedObjects?.length === 0) {
|
|
20
|
+
delete newContext.referencedObjects;
|
|
21
|
+
}
|
|
22
|
+
if (Object.keys(newContext).length === 0) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return newContext;
|
|
26
|
+
}
|
package/esm/context.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { mergeContexts } from "./context/build.js";
|
|
2
|
+
import { buildDashboardContext, buildFiltersContext, buildWidgetContext, buildWidgetsContext } from "./context/dashboard.js";
|
|
3
|
+
import { buildReferenceContext, buildReferencedContext } from "./context/referencedObjects.js";
|
|
4
|
+
export { mergeContexts, buildDashboardContext, buildWidgetContext, buildWidgetsContext, buildReferencedContext, buildReferenceContext, buildFiltersContext, };
|
|
5
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACH,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE/F,OAAO,EACH,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,GACtB,CAAC"}
|
package/esm/context.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/* oxlint-disable no-barrel-files/no-barrel-files */
|
|
3
|
+
import { mergeContexts } from "./context/build.js";
|
|
4
|
+
import { buildDashboardContext, buildFiltersContext, buildWidgetContext, buildWidgetsContext, } from "./context/dashboard.js";
|
|
5
|
+
import { buildReferenceContext, buildReferencedContext } from "./context/referencedObjects.js";
|
|
6
|
+
export { mergeContexts, buildDashboardContext, buildWidgetContext, buildWidgetsContext, buildReferencedContext, buildReferenceContext, buildFiltersContext, };
|
package/esm/internal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { makeTextContents, makeUserMessage } from "./model.js";
|
|
2
|
-
import { setUserContextAction } from "./store/chatWindow/chatWindowSlice.js";
|
|
2
|
+
import { setAmbientUserContextAction, setUserContextAction } from "./store/chatWindow/chatWindowSlice.js";
|
|
3
3
|
import { clearThreadAction, newMessageAction } from "./store/messages/messagesSlice.js";
|
|
4
4
|
export { ChatSkeleton } from "./components/ChatSkeleton.js";
|
|
5
5
|
export { GenAIChatDialog, type GenAIChatDialogProps } from "./components/GenAIChatDialog.js";
|
|
6
6
|
export { GenAIChatDialogConnected, type IGenAIChatDialogConnectedProps, type GenAIChatConnectedEvent, } from "./components/GenAIChatDialogConnected.js";
|
|
7
|
-
export { clearThreadAction, newMessageAction, makeUserMessage, makeTextContents, setUserContextAction };
|
|
7
|
+
export { clearThreadAction, newMessageAction, makeUserMessage, makeTextContents, setUserContextAction, setAmbientUserContextAction, };
|
|
8
8
|
//# sourceMappingURL=internal.d.ts.map
|
package/esm/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EACH,wBAAwB,EACxB,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,GAC/B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACH,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,GAC9B,CAAC"}
|
package/esm/internal.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// (C) 2024-2026 GoodData Corporation
|
|
2
2
|
/* oxlint-disable no-barrel-files/no-barrel-files */
|
|
3
3
|
import { makeTextContents, makeUserMessage } from "./model.js";
|
|
4
|
-
import { setUserContextAction } from "./store/chatWindow/chatWindowSlice.js";
|
|
4
|
+
import { setAmbientUserContextAction, setUserContextAction } from "./store/chatWindow/chatWindowSlice.js";
|
|
5
5
|
import { clearThreadAction, newMessageAction } from "./store/messages/messagesSlice.js";
|
|
6
6
|
export { ChatSkeleton } from "./components/ChatSkeleton.js";
|
|
7
7
|
export { GenAIChatDialog } from "./components/GenAIChatDialog.js";
|
|
8
8
|
export { GenAIChatDialogConnected, } from "./components/GenAIChatDialogConnected.js";
|
|
9
|
-
export { clearThreadAction, newMessageAction, makeUserMessage, makeTextContents, setUserContextAction };
|
|
9
|
+
export { clearThreadAction, newMessageAction, makeUserMessage, makeTextContents, setUserContextAction, setAmbientUserContextAction, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en-US.localization-bundle.d.ts","sourceRoot":"","sources":["../../../src/localization/bundles/en-US.localization-bundle.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"en-US.localization-bundle.d.ts","sourceRoot":"","sources":["../../../src/localization/bundles/en-US.localization-bundle.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6tBjB,CAAC"}
|
|
@@ -121,6 +121,10 @@ export const en_US = {
|
|
|
121
121
|
"text": "Ask your question. Use control+space or control+I for suggestions.",
|
|
122
122
|
"crowdinContext": "Label for the input field where Windows users type their questions to the AI chatbot"
|
|
123
123
|
},
|
|
124
|
+
"gd.gen-ai.context.add_context": {
|
|
125
|
+
"text": "Add context",
|
|
126
|
+
"crowdinContext": "Label for the button that adds a new context to the AI chatbot"
|
|
127
|
+
},
|
|
124
128
|
"gd.gen-ai.agents": {
|
|
125
129
|
"text": "Agents",
|
|
126
130
|
"crowdinContext": "Label for the agent selector in the AI chatbot input"
|
|
@@ -19,5 +19,13 @@ export declare const tagsSelector: (state: RootState) => {
|
|
|
19
19
|
export declare const catalogItemsSelector: (state: RootState) => CatalogItem[];
|
|
20
20
|
export declare const keyDriverAnalysisSelector: (state: RootState) => IKdaDefinition | undefined;
|
|
21
21
|
export declare const keyDriverAnalysisMinimizedSelector: (state: RootState) => boolean | undefined;
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const ambientContextSelector: (state: RootState) => IGenAIUserContext | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Context to attach to the next message: an explicit one-shot context (e.g. Summarize)
|
|
25
|
+
* wins over the ambient context kept in sync by the host.
|
|
26
|
+
*/
|
|
27
|
+
export declare const effectiveContextSelector: (state: RootState) => {
|
|
28
|
+
user: IGenAIUserContext | undefined;
|
|
29
|
+
ambient: IGenAIUserContext | undefined;
|
|
30
|
+
};
|
|
23
31
|
//# sourceMappingURL=chatWindowSelectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatWindowSelectors.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSelectors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"chatWindowSelectors.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSelectors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,eAAO,MAAM,cAAc,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAGlD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAGxD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAGrD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,aAAa,GAAG,SAGxE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,sBAAsB,GAAG,SAG7E,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAGrD,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAGjE,CAAC;AAKF,eAAO,MAAM,4BAA4B,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAIhE,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,eAAe,EAAE,GAAG,SAG3E,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,wBAAwB,EAAE,GAAG,SACZ,CAAC;AAEvF,eAAO,MAAM,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK;IAC7C,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAClC,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAMpC,CAAC;AAEH,eAAO,MAAM,oBAAoB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,WAAW,EAKnE,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,cAAc,GAAG,SAG9E,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,GAAG,SAGhF,CAAC;AAOF,eAAO,MAAM,sBAAsB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,iBAAiB,GAAG,SAG9E,CAAC;AAOF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK;IACzD,IAAI,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACpC,OAAO,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAY1C,CAAC"}
|
|
@@ -26,4 +26,17 @@ export const catalogItemsSelector = createSelector(chatWindowSliceSelector, (sta
|
|
|
26
26
|
});
|
|
27
27
|
export const keyDriverAnalysisSelector = createSelector(chatWindowSliceSelector, (state) => state.keyDriverAnalysis);
|
|
28
28
|
export const keyDriverAnalysisMinimizedSelector = createSelector(chatWindowSliceSelector, (state) => state.keyDriverAnalysisMinimized);
|
|
29
|
-
|
|
29
|
+
const userContextSelector = createSelector(chatWindowSliceSelector, (state) => state.context.user);
|
|
30
|
+
export const ambientContextSelector = createSelector(chatWindowSliceSelector, (state) => state.context.ambient);
|
|
31
|
+
const contextModeSelector = createSelector(chatWindowSliceSelector, (state) => state.context.ambientMode);
|
|
32
|
+
/**
|
|
33
|
+
* Context to attach to the next message: an explicit one-shot context (e.g. Summarize)
|
|
34
|
+
* wins over the ambient context kept in sync by the host.
|
|
35
|
+
*/
|
|
36
|
+
export const effectiveContextSelector = createSelector(userContextSelector, ambientContextSelector, contextModeSelector, (userContext, ambientUserContext, mode) => {
|
|
37
|
+
const suppressed = mode === "suppressed";
|
|
38
|
+
return {
|
|
39
|
+
user: userContext,
|
|
40
|
+
ambient: suppressed ? undefined : ambientUserContext,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
@@ -2,6 +2,8 @@ import { type Reducer } from "@reduxjs/toolkit";
|
|
|
2
2
|
import { type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
|
|
3
3
|
import { type CatalogItem, type GenAIObjectType, type IAllowedRelationshipType, type IColorPalette, type IGenAIUserContext } from "@gooddata/sdk-model";
|
|
4
4
|
import type { IKdaDefinition } from "@gooddata/sdk-ui-dashboard";
|
|
5
|
+
import { type IGenAIContextObject } from "../../context/collectContextReferences.js";
|
|
6
|
+
import { type StoreContext } from "../../types.js";
|
|
5
7
|
type ChatWindowSliceState = {
|
|
6
8
|
/**
|
|
7
9
|
* Defines if the chat window is open.
|
|
@@ -52,10 +54,9 @@ type ChatWindowSliceState = {
|
|
|
52
54
|
*/
|
|
53
55
|
allowedRelationshipTypes?: IAllowedRelationshipType[];
|
|
54
56
|
/**
|
|
55
|
-
*
|
|
56
|
-
* Cleared after being consumed by the saga.
|
|
57
|
+
* Context related to the chat.
|
|
57
58
|
*/
|
|
58
|
-
|
|
59
|
+
context: StoreContext;
|
|
59
60
|
/**
|
|
60
61
|
* Whether the chat runs against the caller's preview agent. In preview mode the assistant
|
|
61
62
|
* is pinned to that single agent, so agent switching is not applicable.
|
|
@@ -90,10 +91,22 @@ export declare const setOpenAction: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
90
91
|
excludeTags?: string[] | undefined;
|
|
91
92
|
}, "chatWindow/setTagsAction">, setCatalogItemsActions: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<CatalogItem[] | undefined, "chatWindow/setCatalogItemsActions">, setAllowedRelationshipTypesAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
92
93
|
allowedRelationshipTypes?: IAllowedRelationshipType[] | undefined;
|
|
93
|
-
}, "chatWindow/setAllowedRelationshipTypesAction">,
|
|
94
|
-
|
|
95
|
-
}, "chatWindow/
|
|
94
|
+
}, "chatWindow/setAllowedRelationshipTypesAction">, addContextReferenceAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
95
|
+
object: IGenAIContextObject;
|
|
96
|
+
}, "chatWindow/addContextReferenceAction">, removeAmbientUserContextAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/removeAmbientUserContextAction">, clearUserContextAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/clearUserContextAction">, setIsPreviewAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
96
97
|
isPreview?: boolean | undefined;
|
|
97
|
-
}, "chatWindow/setIsPreviewAction"
|
|
98
|
+
}, "chatWindow/setIsPreviewAction">,
|
|
99
|
+
/**
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
setAmbientUserContextAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
103
|
+
userContext?: IGenAIUserContext | undefined;
|
|
104
|
+
}, "chatWindow/setAmbientUserContextAction">,
|
|
105
|
+
/**
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
setUserContextAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
109
|
+
userContext?: IGenAIUserContext | undefined;
|
|
110
|
+
}, "chatWindow/setUserContextAction">;
|
|
98
111
|
export {};
|
|
99
112
|
//# sourceMappingURL=chatWindowSlice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatWindowSlice.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSlice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,OAAO,EAAe,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"chatWindowSlice.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSlice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,OAAO,EAAe,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAErF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,KAAK,oBAAoB,GAAG;IACxB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC;;OAEG;IACH,iBAAiB,CAAC,EAAE,cAAc,CAAC;IACnC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,wBAAwB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACtD;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAoBhD,eAAO,MAAM,yBAAyB;;0BAOpC,CAAC;AA+GH,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,oBAAoB,CAA2B,CAAC;AAC7F,eAAO,MACH,aAAa;;gCACb,mBAAmB;;sCACnB,gBAAgB;;mCAChB,qBAAqB;;wCACrB,iBAAiB;;oCACjB,qBAAqB;;wCACrB,0BAA0B;;6CAC1B,mCAAmC;;sDACnC,oBAAoB;;uCACpB,aAAa;;;gCACb,sBAAsB,+HACtB,iCAAiC;;oDACjC,yBAAyB;;4CACzB,8BAA8B,uGAC9B,sBAAsB,+FACtB,kBAAkB;;;AAClB;;GAEG;AACH,2BAA2B;;;AAC3B;;GAEG;AACH,oBAAoB;;qCACG,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// (C) 2024-2026 GoodData Corporation
|
|
2
2
|
import { createSlice } from "@reduxjs/toolkit";
|
|
3
|
+
import { addContextReference } from "../../context/addContextReference.js";
|
|
4
|
+
import { isReferenceChanged } from "../../context/isReferenceChanged.js";
|
|
3
5
|
export const chatWindowSliceName = "chatWindow";
|
|
4
6
|
const initialState = {
|
|
5
7
|
isOpen: false,
|
|
@@ -11,7 +13,11 @@ const initialState = {
|
|
|
11
13
|
includeTags: undefined,
|
|
12
14
|
excludeTags: undefined,
|
|
13
15
|
allowedRelationshipTypes: undefined,
|
|
14
|
-
|
|
16
|
+
context: {
|
|
17
|
+
ambientMode: "enabled",
|
|
18
|
+
ambient: undefined,
|
|
19
|
+
user: undefined,
|
|
20
|
+
},
|
|
15
21
|
isPreview: undefined,
|
|
16
22
|
};
|
|
17
23
|
export const getInitialChatWindowState = ({ isPreview, } = {}) => ({
|
|
@@ -60,10 +66,26 @@ const chatWindowSlice = createSlice({
|
|
|
60
66
|
state.allowedRelationshipTypes = allowedRelationshipTypes;
|
|
61
67
|
},
|
|
62
68
|
setUserContextAction: (state, { payload: { userContext } }) => {
|
|
63
|
-
state.
|
|
69
|
+
state.context.user = userContext;
|
|
64
70
|
},
|
|
65
71
|
clearUserContextAction: (state) => {
|
|
66
|
-
state.
|
|
72
|
+
state.context.user = undefined;
|
|
73
|
+
},
|
|
74
|
+
setAmbientUserContextAction: (state, { payload: { userContext } }) => {
|
|
75
|
+
if (!state.settings?.enableAiContextSetup) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (state.context.ambientMode === "suppressed" &&
|
|
79
|
+
isReferenceChanged(state.context.ambient, userContext)) {
|
|
80
|
+
state.context.ambientMode = "enabled";
|
|
81
|
+
}
|
|
82
|
+
state.context.ambient = userContext;
|
|
83
|
+
},
|
|
84
|
+
addContextReferenceAction: (state, { payload: { object } }) => {
|
|
85
|
+
state.context = addContextReference(state.context, object);
|
|
86
|
+
},
|
|
87
|
+
removeAmbientUserContextAction: (state) => {
|
|
88
|
+
state.context.ambientMode = "suppressed";
|
|
67
89
|
},
|
|
68
90
|
setIsPreviewAction: (state, { payload: { isPreview } }) => {
|
|
69
91
|
state.isPreview = isPreview;
|
|
@@ -72,4 +94,12 @@ const chatWindowSlice = createSlice({
|
|
|
72
94
|
},
|
|
73
95
|
});
|
|
74
96
|
export const chatWindowSliceReducer = chatWindowSlice.reducer;
|
|
75
|
-
export const { setOpenAction, setFullscreenAction, setHistoryAction, setColorPaletteAction, setSettingsAction, copyToClipboardAction, setKeyDriverAnalysisAction, setKeyDriverAnalysisMinimizedAction, setObjectTypesAction, setTagsAction, setCatalogItemsActions, setAllowedRelationshipTypesAction,
|
|
97
|
+
export const { setOpenAction, setFullscreenAction, setHistoryAction, setColorPaletteAction, setSettingsAction, copyToClipboardAction, setKeyDriverAnalysisAction, setKeyDriverAnalysisMinimizedAction, setObjectTypesAction, setTagsAction, setCatalogItemsActions, setAllowedRelationshipTypesAction, addContextReferenceAction, removeAmbientUserContextAction, clearUserContextAction, setIsPreviewAction,
|
|
98
|
+
/**
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
setAmbientUserContextAction,
|
|
102
|
+
/**
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
setUserContextAction, } = chatWindowSlice.actions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onUserMessage.d.ts","sourceRoot":"","sources":["../../../src/store/sideEffects/onUserMessage.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,KAAK,iBAAiB,EASzB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"onUserMessage.d.ts","sourceRoot":"","sources":["../../../src/store/sideEffects/onUserMessage.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,KAAK,iBAAiB,EASzB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAOlC,MAAM,gBAAgB,CAAC;AAkBxB,OAAO,EAOH,KAAK,gBAAgB,EAGxB,MAAM,8BAA8B,CAAC;AAMtC;;;GAGG;AACH,wBAAiB,aAAa,CAAC,EAAE,OAAO,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oJAmB9E"}
|
|
@@ -3,7 +3,7 @@ import { call, cancel, cancelled, getContext, put, select } from "redux-saga/eff
|
|
|
3
3
|
import { isChatConversationError, isChatConversationItem, } from "@gooddata/sdk-backend-spi";
|
|
4
4
|
import { isChatConversationLocalItem, isTextContents, isUserMessage, makeAssistantItem, makeAssistantMessage, } from "../../model.js";
|
|
5
5
|
import { generateTitleFromQuestion } from "../../utils.js";
|
|
6
|
-
import { agentSwitchingActiveSelector, allowedRelationshipTypesSelector, objectTypesSelector, settingsSelector, tagsSelector,
|
|
6
|
+
import { agentSwitchingActiveSelector, allowedRelationshipTypesSelector, effectiveContextSelector, objectTypesSelector, settingsSelector, tagsSelector, } from "../chatWindow/chatWindowSelectors.js";
|
|
7
7
|
import { clearUserContextAction } from "../chatWindow/chatWindowSlice.js";
|
|
8
8
|
import { conversationMessagesByIdSelector, conversationSelector, messagesSelector, pendingAgentSwitchSelector, selectedAgentIdSelector, } from "../messages/messagesSelectors.js";
|
|
9
9
|
import { applyPendingAgentSwitchAction, evaluateMessageAction, evaluateMessageCompleteAction, evaluateMessageErrorAction, evaluateMessageStreamingAction, evaluateMessageUpdateAction, revertAgentSwitchAction, setCurrentConversationAction, } from "../messages/messagesSlice.js";
|
|
@@ -93,7 +93,7 @@ function* evaluateUserMessage(message, preparedChatThread) {
|
|
|
93
93
|
const settings = yield select(settingsSelector);
|
|
94
94
|
const objectTypes = yield select(objectTypesSelector);
|
|
95
95
|
const allowedRelationshipTypes = yield select(allowedRelationshipTypesSelector);
|
|
96
|
-
const
|
|
96
|
+
const { user, ambient } = yield select(effectiveContextSelector);
|
|
97
97
|
// Clear user context immediately — it is a one-shot value
|
|
98
98
|
yield put(clearUserContextAction());
|
|
99
99
|
const showReasoning = Boolean(settings?.enableGenAIReasoningVisibility);
|
|
@@ -101,13 +101,14 @@ function* evaluateUserMessage(message, preparedChatThread) {
|
|
|
101
101
|
let currentAssistantMessage = message;
|
|
102
102
|
let currentInteractionId = undefined;
|
|
103
103
|
let queryBuilder = preparedChatThread
|
|
104
|
-
.withSearchLimit(Number(settings?.["aiChatSearchLimit"]) ||
|
|
104
|
+
.withSearchLimit(Number(settings?.["aiChatSearchLimit"]) || 10)
|
|
105
105
|
.withObjectTypes(objectTypes);
|
|
106
106
|
if (allowedRelationshipTypes?.length) {
|
|
107
107
|
queryBuilder = queryBuilder.withAllowedRelationshipTypes(allowedRelationshipTypes);
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
const context = user ?? ambient;
|
|
110
|
+
if (context) {
|
|
111
|
+
queryBuilder = queryBuilder.withUserContext(context);
|
|
111
112
|
}
|
|
112
113
|
try {
|
|
113
114
|
const results = yield call([queryBuilder, queryBuilder.stream]);
|
|
@@ -323,15 +324,17 @@ function* evaluateUserConversationMessage(conversation, userMessage, assistantMe
|
|
|
323
324
|
const objectTypes = yield select(objectTypesSelector);
|
|
324
325
|
const { includeTags, excludeTags } = yield select(tagsSelector);
|
|
325
326
|
const allowedRelationshipTypes = yield select(allowedRelationshipTypesSelector);
|
|
326
|
-
|
|
327
|
-
//
|
|
327
|
+
// One-shot context (e.g. Summarize) wins over the ambient dashboard context;
|
|
328
|
+
// the ambient part persists and rides on every message.
|
|
329
|
+
const { user, ambient } = yield select(effectiveContextSelector);
|
|
330
|
+
// Clear the one-shot user context immediately — it is a one-shot value
|
|
328
331
|
yield put(clearUserContextAction());
|
|
329
332
|
// Track interaction ID to assistant message mapping
|
|
330
333
|
let currentUserMessage = userMessage;
|
|
331
334
|
let currentAssistantMessage = assistantMessage;
|
|
332
335
|
let currentInteractionId = undefined;
|
|
333
336
|
let queryBuilder = preparedChatThread
|
|
334
|
-
.withSearchLimit(Number(settings?.["aiChatSearchLimit"]) ||
|
|
337
|
+
.withSearchLimit(Number(settings?.["aiChatSearchLimit"]) || 10)
|
|
335
338
|
.withObjectTypes(objectTypes);
|
|
336
339
|
if (excludeTags) {
|
|
337
340
|
queryBuilder = queryBuilder.withExcludeTags(excludeTags);
|
|
@@ -342,8 +345,9 @@ function* evaluateUserConversationMessage(conversation, userMessage, assistantMe
|
|
|
342
345
|
if (allowedRelationshipTypes?.length) {
|
|
343
346
|
queryBuilder = queryBuilder.withAllowedRelationshipTypes(allowedRelationshipTypes);
|
|
344
347
|
}
|
|
345
|
-
|
|
346
|
-
|
|
348
|
+
const context = user ?? ambient;
|
|
349
|
+
if (context) {
|
|
350
|
+
queryBuilder = queryBuilder.withUserContext(context);
|
|
347
351
|
}
|
|
348
352
|
try {
|
|
349
353
|
const results = yield call([
|