drizzle-cube 0.4.11 → 0.4.13
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/client/index.js +393 -381
- package/dist/client/index.js.map +1 -1
- package/dist/client-bundle-stats.html +1 -1
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { D as J, A as H, e as G, P as X } from "./chunks/components-ClQziOcT.js";
|
|
2
|
-
import { i as He, a as Ge, C as Xe, h as Ye, g as Ze, b as et, j as tt, f as st, d as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import R, { useRef as N, createContext as Z, useContext as ee, useState as
|
|
5
|
-
import { c as te, d as se, e as
|
|
6
|
-
import { a as
|
|
2
|
+
import { i as He, a as Ge, C as Xe, h as Ye, g as Ze, b as et, j as tt, f as st, d as rt, M as at, c as ct, n as nt, T as ot, R as dt, Q as it, O as lt, S as ut, V as mt, I as pt, H as ht, K as ft, W as gt, G as bt, J as yt, X as xt, L as vt, N as Ct, U as kt, Y as Nt, Z as wt, z as St, q as At, x as Dt, t as Tt, s as Mt, w as It, p as Et, v as Bt, o as Lt, r as Rt, y as Pt, u as Qt, k as Ft, l as _t, m as Vt, F as jt, E as qt, B as Ut } from "./chunks/components-ClQziOcT.js";
|
|
3
|
+
import { jsx as r, jsxs as y, Fragment as Y } from "react/jsx-runtime";
|
|
4
|
+
import R, { useRef as N, createContext as Z, useContext as ee, useState as _, useCallback as f, useEffect as P } from "react";
|
|
5
|
+
import { c as te, d as se, e as re, s as ae, f as K } from "./chunks/vendor-AVsJ2ni0.js";
|
|
6
|
+
import { a as V } from "./chunks/icons-DAeqv1iX.js";
|
|
7
7
|
import { D as Ot, h as $t, i as zt, b as Wt, e as Jt, f as Ht, g as Gt, r as Xt, c as Yt, s as Zt } from "./chunks/icons-DAeqv1iX.js";
|
|
8
8
|
import { Q as ce } from "./chunks/chart-markdown-Du4Z2iqK.js";
|
|
9
|
-
import { f as
|
|
10
|
-
import { h as ts, a as ss, S as
|
|
9
|
+
import { f as ne } from "./chunks/providers-CgxXm6Ll.js";
|
|
10
|
+
import { h as ts, a as ss, S as rs, e as as, d as cs, i as ns, b as os, g as ds, u as is, j as ls, c as us, w as ms } from "./chunks/providers-CgxXm6Ll.js";
|
|
11
11
|
import { L as hs, u as fs } from "./chunks/charts-core-DmGfleFz.js";
|
|
12
12
|
import { L as bs, g as ys, c as xs, b as vs, i as Cs, p as ks, a as Ns } from "./chunks/charts-loader-CH0_S06T.js";
|
|
13
|
-
import { E as Ss, a as As, p as Ds, q as Ts, m as Ms, l as Is, r as Es, C as Bs, D as Ls, o as Rs, B as Ps, n as Qs, w as Fs, t as _s, d as Vs, f as js, s as qs, e as Us, i as Ks, c as Os, h as $s, g as zs, u as Ws, b as Js, y as Hs, A as Gs, x as Xs, k as Ys, v as Zs, z as
|
|
14
|
-
import { u as
|
|
15
|
-
import { c as
|
|
16
|
-
import { e as
|
|
17
|
-
import { c as
|
|
18
|
-
import { T as
|
|
19
|
-
import { createExplainQueryKey as
|
|
20
|
-
import { i as
|
|
21
|
-
import { h as
|
|
13
|
+
import { E as Ss, a as As, p as Ds, q as Ts, m as Ms, l as Is, r as Es, C as Bs, D as Ls, o as Rs, B as Ps, n as Qs, w as Fs, t as _s, d as Vs, f as js, s as qs, e as Us, i as Ks, c as Os, h as $s, g as zs, u as Ws, b as Js, y as Hs, A as Gs, x as Xs, k as Ys, v as Zs, z as er, j as tr } from "./chunks/analysis-builder-shared-D56zYeV0.js";
|
|
14
|
+
import { u as rr } from "./chunks/chart-bubble-Bf42A1-B.js";
|
|
15
|
+
import { c as cr, f as nr } from "./chunks/index-CApFCBF9.js";
|
|
16
|
+
import { e as dr, c as ir, l as lr, h as ur, k as mr, j as pr, i as hr, m as fr, g as gr, f as br, u as yr, u as xr, d as vr, b as Cr, a as kr, v as Nr } from "./chunks/useDirtyStateTracking-Cu1HSjmo.js";
|
|
17
|
+
import { c as Sr, b as Ar, f as Dr, g as Tr, a as Mr, i as Ir, t as Er } from "./chunks/funnel-utils-CyonoNeC.js";
|
|
18
|
+
import { T as Lr, c as Rr, g as Pr, a as Qr, i as Fr, r as _r, s as Vr, b as jr, w as qr } from "./chunks/theme-Dp3hFed1.js";
|
|
19
|
+
import { createExplainQueryKey as Kr, useDryRunQueries as Or, useDryRunQuery as $r, useExplainAI as zr, useExplainQuery as Wr, useMultiDryRunQueries as Jr } from "./hooks.js";
|
|
20
|
+
import { i as Gr, a as Xr } from "./chunks/flow-utils-CjQZG5qq.js";
|
|
21
|
+
import { h as Zr } from "./chunks/syntaxHighlighting-BQfjio-i.js";
|
|
22
22
|
const $ = () => ({
|
|
23
23
|
blocks: [],
|
|
24
24
|
messages: [],
|
|
@@ -26,26 +26,26 @@ const $ = () => ({
|
|
|
26
26
|
sessionId: null,
|
|
27
27
|
inputValue: ""
|
|
28
28
|
});
|
|
29
|
-
function
|
|
29
|
+
function oe(e, t) {
|
|
30
30
|
return {
|
|
31
31
|
// Block actions
|
|
32
32
|
addBlock: (s) => e((c) => ({
|
|
33
33
|
blocks: [...c.blocks, s]
|
|
34
34
|
})),
|
|
35
35
|
removeBlock: (s) => e((c) => ({
|
|
36
|
-
blocks: c.blocks.filter((
|
|
36
|
+
blocks: c.blocks.filter((a) => a.id !== s)
|
|
37
37
|
})),
|
|
38
|
-
moveBlock: (s, c) => e((
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
if (c === "up" &&
|
|
42
|
-
if (c === "down" &&
|
|
43
|
-
const
|
|
44
|
-
return [n
|
|
38
|
+
moveBlock: (s, c) => e((a) => {
|
|
39
|
+
const n = a.blocks.findIndex((i) => i.id === s);
|
|
40
|
+
if (n === -1) return {};
|
|
41
|
+
if (c === "up" && n === 0) return {};
|
|
42
|
+
if (c === "down" && n === a.blocks.length - 1) return {};
|
|
43
|
+
const o = [...a.blocks], l = c === "up" ? n - 1 : n + 1;
|
|
44
|
+
return [o[n], o[l]] = [o[l], o[n]], { blocks: o };
|
|
45
45
|
}),
|
|
46
|
-
updateBlock: (s, c) => e((
|
|
47
|
-
blocks:
|
|
48
|
-
(
|
|
46
|
+
updateBlock: (s, c) => e((a) => ({
|
|
47
|
+
blocks: a.blocks.map(
|
|
48
|
+
(n) => n.id === s && n.type === "portlet" ? { ...n, ...c } : n
|
|
49
49
|
)
|
|
50
50
|
})),
|
|
51
51
|
// Chat actions
|
|
@@ -53,30 +53,30 @@ function ne(e, t) {
|
|
|
53
53
|
messages: [...c.messages, s]
|
|
54
54
|
})),
|
|
55
55
|
appendToLastAssistantMessage: (s) => e((c) => {
|
|
56
|
-
const
|
|
57
|
-
return
|
|
58
|
-
...
|
|
59
|
-
content:
|
|
60
|
-
}), { messages:
|
|
56
|
+
const a = [...c.messages], n = a[a.length - 1];
|
|
57
|
+
return n && n.role === "assistant" && (a[a.length - 1] = {
|
|
58
|
+
...n,
|
|
59
|
+
content: n.content + s
|
|
60
|
+
}), { messages: a };
|
|
61
61
|
}),
|
|
62
62
|
setLastAssistantError: (s) => e((c) => {
|
|
63
|
-
const
|
|
64
|
-
return
|
|
63
|
+
const a = [...c.messages], n = a[a.length - 1];
|
|
64
|
+
return n && n.role === "assistant" && (a[a.length - 1] = { ...n, error: s }), { messages: a };
|
|
65
65
|
}),
|
|
66
66
|
addToolCallToLastAssistant: (s) => e((c) => {
|
|
67
|
-
const
|
|
68
|
-
return
|
|
69
|
-
...
|
|
70
|
-
toolCalls: [...
|
|
71
|
-
}), { messages:
|
|
67
|
+
const a = [...c.messages], n = a[a.length - 1];
|
|
68
|
+
return n && n.role === "assistant" && (a[a.length - 1] = {
|
|
69
|
+
...n,
|
|
70
|
+
toolCalls: [...n.toolCalls || [], s]
|
|
71
|
+
}), { messages: a };
|
|
72
72
|
}),
|
|
73
73
|
updateLastToolCall: (s) => e((c) => {
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
77
|
-
l !== -1 && (
|
|
74
|
+
const a = [...c.messages], n = a[a.length - 1];
|
|
75
|
+
if (n?.role === "assistant" && n.toolCalls?.length) {
|
|
76
|
+
const o = [...n.toolCalls], l = s.id ? o.findIndex((i) => i.id === s.id) : o.length - 1;
|
|
77
|
+
l !== -1 && (o[l] = { ...o[l], ...s }, a[a.length - 1] = { ...n, toolCalls: o });
|
|
78
78
|
}
|
|
79
|
-
return { messages:
|
|
79
|
+
return { messages: a };
|
|
80
80
|
}),
|
|
81
81
|
// Session/UI actions
|
|
82
82
|
setIsStreaming: (s) => e({ isStreaming: s }),
|
|
@@ -101,10 +101,10 @@ function ne(e, t) {
|
|
|
101
101
|
function de() {
|
|
102
102
|
const e = $();
|
|
103
103
|
return se()(
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
re(
|
|
105
|
+
ae((t, s) => ({
|
|
106
106
|
...e,
|
|
107
|
-
...
|
|
107
|
+
...oe(t, s)
|
|
108
108
|
})),
|
|
109
109
|
{ name: "NotebookStore" }
|
|
110
110
|
)
|
|
@@ -120,9 +120,9 @@ function ie({
|
|
|
120
120
|
const c = de();
|
|
121
121
|
t && c.getState().load(t), s.current = c;
|
|
122
122
|
}
|
|
123
|
-
return /* @__PURE__ */
|
|
123
|
+
return /* @__PURE__ */ r(z.Provider, { value: s.current, children: e });
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function S(e) {
|
|
126
126
|
const t = ee(z);
|
|
127
127
|
if (!t)
|
|
128
128
|
throw new Error("useNotebookStore must be used within NotebookStoreProvider");
|
|
@@ -146,23 +146,23 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
|
|
|
146
146
|
removeBlock: e.removeBlock,
|
|
147
147
|
moveBlock: e.moveBlock,
|
|
148
148
|
updateBlock: e.updateBlock
|
|
149
|
-
}),
|
|
149
|
+
}), j = { width: "16px", height: "16px", color: "currentColor" }, he = V("chevronUp"), fe = V("chevronDown"), ge = V("edit"), be = V("delete"), ye = R.memo(function({
|
|
150
150
|
block: t,
|
|
151
151
|
onRemove: s,
|
|
152
152
|
onMoveUp: c,
|
|
153
|
-
onMoveDown:
|
|
154
|
-
onEdit:
|
|
155
|
-
isFirst:
|
|
153
|
+
onMoveDown: a,
|
|
154
|
+
onEdit: n,
|
|
155
|
+
isFirst: o,
|
|
156
156
|
isLast: l
|
|
157
157
|
}) {
|
|
158
|
-
const [i,
|
|
159
|
-
|
|
158
|
+
const [i, g] = _(null), b = f((v) => {
|
|
159
|
+
g(v);
|
|
160
160
|
}, []);
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
i && /* @__PURE__ */
|
|
161
|
+
return /* @__PURE__ */ y("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
|
|
162
|
+
/* @__PURE__ */ y("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-3 dc:py-1.5 dc:border-b border-dc-border dc:shrink-0 bg-dc-surface-secondary dc:rounded-t-lg", children: [
|
|
163
|
+
/* @__PURE__ */ y("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
|
|
164
|
+
/* @__PURE__ */ r("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: t.title || "Untitled" }),
|
|
165
|
+
i && /* @__PURE__ */ r(
|
|
166
166
|
J,
|
|
167
167
|
{
|
|
168
168
|
chartConfig: i.chartConfig,
|
|
@@ -174,46 +174,46 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
|
|
|
174
174
|
}
|
|
175
175
|
)
|
|
176
176
|
] }),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
!
|
|
177
|
+
/* @__PURE__ */ y("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
|
|
178
|
+
!o && /* @__PURE__ */ r(
|
|
179
179
|
"button",
|
|
180
180
|
{
|
|
181
181
|
onClick: () => c(t.id),
|
|
182
182
|
className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
|
|
183
183
|
title: "Move up",
|
|
184
|
-
children: /* @__PURE__ */
|
|
184
|
+
children: /* @__PURE__ */ r(he, { style: j })
|
|
185
185
|
}
|
|
186
186
|
),
|
|
187
|
-
!l && /* @__PURE__ */
|
|
187
|
+
!l && /* @__PURE__ */ r(
|
|
188
188
|
"button",
|
|
189
189
|
{
|
|
190
|
-
onClick: () =>
|
|
190
|
+
onClick: () => a(t.id),
|
|
191
191
|
className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
|
|
192
192
|
title: "Move down",
|
|
193
|
-
children: /* @__PURE__ */
|
|
193
|
+
children: /* @__PURE__ */ r(fe, { style: j })
|
|
194
194
|
}
|
|
195
195
|
),
|
|
196
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ r(
|
|
197
197
|
"button",
|
|
198
198
|
{
|
|
199
|
-
onClick: () =>
|
|
199
|
+
onClick: () => n(t),
|
|
200
200
|
className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
|
|
201
201
|
title: "Edit visualization",
|
|
202
|
-
children: /* @__PURE__ */
|
|
202
|
+
children: /* @__PURE__ */ r(ge, { style: j })
|
|
203
203
|
}
|
|
204
204
|
),
|
|
205
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ r(
|
|
206
206
|
"button",
|
|
207
207
|
{
|
|
208
208
|
onClick: () => s(t.id),
|
|
209
209
|
className: "dc:p-1 dc:mr-0.5 dc:bg-transparent dc:border-none dc:rounded-sm dc:cursor-pointer dc:hover:bg-dc-danger-bg text-dc-danger dc:transition-colors",
|
|
210
210
|
title: "Remove",
|
|
211
|
-
children: /* @__PURE__ */
|
|
211
|
+
children: /* @__PURE__ */ r(be, { style: j })
|
|
212
212
|
}
|
|
213
213
|
)
|
|
214
214
|
] })
|
|
215
215
|
] }),
|
|
216
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ r("div", { className: "dc:flex-1 dc:min-h-0", children: /* @__PURE__ */ r(
|
|
217
217
|
H,
|
|
218
218
|
{
|
|
219
219
|
query: t.query,
|
|
@@ -222,7 +222,7 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
|
|
|
222
222
|
displayConfig: t.displayConfig,
|
|
223
223
|
height: 400,
|
|
224
224
|
eagerLoad: !0,
|
|
225
|
-
onDebugDataReady:
|
|
225
|
+
onDebugDataReady: b
|
|
226
226
|
}
|
|
227
227
|
) })
|
|
228
228
|
] });
|
|
@@ -251,13 +251,13 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
|
|
|
251
251
|
block: t,
|
|
252
252
|
onRemove: s,
|
|
253
253
|
onMoveUp: c,
|
|
254
|
-
onMoveDown:
|
|
255
|
-
isFirst:
|
|
256
|
-
isLast:
|
|
254
|
+
onMoveDown: a,
|
|
255
|
+
isFirst: n,
|
|
256
|
+
isLast: o
|
|
257
257
|
}) {
|
|
258
|
-
return /* @__PURE__ */
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
!
|
|
258
|
+
return /* @__PURE__ */ y("div", { className: "dc:group dc:relative dc:mb-4", children: [
|
|
259
|
+
/* @__PURE__ */ y("div", { className: "dc:absolute dc:right-2 dc:top-2 dc:z-10 dc:flex dc:gap-1 dc:opacity-0 dc:group-hover:opacity-100 dc:transition-opacity", children: [
|
|
260
|
+
!n && /* @__PURE__ */ r(
|
|
261
261
|
"button",
|
|
262
262
|
{
|
|
263
263
|
onClick: () => c(t.id),
|
|
@@ -266,16 +266,16 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
|
|
|
266
266
|
children: "▲"
|
|
267
267
|
}
|
|
268
268
|
),
|
|
269
|
-
!
|
|
269
|
+
!o && /* @__PURE__ */ r(
|
|
270
270
|
"button",
|
|
271
271
|
{
|
|
272
|
-
onClick: () =>
|
|
272
|
+
onClick: () => a(t.id),
|
|
273
273
|
className: "dc:p-1 dc:rounded dc:text-xs bg-dc-surface text-dc-text-secondary dc:hover:opacity-80 border-dc-border dc:border",
|
|
274
274
|
title: "Move down",
|
|
275
275
|
children: "▼"
|
|
276
276
|
}
|
|
277
277
|
),
|
|
278
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ r(
|
|
279
279
|
"button",
|
|
280
280
|
{
|
|
281
281
|
onClick: () => s(t.id),
|
|
@@ -285,74 +285,74 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
|
|
|
285
285
|
}
|
|
286
286
|
)
|
|
287
287
|
] }),
|
|
288
|
-
t.title && /* @__PURE__ */
|
|
289
|
-
/* @__PURE__ */
|
|
288
|
+
t.title && /* @__PURE__ */ r("h4", { className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2 dc:px-1", children: t.title }),
|
|
289
|
+
/* @__PURE__ */ r("div", { className: "dc:rounded-lg dc:p-4 bg-dc-surface border-dc-border dc:border", children: /* @__PURE__ */ r(ce, { options: xe, children: t.content }) })
|
|
290
290
|
] });
|
|
291
291
|
}), Ce = R.memo(function() {
|
|
292
|
-
const t =
|
|
293
|
-
|
|
294
|
-
t.length > i.current &&
|
|
292
|
+
const t = S(le), { removeBlock: s, moveBlock: c, updateBlock: a } = S(K(pe)), n = N(null), [o, l] = _(null), i = N(t.length);
|
|
293
|
+
P(() => {
|
|
294
|
+
t.length > i.current && n.current?.scrollIntoView({ behavior: "smooth" }), i.current = t.length;
|
|
295
295
|
}, [t.length]);
|
|
296
|
-
const
|
|
297
|
-
if (!
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
300
|
-
const
|
|
301
|
-
|
|
296
|
+
const g = f((d) => s(d), [s]), b = f((d) => c(d, "up"), [c]), v = f((d) => c(d, "down"), [c]), m = f((d) => l(d), []), A = f((d) => {
|
|
297
|
+
if (!o) return;
|
|
298
|
+
const C = G(d), { analysisConfig: x } = C;
|
|
299
|
+
if (x) {
|
|
300
|
+
const k = x.charts[x.analysisType];
|
|
301
|
+
a(o.id, {
|
|
302
302
|
title: d.title,
|
|
303
|
-
query: JSON.stringify(
|
|
304
|
-
chartType:
|
|
305
|
-
chartConfig:
|
|
306
|
-
displayConfig:
|
|
303
|
+
query: JSON.stringify(x.query),
|
|
304
|
+
chartType: k?.chartType || "bar",
|
|
305
|
+
chartConfig: k?.chartConfig,
|
|
306
|
+
displayConfig: k?.displayConfig
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
l(null);
|
|
310
|
-
}, [
|
|
311
|
-
return t.length === 0 ? /* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
] }) }) : /* @__PURE__ */
|
|
315
|
-
t.map((d,
|
|
316
|
-
const
|
|
317
|
-
return d.type === "portlet" ? /* @__PURE__ */
|
|
310
|
+
}, [o, a]);
|
|
311
|
+
return t.length === 0 ? /* @__PURE__ */ r("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ y("div", { className: "dc:text-center dc:max-w-sm dc:px-6", children: [
|
|
312
|
+
/* @__PURE__ */ r("h3", { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2", children: "Your notebook is empty" }),
|
|
313
|
+
/* @__PURE__ */ r("p", { className: "dc:text-sm text-dc-text-secondary", children: "Ask the AI assistant a question about your data. Charts and insights will appear here as the assistant analyzes your data." })
|
|
314
|
+
] }) }) : /* @__PURE__ */ y("div", { className: "dc:h-full dc:overflow-y-auto dc:p-4", children: [
|
|
315
|
+
t.map((d, C) => {
|
|
316
|
+
const x = C === 0, k = C === t.length - 1;
|
|
317
|
+
return d.type === "portlet" ? /* @__PURE__ */ r(
|
|
318
318
|
ye,
|
|
319
319
|
{
|
|
320
320
|
block: d,
|
|
321
|
-
onRemove:
|
|
322
|
-
onMoveUp:
|
|
323
|
-
onMoveDown:
|
|
321
|
+
onRemove: g,
|
|
322
|
+
onMoveUp: b,
|
|
323
|
+
onMoveDown: v,
|
|
324
324
|
onEdit: m,
|
|
325
|
-
isFirst:
|
|
326
|
-
isLast:
|
|
325
|
+
isFirst: x,
|
|
326
|
+
isLast: k
|
|
327
327
|
},
|
|
328
328
|
d.id
|
|
329
|
-
) : d.type === "markdown" ? /* @__PURE__ */
|
|
329
|
+
) : d.type === "markdown" ? /* @__PURE__ */ r(
|
|
330
330
|
ve,
|
|
331
331
|
{
|
|
332
332
|
block: d,
|
|
333
|
-
onRemove:
|
|
334
|
-
onMoveUp:
|
|
335
|
-
onMoveDown:
|
|
336
|
-
isFirst:
|
|
337
|
-
isLast:
|
|
333
|
+
onRemove: g,
|
|
334
|
+
onMoveUp: b,
|
|
335
|
+
onMoveDown: v,
|
|
336
|
+
isFirst: x,
|
|
337
|
+
isLast: k
|
|
338
338
|
},
|
|
339
339
|
d.id
|
|
340
340
|
) : null;
|
|
341
341
|
}),
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ r("div", { ref: n }),
|
|
343
|
+
/* @__PURE__ */ r(
|
|
344
344
|
X,
|
|
345
345
|
{
|
|
346
|
-
isOpen: !!
|
|
346
|
+
isOpen: !!o,
|
|
347
347
|
onClose: () => l(null),
|
|
348
|
-
onSave:
|
|
349
|
-
portlet:
|
|
350
|
-
id:
|
|
351
|
-
title:
|
|
352
|
-
query:
|
|
353
|
-
chartType:
|
|
354
|
-
chartConfig:
|
|
355
|
-
displayConfig:
|
|
348
|
+
onSave: A,
|
|
349
|
+
portlet: o ? {
|
|
350
|
+
id: o.id,
|
|
351
|
+
title: o.title,
|
|
352
|
+
query: o.query,
|
|
353
|
+
chartType: o.chartType,
|
|
354
|
+
chartConfig: o.chartConfig,
|
|
355
|
+
displayConfig: o.displayConfig,
|
|
356
356
|
w: 5,
|
|
357
357
|
h: 4,
|
|
358
358
|
x: 0,
|
|
@@ -388,21 +388,21 @@ function Ne(e) {
|
|
|
388
388
|
agentEndpoint: t,
|
|
389
389
|
agentApiKey: s,
|
|
390
390
|
onAddPortlet: c,
|
|
391
|
-
onAddMarkdown:
|
|
392
|
-
onTextDelta:
|
|
393
|
-
onToolStart:
|
|
391
|
+
onAddMarkdown: a,
|
|
392
|
+
onTextDelta: n,
|
|
393
|
+
onToolStart: o,
|
|
394
394
|
onToolResult: l,
|
|
395
395
|
onTurnComplete: i,
|
|
396
|
-
onDone:
|
|
397
|
-
onError:
|
|
398
|
-
} = e, { cubeApi:
|
|
399
|
-
function
|
|
396
|
+
onDone: g,
|
|
397
|
+
onError: b
|
|
398
|
+
} = e, { cubeApi: v } = ne(), m = N(null), [A, d] = _(!1), C = f(async (k, D) => {
|
|
399
|
+
function I(h) {
|
|
400
400
|
switch (h.type) {
|
|
401
401
|
case "text_delta":
|
|
402
|
-
|
|
402
|
+
n(h.data);
|
|
403
403
|
break;
|
|
404
404
|
case "tool_use_start":
|
|
405
|
-
|
|
405
|
+
o(h.data.id, h.data.name, h.data.input);
|
|
406
406
|
break;
|
|
407
407
|
case "tool_use_result":
|
|
408
408
|
l(h.data.id, h.data.name, h.data.result, h.data.isError);
|
|
@@ -414,7 +414,7 @@ function Ne(e) {
|
|
|
414
414
|
});
|
|
415
415
|
break;
|
|
416
416
|
case "add_markdown":
|
|
417
|
-
|
|
417
|
+
a({
|
|
418
418
|
...h.data,
|
|
419
419
|
type: "markdown"
|
|
420
420
|
});
|
|
@@ -423,56 +423,56 @@ function Ne(e) {
|
|
|
423
423
|
i?.();
|
|
424
424
|
break;
|
|
425
425
|
case "done":
|
|
426
|
-
|
|
426
|
+
g(h.data.sessionId);
|
|
427
427
|
break;
|
|
428
428
|
case "error":
|
|
429
|
-
|
|
429
|
+
b(h.data.message);
|
|
430
430
|
break;
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
m.current && m.current.abort();
|
|
434
|
-
const
|
|
435
|
-
m.current =
|
|
434
|
+
const p = new AbortController();
|
|
435
|
+
m.current = p, d(!0);
|
|
436
436
|
try {
|
|
437
|
-
const h =
|
|
437
|
+
const h = v.apiUrl || "/cubejs-api/v1", T = t || `${h}/agent/chat`, M = {
|
|
438
438
|
"Content-Type": "application/json",
|
|
439
|
-
...
|
|
439
|
+
...v.headers
|
|
440
440
|
};
|
|
441
|
-
s && (
|
|
442
|
-
const
|
|
441
|
+
s && (M["X-Agent-Api-Key"] = s);
|
|
442
|
+
const w = await fetch(T, {
|
|
443
443
|
method: "POST",
|
|
444
|
-
headers:
|
|
445
|
-
credentials:
|
|
444
|
+
headers: M,
|
|
445
|
+
credentials: v.credentials ?? "include",
|
|
446
446
|
body: JSON.stringify({
|
|
447
|
-
message:
|
|
448
|
-
...
|
|
447
|
+
message: k,
|
|
448
|
+
...D ? { sessionId: D } : {}
|
|
449
449
|
}),
|
|
450
|
-
signal:
|
|
450
|
+
signal: p.signal
|
|
451
451
|
});
|
|
452
|
-
if (!
|
|
453
|
-
const B = await
|
|
454
|
-
throw new Error(B.error || `Agent request failed: ${
|
|
452
|
+
if (!w.ok) {
|
|
453
|
+
const B = await w.json().catch(() => ({}));
|
|
454
|
+
throw new Error(B.error || `Agent request failed: ${w.status}`);
|
|
455
455
|
}
|
|
456
|
-
if (!
|
|
456
|
+
if (!w.body)
|
|
457
457
|
throw new Error("No response body received");
|
|
458
|
-
const
|
|
458
|
+
const Q = w.body.getReader(), q = new TextDecoder();
|
|
459
459
|
let E = "";
|
|
460
460
|
for (; ; ) {
|
|
461
|
-
const { done: B, value: u } = await
|
|
461
|
+
const { done: B, value: u } = await Q.read();
|
|
462
462
|
if (B) break;
|
|
463
463
|
E += q.decode(u, { stream: !0 });
|
|
464
464
|
const L = E.split(`
|
|
465
465
|
|
|
466
466
|
`);
|
|
467
467
|
E = L.pop() || "";
|
|
468
|
-
for (const
|
|
469
|
-
const U =
|
|
468
|
+
for (const F of L) {
|
|
469
|
+
const U = F.trim().split(`
|
|
470
470
|
`);
|
|
471
471
|
for (const O of U)
|
|
472
472
|
if (O.startsWith("data: "))
|
|
473
473
|
try {
|
|
474
474
|
const W = JSON.parse(O.slice(6));
|
|
475
|
-
|
|
475
|
+
I(W);
|
|
476
476
|
} catch {
|
|
477
477
|
}
|
|
478
478
|
}
|
|
@@ -484,46 +484,46 @@ function Ne(e) {
|
|
|
484
484
|
if (u.startsWith("data: "))
|
|
485
485
|
try {
|
|
486
486
|
const L = JSON.parse(u.slice(6));
|
|
487
|
-
|
|
487
|
+
I(L);
|
|
488
488
|
} catch {
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
} catch (h) {
|
|
492
492
|
if (h.name !== "AbortError") {
|
|
493
|
-
const
|
|
494
|
-
|
|
493
|
+
const T = h instanceof Error ? h.message : "Stream failed";
|
|
494
|
+
b(ke(T));
|
|
495
495
|
}
|
|
496
496
|
} finally {
|
|
497
497
|
d(!1), m.current = null;
|
|
498
498
|
}
|
|
499
|
-
}, [
|
|
499
|
+
}, [v, t, s, c, a, n, o, l, i, g, b]), x = f(() => {
|
|
500
500
|
m.current && (m.current.abort(), m.current = null, d(!1));
|
|
501
501
|
}, []);
|
|
502
502
|
return {
|
|
503
|
-
sendMessage:
|
|
504
|
-
isStreaming:
|
|
505
|
-
abort:
|
|
503
|
+
sendMessage: C,
|
|
504
|
+
isStreaming: A,
|
|
505
|
+
abort: x
|
|
506
506
|
};
|
|
507
507
|
}
|
|
508
508
|
function we(e) {
|
|
509
509
|
const t = [];
|
|
510
510
|
let s = e, c = 0;
|
|
511
511
|
for (; s; ) {
|
|
512
|
-
const
|
|
513
|
-
if (
|
|
514
|
-
const [,
|
|
515
|
-
|
|
516
|
-
/* @__PURE__ */
|
|
512
|
+
const a = s.match(/^(.*?)`([^`]+)`(.*)$/);
|
|
513
|
+
if (a) {
|
|
514
|
+
const [, o, l, i] = a;
|
|
515
|
+
o && t.push(/* @__PURE__ */ r("span", { children: o }, c++)), t.push(
|
|
516
|
+
/* @__PURE__ */ r("code", { className: "dc:px-1 dc:py-0.5 dc:rounded dc:text-xs bg-dc-surface dc:font-mono", children: l }, c++)
|
|
517
517
|
), s = i;
|
|
518
518
|
continue;
|
|
519
519
|
}
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
const [,
|
|
523
|
-
|
|
520
|
+
const n = s.match(/^(.*?)\*\*([^*]+)\*\*(.*)$/);
|
|
521
|
+
if (n) {
|
|
522
|
+
const [, o, l, i] = n;
|
|
523
|
+
o && t.push(/* @__PURE__ */ r("span", { children: o }, c++)), t.push(/* @__PURE__ */ r("strong", { className: "dc:font-semibold", children: l }, c++)), s = i;
|
|
524
524
|
continue;
|
|
525
525
|
}
|
|
526
|
-
t.push(/* @__PURE__ */
|
|
526
|
+
t.push(/* @__PURE__ */ r("span", { children: s }, c));
|
|
527
527
|
break;
|
|
528
528
|
}
|
|
529
529
|
return t;
|
|
@@ -536,39 +536,39 @@ const Se = {
|
|
|
536
536
|
add_markdown: "Adding explanation"
|
|
537
537
|
};
|
|
538
538
|
function Ae({ toolCall: e }) {
|
|
539
|
-
const [t, s] =
|
|
540
|
-
return /* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
539
|
+
const [t, s] = _(!1), c = Se[e.name] || e.name, a = e.status === "running";
|
|
540
|
+
return /* @__PURE__ */ y("div", { className: "dc:my-1 dc:text-xs", children: [
|
|
541
|
+
/* @__PURE__ */ y(
|
|
542
542
|
"button",
|
|
543
543
|
{
|
|
544
544
|
onClick: () => s(!t),
|
|
545
545
|
className: "dc:flex dc:items-center dc:gap-1.5 text-dc-text-secondary dc:hover:opacity-80 dc:transition-opacity",
|
|
546
546
|
children: [
|
|
547
|
-
|
|
548
|
-
/* @__PURE__ */
|
|
547
|
+
a ? /* @__PURE__ */ r("span", { className: "dc:inline-block dc:w-3 dc:h-3 dc:border-2 border-dc-accent dc:border-t-transparent dc:rounded-full dc:animate-spin" }) : /* @__PURE__ */ r("span", { className: "dc:text-xs", children: e.status === "error" ? "✗" : "✓" }),
|
|
548
|
+
/* @__PURE__ */ y("span", { children: [
|
|
549
549
|
c,
|
|
550
|
-
|
|
550
|
+
a ? "..." : ""
|
|
551
551
|
] }),
|
|
552
|
-
!
|
|
552
|
+
!a && /* @__PURE__ */ r("span", { className: "dc:text-[10px] dc:opacity-60", children: t ? "▲" : "▼" })
|
|
553
553
|
]
|
|
554
554
|
}
|
|
555
555
|
),
|
|
556
|
-
t && e.result != null && /* @__PURE__ */
|
|
556
|
+
t && e.result != null && /* @__PURE__ */ r("pre", { className: "dc:mt-1 dc:p-2 dc:rounded dc:text-[11px] dc:overflow-x-auto dc:max-h-32 dc:overflow-y-auto bg-dc-surface-secondary text-dc-text-secondary", children: typeof e.result == "string" ? e.result : JSON.stringify(e.result, null, 2) })
|
|
557
557
|
] });
|
|
558
558
|
}
|
|
559
559
|
const De = R.memo(function({ message: t }) {
|
|
560
|
-
const s = t.role === "user", c = !!t.content?.trim(),
|
|
561
|
-
return !s && !c && !
|
|
560
|
+
const s = t.role === "user", c = !!t.content?.trim(), a = !!t.error, n = t.toolCalls && t.toolCalls.length > 0;
|
|
561
|
+
return !s && !c && !a && !n ? null : /* @__PURE__ */ r("div", { className: `dc:flex dc:mb-3 ${s ? "dc:justify-end" : "dc:justify-start"}`, children: /* @__PURE__ */ y(
|
|
562
562
|
"div",
|
|
563
563
|
{
|
|
564
|
-
className: `dc:max-w-[85%] dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm ${s ? "bg-dc-accent text-dc-accent-text dc:rounded-br-sm" :
|
|
564
|
+
className: `dc:max-w-[85%] dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm ${s ? "bg-dc-accent text-dc-accent-text dc:rounded-br-sm" : a && !c ? "bg-dc-warning-bg text-dc-text dc:rounded-bl-sm" : "bg-dc-surface-secondary text-dc-text dc:rounded-bl-sm"}`,
|
|
565
565
|
children: [
|
|
566
|
-
c && /* @__PURE__ */
|
|
567
|
-
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
/* @__PURE__ */
|
|
566
|
+
c && /* @__PURE__ */ r("div", { className: "dc:whitespace-pre-wrap dc:break-words", children: s ? t.content : we(t.content) }),
|
|
567
|
+
a && /* @__PURE__ */ y("div", { className: `dc:flex dc:items-start dc:gap-2 ${c ? "dc:mt-2 dc:pt-2 dc:border-t dc:border-current dc:border-opacity-10" : ""}`, children: [
|
|
568
|
+
/* @__PURE__ */ r("span", { className: "dc:text-base dc:leading-none dc:mt-0.5 text-dc-warning dc:flex-shrink-0", children: "⚠" }),
|
|
569
|
+
/* @__PURE__ */ r("span", { className: "text-dc-text-secondary", children: t.error })
|
|
570
570
|
] }),
|
|
571
|
-
|
|
571
|
+
n && /* @__PURE__ */ r("div", { className: c || a ? "dc:mt-1 dc:border-t dc:border-current dc:border-opacity-10 dc:pt-1" : "", children: t.toolCalls.map((o, l) => /* @__PURE__ */ r(Ae, { toolCall: o }, o.id || l)) })
|
|
572
572
|
]
|
|
573
573
|
}
|
|
574
574
|
) });
|
|
@@ -576,57 +576,57 @@ const De = R.memo(function({ message: t }) {
|
|
|
576
576
|
value: t,
|
|
577
577
|
onChange: s,
|
|
578
578
|
onSend: c,
|
|
579
|
-
onStop:
|
|
580
|
-
onContinue:
|
|
581
|
-
isStreaming:
|
|
579
|
+
onStop: a,
|
|
580
|
+
onContinue: n,
|
|
581
|
+
isStreaming: o = !1,
|
|
582
582
|
showContinue: l = !1,
|
|
583
583
|
disabled: i = !1,
|
|
584
|
-
placeholder:
|
|
584
|
+
placeholder: g = "Ask about your data..."
|
|
585
585
|
}) {
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
const m =
|
|
586
|
+
const b = N(null);
|
|
587
|
+
P(() => {
|
|
588
|
+
const m = b.current;
|
|
589
589
|
m && (m.style.height = "auto", m.style.height = `${Math.min(m.scrollHeight, 150)}px`);
|
|
590
590
|
}, [t]);
|
|
591
|
-
const
|
|
591
|
+
const v = f(
|
|
592
592
|
(m) => {
|
|
593
593
|
m.key === "Enter" && !m.shiftKey && (m.preventDefault(), !i && t.trim() && c());
|
|
594
594
|
},
|
|
595
595
|
[i, t, c]
|
|
596
596
|
);
|
|
597
|
-
return /* @__PURE__ */
|
|
598
|
-
/* @__PURE__ */
|
|
597
|
+
return /* @__PURE__ */ y("div", { className: "dc:flex dc:gap-2 dc:items-end dc:p-3 border-dc-border dc:border-t", children: [
|
|
598
|
+
/* @__PURE__ */ r(
|
|
599
599
|
"textarea",
|
|
600
600
|
{
|
|
601
|
-
ref:
|
|
601
|
+
ref: b,
|
|
602
602
|
value: t,
|
|
603
603
|
onChange: (m) => s(m.target.value),
|
|
604
|
-
onKeyDown:
|
|
605
|
-
placeholder:
|
|
604
|
+
onKeyDown: v,
|
|
605
|
+
placeholder: g,
|
|
606
606
|
disabled: i,
|
|
607
607
|
rows: 1,
|
|
608
608
|
className: "dc:flex-1 dc:resize-none dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm bg-dc-surface-secondary text-dc-text border-dc-border dc:border dc:outline-none dc:focus:ring-1 focus:ring-dc-accent dc:disabled:opacity-50"
|
|
609
609
|
}
|
|
610
610
|
),
|
|
611
|
-
|
|
611
|
+
o ? /* @__PURE__ */ r(
|
|
612
612
|
"button",
|
|
613
613
|
{
|
|
614
|
-
onClick:
|
|
614
|
+
onClick: a,
|
|
615
615
|
className: "dc:px-4 dc:py-2 dc:rounded-lg dc:text-sm dc:font-medium dc:transition-colors text-dc-error border-dc-border dc:border dc:hover:opacity-80 dc:shrink-0",
|
|
616
616
|
children: "Stop"
|
|
617
617
|
}
|
|
618
|
-
) : /* @__PURE__ */
|
|
619
|
-
l && !t.trim() && /* @__PURE__ */
|
|
618
|
+
) : /* @__PURE__ */ y(Y, { children: [
|
|
619
|
+
l && !t.trim() && /* @__PURE__ */ r(
|
|
620
620
|
"button",
|
|
621
621
|
{
|
|
622
622
|
onClick: () => {
|
|
623
|
-
|
|
623
|
+
n?.(), b.current?.focus();
|
|
624
624
|
},
|
|
625
625
|
className: "dc:px-4 dc:py-2 dc:rounded-lg dc:text-sm dc:font-medium dc:transition-colors border-dc-border dc:border text-dc-text-secondary dc:hover:opacity-80 dc:shrink-0",
|
|
626
626
|
children: "Continue"
|
|
627
627
|
}
|
|
628
628
|
),
|
|
629
|
-
/* @__PURE__ */
|
|
629
|
+
/* @__PURE__ */ r(
|
|
630
630
|
"button",
|
|
631
631
|
{
|
|
632
632
|
onClick: c,
|
|
@@ -642,80 +642,80 @@ const De = R.memo(function({ message: t }) {
|
|
|
642
642
|
agentApiKey: s,
|
|
643
643
|
onClear: c
|
|
644
644
|
}) {
|
|
645
|
-
const
|
|
646
|
-
addMessage:
|
|
647
|
-
appendToLastAssistantMessage:
|
|
648
|
-
setLastAssistantError:
|
|
645
|
+
const a = N(null), n = N(!1), { messages: o, isStreaming: l, inputValue: i } = S(K(ue)), {
|
|
646
|
+
addMessage: g,
|
|
647
|
+
appendToLastAssistantMessage: b,
|
|
648
|
+
setLastAssistantError: v,
|
|
649
649
|
addToolCallToLastAssistant: m,
|
|
650
|
-
updateLastToolCall:
|
|
650
|
+
updateLastToolCall: A,
|
|
651
651
|
setIsStreaming: d,
|
|
652
|
-
setInputValue:
|
|
653
|
-
setSessionId:
|
|
654
|
-
} =
|
|
655
|
-
|
|
652
|
+
setInputValue: C,
|
|
653
|
+
setSessionId: x
|
|
654
|
+
} = S(K(me)), k = S((u) => u.sessionId), D = S((u) => u.addBlock), I = S((u) => u.reset), p = f(() => {
|
|
655
|
+
n.current && (n.current = !1, g({
|
|
656
656
|
id: `msg-${Date.now()}`,
|
|
657
657
|
role: "assistant",
|
|
658
658
|
content: "",
|
|
659
659
|
toolCalls: [],
|
|
660
660
|
timestamp: Date.now()
|
|
661
661
|
}));
|
|
662
|
-
}, [
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}, [
|
|
666
|
-
const { sendMessage:
|
|
662
|
+
}, [g]), h = N(o.length);
|
|
663
|
+
P(() => {
|
|
664
|
+
o.length > h.current && a.current?.scrollIntoView({ behavior: "smooth" }), h.current = o.length;
|
|
665
|
+
}, [o]);
|
|
666
|
+
const { sendMessage: T, abort: M } = Ne({
|
|
667
667
|
agentEndpoint: t,
|
|
668
668
|
agentApiKey: s,
|
|
669
|
-
onTextDelta:
|
|
670
|
-
|
|
671
|
-
}, [
|
|
672
|
-
onToolStart:
|
|
673
|
-
|
|
674
|
-
}, [
|
|
675
|
-
onToolResult:
|
|
676
|
-
|
|
677
|
-
}, [
|
|
678
|
-
onAddPortlet:
|
|
679
|
-
|
|
680
|
-
}, [
|
|
681
|
-
onAddMarkdown:
|
|
682
|
-
|
|
683
|
-
}, [
|
|
684
|
-
onTurnComplete:
|
|
685
|
-
|
|
669
|
+
onTextDelta: f((u) => {
|
|
670
|
+
p(), b(u);
|
|
671
|
+
}, [p, b]),
|
|
672
|
+
onToolStart: f((u, L, F) => {
|
|
673
|
+
p(), m({ id: u, name: L, input: F, status: "running" });
|
|
674
|
+
}, [p, m]),
|
|
675
|
+
onToolResult: f((u, L, F, U) => {
|
|
676
|
+
A({ id: u, status: U ? "error" : "complete", result: F });
|
|
677
|
+
}, [A]),
|
|
678
|
+
onAddPortlet: f((u) => {
|
|
679
|
+
D(u);
|
|
680
|
+
}, [D]),
|
|
681
|
+
onAddMarkdown: f((u) => {
|
|
682
|
+
D(u);
|
|
683
|
+
}, [D]),
|
|
684
|
+
onTurnComplete: f(() => {
|
|
685
|
+
n.current = !0;
|
|
686
686
|
}, []),
|
|
687
|
-
onDone:
|
|
688
|
-
|
|
689
|
-
}, [
|
|
690
|
-
onError:
|
|
691
|
-
|
|
692
|
-
}, [
|
|
693
|
-
}),
|
|
694
|
-
!u || l || (
|
|
687
|
+
onDone: f((u) => {
|
|
688
|
+
n.current = !1, x(u), d(!1);
|
|
689
|
+
}, [x, d]),
|
|
690
|
+
onError: f((u) => {
|
|
691
|
+
p(), v(u), d(!1);
|
|
692
|
+
}, [p, v, d])
|
|
693
|
+
}), w = f((u) => {
|
|
694
|
+
!u || l || (n.current = !1, g({
|
|
695
695
|
id: `msg-${Date.now()}`,
|
|
696
696
|
role: "user",
|
|
697
697
|
content: u,
|
|
698
698
|
timestamp: Date.now()
|
|
699
|
-
}),
|
|
699
|
+
}), g({
|
|
700
700
|
id: `msg-${Date.now() + 1}`,
|
|
701
701
|
role: "assistant",
|
|
702
702
|
content: "",
|
|
703
703
|
toolCalls: [],
|
|
704
704
|
timestamp: Date.now()
|
|
705
|
-
}),
|
|
706
|
-
}, [l,
|
|
707
|
-
|
|
708
|
-
}, [i,
|
|
709
|
-
|
|
710
|
-
}, [
|
|
711
|
-
|
|
712
|
-
}, [
|
|
713
|
-
|
|
714
|
-
}, [
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
|
|
705
|
+
}), C(""), d(!0), T(u, k));
|
|
706
|
+
}, [l, g, C, d, T, k]), Q = f(() => {
|
|
707
|
+
w(i.trim());
|
|
708
|
+
}, [i, w]), q = f(() => {
|
|
709
|
+
M(), d(!1);
|
|
710
|
+
}, [M, d]), E = f(() => {
|
|
711
|
+
C("");
|
|
712
|
+
}, [C]), B = f(() => {
|
|
713
|
+
M(), d(!1), I(), c?.();
|
|
714
|
+
}, [M, d, I, c]);
|
|
715
|
+
return /* @__PURE__ */ y("div", { className: "dc:flex dc:flex-col dc:h-full bg-dc-surface", children: [
|
|
716
|
+
/* @__PURE__ */ y("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-4 dc:py-3 border-dc-border dc:border-b", children: [
|
|
717
|
+
/* @__PURE__ */ r("h3", { className: "dc:text-sm dc:font-semibold text-dc-text", children: "AI Assistant" }),
|
|
718
|
+
o.length > 0 && /* @__PURE__ */ r(
|
|
719
719
|
"button",
|
|
720
720
|
{
|
|
721
721
|
onClick: B,
|
|
@@ -726,32 +726,32 @@ const De = R.memo(function({ message: t }) {
|
|
|
726
726
|
}
|
|
727
727
|
)
|
|
728
728
|
] }),
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
|
|
731
|
-
/* @__PURE__ */
|
|
729
|
+
/* @__PURE__ */ y("div", { className: "dc:flex-1 dc:overflow-y-auto dc:px-4 dc:py-3", children: [
|
|
730
|
+
o.length === 0 ? /* @__PURE__ */ r(Ie, {}) : o.map((u) => /* @__PURE__ */ r(De, { message: u }, u.id)),
|
|
731
|
+
/* @__PURE__ */ r("div", { ref: a })
|
|
732
732
|
] }),
|
|
733
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ r(
|
|
734
734
|
Te,
|
|
735
735
|
{
|
|
736
736
|
value: i,
|
|
737
|
-
onChange:
|
|
738
|
-
onSend:
|
|
737
|
+
onChange: C,
|
|
738
|
+
onSend: Q,
|
|
739
739
|
onStop: q,
|
|
740
740
|
onContinue: E,
|
|
741
741
|
isStreaming: l,
|
|
742
|
-
showContinue: !l &&
|
|
742
|
+
showContinue: !l && o.length > 0
|
|
743
743
|
}
|
|
744
744
|
)
|
|
745
745
|
] });
|
|
746
746
|
});
|
|
747
747
|
function Ie() {
|
|
748
|
-
return /* @__PURE__ */
|
|
749
|
-
/* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
/* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ r("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ y("div", { className: "dc:text-center dc:max-w-xs", children: [
|
|
749
|
+
/* @__PURE__ */ r("div", { className: "dc:text-lg dc:font-semibold text-dc-text dc:mb-2", children: "Data Analysis Assistant" }),
|
|
750
|
+
/* @__PURE__ */ r("p", { className: "dc:text-sm text-dc-text-secondary dc:mb-4", children: "Ask me about your data and I'll create visualizations and insights." }),
|
|
751
|
+
/* @__PURE__ */ y("div", { className: "dc:space-y-2 dc:text-xs text-dc-text-muted", children: [
|
|
752
|
+
/* @__PURE__ */ r("p", { children: '"Show me employee productivity trends"' }),
|
|
753
|
+
/* @__PURE__ */ r("p", { children: '"What are the top departments by headcount?"' }),
|
|
754
|
+
/* @__PURE__ */ r("p", { children: '"Compare revenue across product categories"' })
|
|
755
755
|
] })
|
|
756
756
|
] }) });
|
|
757
757
|
}
|
|
@@ -760,70 +760,82 @@ function Ee({
|
|
|
760
760
|
agentApiKey: t,
|
|
761
761
|
onSave: s,
|
|
762
762
|
onDirtyStateChange: c,
|
|
763
|
-
className:
|
|
763
|
+
className: a
|
|
764
764
|
}) {
|
|
765
|
-
const [
|
|
766
|
-
|
|
767
|
-
const
|
|
768
|
-
c?.(
|
|
769
|
-
}, [
|
|
770
|
-
const C = N(),
|
|
771
|
-
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
if ((
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
765
|
+
const [n, o] = _(60), l = N(null), i = N(!1), g = S((p) => p.blocks.length), b = S((p) => p.messages.length), v = S((p) => p.isStreaming), m = S((p) => p.save), A = N({ blockCount: g, msgCount: b });
|
|
766
|
+
P(() => {
|
|
767
|
+
const p = g !== A.current.blockCount || b !== A.current.msgCount;
|
|
768
|
+
c?.(p);
|
|
769
|
+
}, [g, b, c]);
|
|
770
|
+
const d = N(), C = N(!1), x = N(s);
|
|
771
|
+
x.current = s;
|
|
772
|
+
const k = N(g > 0 || b > 0);
|
|
773
|
+
P(() => {
|
|
774
|
+
if ((g > 0 || b > 0) && (k.current = !0), !(!x.current || !k.current)) {
|
|
775
|
+
if (v) {
|
|
776
|
+
C.current = !0, d.current && clearTimeout(d.current);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
return d.current && clearTimeout(d.current), d.current = setTimeout(() => {
|
|
780
|
+
C.current = !1;
|
|
781
|
+
const p = m();
|
|
782
|
+
x.current?.(p);
|
|
778
783
|
}, 1e3), () => {
|
|
779
|
-
|
|
784
|
+
d.current && clearTimeout(d.current);
|
|
780
785
|
};
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
786
|
+
}
|
|
787
|
+
}, [g, b, v, m]), P(() => {
|
|
788
|
+
!v && C.current && x.current && k.current && (d.current && clearTimeout(d.current), d.current = setTimeout(() => {
|
|
789
|
+
C.current = !1;
|
|
790
|
+
const p = m();
|
|
791
|
+
x.current?.(p);
|
|
792
|
+
}, 1e3));
|
|
793
|
+
}, [v, m]);
|
|
794
|
+
const D = f(() => {
|
|
795
|
+
x.current && (d.current && clearTimeout(d.current), x.current({ blocks: [], messages: [] }));
|
|
796
|
+
}, []), I = f((p) => {
|
|
797
|
+
p.preventDefault(), i.current = !0;
|
|
798
|
+
const h = (M) => {
|
|
787
799
|
if (!i.current || !l.current) return;
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
},
|
|
791
|
-
i.current = !1, document.removeEventListener("mousemove",
|
|
800
|
+
const w = l.current.getBoundingClientRect(), Q = (M.clientX - w.left) / w.width * 100;
|
|
801
|
+
o(Math.min(Math.max(Q, 30), 80));
|
|
802
|
+
}, T = () => {
|
|
803
|
+
i.current = !1, document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", T);
|
|
792
804
|
};
|
|
793
|
-
document.addEventListener("mousemove",
|
|
805
|
+
document.addEventListener("mousemove", h), document.addEventListener("mouseup", T);
|
|
794
806
|
}, []);
|
|
795
|
-
return /* @__PURE__ */
|
|
807
|
+
return /* @__PURE__ */ y(
|
|
796
808
|
"div",
|
|
797
809
|
{
|
|
798
810
|
ref: l,
|
|
799
|
-
className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${
|
|
811
|
+
className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${a || ""}`,
|
|
800
812
|
children: [
|
|
801
|
-
/* @__PURE__ */
|
|
813
|
+
/* @__PURE__ */ r(
|
|
802
814
|
"div",
|
|
803
815
|
{
|
|
804
816
|
className: "dc:h-full dc:overflow-hidden",
|
|
805
|
-
style: { width: `${
|
|
806
|
-
children: /* @__PURE__ */
|
|
817
|
+
style: { width: `${n}%` },
|
|
818
|
+
children: /* @__PURE__ */ r(Ce, {})
|
|
807
819
|
}
|
|
808
820
|
),
|
|
809
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ r(
|
|
810
822
|
"div",
|
|
811
823
|
{
|
|
812
824
|
className: "dc:w-1 dc:h-full dc:cursor-col-resize dc:flex-shrink-0 dc:transition-colors bg-dc-border dc:hover:bg-dc-accent",
|
|
813
|
-
onMouseDown:
|
|
825
|
+
onMouseDown: I
|
|
814
826
|
}
|
|
815
827
|
),
|
|
816
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ r(
|
|
817
829
|
"div",
|
|
818
830
|
{
|
|
819
831
|
className: "dc:h-full dc:overflow-hidden",
|
|
820
|
-
style: { width: `${100 -
|
|
821
|
-
children: /* @__PURE__ */
|
|
832
|
+
style: { width: `${100 - n}%` },
|
|
833
|
+
children: /* @__PURE__ */ r(
|
|
822
834
|
Me,
|
|
823
835
|
{
|
|
824
836
|
agentEndpoint: e,
|
|
825
837
|
agentApiKey: t,
|
|
826
|
-
onClear:
|
|
838
|
+
onClear: D
|
|
827
839
|
}
|
|
828
840
|
)
|
|
829
841
|
}
|
|
@@ -836,27 +848,27 @@ const Oe = R.memo(function({
|
|
|
836
848
|
config: t,
|
|
837
849
|
...s
|
|
838
850
|
}) {
|
|
839
|
-
return /* @__PURE__ */
|
|
851
|
+
return /* @__PURE__ */ r(ie, { initialConfig: t, children: /* @__PURE__ */ r(Ee, { ...s }) });
|
|
840
852
|
});
|
|
841
853
|
function $e() {
|
|
842
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ r("div", { children: "Analytics Page - Coming in Phase 4" });
|
|
843
855
|
}
|
|
844
|
-
const Be =
|
|
856
|
+
const Be = V("segment");
|
|
845
857
|
function ze({
|
|
846
858
|
className: e = ""
|
|
847
859
|
}) {
|
|
848
|
-
return /* @__PURE__ */
|
|
860
|
+
return /* @__PURE__ */ r(
|
|
849
861
|
"div",
|
|
850
862
|
{
|
|
851
863
|
className: `dc:flex dc:items-center dc:justify-center bg-dc-bg-secondary ${e}`,
|
|
852
|
-
children: /* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
864
|
+
children: /* @__PURE__ */ y("div", { className: "dc:text-center", children: [
|
|
865
|
+
/* @__PURE__ */ r(
|
|
854
866
|
Be,
|
|
855
867
|
{
|
|
856
868
|
className: "dc:w-8 dc:h-8 dc:mx-auto dc:mb-2 text-dc-text-muted dc:opacity-50"
|
|
857
869
|
}
|
|
858
870
|
),
|
|
859
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ r("span", { className: "dc:text-xs text-dc-text-muted", children: "No preview" })
|
|
860
872
|
] })
|
|
861
873
|
}
|
|
862
874
|
);
|
|
@@ -877,86 +889,86 @@ export {
|
|
|
877
889
|
tt as DashboardStoreProvider,
|
|
878
890
|
ze as DashboardThumbnailPlaceholder,
|
|
879
891
|
st as DrillBreadcrumb,
|
|
880
|
-
|
|
892
|
+
rt as DrillMenu,
|
|
881
893
|
Ss as ExecutionPlanPanel,
|
|
882
894
|
As as ExplainAIPanel,
|
|
883
895
|
bs as LazyChart,
|
|
884
896
|
hs as LoadingIndicator,
|
|
885
|
-
|
|
897
|
+
at as Modal,
|
|
886
898
|
ie as NotebookStoreProvider,
|
|
887
899
|
X as PortletAnalysisModal,
|
|
888
900
|
ct as PortletContainer,
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
901
|
+
rs as ScrollContainerProvider,
|
|
902
|
+
Lr as THEME_PRESETS,
|
|
903
|
+
Rr as applyTheme,
|
|
904
|
+
Sr as buildFunnelConfigFromQueries,
|
|
905
|
+
Ar as buildServerFunnelQuery,
|
|
906
|
+
as as captureThumbnail,
|
|
895
907
|
Ds as compressAndEncode,
|
|
896
908
|
cs as createCubeClient,
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
909
|
+
cr as createDashboardLayout,
|
|
910
|
+
nt as createDashboardStore,
|
|
911
|
+
ot as createDefaultConfig,
|
|
900
912
|
dt as createDefaultFlowConfig,
|
|
901
913
|
it as createDefaultFunnelConfig,
|
|
902
914
|
lt as createDefaultQueryConfig,
|
|
903
915
|
ut as createDefaultRetentionConfig,
|
|
904
916
|
mt as createDefaultWorkspace,
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
917
|
+
Kr as createExplainQueryKey,
|
|
918
|
+
dr as createFlowQueryKey,
|
|
919
|
+
ir as createFunnelQueryKey,
|
|
908
920
|
de as createNotebookStore,
|
|
909
921
|
Ts as decodeAndDecompress,
|
|
910
922
|
Ms as detectAsymmetricDateRanges,
|
|
911
923
|
Is as detectMeasureCollisions,
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
924
|
+
nr as formatChartData,
|
|
925
|
+
Dr as formatDuration,
|
|
926
|
+
lr as generateQueryLabel,
|
|
915
927
|
Es as generateShareUrl,
|
|
916
928
|
Bs as getAvailableBindingKeyDimensions,
|
|
917
929
|
ys as getAvailableChartTypes,
|
|
918
|
-
|
|
930
|
+
Tr as getBindingKeyField,
|
|
919
931
|
Ls as getBindingKeyLabel,
|
|
920
932
|
$t as getChartTypeIcon,
|
|
921
|
-
|
|
922
|
-
|
|
933
|
+
ur as getCombinedFields,
|
|
934
|
+
Mr as getCubeNameFromQuery,
|
|
923
935
|
zt as getFieldTypeIcon,
|
|
924
|
-
|
|
936
|
+
V as getIcon,
|
|
925
937
|
Wt as getIconData,
|
|
926
938
|
Jt as getIconRegistry,
|
|
927
939
|
Ht as getIconsByCategory,
|
|
928
940
|
Gt as getMeasureTypeIcon,
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
941
|
+
mr as getQueryIndices,
|
|
942
|
+
pr as getQueryLabels,
|
|
943
|
+
Pr as getTheme,
|
|
944
|
+
Qr as getThemeVariable,
|
|
933
945
|
xs as getUnavailableChartTypes,
|
|
934
946
|
Rs as getValidationSummary,
|
|
935
|
-
|
|
947
|
+
Zr as highlightCodeBlocks,
|
|
936
948
|
vs as isChartTypeAvailable,
|
|
937
|
-
|
|
949
|
+
Fr as isDarkMode,
|
|
938
950
|
pt as isFlowConfig,
|
|
939
951
|
ht as isFunnelConfig,
|
|
940
|
-
|
|
952
|
+
Ir as isFunnelData,
|
|
941
953
|
Ps as isMinimumFunnelConfigValid,
|
|
942
954
|
ft as isMultiQuery,
|
|
943
955
|
gt as isMultiQueryConfig,
|
|
944
|
-
|
|
956
|
+
hr as isMultiQueryData,
|
|
945
957
|
Qs as isMultiQueryValid,
|
|
946
958
|
bt as isQueryConfig,
|
|
947
959
|
yt as isRetentionConfig,
|
|
948
|
-
|
|
949
|
-
|
|
960
|
+
Gr as isSankeyData,
|
|
961
|
+
Xr as isServerFlowQuery,
|
|
950
962
|
xt as isServerFunnelQuery,
|
|
951
963
|
Fs as isShareableSize,
|
|
952
964
|
vt as isSingleQuery,
|
|
953
|
-
|
|
965
|
+
ns as isThumbnailCaptureAvailable,
|
|
954
966
|
Ct as isValidAnalysisConfig,
|
|
955
967
|
kt as isValidAnalysisWorkspace,
|
|
956
968
|
Cs as isValidChartType,
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
969
|
+
fr as mergeQueryResults,
|
|
970
|
+
gr as mergeResultsByKey,
|
|
971
|
+
br as mergeResultsConcat,
|
|
960
972
|
Nt as migrateConfig,
|
|
961
973
|
wt as migrateLegacyPortlet,
|
|
962
974
|
_s as parseShareUrl,
|
|
@@ -964,7 +976,7 @@ export {
|
|
|
964
976
|
Ns as preloadCharts,
|
|
965
977
|
Xt as registerIcons,
|
|
966
978
|
Yt as resetIcons,
|
|
967
|
-
|
|
979
|
+
_r as resetTheme,
|
|
968
980
|
St as selectAllActions,
|
|
969
981
|
pe as selectBlockActions,
|
|
970
982
|
le as selectBlocks,
|
|
@@ -993,47 +1005,47 @@ export {
|
|
|
993
1005
|
Pt as selectThumbnailDirty,
|
|
994
1006
|
zs as selectUIState,
|
|
995
1007
|
Zt as setIcon,
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1008
|
+
Vr as setTheme,
|
|
1009
|
+
jr as setThemeVariable,
|
|
1010
|
+
Er as transformServerFunnelResult,
|
|
999
1011
|
Ne as useAgentChat,
|
|
1000
1012
|
Ws as useAnalysisBuilder,
|
|
1001
1013
|
Js as useAnalysisBuilderStore,
|
|
1002
|
-
|
|
1003
|
-
|
|
1014
|
+
ne as useCubeApi,
|
|
1015
|
+
os as useCubeContext,
|
|
1004
1016
|
ds as useCubeFeatures,
|
|
1005
1017
|
fs as useCubeFieldLabel,
|
|
1006
|
-
|
|
1018
|
+
yr as useCubeLoadQuery,
|
|
1007
1019
|
is as useCubeMeta,
|
|
1008
1020
|
ls as useCubeMetaQuery,
|
|
1009
|
-
|
|
1021
|
+
xr as useCubeQuery,
|
|
1010
1022
|
Qt as useDashboard,
|
|
1011
1023
|
Ft as useDashboardStore,
|
|
1012
1024
|
_t as useDashboardStoreApi,
|
|
1013
1025
|
Vt as useDashboardStoreOptional,
|
|
1014
1026
|
jt as useDrillInteraction,
|
|
1015
|
-
|
|
1016
|
-
$
|
|
1027
|
+
Or as useDryRunQueries,
|
|
1028
|
+
$r as useDryRunQuery,
|
|
1017
1029
|
qt as useElementVisibility,
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1030
|
+
zr as useExplainAI,
|
|
1031
|
+
Wr as useExplainQuery,
|
|
1032
|
+
vr as useFlowQuery,
|
|
1033
|
+
Cr as useFunnelQuery,
|
|
1034
|
+
kr as useMultiCubeLoadQuery,
|
|
1035
|
+
Jr as useMultiDryRunQueries,
|
|
1036
|
+
S as useNotebookStore,
|
|
1025
1037
|
us as useScrollContainer,
|
|
1026
1038
|
Ut as useScrollDetection,
|
|
1027
|
-
|
|
1039
|
+
rr as useTheme,
|
|
1028
1040
|
Hs as validateBindingKeyExists,
|
|
1029
1041
|
Gs as validateBindingKeyForSteps,
|
|
1030
1042
|
Xs as validateFunnelConfig,
|
|
1031
|
-
|
|
1043
|
+
Nr as validateMergeKey,
|
|
1032
1044
|
Ys as validateMergeKeys,
|
|
1033
1045
|
Zs as validateMultiQueryConfig,
|
|
1034
|
-
|
|
1035
|
-
|
|
1046
|
+
er as validateStepQueries,
|
|
1047
|
+
tr as validateTimeDimensionAlignment,
|
|
1036
1048
|
ms as warnIfScreenshotLibMissing,
|
|
1037
|
-
|
|
1049
|
+
qr as watchThemeChanges
|
|
1038
1050
|
};
|
|
1039
1051
|
//# sourceMappingURL=index.js.map
|