dp-widgets-framework 1.0.6 → 1.0.7
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/dist/index.esm.js +149 -646
- package/dist/index.js +149 -646
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35966,7 +35966,87 @@ function SummaryWidget({ title, data, metadata, className }) {
|
|
|
35966
35966
|
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto space-y-4", children: jsxRuntimeExports.jsx("div", { className: "prose prose-sm max-w-none", children: jsxRuntimeExports.jsx(Markdown, { className: "text-gray-800 dark:text-gray-200", children: data.content }) }) })] }));
|
|
35967
35967
|
}
|
|
35968
35968
|
|
|
35969
|
-
const CHART_REFRESH_TIMEOUT =
|
|
35969
|
+
const CHART_REFRESH_TIMEOUT = 3000;
|
|
35970
|
+
const DEFAULT_COLORS = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
|
|
35971
|
+
const LINE_COLORS = ["#243D84", "#69238B", "#4A959F", "#D0A677", "#B31E47", "#396431"];
|
|
35972
|
+
const clearChat = async (widgetBackendUrl, widgetId) => {
|
|
35973
|
+
if (!widgetBackendUrl || !widgetId)
|
|
35974
|
+
return;
|
|
35975
|
+
console.log('clearChat called for widgetId:', widgetId);
|
|
35976
|
+
try {
|
|
35977
|
+
await fetch(`${widgetBackendUrl}/api/clear-chat`, {
|
|
35978
|
+
method: 'POST',
|
|
35979
|
+
headers: {
|
|
35980
|
+
'Content-Type': 'application/json',
|
|
35981
|
+
},
|
|
35982
|
+
body: JSON.stringify({
|
|
35983
|
+
session_id: widgetId,
|
|
35984
|
+
delete_state: true
|
|
35985
|
+
}),
|
|
35986
|
+
});
|
|
35987
|
+
console.log('Dispatching clearChartState event from clearChat for widgetId:', widgetId);
|
|
35988
|
+
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
35989
|
+
}
|
|
35990
|
+
catch (error) {
|
|
35991
|
+
console.error('Failed to clear chat:', error);
|
|
35992
|
+
}
|
|
35993
|
+
};
|
|
35994
|
+
const createLoadingComponent = (message = "Loading chart data...") => (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-2", children: [jsxRuntimeExports.jsx(lucideReact.RefreshCw, { className: "h-6 w-6 animate-spin text-blue-500" }), jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-500", children: message })] }) }));
|
|
35995
|
+
const createInitialChartState = (agentType, widgetIds, datasetId) => {
|
|
35996
|
+
const baseState = { dataset_id: datasetId || "home_generation_dataset" };
|
|
35997
|
+
switch (agentType) {
|
|
35998
|
+
case "Pie Chart Agent":
|
|
35999
|
+
return {
|
|
36000
|
+
pie_chart_data: {
|
|
36001
|
+
title: "",
|
|
36002
|
+
type: "pie",
|
|
36003
|
+
chart_type: "financial",
|
|
36004
|
+
data: { labels: [], values: [], percentages: [], total: 0 },
|
|
36005
|
+
metadata: { categories: 0, largest_category: "", largest_value: 0, largest_percentage: 0 }
|
|
36006
|
+
}
|
|
36007
|
+
};
|
|
36008
|
+
case "Line Chart Agent":
|
|
36009
|
+
case "Bar Chart Agent":
|
|
36010
|
+
return Object.assign({ bar_chart_data: {
|
|
36011
|
+
title: "",
|
|
36012
|
+
type: agentType === "Line Chart Agent" ? "line" : "bar",
|
|
36013
|
+
chart_type: "financial",
|
|
36014
|
+
orientation: agentType === "Line Chart Agent" ? "horizontal" : "vertical",
|
|
36015
|
+
data: { labels: [], values: [], total: 0, average: 0 },
|
|
36016
|
+
metadata: { categories: 0, highest_category: "", highest_value: 0, lowest_category: "", lowest_value: 0, range: 0 }
|
|
36017
|
+
} }, baseState);
|
|
36018
|
+
case "Series Bar Chart Agent":
|
|
36019
|
+
case "Series Line Chart Agent":
|
|
36020
|
+
return Object.assign({ series_bar_chart_data: {
|
|
36021
|
+
title: "",
|
|
36022
|
+
type: "series_bar",
|
|
36023
|
+
chart_type: "financial",
|
|
36024
|
+
orientation: "vertical",
|
|
36025
|
+
data: { labels: [], series: [], total: 0, average: 0 },
|
|
36026
|
+
metadata: {
|
|
36027
|
+
categories: 0, series_count: 0, highest_category: "", highest_value: 0, highest_series: "",
|
|
36028
|
+
lowest_category: "", lowest_value: 0, lowest_series: "", range: 0, series_totals: {}, series_averages: {}
|
|
36029
|
+
}
|
|
36030
|
+
} }, baseState);
|
|
36031
|
+
case "Data Grid Agent":
|
|
36032
|
+
return Object.assign({ matrix_grid_data: {
|
|
36033
|
+
title: "",
|
|
36034
|
+
type: "data_grid",
|
|
36035
|
+
grid_type: "",
|
|
36036
|
+
data: { headers: [], rows: [], row_count: 0, column_count: 0 },
|
|
36037
|
+
metadata: { total_rows: 0, total_columns: 0, numeric_columns: [] }
|
|
36038
|
+
} }, baseState);
|
|
36039
|
+
case "Summary Agent":
|
|
36040
|
+
return Object.assign({ summary_data: {
|
|
36041
|
+
title: "",
|
|
36042
|
+
type: "summary",
|
|
36043
|
+
data: { content: "", word_count: 0, character_count: 0, character_count_no_spaces: 0, line_count: 0 },
|
|
36044
|
+
metadata: { created_at: "", content_type: "text", is_multiline: false }
|
|
36045
|
+
} }, baseState);
|
|
36046
|
+
default:
|
|
36047
|
+
return { widget_ids: widgetIds };
|
|
36048
|
+
}
|
|
36049
|
+
};
|
|
35970
36050
|
const loadAgentState = async (widgetBackendUrl, threadId, agentName) => {
|
|
35971
36051
|
try {
|
|
35972
36052
|
const response = await fetch(`${widgetBackendUrl}/api/copilot/${agentName}`, {
|
|
@@ -36030,7 +36110,6 @@ const parseAndUpdateChartState = (apiResponse, setChartState) => {
|
|
|
36030
36110
|
if (chartData.agent_message) {
|
|
36031
36111
|
newChartState.agent_message = chartData.agent_message;
|
|
36032
36112
|
}
|
|
36033
|
-
console.log('Chart state updated from API response:', newChartState);
|
|
36034
36113
|
return newChartState;
|
|
36035
36114
|
});
|
|
36036
36115
|
}
|
|
@@ -36065,40 +36144,15 @@ const getStyleValues = (styles = {}) => {
|
|
|
36065
36144
|
};
|
|
36066
36145
|
function BarChartComponent({ orientation, barChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36067
36146
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36147
|
+
const hasCalledRef = React.useRef(false);
|
|
36068
36148
|
const labels = ((_b = (_a = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _c === void 0 ? void 0 : _c.bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36069
36149
|
const values = ((_g = (_f = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _h === void 0 ? void 0 : _h.bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36070
36150
|
const chartTitle = ((_l = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _m === void 0 ? void 0 : _m.bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36071
36151
|
values.length > 0 ? Math.max(...values) : 0;
|
|
36072
36152
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36073
|
-
const clearChat = async () => {
|
|
36074
|
-
if (!widgetBackendUrl || !widgetId)
|
|
36075
|
-
return;
|
|
36076
|
-
console.log('clearChat called for widgetId:', widgetId);
|
|
36077
|
-
try {
|
|
36078
|
-
await fetch(`${widgetBackendUrl}/api/clear-chat`, {
|
|
36079
|
-
method: 'POST',
|
|
36080
|
-
headers: {
|
|
36081
|
-
'Content-Type': 'application/json',
|
|
36082
|
-
},
|
|
36083
|
-
body: JSON.stringify({
|
|
36084
|
-
session_id: widgetId,
|
|
36085
|
-
delete_state: true
|
|
36086
|
-
}),
|
|
36087
|
-
});
|
|
36088
|
-
// Clear chart state directly after clearing chat
|
|
36089
|
-
console.log('Dispatching clearChartState event from clearChat for widgetId:', widgetId);
|
|
36090
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36091
|
-
}
|
|
36092
|
-
catch (error) {
|
|
36093
|
-
console.error('Failed to clear chat:', error);
|
|
36094
|
-
}
|
|
36095
|
-
};
|
|
36096
36153
|
const handleRefresh = async () => {
|
|
36097
|
-
if (query) {
|
|
36098
|
-
await clearChat();
|
|
36099
|
-
// Send trigger event to clear chart state
|
|
36100
|
-
console.log('Dispatching clearChartState event for widgetId:', widgetId);
|
|
36101
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36154
|
+
if (query && widgetBackendUrl && widgetId) {
|
|
36155
|
+
await clearChat(widgetBackendUrl, widgetId);
|
|
36102
36156
|
appendMessage(new TextMessage({
|
|
36103
36157
|
content: `${query} and render data on a bar chart`,
|
|
36104
36158
|
role: Role.User,
|
|
@@ -36106,10 +36160,12 @@ function BarChartComponent({ orientation, barChartState, styles, appendMessage,
|
|
|
36106
36160
|
}
|
|
36107
36161
|
};
|
|
36108
36162
|
React.useEffect(() => {
|
|
36109
|
-
if (isEmpty && query && isFirstLoad && !(barChartState === null || barChartState === void 0 ? void 0 : barChartState.agent_message)) {
|
|
36163
|
+
if (isEmpty && query && isFirstLoad && !(barChartState === null || barChartState === void 0 ? void 0 : barChartState.agent_message) && !hasCalledRef.current) {
|
|
36164
|
+
// console.log('calling append message')
|
|
36165
|
+
hasCalledRef.current = true;
|
|
36110
36166
|
handleRefresh();
|
|
36111
36167
|
}
|
|
36112
|
-
}, [isEmpty, query, isFirstLoad]);
|
|
36168
|
+
}, [isEmpty, query, isFirstLoad, barChartState]);
|
|
36113
36169
|
// Start timeout when chart is empty and loading
|
|
36114
36170
|
React.useEffect(() => {
|
|
36115
36171
|
if (isEmpty && startLoadingTimeout && !(barChartState === null || barChartState === void 0 ? void 0 : barChartState.agent_message)) {
|
|
@@ -36119,12 +36175,11 @@ function BarChartComponent({ orientation, barChartState, styles, appendMessage,
|
|
|
36119
36175
|
clearLoadingTimeout();
|
|
36120
36176
|
}
|
|
36121
36177
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36122
|
-
const colors = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#8C99C4", "#601B07", "#50649D", "#B4A8A0", "#808080", "#6F2587"];
|
|
36123
36178
|
const finalColors = React.useMemo(() => {
|
|
36124
|
-
return shuffleColors(
|
|
36179
|
+
return shuffleColors(DEFAULT_COLORS, labels === null || labels === void 0 ? void 0 : labels.length);
|
|
36125
36180
|
}, [labels.length]);
|
|
36126
36181
|
if (isEmpty) {
|
|
36127
|
-
return (
|
|
36182
|
+
return createLoadingComponent();
|
|
36128
36183
|
}
|
|
36129
36184
|
const transformedData = {
|
|
36130
36185
|
labels: labels,
|
|
@@ -36133,10 +36188,6 @@ function BarChartComponent({ orientation, barChartState, styles, appendMessage,
|
|
|
36133
36188
|
label: chartTitle || "Data",
|
|
36134
36189
|
data: values,
|
|
36135
36190
|
backgroundColor: finalColors,
|
|
36136
|
-
// backgroundColor: labels.map((_, index) => {
|
|
36137
|
-
// const colors = ["#60a5fa", "#34d399", "#fbbf24", "#f87171", "#a78bfa", "#fb7185", "#4ade80", "#facc15"];
|
|
36138
|
-
// return colors[index % colors.length];
|
|
36139
|
-
// }),
|
|
36140
36191
|
},
|
|
36141
36192
|
],
|
|
36142
36193
|
};
|
|
@@ -36144,33 +36195,11 @@ function BarChartComponent({ orientation, barChartState, styles, appendMessage,
|
|
|
36144
36195
|
}
|
|
36145
36196
|
function SeriesBarChartComponent({ orientation, seriesBarChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36146
36197
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36198
|
+
const hasCalledRef = React.useRef(false);
|
|
36147
36199
|
const labels = ((_b = (_a = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _c === void 0 ? void 0 : _c.series_bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36148
36200
|
const series = ((_g = (_f = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.series) || ((_k = (_j = (_h = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _h === void 0 ? void 0 : _h.series_bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.series) || [];
|
|
36149
36201
|
const chartTitle = ((_l = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _m === void 0 ? void 0 : _m.series_bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36150
36202
|
const isEmpty = labels.length === 0 || series.length === 0;
|
|
36151
|
-
const clearChat = async () => {
|
|
36152
|
-
if (!widgetBackendUrl || !widgetId)
|
|
36153
|
-
return;
|
|
36154
|
-
console.log('clearChat called for widgetId:', widgetId);
|
|
36155
|
-
try {
|
|
36156
|
-
await fetch(`${widgetBackendUrl}/api/clear-chat`, {
|
|
36157
|
-
method: 'POST',
|
|
36158
|
-
headers: {
|
|
36159
|
-
'Content-Type': 'application/json',
|
|
36160
|
-
},
|
|
36161
|
-
body: JSON.stringify({
|
|
36162
|
-
session_id: widgetId,
|
|
36163
|
-
delete_state: true
|
|
36164
|
-
}),
|
|
36165
|
-
});
|
|
36166
|
-
// Clear chart state directly after clearing chat
|
|
36167
|
-
console.log('Dispatching clearChartState event from clearChat for widgetId:', widgetId);
|
|
36168
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36169
|
-
}
|
|
36170
|
-
catch (error) {
|
|
36171
|
-
console.error('Failed to clear chat:', error);
|
|
36172
|
-
}
|
|
36173
|
-
};
|
|
36174
36203
|
const handleRefresh = async () => {
|
|
36175
36204
|
if (query) {
|
|
36176
36205
|
await clearChat();
|
|
@@ -36184,10 +36213,11 @@ function SeriesBarChartComponent({ orientation, seriesBarChartState, styles, app
|
|
|
36184
36213
|
}
|
|
36185
36214
|
};
|
|
36186
36215
|
React.useEffect(() => {
|
|
36187
|
-
if (isEmpty && query && isFirstLoad && !(seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.agent_message)) {
|
|
36216
|
+
if (isEmpty && query && isFirstLoad && !(seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.agent_message) && !hasCalledRef.current) {
|
|
36217
|
+
hasCalledRef.current = true;
|
|
36188
36218
|
handleRefresh();
|
|
36189
36219
|
}
|
|
36190
|
-
}, [isEmpty, query, isFirstLoad]);
|
|
36220
|
+
}, [isEmpty, query, isFirstLoad, seriesBarChartState]);
|
|
36191
36221
|
// Start timeout when chart is empty and loading
|
|
36192
36222
|
React.useEffect(() => {
|
|
36193
36223
|
if (isEmpty && startLoadingTimeout && !(seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.agent_message)) {
|
|
@@ -36197,12 +36227,11 @@ function SeriesBarChartComponent({ orientation, seriesBarChartState, styles, app
|
|
|
36197
36227
|
clearLoadingTimeout();
|
|
36198
36228
|
}
|
|
36199
36229
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36200
|
-
const colors = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#8C99C4", "#601B07", "#50649D", "#B4A8A0", "#808080", "#6F2587"];
|
|
36201
36230
|
const finalColors = React.useMemo(() => {
|
|
36202
|
-
return shuffleColors(
|
|
36231
|
+
return shuffleColors(DEFAULT_COLORS, series === null || series === void 0 ? void 0 : series.length);
|
|
36203
36232
|
}, [series.length]);
|
|
36204
36233
|
if (isEmpty) {
|
|
36205
|
-
return (
|
|
36234
|
+
return createLoadingComponent();
|
|
36206
36235
|
}
|
|
36207
36236
|
const transformedData = {
|
|
36208
36237
|
labels: labels,
|
|
@@ -36216,33 +36245,11 @@ function SeriesBarChartComponent({ orientation, seriesBarChartState, styles, app
|
|
|
36216
36245
|
}
|
|
36217
36246
|
function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36218
36247
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36248
|
+
const hasCalledRef = React.useRef(false);
|
|
36219
36249
|
const labels = ((_b = (_a = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _c === void 0 ? void 0 : _c.series_bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36220
36250
|
const series = ((_g = (_f = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.series) || ((_k = (_j = (_h = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _h === void 0 ? void 0 : _h.series_bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.series) || [];
|
|
36221
36251
|
const chartTitle = ((_l = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _m === void 0 ? void 0 : _m.series_bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36222
36252
|
const isEmpty = labels.length === 0 || series.length === 0;
|
|
36223
|
-
const clearChat = async () => {
|
|
36224
|
-
if (!widgetBackendUrl || !widgetId)
|
|
36225
|
-
return;
|
|
36226
|
-
console.log('clearChat called for widgetId:', widgetId);
|
|
36227
|
-
try {
|
|
36228
|
-
await fetch(`${widgetBackendUrl}/api/clear-chat`, {
|
|
36229
|
-
method: 'POST',
|
|
36230
|
-
headers: {
|
|
36231
|
-
'Content-Type': 'application/json',
|
|
36232
|
-
},
|
|
36233
|
-
body: JSON.stringify({
|
|
36234
|
-
session_id: widgetId,
|
|
36235
|
-
delete_state: true
|
|
36236
|
-
}),
|
|
36237
|
-
});
|
|
36238
|
-
// Clear chart state directly after clearing chat
|
|
36239
|
-
console.log('Dispatching clearChartState event from clearChat for widgetId:', widgetId);
|
|
36240
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36241
|
-
}
|
|
36242
|
-
catch (error) {
|
|
36243
|
-
console.error('Failed to clear chat:', error);
|
|
36244
|
-
}
|
|
36245
|
-
};
|
|
36246
36253
|
const handleRefresh = async () => {
|
|
36247
36254
|
if (query) {
|
|
36248
36255
|
await clearChat();
|
|
@@ -36256,10 +36263,11 @@ function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, a
|
|
|
36256
36263
|
}
|
|
36257
36264
|
};
|
|
36258
36265
|
React.useEffect(() => {
|
|
36259
|
-
if (isEmpty && query && isFirstLoad && !(seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.agent_message)) {
|
|
36266
|
+
if (isEmpty && query && isFirstLoad && !(seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.agent_message) && !hasCalledRef.current) {
|
|
36267
|
+
hasCalledRef.current = true;
|
|
36260
36268
|
handleRefresh();
|
|
36261
36269
|
}
|
|
36262
|
-
}, [isEmpty, query, isFirstLoad]);
|
|
36270
|
+
}, [isEmpty, query, isFirstLoad, seriesLineChartState]);
|
|
36263
36271
|
// Start timeout when chart is empty and loading
|
|
36264
36272
|
React.useEffect(() => {
|
|
36265
36273
|
if (isEmpty && startLoadingTimeout && !(seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.agent_message)) {
|
|
@@ -36269,12 +36277,11 @@ function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, a
|
|
|
36269
36277
|
clearLoadingTimeout();
|
|
36270
36278
|
}
|
|
36271
36279
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36272
|
-
const colors = ["#243D84", "#69238B", "#4A959F", "#D0A677", "#B31E47", "#396431", "#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC"];
|
|
36273
36280
|
const finalColors = React.useMemo(() => {
|
|
36274
|
-
return shuffleColors(
|
|
36281
|
+
return shuffleColors([...LINE_COLORS, ...DEFAULT_COLORS], series === null || series === void 0 ? void 0 : series.length);
|
|
36275
36282
|
}, [series.length]);
|
|
36276
36283
|
if (isEmpty) {
|
|
36277
|
-
return (
|
|
36284
|
+
return createLoadingComponent();
|
|
36278
36285
|
}
|
|
36279
36286
|
const transformedData = {
|
|
36280
36287
|
labels: labels,
|
|
@@ -36295,34 +36302,12 @@ function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, a
|
|
|
36295
36302
|
}
|
|
36296
36303
|
function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36297
36304
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
36305
|
+
const hasCalledRef = React.useRef(false);
|
|
36298
36306
|
const labels = ((_b = (_a = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _c === void 0 ? void 0 : _c.pie_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36299
36307
|
const values = ((_g = (_f = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _h === void 0 ? void 0 : _h.pie_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36300
36308
|
((_m = (_l = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.percentages) || ((_q = (_p = (_o = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _o === void 0 ? void 0 : _o.pie_chart_data) === null || _p === void 0 ? void 0 : _p.data) === null || _q === void 0 ? void 0 : _q.percentages) || [];
|
|
36301
36309
|
const chartTitle = ((_r = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _r === void 0 ? void 0 : _r.title) || ((_t = (_s = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _s === void 0 ? void 0 : _s.pie_chart_data) === null || _t === void 0 ? void 0 : _t.title) || "";
|
|
36302
36310
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36303
|
-
const clearChat = async () => {
|
|
36304
|
-
if (!widgetBackendUrl || !widgetId)
|
|
36305
|
-
return;
|
|
36306
|
-
console.log('clearChat called for widgetId:', widgetId);
|
|
36307
|
-
try {
|
|
36308
|
-
await fetch(`${widgetBackendUrl}/api/clear-chat`, {
|
|
36309
|
-
method: 'POST',
|
|
36310
|
-
headers: {
|
|
36311
|
-
'Content-Type': 'application/json',
|
|
36312
|
-
},
|
|
36313
|
-
body: JSON.stringify({
|
|
36314
|
-
session_id: widgetId,
|
|
36315
|
-
delete_state: true
|
|
36316
|
-
}),
|
|
36317
|
-
});
|
|
36318
|
-
// Clear chart state directly after clearing chat
|
|
36319
|
-
console.log('Dispatching clearChartState event from clearChat for widgetId:', widgetId);
|
|
36320
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36321
|
-
}
|
|
36322
|
-
catch (error) {
|
|
36323
|
-
console.error('Failed to clear chat:', error);
|
|
36324
|
-
}
|
|
36325
|
-
};
|
|
36326
36311
|
const handleRefresh = async () => {
|
|
36327
36312
|
if (query) {
|
|
36328
36313
|
await clearChat();
|
|
@@ -36336,10 +36321,11 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36336
36321
|
}
|
|
36337
36322
|
};
|
|
36338
36323
|
React.useEffect(() => {
|
|
36339
|
-
if (isEmpty && query && isFirstLoad && !(pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.agent_message)) {
|
|
36324
|
+
if (isEmpty && query && isFirstLoad && !(pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.agent_message) && !hasCalledRef.current) {
|
|
36325
|
+
hasCalledRef.current = true;
|
|
36340
36326
|
handleRefresh();
|
|
36341
36327
|
}
|
|
36342
|
-
}, [isEmpty, query, isFirstLoad]);
|
|
36328
|
+
}, [isEmpty, query, isFirstLoad, pieChartState]);
|
|
36343
36329
|
// Start timeout when chart is empty and loading
|
|
36344
36330
|
React.useEffect(() => {
|
|
36345
36331
|
if (isEmpty && startLoadingTimeout && !(pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.agent_message)) {
|
|
@@ -36349,23 +36335,12 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36349
36335
|
clearLoadingTimeout();
|
|
36350
36336
|
}
|
|
36351
36337
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36352
|
-
const palette = ["#E4DCB8", "#DAC46C", "#808080", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#808080", "#6F2587"];
|
|
36353
36338
|
const backgroundColors = React.useMemo(() => {
|
|
36354
|
-
return shuffleColorsWithPriority(
|
|
36339
|
+
return shuffleColorsWithPriority(DEFAULT_COLORS, labels.length, ["#7B0D3F"]);
|
|
36355
36340
|
}, [labels.length]);
|
|
36356
36341
|
if (isEmpty) {
|
|
36357
|
-
return (
|
|
36358
|
-
}
|
|
36359
|
-
// const borderColors = [
|
|
36360
|
-
// "rgba(255, 99, 132, 1)",
|
|
36361
|
-
// "rgba(54, 162, 235, 1)",
|
|
36362
|
-
// "rgba(255, 206, 86, 1)",
|
|
36363
|
-
// "rgba(75, 192, 192, 1)",
|
|
36364
|
-
// "rgba(153, 102, 255, 1)",
|
|
36365
|
-
// "rgba(255, 159, 64, 1)",
|
|
36366
|
-
// "rgba(199, 199, 199, 1)",
|
|
36367
|
-
// "rgba(83, 102, 255, 1)",
|
|
36368
|
-
// ];
|
|
36342
|
+
return createLoadingComponent();
|
|
36343
|
+
}
|
|
36369
36344
|
const transformedData = {
|
|
36370
36345
|
labels: labels,
|
|
36371
36346
|
datasets: [
|
|
@@ -36373,7 +36348,6 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36373
36348
|
label: chartTitle || "Data",
|
|
36374
36349
|
data: values,
|
|
36375
36350
|
backgroundColor: labels.map((_, index) => backgroundColors[index % backgroundColors.length]),
|
|
36376
|
-
// borderColor: labels.map((_, index) => borderColors[index % borderColors.length]),
|
|
36377
36351
|
borderWidth: 0,
|
|
36378
36352
|
},
|
|
36379
36353
|
],
|
|
@@ -36382,40 +36356,15 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36382
36356
|
}
|
|
36383
36357
|
function LineChartComponent({ lineChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36384
36358
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36359
|
+
const hasCalledRef = React.useRef(false);
|
|
36385
36360
|
const labels = ((_b = (_a = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _c === void 0 ? void 0 : _c.bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36386
36361
|
const values = ((_g = (_f = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _h === void 0 ? void 0 : _h.bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36387
36362
|
const chartTitle = ((_l = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _m === void 0 ? void 0 : _m.bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36388
36363
|
values.length > 0 ? Math.max(...values) : 0;
|
|
36389
36364
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36390
|
-
const clearChat = async () => {
|
|
36391
|
-
if (!widgetBackendUrl || !widgetId)
|
|
36392
|
-
return;
|
|
36393
|
-
console.log('clearChat called for widgetId:', widgetId);
|
|
36394
|
-
try {
|
|
36395
|
-
await fetch(`${widgetBackendUrl}/api/clear-chat`, {
|
|
36396
|
-
method: 'POST',
|
|
36397
|
-
headers: {
|
|
36398
|
-
'Content-Type': 'application/json',
|
|
36399
|
-
},
|
|
36400
|
-
body: JSON.stringify({
|
|
36401
|
-
session_id: widgetId,
|
|
36402
|
-
delete_state: true
|
|
36403
|
-
}),
|
|
36404
|
-
});
|
|
36405
|
-
// Clear chart state directly after clearing chat
|
|
36406
|
-
console.log('Dispatching clearChartState event from clearChat for widgetId:', widgetId);
|
|
36407
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36408
|
-
}
|
|
36409
|
-
catch (error) {
|
|
36410
|
-
console.error('Failed to clear chat:', error);
|
|
36411
|
-
}
|
|
36412
|
-
};
|
|
36413
36365
|
const handleRefresh = async () => {
|
|
36414
|
-
if (query) {
|
|
36415
|
-
await clearChat();
|
|
36416
|
-
// Send trigger event to clear chart state
|
|
36417
|
-
console.log('Dispatching clearChartState event for widgetId:', widgetId);
|
|
36418
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36366
|
+
if (query && widgetBackendUrl && widgetId) {
|
|
36367
|
+
await clearChat(widgetBackendUrl, widgetId);
|
|
36419
36368
|
appendMessage(new TextMessage({
|
|
36420
36369
|
content: `${query} and render data on a bar chart`,
|
|
36421
36370
|
role: Role.User,
|
|
@@ -36423,10 +36372,11 @@ function LineChartComponent({ lineChartState, styles, appendMessage, query, isFi
|
|
|
36423
36372
|
}
|
|
36424
36373
|
};
|
|
36425
36374
|
React.useEffect(() => {
|
|
36426
|
-
if (isEmpty && query && isFirstLoad && !(lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.agent_message)) {
|
|
36375
|
+
if (isEmpty && query && isFirstLoad && !(lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.agent_message) && !hasCalledRef.current) {
|
|
36376
|
+
hasCalledRef.current = true;
|
|
36427
36377
|
handleRefresh();
|
|
36428
36378
|
}
|
|
36429
|
-
}, [isEmpty, query, isFirstLoad]);
|
|
36379
|
+
}, [isEmpty, query, isFirstLoad, lineChartState]);
|
|
36430
36380
|
// Start timeout when chart is empty and loading
|
|
36431
36381
|
React.useEffect(() => {
|
|
36432
36382
|
if (isEmpty && startLoadingTimeout && !(lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.agent_message)) {
|
|
@@ -36436,19 +36386,11 @@ function LineChartComponent({ lineChartState, styles, appendMessage, query, isFi
|
|
|
36436
36386
|
clearLoadingTimeout();
|
|
36437
36387
|
}
|
|
36438
36388
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36439
|
-
const colors = [
|
|
36440
|
-
"#243D84",
|
|
36441
|
-
"#69238B",
|
|
36442
|
-
"#4A959F",
|
|
36443
|
-
"#D0A677",
|
|
36444
|
-
"#B31E47",
|
|
36445
|
-
"#396431",
|
|
36446
|
-
];
|
|
36447
36389
|
const lineColor = React.useMemo(() => {
|
|
36448
|
-
return
|
|
36390
|
+
return LINE_COLORS[Math.floor(Math.random() * LINE_COLORS.length)];
|
|
36449
36391
|
}, [labels.length]);
|
|
36450
36392
|
if (isEmpty) {
|
|
36451
|
-
return (
|
|
36393
|
+
return createLoadingComponent();
|
|
36452
36394
|
}
|
|
36453
36395
|
const transformedData = {
|
|
36454
36396
|
labels: labels,
|
|
@@ -36470,33 +36412,11 @@ function LineChartComponent({ lineChartState, styles, appendMessage, query, isFi
|
|
|
36470
36412
|
}
|
|
36471
36413
|
function DataGridComponent({ dataGridState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36472
36414
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36415
|
+
const hasCalledRef = React.useRef(false);
|
|
36473
36416
|
const columns = ((_b = (_a = dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.matrix_grid_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.headers) || ((_e = (_d = (_c = dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.state) === null || _c === void 0 ? void 0 : _c.matrix_grid_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.headers) || [];
|
|
36474
36417
|
const rows = ((_g = (_f = dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.matrix_grid_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.rows) || ((_k = (_j = (_h = dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.state) === null || _h === void 0 ? void 0 : _h.matrix_grid_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.rows) || [];
|
|
36475
36418
|
const gridTitle = ((_l = dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.matrix_grid_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.state) === null || _m === void 0 ? void 0 : _m.matrix_grid_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36476
36419
|
const isEmpty = columns.length === 0 || rows.length === 0;
|
|
36477
|
-
const clearChat = async () => {
|
|
36478
|
-
if (!widgetBackendUrl || !widgetId)
|
|
36479
|
-
return;
|
|
36480
|
-
console.log('clearChat called for widgetId:', widgetId);
|
|
36481
|
-
try {
|
|
36482
|
-
await fetch(`${widgetBackendUrl}/api/clear-chat`, {
|
|
36483
|
-
method: 'POST',
|
|
36484
|
-
headers: {
|
|
36485
|
-
'Content-Type': 'application/json',
|
|
36486
|
-
},
|
|
36487
|
-
body: JSON.stringify({
|
|
36488
|
-
session_id: widgetId,
|
|
36489
|
-
delete_state: true
|
|
36490
|
-
}),
|
|
36491
|
-
});
|
|
36492
|
-
// Clear chart state directly after clearing chat
|
|
36493
|
-
console.log('Dispatching clearChartState event from clearChat for widgetId:', widgetId);
|
|
36494
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36495
|
-
}
|
|
36496
|
-
catch (error) {
|
|
36497
|
-
console.error('Failed to clear chat:', error);
|
|
36498
|
-
}
|
|
36499
|
-
};
|
|
36500
36420
|
const handleRefresh = async () => {
|
|
36501
36421
|
if (query) {
|
|
36502
36422
|
await clearChat();
|
|
@@ -36510,10 +36430,11 @@ function DataGridComponent({ dataGridState, styles, appendMessage, query, isFirs
|
|
|
36510
36430
|
}
|
|
36511
36431
|
};
|
|
36512
36432
|
React.useEffect(() => {
|
|
36513
|
-
if (isEmpty && query && isFirstLoad && !(dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.agent_message)) {
|
|
36433
|
+
if (isEmpty && query && isFirstLoad && !(dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.agent_message) && !hasCalledRef.current) {
|
|
36434
|
+
hasCalledRef.current = true;
|
|
36514
36435
|
handleRefresh();
|
|
36515
36436
|
}
|
|
36516
|
-
}, [isEmpty, query, isFirstLoad]);
|
|
36437
|
+
}, [isEmpty, query, isFirstLoad, dataGridState]);
|
|
36517
36438
|
// Start timeout when chart is empty and loading
|
|
36518
36439
|
React.useEffect(() => {
|
|
36519
36440
|
if (isEmpty && startLoadingTimeout && !(dataGridState === null || dataGridState === void 0 ? void 0 : dataGridState.agent_message)) {
|
|
@@ -36524,7 +36445,7 @@ function DataGridComponent({ dataGridState, styles, appendMessage, query, isFirs
|
|
|
36524
36445
|
}
|
|
36525
36446
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36526
36447
|
if (isEmpty) {
|
|
36527
|
-
return (
|
|
36448
|
+
return createLoadingComponent("Loading table data...");
|
|
36528
36449
|
}
|
|
36529
36450
|
const transformedData = {
|
|
36530
36451
|
columns: columns,
|
|
@@ -36534,34 +36455,12 @@ function DataGridComponent({ dataGridState, styles, appendMessage, query, isFirs
|
|
|
36534
36455
|
}
|
|
36535
36456
|
function SummaryComponent({ summaryState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout, setChartState, widget_ids }) {
|
|
36536
36457
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
36458
|
+
const hasCalledRef = React.useRef(false);
|
|
36537
36459
|
const content = ((_b = (_a = summaryState === null || summaryState === void 0 ? void 0 : summaryState.summary_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.content) || ((_e = (_d = (_c = summaryState === null || summaryState === void 0 ? void 0 : summaryState.state) === null || _c === void 0 ? void 0 : _c.summary_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.content) || "";
|
|
36538
36460
|
const title = ((_f = summaryState === null || summaryState === void 0 ? void 0 : summaryState.summary_data) === null || _f === void 0 ? void 0 : _f.title) || ((_h = (_g = summaryState === null || summaryState === void 0 ? void 0 : summaryState.state) === null || _g === void 0 ? void 0 : _g.summary_data) === null || _h === void 0 ? void 0 : _h.title) || "";
|
|
36539
36461
|
const data = ((_j = summaryState === null || summaryState === void 0 ? void 0 : summaryState.summary_data) === null || _j === void 0 ? void 0 : _j.data) || ((_l = (_k = summaryState === null || summaryState === void 0 ? void 0 : summaryState.state) === null || _k === void 0 ? void 0 : _k.summary_data) === null || _l === void 0 ? void 0 : _l.data) || null;
|
|
36540
36462
|
const metadata = ((_m = summaryState === null || summaryState === void 0 ? void 0 : summaryState.summary_data) === null || _m === void 0 ? void 0 : _m.metadata) || ((_p = (_o = summaryState === null || summaryState === void 0 ? void 0 : summaryState.state) === null || _o === void 0 ? void 0 : _o.summary_data) === null || _p === void 0 ? void 0 : _p.metadata) || null;
|
|
36541
36463
|
const isEmpty = !content || content.trim() === "";
|
|
36542
|
-
const clearChat = async () => {
|
|
36543
|
-
if (!widgetBackendUrl || !widgetId)
|
|
36544
|
-
return;
|
|
36545
|
-
console.log('clearChat called for widgetId:', widgetId);
|
|
36546
|
-
try {
|
|
36547
|
-
await fetch(`${widgetBackendUrl}/api/clear-chat`, {
|
|
36548
|
-
method: 'POST',
|
|
36549
|
-
headers: {
|
|
36550
|
-
'Content-Type': 'application/json',
|
|
36551
|
-
},
|
|
36552
|
-
body: JSON.stringify({
|
|
36553
|
-
session_id: widgetId,
|
|
36554
|
-
delete_state: true
|
|
36555
|
-
}),
|
|
36556
|
-
});
|
|
36557
|
-
// Clear chart state directly after clearing chat
|
|
36558
|
-
console.log('Dispatching clearChartState event from clearChat for widgetId:', widgetId);
|
|
36559
|
-
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId } }));
|
|
36560
|
-
}
|
|
36561
|
-
catch (error) {
|
|
36562
|
-
console.error('Failed to clear chat:', error);
|
|
36563
|
-
}
|
|
36564
|
-
};
|
|
36565
36464
|
const handleRefresh = async () => {
|
|
36566
36465
|
if (query) {
|
|
36567
36466
|
await clearChat();
|
|
@@ -36575,13 +36474,14 @@ function SummaryComponent({ summaryState, styles, appendMessage, query, isFirstL
|
|
|
36575
36474
|
}
|
|
36576
36475
|
};
|
|
36577
36476
|
React.useEffect(() => {
|
|
36578
|
-
if (isEmpty && query && isFirstLoad && !(summaryState === null || summaryState === void 0 ? void 0 : summaryState.agent_message)) {
|
|
36477
|
+
if (isEmpty && query && isFirstLoad && !(summaryState === null || summaryState === void 0 ? void 0 : summaryState.agent_message) && !hasCalledRef.current) {
|
|
36478
|
+
hasCalledRef.current = true;
|
|
36579
36479
|
setChartState(prevState => (Object.assign(Object.assign({}, prevState), { widget_ids: widget_ids })));
|
|
36580
36480
|
setTimeout(() => {
|
|
36581
36481
|
handleRefresh();
|
|
36582
36482
|
}, 500);
|
|
36583
36483
|
}
|
|
36584
|
-
}, [isEmpty, query, isFirstLoad]);
|
|
36484
|
+
}, [isEmpty, query, isFirstLoad, summaryState]);
|
|
36585
36485
|
// Start timeout when summary is empty and loading
|
|
36586
36486
|
React.useEffect(() => {
|
|
36587
36487
|
if (isEmpty && startLoadingTimeout && !(summaryState === null || summaryState === void 0 ? void 0 : summaryState.agent_message)) {
|
|
@@ -36592,202 +36492,24 @@ function SummaryComponent({ summaryState, styles, appendMessage, query, isFirstL
|
|
|
36592
36492
|
}
|
|
36593
36493
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36594
36494
|
if (isEmpty) {
|
|
36595
|
-
return (
|
|
36495
|
+
return createLoadingComponent("Loading summary...");
|
|
36596
36496
|
}
|
|
36597
36497
|
return (jsxRuntimeExports.jsx(SummaryWidget, { title: title, data: data, metadata: metadata, className: "" }));
|
|
36598
36498
|
}
|
|
36599
|
-
function CopilotKitAgent({ widget, showHeader, styles, onResetReady, widgetIds, widgetBackendUrl }) {
|
|
36600
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31
|
|
36499
|
+
function CopilotKitAgent({ widget, showHeader, styles, onResetReady, widgetIds, widgetBackendUrl, datasetId }) {
|
|
36500
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31;
|
|
36601
36501
|
const agentType = (_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentType;
|
|
36602
36502
|
const orientation = (_b = widget.config) === null || _b === void 0 ? void 0 : _b.orientation;
|
|
36603
36503
|
const isFirstLoad = (_c = widget.config) === null || _c === void 0 ? void 0 : _c.isFirstLoad;
|
|
36604
36504
|
const { threadId, setThreadId } = reactCore.useCopilotContext();
|
|
36605
36505
|
const timeoutRef = React.useRef(null);
|
|
36606
36506
|
const [isTimeoutTriggered, setIsTimeoutTriggered] = React.useState(false);
|
|
36607
|
-
const [timeoutCount, setTimeoutCount] = React.useState(0);
|
|
36608
36507
|
React.useEffect(() => {
|
|
36609
36508
|
setThreadId(widget.id);
|
|
36610
36509
|
}, [widget.id, setThreadId]);
|
|
36611
|
-
const getInitialState = () => {
|
|
36612
|
-
if (agentType === "Pie Chart Agent") {
|
|
36613
|
-
return {
|
|
36614
|
-
pie_chart_data: {
|
|
36615
|
-
title: "",
|
|
36616
|
-
type: "pie",
|
|
36617
|
-
chart_type: "financial",
|
|
36618
|
-
data: {
|
|
36619
|
-
labels: [],
|
|
36620
|
-
values: [],
|
|
36621
|
-
percentages: [],
|
|
36622
|
-
total: 0
|
|
36623
|
-
},
|
|
36624
|
-
metadata: {
|
|
36625
|
-
categories: 0,
|
|
36626
|
-
largest_category: "",
|
|
36627
|
-
largest_value: 0,
|
|
36628
|
-
largest_percentage: 0
|
|
36629
|
-
}
|
|
36630
|
-
}
|
|
36631
|
-
};
|
|
36632
|
-
}
|
|
36633
|
-
else if (agentType === "Line Chart Agent") {
|
|
36634
|
-
return {
|
|
36635
|
-
bar_chart_data: {
|
|
36636
|
-
title: "",
|
|
36637
|
-
type: "line",
|
|
36638
|
-
chart_type: "financial",
|
|
36639
|
-
orientation: "horizontal",
|
|
36640
|
-
data: {
|
|
36641
|
-
labels: [],
|
|
36642
|
-
values: [],
|
|
36643
|
-
total: 0,
|
|
36644
|
-
average: 0
|
|
36645
|
-
},
|
|
36646
|
-
metadata: {
|
|
36647
|
-
categories: 0,
|
|
36648
|
-
highest_category: "",
|
|
36649
|
-
highest_value: 0,
|
|
36650
|
-
lowest_category: "",
|
|
36651
|
-
lowest_value: 0,
|
|
36652
|
-
range: 0
|
|
36653
|
-
}
|
|
36654
|
-
},
|
|
36655
|
-
dataset_id: "home_generation_dataset"
|
|
36656
|
-
};
|
|
36657
|
-
}
|
|
36658
|
-
else if (agentType === "Data Grid Agent") {
|
|
36659
|
-
return {
|
|
36660
|
-
matrix_grid_data: {
|
|
36661
|
-
title: "",
|
|
36662
|
-
type: "data_grid",
|
|
36663
|
-
data: {
|
|
36664
|
-
headers: [],
|
|
36665
|
-
rows: [],
|
|
36666
|
-
"row_count": 0,
|
|
36667
|
-
"column_count": 0
|
|
36668
|
-
},
|
|
36669
|
-
metadata: {
|
|
36670
|
-
total_rows: 0,
|
|
36671
|
-
total_columns: 0,
|
|
36672
|
-
numeric_columns: []
|
|
36673
|
-
}
|
|
36674
|
-
},
|
|
36675
|
-
dataset_id: "home_generation_dataset"
|
|
36676
|
-
};
|
|
36677
|
-
}
|
|
36678
|
-
else if (agentType === "Bar Chart Agent") {
|
|
36679
|
-
return {
|
|
36680
|
-
bar_chart_data: {
|
|
36681
|
-
title: "",
|
|
36682
|
-
type: "bar",
|
|
36683
|
-
chart_type: "financial",
|
|
36684
|
-
orientation: "vertical",
|
|
36685
|
-
data: {
|
|
36686
|
-
labels: [],
|
|
36687
|
-
values: [],
|
|
36688
|
-
total: 0,
|
|
36689
|
-
average: 0
|
|
36690
|
-
},
|
|
36691
|
-
metadata: {
|
|
36692
|
-
categories: 0,
|
|
36693
|
-
highest_category: "",
|
|
36694
|
-
highest_value: 0,
|
|
36695
|
-
lowest_category: "",
|
|
36696
|
-
lowest_value: 0,
|
|
36697
|
-
range: 0
|
|
36698
|
-
}
|
|
36699
|
-
},
|
|
36700
|
-
dataset_id: "home_generation_dataset"
|
|
36701
|
-
};
|
|
36702
|
-
}
|
|
36703
|
-
else if (agentType === "Series Bar Chart Agent") {
|
|
36704
|
-
return {
|
|
36705
|
-
series_bar_chart_data: {
|
|
36706
|
-
title: "",
|
|
36707
|
-
type: "series_bar",
|
|
36708
|
-
chart_type: "financial",
|
|
36709
|
-
orientation: "vertical",
|
|
36710
|
-
data: {
|
|
36711
|
-
labels: [],
|
|
36712
|
-
series: [],
|
|
36713
|
-
total: 0,
|
|
36714
|
-
average: 0
|
|
36715
|
-
},
|
|
36716
|
-
metadata: {
|
|
36717
|
-
categories: 0,
|
|
36718
|
-
series_count: 0,
|
|
36719
|
-
highest_category: "",
|
|
36720
|
-
highest_value: 0,
|
|
36721
|
-
highest_series: "",
|
|
36722
|
-
lowest_category: "",
|
|
36723
|
-
lowest_value: 0,
|
|
36724
|
-
lowest_series: "",
|
|
36725
|
-
range: 0,
|
|
36726
|
-
series_totals: {},
|
|
36727
|
-
series_averages: {}
|
|
36728
|
-
}
|
|
36729
|
-
},
|
|
36730
|
-
dataset_id: "home_generation_dataset"
|
|
36731
|
-
};
|
|
36732
|
-
}
|
|
36733
|
-
else if (agentType === "Series Line Chart Agent") {
|
|
36734
|
-
return {
|
|
36735
|
-
series_bar_chart_data: {
|
|
36736
|
-
title: "",
|
|
36737
|
-
type: "series_bar",
|
|
36738
|
-
chart_type: "financial",
|
|
36739
|
-
orientation: "vertical",
|
|
36740
|
-
data: {
|
|
36741
|
-
labels: [],
|
|
36742
|
-
series: [],
|
|
36743
|
-
total: 0,
|
|
36744
|
-
average: 0
|
|
36745
|
-
},
|
|
36746
|
-
metadata: {
|
|
36747
|
-
categories: 0,
|
|
36748
|
-
series_count: 0,
|
|
36749
|
-
highest_category: "",
|
|
36750
|
-
highest_value: 0,
|
|
36751
|
-
highest_series: "",
|
|
36752
|
-
lowest_category: "",
|
|
36753
|
-
lowest_value: 0,
|
|
36754
|
-
lowest_series: "",
|
|
36755
|
-
range: 0,
|
|
36756
|
-
series_totals: {},
|
|
36757
|
-
series_averages: {},
|
|
36758
|
-
}
|
|
36759
|
-
},
|
|
36760
|
-
dataset_id: "home_generation_dataset"
|
|
36761
|
-
};
|
|
36762
|
-
}
|
|
36763
|
-
else if (agentType === "Summary Agent") {
|
|
36764
|
-
return {
|
|
36765
|
-
summary_data: {
|
|
36766
|
-
title: "",
|
|
36767
|
-
type: "summary",
|
|
36768
|
-
data: {
|
|
36769
|
-
content: "",
|
|
36770
|
-
word_count: 0,
|
|
36771
|
-
character_count: 0,
|
|
36772
|
-
character_count_no_spaces: 0,
|
|
36773
|
-
line_count: 0
|
|
36774
|
-
},
|
|
36775
|
-
metadata: {
|
|
36776
|
-
created_at: "",
|
|
36777
|
-
content_type: "text",
|
|
36778
|
-
is_multiline: false
|
|
36779
|
-
}
|
|
36780
|
-
},
|
|
36781
|
-
dataset_id: "home_generation_dataset"
|
|
36782
|
-
};
|
|
36783
|
-
}
|
|
36784
|
-
else {
|
|
36785
|
-
return { widget_ids: widgetIds };
|
|
36786
|
-
}
|
|
36787
|
-
};
|
|
36788
36510
|
const { state: chartState, setState: setChartState } = reactCore.useCoAgent({
|
|
36789
36511
|
name: (_d = widget.config) === null || _d === void 0 ? void 0 : _d.agentName,
|
|
36790
|
-
initialState:
|
|
36512
|
+
initialState: createInitialChartState(agentType || '', widgetIds, datasetId),
|
|
36791
36513
|
});
|
|
36792
36514
|
// Function to handle timeout and call loadAgentState API
|
|
36793
36515
|
const handleLoadingTimeout = React.useCallback(async () => {
|
|
@@ -36796,7 +36518,6 @@ function CopilotKitAgent({ widget, showHeader, styles, onResetReady, widgetIds,
|
|
|
36796
36518
|
return;
|
|
36797
36519
|
console.log('Loading timeout triggered for widget:', widget.id);
|
|
36798
36520
|
setIsTimeoutTriggered(true);
|
|
36799
|
-
setTimeoutCount(prev => prev + 1);
|
|
36800
36521
|
const agentName = ((_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentName) || "adk-construction-project-agent";
|
|
36801
36522
|
const apiResponse = await loadAgentState(widgetBackendUrl, widget.id, agentName);
|
|
36802
36523
|
if (apiResponse && !(chartState === null || chartState === void 0 ? void 0 : chartState.agent_message)) {
|
|
@@ -36835,8 +36556,7 @@ function CopilotKitAgent({ widget, showHeader, styles, onResetReady, widgetIds,
|
|
|
36835
36556
|
delete_state: true
|
|
36836
36557
|
}),
|
|
36837
36558
|
});
|
|
36838
|
-
|
|
36839
|
-
setChartState(getInitialState());
|
|
36559
|
+
setChartState(createInitialChartState(agentType || '', widgetIds, datasetId));
|
|
36840
36560
|
}
|
|
36841
36561
|
catch (error) {
|
|
36842
36562
|
console.error('Failed to clear chat and state:', error);
|
|
@@ -36850,25 +36570,16 @@ function CopilotKitAgent({ widget, showHeader, styles, onResetReady, widgetIds,
|
|
|
36850
36570
|
}
|
|
36851
36571
|
};
|
|
36852
36572
|
}, []);
|
|
36853
|
-
const { appendMessage, reset
|
|
36573
|
+
const { appendMessage, reset } = reactCore.useCopilotChat();
|
|
36854
36574
|
// Register the reset function with the parent component
|
|
36855
36575
|
React.useEffect(() => {
|
|
36856
|
-
console.log('onResetReady available:', !!onResetReady, 'reset available:', !!reset, 'widget.id:', widget.id);
|
|
36857
36576
|
if (onResetReady && reset && widget.id) {
|
|
36858
|
-
console.log('Registering reset function for widget:', widget.id);
|
|
36859
|
-
// Create a wrapped reset function that also clears chart state
|
|
36860
36577
|
const wrappedReset = () => {
|
|
36861
|
-
console.log('Reset called for widget:', widget.id);
|
|
36862
36578
|
reset();
|
|
36863
|
-
// Clear chart state after reset
|
|
36864
|
-
console.log('Dispatching clearChartState event from reset for widgetId:', widget.id);
|
|
36865
36579
|
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId: widget.id } }));
|
|
36866
36580
|
};
|
|
36867
36581
|
onResetReady(widget.id, wrappedReset);
|
|
36868
36582
|
}
|
|
36869
|
-
else {
|
|
36870
|
-
console.log('Not registering reset - missing dependencies');
|
|
36871
|
-
}
|
|
36872
36583
|
}, [reset, widget.id, onResetReady]); // Removed onResetReady from deps to avoid the error
|
|
36873
36584
|
// Listen for triggerAgent events for this widget
|
|
36874
36585
|
React.useEffect(() => {
|
|
@@ -36906,183 +36617,10 @@ function CopilotKitAgent({ widget, showHeader, styles, onResetReady, widgetIds,
|
|
|
36906
36617
|
};
|
|
36907
36618
|
const handleClearChartState = (event) => {
|
|
36908
36619
|
const { widgetId } = event.detail;
|
|
36909
|
-
console.log('Received clearChartState event - widgetId:', widgetId, 'current widget.id:', widget.id);
|
|
36910
36620
|
if (widgetId === widget.id) {
|
|
36911
|
-
|
|
36912
|
-
// Reset chart state based on agent type with explicit initial state
|
|
36913
|
-
if (agentType === "Pie Chart Agent") {
|
|
36914
|
-
setChartState({
|
|
36915
|
-
pie_chart_data: {
|
|
36916
|
-
title: "",
|
|
36917
|
-
type: "pie",
|
|
36918
|
-
chart_type: "financial",
|
|
36919
|
-
data: {
|
|
36920
|
-
labels: [],
|
|
36921
|
-
values: [],
|
|
36922
|
-
percentages: [],
|
|
36923
|
-
total: 0
|
|
36924
|
-
},
|
|
36925
|
-
metadata: {
|
|
36926
|
-
categories: 0,
|
|
36927
|
-
largest_category: "",
|
|
36928
|
-
largest_value: 0,
|
|
36929
|
-
largest_percentage: 0
|
|
36930
|
-
}
|
|
36931
|
-
}
|
|
36932
|
-
});
|
|
36933
|
-
}
|
|
36934
|
-
else if (agentType === "Bar Chart Agent") {
|
|
36935
|
-
setChartState({
|
|
36936
|
-
bar_chart_data: {
|
|
36937
|
-
title: "",
|
|
36938
|
-
type: "bar",
|
|
36939
|
-
chart_type: "financial",
|
|
36940
|
-
orientation: "vertical",
|
|
36941
|
-
data: {
|
|
36942
|
-
labels: [],
|
|
36943
|
-
values: [],
|
|
36944
|
-
total: 0,
|
|
36945
|
-
average: 0
|
|
36946
|
-
},
|
|
36947
|
-
metadata: {
|
|
36948
|
-
categories: 0,
|
|
36949
|
-
highest_category: "",
|
|
36950
|
-
highest_value: 0,
|
|
36951
|
-
lowest_category: "",
|
|
36952
|
-
lowest_value: 0,
|
|
36953
|
-
range: 0
|
|
36954
|
-
}
|
|
36955
|
-
}
|
|
36956
|
-
});
|
|
36957
|
-
}
|
|
36958
|
-
else if (agentType === "Series Bar Chart Agent") {
|
|
36959
|
-
setChartState({
|
|
36960
|
-
series_bar_chart_data: {
|
|
36961
|
-
title: "",
|
|
36962
|
-
type: "series_bar",
|
|
36963
|
-
chart_type: "financial",
|
|
36964
|
-
orientation: "vertical",
|
|
36965
|
-
data: {
|
|
36966
|
-
labels: [],
|
|
36967
|
-
series: [],
|
|
36968
|
-
total: 0,
|
|
36969
|
-
average: 0
|
|
36970
|
-
},
|
|
36971
|
-
metadata: {
|
|
36972
|
-
categories: 0,
|
|
36973
|
-
series_count: 0,
|
|
36974
|
-
highest_category: "",
|
|
36975
|
-
highest_value: 0,
|
|
36976
|
-
highest_series: "",
|
|
36977
|
-
lowest_category: "",
|
|
36978
|
-
lowest_value: 0,
|
|
36979
|
-
lowest_series: "",
|
|
36980
|
-
range: 0,
|
|
36981
|
-
series_totals: {},
|
|
36982
|
-
series_averages: {}
|
|
36983
|
-
}
|
|
36984
|
-
}
|
|
36985
|
-
});
|
|
36986
|
-
}
|
|
36987
|
-
else if (agentType === "Series Line Chart Agent") {
|
|
36988
|
-
setChartState({
|
|
36989
|
-
series_bar_chart_data: {
|
|
36990
|
-
title: "",
|
|
36991
|
-
type: "series_bar",
|
|
36992
|
-
chart_type: "financial",
|
|
36993
|
-
orientation: "vertical",
|
|
36994
|
-
data: {
|
|
36995
|
-
labels: [],
|
|
36996
|
-
series: [],
|
|
36997
|
-
total: 0,
|
|
36998
|
-
average: 0
|
|
36999
|
-
},
|
|
37000
|
-
metadata: {
|
|
37001
|
-
categories: 0,
|
|
37002
|
-
series_count: 0,
|
|
37003
|
-
highest_category: "",
|
|
37004
|
-
highest_value: 0,
|
|
37005
|
-
highest_series: "",
|
|
37006
|
-
lowest_category: "",
|
|
37007
|
-
lowest_value: 0,
|
|
37008
|
-
lowest_series: "",
|
|
37009
|
-
range: 0,
|
|
37010
|
-
series_totals: {},
|
|
37011
|
-
series_averages: {}
|
|
37012
|
-
}
|
|
37013
|
-
}
|
|
37014
|
-
});
|
|
37015
|
-
}
|
|
37016
|
-
else if (agentType === "Line Chart Agent") {
|
|
37017
|
-
setChartState({
|
|
37018
|
-
bar_chart_data: {
|
|
37019
|
-
title: "",
|
|
37020
|
-
type: "line",
|
|
37021
|
-
chart_type: "financial",
|
|
37022
|
-
orientation: "horizontal",
|
|
37023
|
-
data: {
|
|
37024
|
-
labels: [],
|
|
37025
|
-
values: [],
|
|
37026
|
-
total: 0,
|
|
37027
|
-
average: 0
|
|
37028
|
-
},
|
|
37029
|
-
metadata: {
|
|
37030
|
-
categories: 0,
|
|
37031
|
-
highest_category: "",
|
|
37032
|
-
highest_value: 0,
|
|
37033
|
-
lowest_category: "",
|
|
37034
|
-
lowest_value: 0,
|
|
37035
|
-
range: 0
|
|
37036
|
-
}
|
|
37037
|
-
}
|
|
37038
|
-
});
|
|
37039
|
-
}
|
|
37040
|
-
else if (agentType === "Data Grid Agent") {
|
|
37041
|
-
setChartState({
|
|
37042
|
-
matrix_grid_data: {
|
|
37043
|
-
title: "",
|
|
37044
|
-
type: "data_grid",
|
|
37045
|
-
grid_type: "",
|
|
37046
|
-
data: {
|
|
37047
|
-
headers: [],
|
|
37048
|
-
rows: [],
|
|
37049
|
-
row_count: 0,
|
|
37050
|
-
column_count: 0
|
|
37051
|
-
},
|
|
37052
|
-
metadata: {
|
|
37053
|
-
total_rows: 0,
|
|
37054
|
-
total_columns: 0,
|
|
37055
|
-
numeric_columns: []
|
|
37056
|
-
}
|
|
37057
|
-
}
|
|
37058
|
-
});
|
|
37059
|
-
}
|
|
37060
|
-
else if (agentType === "Summary Agent") {
|
|
37061
|
-
setChartState({
|
|
37062
|
-
summary_data: {
|
|
37063
|
-
title: "",
|
|
37064
|
-
type: "summary",
|
|
37065
|
-
data: {
|
|
37066
|
-
content: "",
|
|
37067
|
-
word_count: 0,
|
|
37068
|
-
character_count: 0,
|
|
37069
|
-
character_count_no_spaces: 0,
|
|
37070
|
-
line_count: 0
|
|
37071
|
-
},
|
|
37072
|
-
metadata: {
|
|
37073
|
-
created_at: "",
|
|
37074
|
-
content_type: "text",
|
|
37075
|
-
is_multiline: false
|
|
37076
|
-
}
|
|
37077
|
-
}
|
|
37078
|
-
});
|
|
37079
|
-
}
|
|
37080
|
-
else {
|
|
37081
|
-
setChartState({ widget_ids: widgetIds });
|
|
37082
|
-
}
|
|
36621
|
+
setChartState(createInitialChartState(agentType || '', widgetIds, datasetId));
|
|
37083
36622
|
}
|
|
37084
36623
|
};
|
|
37085
|
-
console.log('Setting up event listeners for widget:', widget.id);
|
|
37086
36624
|
window.addEventListener('triggerAgent', handleTriggerAgent);
|
|
37087
36625
|
window.addEventListener('clearChartState', handleClearChartState);
|
|
37088
36626
|
return () => {
|
|
@@ -37090,59 +36628,22 @@ function CopilotKitAgent({ widget, showHeader, styles, onResetReady, widgetIds,
|
|
|
37090
36628
|
window.removeEventListener('clearChartState', handleClearChartState);
|
|
37091
36629
|
};
|
|
37092
36630
|
}, [widget.id, appendMessage, agentType, setChartState]);
|
|
37093
|
-
// Monitor chartState and add manual clear functionality
|
|
37094
|
-
React.useEffect(() => {
|
|
37095
|
-
// Add a global function to manually clear this widget's state
|
|
37096
|
-
const clearThisWidget = () => {
|
|
37097
|
-
console.log('Manual clear triggered for widget:', widget.id);
|
|
37098
|
-
if (agentType === "Pie Chart Agent") {
|
|
37099
|
-
setChartState({
|
|
37100
|
-
pie_chart_data: {
|
|
37101
|
-
title: "",
|
|
37102
|
-
type: "pie",
|
|
37103
|
-
chart_type: "financial",
|
|
37104
|
-
data: {
|
|
37105
|
-
labels: [],
|
|
37106
|
-
values: [],
|
|
37107
|
-
percentages: [],
|
|
37108
|
-
total: 0
|
|
37109
|
-
},
|
|
37110
|
-
metadata: {
|
|
37111
|
-
categories: 0,
|
|
37112
|
-
largest_category: "",
|
|
37113
|
-
largest_value: 0,
|
|
37114
|
-
largest_percentage: 0
|
|
37115
|
-
}
|
|
37116
|
-
}
|
|
37117
|
-
});
|
|
37118
|
-
}
|
|
37119
|
-
// Add other agent types as needed
|
|
37120
|
-
};
|
|
37121
|
-
// Make it globally accessible for testing
|
|
37122
|
-
window[`clearWidget_${widget.id}`] = clearThisWidget;
|
|
37123
|
-
return () => {
|
|
37124
|
-
delete window[`clearWidget_${widget.id}`];
|
|
37125
|
-
};
|
|
37126
|
-
}, [widget.id, agentType, setChartState]);
|
|
37127
|
-
console.log('agent_message==>', chartState === null || chartState === void 0 ? void 0 : chartState.agent_message);
|
|
37128
|
-
console.log('Pie Chart Agent==>', (agentType === "Pie Chart Agent" && (!((_h = (_g = (_f = chartState.pie_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.labels) === null || _h === void 0 ? void 0 : _h.length) || !((_l = (_k = (_j = chartState.pie_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) === null || _l === void 0 ? void 0 : _l.length))));
|
|
37129
|
-
console.log('chartState.pie_chart_data?.data?.labels?.length==>', (_o = (_m = chartState.pie_chart_data) === null || _m === void 0 ? void 0 : _m.data) === null || _o === void 0 ? void 0 : _o.labels);
|
|
37130
36631
|
return (jsxRuntimeExports.jsxs("div", { className: cn("flex flex-col h-full"), children: [showHeader && (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between pb-2 border-b", children: jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx(lucideReact.Bot, { className: "h-4 w-4" }), jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium", children: widget.title })] }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 h-full", children: (chartState === null || chartState === void 0 ? void 0 : chartState.agent_message) && agentType !== "chatbot" && (
|
|
37131
36632
|
// Check if data is empty based on agent type
|
|
37132
|
-
(agentType === "Bar Chart Agent" && (!((
|
|
37133
|
-
(agentType === "Series Bar Chart Agent" && (!((
|
|
37134
|
-
(agentType === "Series Line Chart Agent" && (!((
|
|
37135
|
-
(agentType === "Pie Chart Agent" && (!((
|
|
37136
|
-
(agentType === "Line Chart Agent" && (!((
|
|
37137
|
-
(agentType === "Data Grid Agent" && (!((
|
|
37138
|
-
(agentType === "Summary Agent" && (!((
|
|
37139
|
-
title: ((
|
|
37140
|
-
initial: ((
|
|
36633
|
+
(agentType === "Bar Chart Agent" && (!((_h = (_g = (_f = chartState.bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.labels) === null || _h === void 0 ? void 0 : _h.length) || !((_l = (_k = (_j = chartState.bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) === null || _l === void 0 ? void 0 : _l.length))) ||
|
|
36634
|
+
(agentType === "Series Bar Chart Agent" && (!((_p = (_o = (_m = chartState.series_bar_chart_data) === null || _m === void 0 ? void 0 : _m.data) === null || _o === void 0 ? void 0 : _o.labels) === null || _p === void 0 ? void 0 : _p.length) || !((_s = (_r = (_q = chartState.series_bar_chart_data) === null || _q === void 0 ? void 0 : _q.data) === null || _r === void 0 ? void 0 : _r.series) === null || _s === void 0 ? void 0 : _s.length))) ||
|
|
36635
|
+
(agentType === "Series Line Chart Agent" && (!((_v = (_u = (_t = chartState.series_bar_chart_data) === null || _t === void 0 ? void 0 : _t.data) === null || _u === void 0 ? void 0 : _u.labels) === null || _v === void 0 ? void 0 : _v.length) || !((_y = (_x = (_w = chartState.series_bar_chart_data) === null || _w === void 0 ? void 0 : _w.data) === null || _x === void 0 ? void 0 : _x.series) === null || _y === void 0 ? void 0 : _y.length))) ||
|
|
36636
|
+
(agentType === "Pie Chart Agent" && (!((_1 = (_0 = (_z = chartState.pie_chart_data) === null || _z === void 0 ? void 0 : _z.data) === null || _0 === void 0 ? void 0 : _0.labels) === null || _1 === void 0 ? void 0 : _1.length) || !((_4 = (_3 = (_2 = chartState.pie_chart_data) === null || _2 === void 0 ? void 0 : _2.data) === null || _3 === void 0 ? void 0 : _3.values) === null || _4 === void 0 ? void 0 : _4.length))) ||
|
|
36637
|
+
(agentType === "Line Chart Agent" && (!((_7 = (_6 = (_5 = chartState.bar_chart_data) === null || _5 === void 0 ? void 0 : _5.data) === null || _6 === void 0 ? void 0 : _6.labels) === null || _7 === void 0 ? void 0 : _7.length) || !((_10 = (_9 = (_8 = chartState.bar_chart_data) === null || _8 === void 0 ? void 0 : _8.data) === null || _9 === void 0 ? void 0 : _9.values) === null || _10 === void 0 ? void 0 : _10.length))) ||
|
|
36638
|
+
(agentType === "Data Grid Agent" && (!((_13 = (_12 = (_11 = chartState.matrix_grid_data) === null || _11 === void 0 ? void 0 : _11.data) === null || _12 === void 0 ? void 0 : _12.headers) === null || _13 === void 0 ? void 0 : _13.length) || !((_16 = (_15 = (_14 = chartState.matrix_grid_data) === null || _14 === void 0 ? void 0 : _14.data) === null || _15 === void 0 ? void 0 : _15.rows) === null || _16 === void 0 ? void 0 : _16.length))) ||
|
|
36639
|
+
(agentType === "Summary Agent" && (!((_18 = (_17 = chartState.summary_data) === null || _17 === void 0 ? void 0 : _17.data) === null || _18 === void 0 ? void 0 : _18.content) || ((_21 = (_20 = (_19 = chartState.summary_data) === null || _19 === void 0 ? void 0 : _19.data) === null || _20 === void 0 ? void 0 : _20.content) === null || _21 === void 0 ? void 0 : _21.trim()) === ""))) ? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full p-4", children: jsxRuntimeExports.jsx("div", { className: "text-center max-w-md", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: chartState.agent_message }) }) })) : agentType === "Bar Chart Agent" ? (jsxRuntimeExports.jsx(BarChartComponent, { barChartState: chartState, styles: styles, orientation: orientation, appendMessage: appendMessage, query: (_22 = widget.config) === null || _22 === void 0 ? void 0 : _22.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout })) : agentType === "Series Bar Chart Agent" ? (jsxRuntimeExports.jsx(SeriesBarChartComponent, { seriesBarChartState: chartState, styles: styles, orientation: orientation, appendMessage: appendMessage, query: (_23 = widget.config) === null || _23 === void 0 ? void 0 : _23.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout })) : agentType === "Series Line Chart Agent" ? (jsxRuntimeExports.jsx(SeriesLineChartComponent, { seriesLineChartState: chartState, styles: styles, orientation: orientation, appendMessage: appendMessage, query: (_24 = widget.config) === null || _24 === void 0 ? void 0 : _24.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout })) : agentType === "Pie Chart Agent" ? (jsxRuntimeExports.jsx(PieChartComponent, { pieChartState: chartState, styles: styles, appendMessage: appendMessage, query: (_25 = widget.config) === null || _25 === void 0 ? void 0 : _25.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout })) : agentType === "Line Chart Agent" ? (jsxRuntimeExports.jsx(LineChartComponent, { lineChartState: chartState, styles: styles, appendMessage: appendMessage, query: (_26 = widget.config) === null || _26 === void 0 ? void 0 : _26.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout })) : agentType === "Data Grid Agent" ? (jsxRuntimeExports.jsx(DataGridComponent, { dataGridState: chartState, styles: styles, appendMessage: appendMessage, query: (_27 = widget.config) === null || _27 === void 0 ? void 0 : _27.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout })) : agentType === "Summary Agent" ? (jsxRuntimeExports.jsx(SummaryComponent, { summaryState: chartState, styles: styles, appendMessage: appendMessage, query: (_28 = widget.config) === null || _28 === void 0 ? void 0 : _28.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, widget_ids: widgetIds, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout, setChartState: setChartState })) : (jsxRuntimeExports.jsx(reactUi.CopilotChat, { className: "h-full text-xs [&_.copilot-chat-message]:text-xs [&_.copilot-chat-input]:text-xs", labels: {
|
|
36640
|
+
title: ((_29 = widget.config) === null || _29 === void 0 ? void 0 : _29.copilotTitle) || widget.title,
|
|
36641
|
+
initial: ((_30 = widget.config) === null || _30 === void 0 ? void 0 : _30.copilotInitialMessage) || ((_31 = widget.config) === null || _31 === void 0 ? void 0 : _31.placeholder) || "How can I help you today?"
|
|
37141
36642
|
}, onSubmitMessage: () => {
|
|
37142
36643
|
setChartState(prevState => (Object.assign(Object.assign({}, prevState), { widget_ids: widgetIds })));
|
|
37143
36644
|
} })) })] }));
|
|
37144
36645
|
}
|
|
37145
|
-
function AgentWidget({ widget, showHeader = true, widgetBackendUrl, onResetReady, widgetIds, }) {
|
|
36646
|
+
function AgentWidget({ widget, showHeader = true, widgetBackendUrl, onResetReady, widgetIds, datasetId, }) {
|
|
37146
36647
|
var _a, _b;
|
|
37147
36648
|
const styles = getStyleValues((_a = widget.config) === null || _a === void 0 ? void 0 : _a.styles);
|
|
37148
36649
|
// Construct the runtime URL using the configurable backend URL
|
|
@@ -37152,10 +36653,10 @@ function AgentWidget({ widget, showHeader = true, widgetBackendUrl, onResetReady
|
|
|
37152
36653
|
const agentName = ((_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentName) || 'default-agent';
|
|
37153
36654
|
return `${baseUrl}/api/copilot/${agentName}`;
|
|
37154
36655
|
};
|
|
37155
|
-
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(reactCore.CopilotKit, { runtimeUrl: getRuntimeUrl(), showDevConsole: false, agent: ((_b = widget.config) === null || _b === void 0 ? void 0 : _b.agentName) || "widget_assistant", children: jsxRuntimeExports.jsx(CopilotKitAgent, { widget: widget, showHeader: showHeader, styles: styles, onResetReady: onResetReady, widgetIds: widgetIds, widgetBackendUrl: widgetBackendUrl }) }) }));
|
|
36656
|
+
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(reactCore.CopilotKit, { runtimeUrl: getRuntimeUrl(), showDevConsole: false, agent: ((_b = widget.config) === null || _b === void 0 ? void 0 : _b.agentName) || "widget_assistant", children: jsxRuntimeExports.jsx(CopilotKitAgent, { widget: widget, showHeader: showHeader, styles: styles, onResetReady: onResetReady, widgetIds: widgetIds, widgetBackendUrl: widgetBackendUrl, datasetId: datasetId }) }) }));
|
|
37156
36657
|
}
|
|
37157
36658
|
|
|
37158
|
-
function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBackendUrl, onResetReady, widgetIds, }) {
|
|
36659
|
+
function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBackendUrl, onResetReady, widgetIds, datasetId, }) {
|
|
37159
36660
|
const handleConfigUpdate = (config) => {
|
|
37160
36661
|
if (onConfigUpdate) {
|
|
37161
36662
|
onConfigUpdate(widget.id, config);
|
|
@@ -37178,7 +36679,7 @@ function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBack
|
|
|
37178
36679
|
return (jsxRuntimeExports.jsx(FacetWidget, { widget: widget, showHeader: false, onConfigUpdate: handleConfigUpdate }));
|
|
37179
36680
|
case "agent":
|
|
37180
36681
|
case "chatbot":
|
|
37181
|
-
return jsxRuntimeExports.jsx(AgentWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds });
|
|
36682
|
+
return jsxRuntimeExports.jsx(AgentWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId });
|
|
37182
36683
|
default:
|
|
37183
36684
|
return (jsxRuntimeExports.jsxs("div", { className: "text-muted-foreground", children: ["Unknown widget type: ", widget.type] }));
|
|
37184
36685
|
}
|
|
@@ -37418,6 +36919,7 @@ const IconMap = {
|
|
|
37418
36919
|
};
|
|
37419
36920
|
function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSelect, refreshKey, widgetBackendUrl, onSaveLayoutReady, openWidgetPallete = false, onCloseWidgetPallete, defaultAgentName = "adk-construction-project-agent", userId }) {
|
|
37420
36921
|
const [widgets, setWidgets] = React.useState([]);
|
|
36922
|
+
const [datasetId, setDatasetId] = React.useState('');
|
|
37421
36923
|
const [availableWidgets, setAvailableWidgets] = React.useState([]);
|
|
37422
36924
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
37423
36925
|
const [pageData, setPageData] = React.useState(null);
|
|
@@ -37551,6 +37053,7 @@ function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSel
|
|
|
37551
37053
|
console.log(data);
|
|
37552
37054
|
setPageData(data);
|
|
37553
37055
|
setWidgets(data.widgets || []);
|
|
37056
|
+
setDatasetId(data === null || data === void 0 ? void 0 : data.dataset_id);
|
|
37554
37057
|
}
|
|
37555
37058
|
catch (err) {
|
|
37556
37059
|
console.error("Error loading page data:", err);
|
|
@@ -37885,7 +37388,7 @@ function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSel
|
|
|
37885
37388
|
onCloseWidgetPallete === null || onCloseWidgetPallete === void 0 ? void 0 : onCloseWidgetPallete();
|
|
37886
37389
|
}, defaultAgentName: defaultAgentName }), jsxRuntimeExports.jsx(EditWidgetDialog, { initialText: editInitialQuery, isOpen: showEditModal, onClose: () => setShowEditModal(false), onSubmit: handleEditSubmit }), jsxRuntimeExports.jsx("div", { className: "min-h-full", onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, onClick: () => setSelectedWidget(null), children: isLoading ? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full", children: jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "h-8 w-8 animate-spin" }) })) : (jsxRuntimeExports.jsx(RGL, { className: "layout m-0 p-0", layouts: { lg: getLayoutFromWidgets() }, breakpoints: { lg: 1200, md: 996, sm: 768, xs: 480 }, cols: { lg: 12, md: 8, sm: 6, xs: 2 }, rowHeight: 100, isDraggable: isEditing, isResizable: isEditing, draggableHandle: ".drag-icon", onLayoutChange: handleLayoutChange, compactType: "vertical", containerPadding: [0, 0], resizeHandles: ["sw", "nw", "se", "ne"], children: widgets.map((w) => (jsxRuntimeExports.jsxs("div", { style: { borderColor: "rgb(147 197 253 / 1)" }, className: `border border-blue-300 rounded-xl p-4 shadow-lg overflow-hidden ${isEditing ? 'pb-20' : 'pb-14'}`, children: [isEditing &&
|
|
37887
37390
|
jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end mb-4 relative", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center drag-icon cursor-grab absolute left-1/2 -translate-x-1/2", children: [jsxRuntimeExports.jsx(lucideReact.GripHorizontal, { className: "" }), jsxRuntimeExports.jsx(lucideReact.GripHorizontal, { className: "-ml-[3px]" }), jsxRuntimeExports.jsx(lucideReact.GripHorizontal, { className: "-ml-[3px]" })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 cursor-pointer justify-end", children: [jsxRuntimeExports.jsx(lucideReact.Trash2, { onClick: () => removeWidget(w.id), className: "w-5 h-5 text-red-700" }), jsxRuntimeExports.jsx(lucideReact.Edit, { onClick: () => onClickSettings && onClickSettings(w), className: "w-5 h-5 text-gray-600" })] })] }), jsxRuntimeExports.jsxs("div", { className: "w-full h-full relative", children: [(w === null || w === void 0 ? void 0 : w.type) === "chatbot" &&
|
|
37888
|
-
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w.id), onMouseOver: () => setVisibleClearButton(true), onMouseLeave: () => setVisibleClearButton(false), className: "absolute z-40 flex align-middle justify-center gap-2 text-sm px-4 py-2 border-blue-300 rounded-sm dark:bg-white w-fit bg-gray-900 text-white dark:text-gray-900 cursor-pointer shadow-md transition-all", style: { top: "12px", right: "0", borderTopLeftRadius: "4px", borderBottomLeftRadius: "4px" }, children: jsxRuntimeExports.jsx(lucideReact.MessageCircleX, { className: "w-5 h-5" }) }), jsxRuntimeExports.jsx("span", { className: `absolute z-50 w-max py-1 text-xs px-2 rounded-sm dark:text-gray-900 dark:bg-white text-white bg-gray-900 ${visibleClearButton ? "block" : "hidden"}`, style: { top: "56px", right: "16px", borderRadius: "3px" }, children: "Clear Chat" })] }), jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl: widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter(widget => widget.type !== 'chatbot').map(widget => widget.id) })] })] }, w.id))) })) })] }));
|
|
37391
|
+
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w.id), onMouseOver: () => setVisibleClearButton(true), onMouseLeave: () => setVisibleClearButton(false), className: "absolute z-40 flex align-middle justify-center gap-2 text-sm px-4 py-2 border-blue-300 rounded-sm dark:bg-white w-fit bg-gray-900 text-white dark:text-gray-900 cursor-pointer shadow-md transition-all", style: { top: "12px", right: "0", borderTopLeftRadius: "4px", borderBottomLeftRadius: "4px" }, children: jsxRuntimeExports.jsx(lucideReact.MessageCircleX, { className: "w-5 h-5" }) }), jsxRuntimeExports.jsx("span", { className: `absolute z-50 w-max py-1 text-xs px-2 rounded-sm dark:text-gray-900 dark:bg-white text-white bg-gray-900 ${visibleClearButton ? "block" : "hidden"}`, style: { top: "56px", right: "16px", borderRadius: "3px" }, children: "Clear Chat" })] }), jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl: widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter(widget => widget.type !== 'chatbot').map(widget => widget.id), datasetId: datasetId })] })] }, w.id))) })) })] }));
|
|
37889
37392
|
}
|
|
37890
37393
|
|
|
37891
37394
|
const Checkbox = React__namespace.forwardRef((_a, ref) => {
|