@nice2dev/ui-ai 1.0.25 → 1.0.27
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.mjs +190 -190
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -79,8 +79,8 @@ async function* ur(i, e) {
|
|
|
79
79
|
let n = "";
|
|
80
80
|
try {
|
|
81
81
|
for (; !(e != null && e.aborted); ) {
|
|
82
|
-
const { done:
|
|
83
|
-
if (
|
|
82
|
+
const { done: $, value: N } = await r.read();
|
|
83
|
+
if ($)
|
|
84
84
|
break;
|
|
85
85
|
n += t.decode(N, { stream: !0 });
|
|
86
86
|
const z = n.split(`
|
|
@@ -113,9 +113,9 @@ async function* ur(i, e) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
if (n.trim()) {
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
const N =
|
|
116
|
+
const $ = n.trim();
|
|
117
|
+
if ($.startsWith("data:")) {
|
|
118
|
+
const N = $.slice(5).trim();
|
|
119
119
|
if (N && N !== "[DONE]")
|
|
120
120
|
try {
|
|
121
121
|
const g = ((T = (S = (w = JSON.parse(N).choices) == null ? void 0 : w[0]) == null ? void 0 : S.delta) == null ? void 0 : T.content) ?? "";
|
|
@@ -168,8 +168,8 @@ ${n.join(`
|
|
|
168
168
|
}
|
|
169
169
|
function ae(i = {}, e = {}) {
|
|
170
170
|
i = i ?? {}, e = e ?? {};
|
|
171
|
-
const { debounceMs: r = 500, disabled: t = !1 } = e, n = ne(), [c, l] = L(""), [o, f] = L(!1), [h, y] = L(null), [w, S] = L(!1), T = G(null),
|
|
172
|
-
var _,
|
|
171
|
+
const { debounceMs: r = 500, disabled: t = !1 } = e, n = ne(), [c, l] = L(""), [o, f] = L(!1), [h, y] = L(null), [w, S] = L(!1), T = G(null), $ = G(0), N = E(async () => {
|
|
172
|
+
var _, P, M;
|
|
173
173
|
if (!n || !n.enabled || t)
|
|
174
174
|
return;
|
|
175
175
|
const { config: d, rateLimiter: k } = n;
|
|
@@ -212,7 +212,7 @@ function ae(i = {}, e = {}) {
|
|
|
212
212
|
S(!0);
|
|
213
213
|
let I = "";
|
|
214
214
|
for await (const B of ur(b, x.signal))
|
|
215
|
-
if (x.signal.aborted || (I += B.token, l(I), (
|
|
215
|
+
if (x.signal.aborted || (I += B.token, l(I), (P = B.usage) != null && P.completion_tokens && k.recordTokens(B.usage.completion_tokens), B.done))
|
|
216
216
|
break;
|
|
217
217
|
if (I.length > 0) {
|
|
218
218
|
const B = Math.ceil(I.length / 4);
|
|
@@ -245,7 +245,7 @@ function ae(i = {}, e = {}) {
|
|
|
245
245
|
r,
|
|
246
246
|
t,
|
|
247
247
|
n == null ? void 0 : n.enabled,
|
|
248
|
-
|
|
248
|
+
$.current
|
|
249
249
|
]), re(() => () => {
|
|
250
250
|
var d;
|
|
251
251
|
(d = T.current) == null || d.abort();
|
|
@@ -258,7 +258,7 @@ function ae(i = {}, e = {}) {
|
|
|
258
258
|
const d = Ie(i, n.config.privacyMode ?? !1);
|
|
259
259
|
ue.delete(d);
|
|
260
260
|
}
|
|
261
|
-
|
|
261
|
+
$.current += 1, N();
|
|
262
262
|
}, [n, i, N]);
|
|
263
263
|
return !n || !n.enabled ? {
|
|
264
264
|
text: "",
|
|
@@ -365,7 +365,7 @@ const Ge = We(
|
|
|
365
365
|
style: l
|
|
366
366
|
}, o) => {
|
|
367
367
|
var C;
|
|
368
|
-
const f = ne(), [h, y] = L(!1), [w, S] = L(!1), T = G(null),
|
|
368
|
+
const f = ne(), [h, y] = L(!1), [w, S] = L(!1), T = G(null), $ = G(null), N = ae(i, {
|
|
369
369
|
debounceMs: r,
|
|
370
370
|
disabled: !w
|
|
371
371
|
});
|
|
@@ -375,7 +375,7 @@ const Ge = We(
|
|
|
375
375
|
const m = (x) => {
|
|
376
376
|
var u, _;
|
|
377
377
|
const v = x.target;
|
|
378
|
-
(u = T.current) != null && u.contains(v) || (_ =
|
|
378
|
+
(u = T.current) != null && u.contains(v) || (_ = $.current) != null && _.contains(v) || (y(!1), S(!1));
|
|
379
379
|
};
|
|
380
380
|
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
381
381
|
}, [h]), re(() => {
|
|
@@ -446,7 +446,7 @@ const Ge = We(
|
|
|
446
446
|
h && /* @__PURE__ */ s(
|
|
447
447
|
"div",
|
|
448
448
|
{
|
|
449
|
-
ref:
|
|
449
|
+
ref: $,
|
|
450
450
|
role: "tooltip",
|
|
451
451
|
className: "ntd-ai-popover",
|
|
452
452
|
style: yr(k),
|
|
@@ -1017,8 +1017,8 @@ function bi(i, e, r) {
|
|
|
1017
1017
|
aiTriggerIcon: w,
|
|
1018
1018
|
...S
|
|
1019
1019
|
} = n, T = Z(() => {
|
|
1020
|
-
const
|
|
1021
|
-
return f && (
|
|
1020
|
+
const $ = e(S);
|
|
1021
|
+
return f && ($.customPrompt = f), $;
|
|
1022
1022
|
}, [S, f]);
|
|
1023
1023
|
return /* @__PURE__ */ s("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
1024
1024
|
/* @__PURE__ */ a(i, { ...S, ref: c }),
|
|
@@ -1064,9 +1064,9 @@ function wi(i) {
|
|
|
1064
1064
|
function ki(i) {
|
|
1065
1065
|
return Qe(i.label ?? "Color", i.value);
|
|
1066
1066
|
}
|
|
1067
|
-
const Mr = (i, e) => e,
|
|
1068
|
-
function
|
|
1069
|
-
return { t: Me(
|
|
1067
|
+
const Mr = (i, e) => e, Pr = te(Mr);
|
|
1068
|
+
function $r() {
|
|
1069
|
+
return { t: Me(Pr) };
|
|
1070
1070
|
}
|
|
1071
1071
|
te({
|
|
1072
1072
|
dir: "ltr",
|
|
@@ -1116,9 +1116,9 @@ let er = {
|
|
|
1116
1116
|
enabled: Lr,
|
|
1117
1117
|
slowRenderThreshold: 16
|
|
1118
1118
|
};
|
|
1119
|
-
const rr = [],
|
|
1119
|
+
const rr = [], Pe = /* @__PURE__ */ new Map(), ar = /* @__PURE__ */ new Map();
|
|
1120
1120
|
function Ir() {
|
|
1121
|
-
rr.length = 0,
|
|
1121
|
+
rr.length = 0, Pe.clear(), ar.clear();
|
|
1122
1122
|
}
|
|
1123
1123
|
function Or(i) {
|
|
1124
1124
|
const e = er.slowRenderThreshold;
|
|
@@ -1128,7 +1128,7 @@ function de(i) {
|
|
|
1128
1128
|
return i < 1 ? `${(i * 1e3).toFixed(0)}μs` : i < 1e3 ? `${i.toFixed(2)}ms` : `${(i / 1e3).toFixed(2)}s`;
|
|
1129
1129
|
}
|
|
1130
1130
|
function jr() {
|
|
1131
|
-
const i = Array.from(
|
|
1131
|
+
const i = Array.from(Pe.values()), e = Or(), r = i.reduce((c, l) => c + l.renderCount, 0), t = i.length > 0 ? i.reduce((c, l) => c + l.avgRenderTime, 0) / i.length : 0, n = Array.from(ar.values());
|
|
1132
1132
|
return { stats: i, slowRenders: e, totalRenders: r, avgRenderTime: t, marks: n };
|
|
1133
1133
|
}
|
|
1134
1134
|
function Dr() {
|
|
@@ -1164,8 +1164,8 @@ const Hr = dr(
|
|
|
1164
1164
|
const [r, t] = L(e), [n, c] = L([]), [l, o] = L({ used: 0, total: 0 });
|
|
1165
1165
|
if (re(() => {
|
|
1166
1166
|
const h = () => {
|
|
1167
|
-
const w = Array.from(
|
|
1168
|
-
c(w.sort((T,
|
|
1167
|
+
const w = Array.from(Pe.values());
|
|
1168
|
+
c(w.sort((T, $) => $.totalRenderTime - T.totalRenderTime).slice(0, 10));
|
|
1169
1169
|
const S = window.performance;
|
|
1170
1170
|
S.memory && o({
|
|
1171
1171
|
used: S.memory.usedJSHeapSize / 1024 / 1024,
|
|
@@ -1342,7 +1342,7 @@ const Ur = ({
|
|
|
1342
1342
|
style: c,
|
|
1343
1343
|
"data-testid": l
|
|
1344
1344
|
}) => {
|
|
1345
|
-
const { enabled: o, run: f } = Br(), { t: h } =
|
|
1345
|
+
const { enabled: o, run: f } = Br(), { t: h } = $r();
|
|
1346
1346
|
if (!o || !i || i.length === 0)
|
|
1347
1347
|
return null;
|
|
1348
1348
|
const y = r ?? h("tutorial.startAria", "Start tutorial");
|
|
@@ -2875,7 +2875,7 @@ const Vr = {
|
|
|
2875
2875
|
tutorial: c
|
|
2876
2876
|
}) => {
|
|
2877
2877
|
var R;
|
|
2878
|
-
const [l, o] = L(i || Vr), [f, h] = L("data"), [y, w] = L(null), [S, T] = L(null), [
|
|
2878
|
+
const [l, o] = L(i || Vr), [f, h] = L("data"), [y, w] = L(null), [S, T] = L(null), [$, N] = L(null), [z, g] = L(!1), [d, k] = L({
|
|
2879
2879
|
algorithm: "",
|
|
2880
2880
|
hyperparameters: {},
|
|
2881
2881
|
preprocessing: []
|
|
@@ -2986,7 +2986,7 @@ const Vr = {
|
|
|
2986
2986
|
(B) => B.id === p ? { ...B, status: "production", deployments: [...B.deployments, I] } : B
|
|
2987
2987
|
)
|
|
2988
2988
|
});
|
|
2989
|
-
},
|
|
2989
|
+
}, P = (p) => p < 1024 ? `${p} B` : p < 1024 * 1024 ? `${(p / 1024).toFixed(1)} KB` : p < 1024 * 1024 * 1024 ? `${(p / 1024 / 1024).toFixed(1)} MB` : `${(p / 1024 / 1024 / 1024).toFixed(1)} GB`, M = (p) => {
|
|
2990
2990
|
switch (p) {
|
|
2991
2991
|
case "completed":
|
|
2992
2992
|
case "production":
|
|
@@ -3092,7 +3092,7 @@ const Vr = {
|
|
|
3092
3092
|
p.columns.length,
|
|
3093
3093
|
" columns"
|
|
3094
3094
|
] }),
|
|
3095
|
-
/* @__PURE__ */ a("span", { children:
|
|
3095
|
+
/* @__PURE__ */ a("span", { children: P(p.size) })
|
|
3096
3096
|
] }),
|
|
3097
3097
|
/* @__PURE__ */ a("div", { className: "splits-bar", children: p.splits.map((b) => /* @__PURE__ */ a(
|
|
3098
3098
|
"div",
|
|
@@ -3283,7 +3283,7 @@ const Vr = {
|
|
|
3283
3283
|
] }) : l.models.map((p) => /* @__PURE__ */ s(
|
|
3284
3284
|
"div",
|
|
3285
3285
|
{
|
|
3286
|
-
className: `model-card ${
|
|
3286
|
+
className: `model-card ${$ === p.id ? "model-card--selected" : ""}`,
|
|
3287
3287
|
onClick: () => N(p.id),
|
|
3288
3288
|
children: [
|
|
3289
3289
|
/* @__PURE__ */ s("div", { className: "card-header", children: [
|
|
@@ -3301,7 +3301,7 @@ const Vr = {
|
|
|
3301
3301
|
] }),
|
|
3302
3302
|
/* @__PURE__ */ s("span", { children: [
|
|
3303
3303
|
"Size: ",
|
|
3304
|
-
|
|
3304
|
+
P(p.size)
|
|
3305
3305
|
] })
|
|
3306
3306
|
] }),
|
|
3307
3307
|
p.metrics.length > 0 && /* @__PURE__ */ a("div", { className: "metrics-row", children: p.metrics.slice(0, 3).map((b) => /* @__PURE__ */ s("div", { className: "metric-item", children: [
|
|
@@ -3414,7 +3414,7 @@ const Vr = {
|
|
|
3414
3414
|
className: n = ""
|
|
3415
3415
|
}) => {
|
|
3416
3416
|
var se;
|
|
3417
|
-
const [c, l] = L(i || Kr), [o, f] = L("label"), [h, y] = L(0), [w, S] = L(null), [T,
|
|
3417
|
+
const [c, l] = L(i || Kr), [o, f] = L("label"), [h, y] = L(0), [w, S] = L(null), [T, $] = L("select"), [N, z] = L(!1), [g, d] = L(null), [k, C] = L(1), [m, x] = L(!1), [v, u] = L("all"), _ = G(null), P = G(null), M = c.items[h];
|
|
3418
3418
|
re(() => {
|
|
3419
3419
|
i && l(i);
|
|
3420
3420
|
}, [i]);
|
|
@@ -3626,7 +3626,7 @@ const Vr = {
|
|
|
3626
3626
|
"button",
|
|
3627
3627
|
{
|
|
3628
3628
|
className: `tool-button ${T === "select" ? "tool-button--active" : ""}`,
|
|
3629
|
-
onClick: () =>
|
|
3629
|
+
onClick: () => $("select"),
|
|
3630
3630
|
children: "↖️ Select"
|
|
3631
3631
|
}
|
|
3632
3632
|
),
|
|
@@ -3634,7 +3634,7 @@ const Vr = {
|
|
|
3634
3634
|
"button",
|
|
3635
3635
|
{
|
|
3636
3636
|
className: `tool-button ${T === "bbox" ? "tool-button--active" : ""}`,
|
|
3637
|
-
onClick: () =>
|
|
3637
|
+
onClick: () => $("bbox"),
|
|
3638
3638
|
children: "⬜ Box"
|
|
3639
3639
|
}
|
|
3640
3640
|
),
|
|
@@ -3642,7 +3642,7 @@ const Vr = {
|
|
|
3642
3642
|
"button",
|
|
3643
3643
|
{
|
|
3644
3644
|
className: `tool-button ${T === "polygon" ? "tool-button--active" : ""}`,
|
|
3645
|
-
onClick: () =>
|
|
3645
|
+
onClick: () => $("polygon"),
|
|
3646
3646
|
children: "⬡ Polygon"
|
|
3647
3647
|
}
|
|
3648
3648
|
)
|
|
@@ -3673,7 +3673,7 @@ const Vr = {
|
|
|
3673
3673
|
] })
|
|
3674
3674
|
] }),
|
|
3675
3675
|
/* @__PURE__ */ s("div", { className: "label-workspace", children: [
|
|
3676
|
-
/* @__PURE__ */ a("div", { className: "canvas-container", ref:
|
|
3676
|
+
/* @__PURE__ */ a("div", { className: "canvas-container", ref: P, children: M ? /* @__PURE__ */ s(ce, { children: [
|
|
3677
3677
|
M.data.type === "image" && /* @__PURE__ */ s(ce, { children: [
|
|
3678
3678
|
/* @__PURE__ */ a(
|
|
3679
3679
|
"img",
|
|
@@ -4073,13 +4073,13 @@ const Vr = {
|
|
|
4073
4073
|
showLogs: t = !0,
|
|
4074
4074
|
className: n = ""
|
|
4075
4075
|
}) => {
|
|
4076
|
-
const [c, l] = L(i || Yr), [o, f] = L("test"), [h, y] = L("text"), [w, S] = L(""), [T,
|
|
4076
|
+
const [c, l] = L(i || Yr), [o, f] = L("test"), [h, y] = L("text"), [w, S] = L(""), [T, $] = L("{}"), [N, z] = L(null), [g, d] = L({
|
|
4077
4077
|
temperature: 0.7,
|
|
4078
4078
|
topK: 50,
|
|
4079
4079
|
topP: 0.9,
|
|
4080
4080
|
maxTokens: 256,
|
|
4081
4081
|
threshold: 0.5
|
|
4082
|
-
}), [k, C] = L(null), [m, x] = L(!1), [v, u] = L(null), [_,
|
|
4082
|
+
}), [k, C] = L(null), [m, x] = L(!1), [v, u] = L(null), [_, P] = L([]), [M, R] = L(null), p = G(null), b = (O) => {
|
|
4083
4083
|
var W;
|
|
4084
4084
|
const U = (W = O.target.files) == null ? void 0 : W[0];
|
|
4085
4085
|
if (U) {
|
|
@@ -4172,7 +4172,7 @@ const Vr = {
|
|
|
4172
4172
|
}
|
|
4173
4173
|
}, B = async (O) => {
|
|
4174
4174
|
if (e) {
|
|
4175
|
-
R(0),
|
|
4175
|
+
R(0), P([]);
|
|
4176
4176
|
for (let U = 0; U < O.length; U++) {
|
|
4177
4177
|
const W = {
|
|
4178
4178
|
inputs: [O[U]],
|
|
@@ -4180,7 +4180,7 @@ const Vr = {
|
|
|
4180
4180
|
};
|
|
4181
4181
|
try {
|
|
4182
4182
|
const K = await e(W);
|
|
4183
|
-
|
|
4183
|
+
P((V) => [...V, K]);
|
|
4184
4184
|
} catch (K) {
|
|
4185
4185
|
console.error("Batch item failed:", K);
|
|
4186
4186
|
}
|
|
@@ -4310,7 +4310,7 @@ const Vr = {
|
|
|
4310
4310
|
"textarea",
|
|
4311
4311
|
{
|
|
4312
4312
|
value: T,
|
|
4313
|
-
onChange: (O) =>
|
|
4313
|
+
onChange: (O) => $(O.target.value),
|
|
4314
4314
|
placeholder: h === "json" ? `{
|
|
4315
4315
|
"key": "value"
|
|
4316
4316
|
}` : `[
|
|
@@ -4653,8 +4653,8 @@ class pe {
|
|
|
4653
4653
|
return;
|
|
4654
4654
|
}
|
|
4655
4655
|
try {
|
|
4656
|
-
const
|
|
4657
|
-
r(this.normalizeStreamChunk(
|
|
4656
|
+
const $ = JSON.parse(T);
|
|
4657
|
+
r(this.normalizeStreamChunk($));
|
|
4658
4658
|
} catch {
|
|
4659
4659
|
}
|
|
4660
4660
|
}
|
|
@@ -5801,7 +5801,7 @@ Provide summary and insights:`,
|
|
|
5801
5801
|
],
|
|
5802
5802
|
suggestedTemperature: 0.4,
|
|
5803
5803
|
maxTokens: 1024
|
|
5804
|
-
},
|
|
5804
|
+
}, $e = {
|
|
5805
5805
|
[_e.id]: _e,
|
|
5806
5806
|
[we.id]: we,
|
|
5807
5807
|
[ke.id]: ke,
|
|
@@ -5815,13 +5815,13 @@ Provide summary and insights:`,
|
|
|
5815
5815
|
[Je.id]: Je
|
|
5816
5816
|
};
|
|
5817
5817
|
function Ti(i) {
|
|
5818
|
-
return
|
|
5818
|
+
return $e[i];
|
|
5819
5819
|
}
|
|
5820
5820
|
function Ri(i) {
|
|
5821
|
-
return Object.values(
|
|
5821
|
+
return Object.values($e).filter((e) => e.category === i);
|
|
5822
5822
|
}
|
|
5823
5823
|
function Ai() {
|
|
5824
|
-
return Object.keys(
|
|
5824
|
+
return Object.keys($e);
|
|
5825
5825
|
}
|
|
5826
5826
|
class cr {
|
|
5827
5827
|
constructor() {
|
|
@@ -5914,9 +5914,9 @@ class ia {
|
|
|
5914
5914
|
* Get budget status for a tenant
|
|
5915
5915
|
*/
|
|
5916
5916
|
async getBudgetStatus(e) {
|
|
5917
|
-
const r = /* @__PURE__ */ new Date(), t = new Date(r.getFullYear(), r.getMonth(), r.getDate()), n = new Date(r.getFullYear(), r.getMonth(), 1), c = await this.storage.load(e, t), l = await this.storage.load(e, n), o = c.reduce((
|
|
5918
|
-
for (const
|
|
5919
|
-
w >=
|
|
5917
|
+
const r = /* @__PURE__ */ new Date(), t = new Date(r.getFullYear(), r.getMonth(), r.getDate()), n = new Date(r.getFullYear(), r.getMonth(), 1), c = await this.storage.load(e, t), l = await this.storage.load(e, n), o = c.reduce(($, N) => $ + N.estimatedCost, 0), f = l.reduce(($, N) => $ + N.estimatedCost, 0), h = this.budgetConfig.dailyBudget || 1 / 0, y = this.budgetConfig.monthlyBudget || 1 / 0, w = h ? o / h * 100 : 0, S = y ? f / y * 100 : 0, T = [];
|
|
5918
|
+
for (const $ of this.budgetConfig.alertThresholds || [])
|
|
5919
|
+
w >= $ && T.push(`Daily budget ${$}% used`), S >= $ && T.push(`Monthly budget ${$}% used`);
|
|
5920
5920
|
return {
|
|
5921
5921
|
dailyUsed: o,
|
|
5922
5922
|
dailyRemaining: Math.max(0, h - o),
|
|
@@ -6015,8 +6015,8 @@ function Mi(i, e) {
|
|
|
6015
6015
|
re(() => {
|
|
6016
6016
|
const S = typeof window < "u" ? new aa() : new cr();
|
|
6017
6017
|
r.current = new ia(S, e);
|
|
6018
|
-
const T = r.current.onAlert((
|
|
6019
|
-
console.warn(`[AI Cost Alert] ${
|
|
6018
|
+
const T = r.current.onAlert(($) => {
|
|
6019
|
+
console.warn(`[AI Cost Alert] ${$}`);
|
|
6020
6020
|
});
|
|
6021
6021
|
return () => {
|
|
6022
6022
|
T();
|
|
@@ -6326,7 +6326,7 @@ function sa(i, e) {
|
|
|
6326
6326
|
const r = me(i);
|
|
6327
6327
|
return new na(r, e);
|
|
6328
6328
|
}
|
|
6329
|
-
function
|
|
6329
|
+
function Pi(i, e) {
|
|
6330
6330
|
const r = {
|
|
6331
6331
|
strategies: ["retry", "failover", "cache", "graceful-degrade"],
|
|
6332
6332
|
maxRetries: 3,
|
|
@@ -6342,7 +6342,7 @@ function $i(i, e) {
|
|
|
6342
6342
|
}), sa(i, r);
|
|
6343
6343
|
}
|
|
6344
6344
|
function ca(i) {
|
|
6345
|
-
const { columns: e, config: r, onFilterGenerated: t, onSortGenerated: n, onError: c } = i, l = ne(), [o, f] = L(!1), [h, y] = L(null), [w, S] = L(null), [T,
|
|
6345
|
+
const { columns: e, config: r, onFilterGenerated: t, onSortGenerated: n, onError: c } = i, l = ne(), [o, f] = L(!1), [h, y] = L(null), [w, S] = L(null), [T, $] = L([]), N = G(null), z = r || (l == null ? void 0 : l.config), g = Z(() => e.map((m) => ({
|
|
6346
6346
|
id: m.id,
|
|
6347
6347
|
label: m.label,
|
|
6348
6348
|
type: m.type,
|
|
@@ -6358,7 +6358,7 @@ function ca(i) {
|
|
|
6358
6358
|
const x = performance.now();
|
|
6359
6359
|
(v = N.current) == null || v.abort(), N.current = new AbortController();
|
|
6360
6360
|
try {
|
|
6361
|
-
const u = X(z), _ = m.toLowerCase(),
|
|
6361
|
+
const u = X(z), _ = m.toLowerCase(), P = _.includes("sort") || _.includes("order") || _.includes("arrange") || _.includes("by highest") || _.includes("by lowest"), M = _.includes("show") || _.includes("find") || _.includes("filter") || _.includes("where") || _.includes("with") || _.includes("only") || !P, R = { type: "combined" };
|
|
6362
6362
|
if (M) {
|
|
6363
6363
|
const p = oe(_e, {
|
|
6364
6364
|
columns: g,
|
|
@@ -6373,7 +6373,7 @@ function ca(i) {
|
|
|
6373
6373
|
}), I = oa(b);
|
|
6374
6374
|
I && (R.filterConfig = I, R.type = "filter", t == null || t(I));
|
|
6375
6375
|
}
|
|
6376
|
-
if (
|
|
6376
|
+
if (P) {
|
|
6377
6377
|
const p = oe(we, {
|
|
6378
6378
|
columns: g,
|
|
6379
6379
|
query: m
|
|
@@ -6387,14 +6387,14 @@ function ca(i) {
|
|
|
6387
6387
|
}), I = la(b);
|
|
6388
6388
|
I && (R.sortConfig = I, R.type = R.filterConfig ? "combined" : "sort", n == null || n(I));
|
|
6389
6389
|
}
|
|
6390
|
-
return R.latencyMs = performance.now() - x, S(R),
|
|
6390
|
+
return R.latencyMs = performance.now() - x, S(R), $((p) => [...p.slice(-9), { query: m, result: R }]), R;
|
|
6391
6391
|
} catch (u) {
|
|
6392
|
-
const _ = u instanceof Error ? u.message : "AI request failed",
|
|
6392
|
+
const _ = u instanceof Error ? u.message : "AI request failed", P = {
|
|
6393
6393
|
type: "filter",
|
|
6394
6394
|
error: _,
|
|
6395
6395
|
latencyMs: performance.now() - x
|
|
6396
6396
|
};
|
|
6397
|
-
return S(
|
|
6397
|
+
return S(P), c == null || c(_), P;
|
|
6398
6398
|
} finally {
|
|
6399
6399
|
f(!1);
|
|
6400
6400
|
}
|
|
@@ -6448,7 +6448,7 @@ function la(i) {
|
|
|
6448
6448
|
}
|
|
6449
6449
|
return null;
|
|
6450
6450
|
}
|
|
6451
|
-
function
|
|
6451
|
+
function $i({
|
|
6452
6452
|
columns: i,
|
|
6453
6453
|
config: e,
|
|
6454
6454
|
onFilter: r,
|
|
@@ -6459,7 +6459,7 @@ function Pi({
|
|
|
6459
6459
|
className: o,
|
|
6460
6460
|
style: f
|
|
6461
6461
|
}) {
|
|
6462
|
-
const [h, y] = L(""), [w, S] = L(!1), T = G(null), { processQuery:
|
|
6462
|
+
const [h, y] = L(""), [w, S] = L(!1), T = G(null), { processQuery: $, loading: N, lastResult: z, history: g, isConfigured: d } = ca({
|
|
6463
6463
|
columns: i,
|
|
6464
6464
|
config: e,
|
|
6465
6465
|
onFilterGenerated: r,
|
|
@@ -6469,8 +6469,8 @@ function Pi({
|
|
|
6469
6469
|
return [];
|
|
6470
6470
|
const u = [], _ = i.filter((p) => p.type === "string");
|
|
6471
6471
|
_.length > 0 && u.push(`Show ${_[0].label}s containing "example"`);
|
|
6472
|
-
const
|
|
6473
|
-
|
|
6472
|
+
const P = i.filter((p) => p.type === "number");
|
|
6473
|
+
P.length > 0 && (u.push(`${P[0].label} greater than 100`), u.push(`Sort by highest ${P[0].label}`));
|
|
6474
6474
|
const M = i.filter((p) => p.type === "date");
|
|
6475
6475
|
M.length > 0 && (u.push(`${M[0].label} in the last 7 days`), u.push(`Sort by newest ${M[0].label}`));
|
|
6476
6476
|
const R = i.filter((p) => {
|
|
@@ -6479,14 +6479,14 @@ function Pi({
|
|
|
6479
6479
|
});
|
|
6480
6480
|
return R.length > 0 && R[0].options && u.push(`Where ${R[0].label} is ${R[0].options[0]}`), u.slice(0, 5);
|
|
6481
6481
|
}, [i, l]), C = async () => {
|
|
6482
|
-
!h.trim() || N || (await
|
|
6482
|
+
!h.trim() || N || (await $(h.trim()), S(!1));
|
|
6483
6483
|
}, m = (u) => {
|
|
6484
6484
|
u.key === "Enter" ? (u.preventDefault(), C()) : u.key === "Escape" && S(!1);
|
|
6485
6485
|
}, x = (u) => {
|
|
6486
6486
|
var _;
|
|
6487
6487
|
y(u), S(!1), (_ = T.current) == null || _.focus();
|
|
6488
6488
|
}, v = (u) => {
|
|
6489
|
-
y(u), S(!1),
|
|
6489
|
+
y(u), S(!1), $(u);
|
|
6490
6490
|
};
|
|
6491
6491
|
return d ? /* @__PURE__ */ s("div", { className: `nice-datagrid-ai ${o || ""}`, style: f, children: [
|
|
6492
6492
|
/* @__PURE__ */ s("div", { className: "nice-datagrid-ai__input-wrapper", children: [
|
|
@@ -6772,22 +6772,22 @@ function Pi({
|
|
|
6772
6772
|
);
|
|
6773
6773
|
}
|
|
6774
6774
|
function da(i = {}) {
|
|
6775
|
-
const { config: e, schema: r, context: t, onFormGenerated: n, onError: c } = i, l = ne(), [o, f] = L(!1), [h, y] = L(null), [w, S] = L(null), [T,
|
|
6775
|
+
const { config: e, schema: r, context: t, onFormGenerated: n, onError: c } = i, l = ne(), [o, f] = L(!1), [h, y] = L(null), [w, S] = L(null), [T, $] = L([]), N = G(null), z = e || (l == null ? void 0 : l.config), g = E(
|
|
6776
6776
|
async (m) => {
|
|
6777
6777
|
var v, u, _;
|
|
6778
6778
|
if (!z) {
|
|
6779
|
-
const
|
|
6780
|
-
return c == null || c(
|
|
6779
|
+
const P = "AI not configured. Provide config or wrap in NiceAIProvider.";
|
|
6780
|
+
return c == null || c(P), { error: P };
|
|
6781
6781
|
}
|
|
6782
6782
|
f(!0), y(m);
|
|
6783
6783
|
const x = performance.now();
|
|
6784
6784
|
(v = N.current) == null || v.abort(), N.current = new AbortController();
|
|
6785
6785
|
try {
|
|
6786
|
-
const
|
|
6786
|
+
const P = X(z), M = oe(ke, {
|
|
6787
6787
|
description: m,
|
|
6788
6788
|
schema: r ? JSON.stringify(r, null, 2) : void 0,
|
|
6789
6789
|
context: t
|
|
6790
|
-
}), R = await
|
|
6790
|
+
}), R = await P.chat({
|
|
6791
6791
|
messages: [
|
|
6792
6792
|
{ role: "system", content: M.system },
|
|
6793
6793
|
{ role: "user", content: M.user }
|
|
@@ -6800,9 +6800,9 @@ function da(i = {}) {
|
|
|
6800
6800
|
latencyMs: performance.now() - x,
|
|
6801
6801
|
error: p ? void 0 : "Failed to parse form configuration"
|
|
6802
6802
|
};
|
|
6803
|
-
return p && (n == null || n(p)), S(b),
|
|
6804
|
-
} catch (
|
|
6805
|
-
const M =
|
|
6803
|
+
return p && (n == null || n(p)), S(b), $((I) => [...I.slice(-9), { description: m, result: b }]), b;
|
|
6804
|
+
} catch (P) {
|
|
6805
|
+
const M = P instanceof Error ? P.message : "AI request failed", R = {
|
|
6806
6806
|
error: M,
|
|
6807
6807
|
latencyMs: performance.now() - x
|
|
6808
6808
|
};
|
|
@@ -6876,7 +6876,7 @@ function zi({
|
|
|
6876
6876
|
style: f,
|
|
6877
6877
|
renderForm: h
|
|
6878
6878
|
}) {
|
|
6879
|
-
const [y, w] = L(""), [S, T] = L(!1),
|
|
6879
|
+
const [y, w] = L(""), [S, T] = L(!1), $ = G(null), { generateForm: N, loading: z, lastResult: g, isConfigured: d } = da({
|
|
6880
6880
|
config: i,
|
|
6881
6881
|
schema: e,
|
|
6882
6882
|
context: r,
|
|
@@ -6892,7 +6892,7 @@ function zi({
|
|
|
6892
6892
|
!y.trim() || z || await N(y.trim());
|
|
6893
6893
|
}, m = (u) => {
|
|
6894
6894
|
var _;
|
|
6895
|
-
w(u), T(!1), (_ =
|
|
6895
|
+
w(u), T(!1), (_ = $.current) == null || _.focus();
|
|
6896
6896
|
}, x = (u) => {
|
|
6897
6897
|
u.key === "Enter" && (u.ctrlKey || u.metaKey) && (u.preventDefault(), C());
|
|
6898
6898
|
}, v = (u) => {
|
|
@@ -6908,7 +6908,7 @@ function zi({
|
|
|
6908
6908
|
/* @__PURE__ */ a(
|
|
6909
6909
|
"textarea",
|
|
6910
6910
|
{
|
|
6911
|
-
ref:
|
|
6911
|
+
ref: $,
|
|
6912
6912
|
value: y,
|
|
6913
6913
|
onChange: v,
|
|
6914
6914
|
onKeyDown: x,
|
|
@@ -7438,7 +7438,7 @@ function ua({ config: i }) {
|
|
|
7438
7438
|
] });
|
|
7439
7439
|
}
|
|
7440
7440
|
function ma(i = {}) {
|
|
7441
|
-
const { config: e, dataFields: r, context: t, onChartGenerated: n, onError: c } = i, l = ne(), [o, f] = L(!1), [h, y] = L(null), [w, S] = L(null), [T,
|
|
7441
|
+
const { config: e, dataFields: r, context: t, onChartGenerated: n, onError: c } = i, l = ne(), [o, f] = L(!1), [h, y] = L(null), [w, S] = L(null), [T, $] = L([]), N = G(null), z = e || (l == null ? void 0 : l.config), g = Z(() => {
|
|
7442
7442
|
if (r)
|
|
7443
7443
|
return r.map((x) => {
|
|
7444
7444
|
var v;
|
|
@@ -7451,7 +7451,7 @@ function ma(i = {}) {
|
|
|
7451
7451
|
});
|
|
7452
7452
|
}, [r]), d = E(
|
|
7453
7453
|
async (x) => {
|
|
7454
|
-
var u, _,
|
|
7454
|
+
var u, _, P;
|
|
7455
7455
|
if (!z) {
|
|
7456
7456
|
const M = "AI not configured. Provide config or wrap in NiceAIProvider.";
|
|
7457
7457
|
return c == null || c(M), { error: M };
|
|
@@ -7473,12 +7473,12 @@ function ma(i = {}) {
|
|
|
7473
7473
|
maxTokens: 1024
|
|
7474
7474
|
}), b = fa(p), I = {
|
|
7475
7475
|
config: b || void 0,
|
|
7476
|
-
rawResponse: (
|
|
7476
|
+
rawResponse: (P = (_ = p.choices[0]) == null ? void 0 : _.message) == null ? void 0 : P.content,
|
|
7477
7477
|
latencyMs: performance.now() - v,
|
|
7478
7478
|
error: b ? void 0 : "Failed to parse chart configuration",
|
|
7479
7479
|
suggestions: ha(b)
|
|
7480
7480
|
};
|
|
7481
|
-
return b && (n == null || n(b)), S(I),
|
|
7481
|
+
return b && (n == null || n(b)), S(I), $((B) => [...B.slice(-9), { request: x, result: I }]), I;
|
|
7482
7482
|
} catch (M) {
|
|
7483
7483
|
const R = M instanceof Error ? M.message : "AI request failed", p = {
|
|
7484
7484
|
error: R,
|
|
@@ -7566,7 +7566,7 @@ function Li({
|
|
|
7566
7566
|
renderChart: h
|
|
7567
7567
|
}) {
|
|
7568
7568
|
var _;
|
|
7569
|
-
const [y, w] = L(""), [S, T] = L(null),
|
|
7569
|
+
const [y, w] = L(""), [S, T] = L(null), $ = G(null), {
|
|
7570
7570
|
generateChart: N,
|
|
7571
7571
|
suggestAlternatives: z,
|
|
7572
7572
|
loading: g,
|
|
@@ -7591,45 +7591,45 @@ function Li({
|
|
|
7591
7591
|
], m = async () => {
|
|
7592
7592
|
if (!y.trim() || g)
|
|
7593
7593
|
return;
|
|
7594
|
-
const
|
|
7595
|
-
await N(
|
|
7596
|
-
}, x = (
|
|
7597
|
-
|
|
7598
|
-
}, v = (
|
|
7599
|
-
T(S ===
|
|
7600
|
-
}, u = async (
|
|
7594
|
+
const P = S ? `Create a ${S} chart: ${y}` : y;
|
|
7595
|
+
await N(P);
|
|
7596
|
+
}, x = (P) => {
|
|
7597
|
+
P.key === "Enter" && (P.preventDefault(), m());
|
|
7598
|
+
}, v = (P) => {
|
|
7599
|
+
T(S === P ? null : P);
|
|
7600
|
+
}, u = async (P) => {
|
|
7601
7601
|
if (!(d != null && d.config))
|
|
7602
7602
|
return;
|
|
7603
7603
|
const M = {
|
|
7604
7604
|
...d.config,
|
|
7605
|
-
type:
|
|
7605
|
+
type: P
|
|
7606
7606
|
};
|
|
7607
7607
|
t == null || t(M);
|
|
7608
7608
|
};
|
|
7609
7609
|
return k ? /* @__PURE__ */ s("div", { className: `nice-chart-ai ${o || ""}`, style: f, children: [
|
|
7610
|
-
c && /* @__PURE__ */ a("div", { className: "nice-chart-ai__types", children: C.map(({ type:
|
|
7610
|
+
c && /* @__PURE__ */ a("div", { className: "nice-chart-ai__types", children: C.map(({ type: P, icon: M, label: R }) => /* @__PURE__ */ s(
|
|
7611
7611
|
"button",
|
|
7612
7612
|
{
|
|
7613
7613
|
type: "button",
|
|
7614
|
-
className: `nice-chart-ai__type ${S ===
|
|
7615
|
-
onClick: () => v(
|
|
7614
|
+
className: `nice-chart-ai__type ${S === P ? "nice-chart-ai__type--selected" : ""}`,
|
|
7615
|
+
onClick: () => v(P),
|
|
7616
7616
|
title: R,
|
|
7617
7617
|
children: [
|
|
7618
7618
|
/* @__PURE__ */ a("span", { className: "nice-chart-ai__type-icon", children: M }),
|
|
7619
7619
|
/* @__PURE__ */ a("span", { className: "nice-chart-ai__type-label", children: R })
|
|
7620
7620
|
]
|
|
7621
7621
|
},
|
|
7622
|
-
|
|
7622
|
+
P
|
|
7623
7623
|
)) }),
|
|
7624
7624
|
/* @__PURE__ */ s("div", { className: "nice-chart-ai__input-wrapper", children: [
|
|
7625
7625
|
/* @__PURE__ */ a("span", { className: "nice-chart-ai__icon", children: "📊" }),
|
|
7626
7626
|
/* @__PURE__ */ a(
|
|
7627
7627
|
"input",
|
|
7628
7628
|
{
|
|
7629
|
-
ref:
|
|
7629
|
+
ref: $,
|
|
7630
7630
|
type: "text",
|
|
7631
7631
|
value: y,
|
|
7632
|
-
onChange: (
|
|
7632
|
+
onChange: (P) => w(P.target.value),
|
|
7633
7633
|
onKeyDown: x,
|
|
7634
7634
|
placeholder: n,
|
|
7635
7635
|
className: "nice-chart-ai__input",
|
|
@@ -7649,13 +7649,13 @@ function Li({
|
|
|
7649
7649
|
] }),
|
|
7650
7650
|
e && e.length > 0 && /* @__PURE__ */ s("div", { className: "nice-chart-ai__fields", children: [
|
|
7651
7651
|
/* @__PURE__ */ a("span", { className: "nice-chart-ai__fields-label", children: "Available fields:" }),
|
|
7652
|
-
e.map((
|
|
7652
|
+
e.map((P) => /* @__PURE__ */ a("span", { className: "nice-chart-ai__field-badge", title: P.type, children: P.label || P.name }, P.name))
|
|
7653
7653
|
] }),
|
|
7654
7654
|
d && /* @__PURE__ */ a("div", { className: "nice-chart-ai__result", children: d.error ? /* @__PURE__ */ a("div", { className: "nice-chart-ai__error", children: d.error }) : d.config && /* @__PURE__ */ s(ce, { children: [
|
|
7655
7655
|
/* @__PURE__ */ s("div", { className: "nice-chart-ai__result-header", children: [
|
|
7656
7656
|
/* @__PURE__ */ s("div", { className: "nice-chart-ai__result-info", children: [
|
|
7657
7657
|
/* @__PURE__ */ s("span", { className: "nice-chart-ai__chart-type", children: [
|
|
7658
|
-
(_ = C.find((
|
|
7658
|
+
(_ = C.find((P) => P.type === d.config.type)) == null ? void 0 : _.icon,
|
|
7659
7659
|
d.config.type.charAt(0).toUpperCase() + d.config.type.slice(1),
|
|
7660
7660
|
" ",
|
|
7661
7661
|
"Chart"
|
|
@@ -7678,16 +7678,16 @@ function Li({
|
|
|
7678
7678
|
] }),
|
|
7679
7679
|
/* @__PURE__ */ s("div", { className: "nice-chart-ai__alternatives", children: [
|
|
7680
7680
|
/* @__PURE__ */ a("span", { children: "Try also:" }),
|
|
7681
|
-
C.filter((
|
|
7681
|
+
C.filter((P) => P.type !== d.config.type).slice(0, 4).map(({ type: P, icon: M }) => /* @__PURE__ */ a(
|
|
7682
7682
|
"button",
|
|
7683
7683
|
{
|
|
7684
7684
|
type: "button",
|
|
7685
7685
|
className: "nice-chart-ai__alternative",
|
|
7686
|
-
onClick: () => u(
|
|
7687
|
-
title: `Convert to ${
|
|
7686
|
+
onClick: () => u(P),
|
|
7687
|
+
title: `Convert to ${P}`,
|
|
7688
7688
|
children: M
|
|
7689
7689
|
},
|
|
7690
|
-
|
|
7690
|
+
P
|
|
7691
7691
|
))
|
|
7692
7692
|
] }),
|
|
7693
7693
|
l && /* @__PURE__ */ a("div", { className: "nice-chart-ai__preview", children: h ? h(d.config) : /* @__PURE__ */ a(ga, { config: d.config }) }),
|
|
@@ -8136,7 +8136,7 @@ function ya(i = {}) {
|
|
|
8136
8136
|
debounceMs: c = 300,
|
|
8137
8137
|
onSuggestion: l,
|
|
8138
8138
|
onError: o
|
|
8139
|
-
} = i, f = ne(), [h, y] = L(!1), [w, S] = L([]), [T,
|
|
8139
|
+
} = i, f = ne(), [h, y] = L(!1), [w, S] = L([]), [T, $] = L(-1), N = G(null), z = G(null), g = e || (f == null ? void 0 : f.config), d = E(
|
|
8140
8140
|
async (R, p) => {
|
|
8141
8141
|
var I, B, q;
|
|
8142
8142
|
if (!g)
|
|
@@ -8167,7 +8167,7 @@ function ya(i = {}) {
|
|
|
8167
8167
|
rawResponse: (q = (B = se.choices[0]) == null ? void 0 : B.message) == null ? void 0 : q.content,
|
|
8168
8168
|
latencyMs: performance.now() - b
|
|
8169
8169
|
};
|
|
8170
|
-
return S(A),
|
|
8170
|
+
return S(A), $(A.length > 0 ? 0 : -1), l == null || l(A), j;
|
|
8171
8171
|
} catch (ee) {
|
|
8172
8172
|
const Y = ee instanceof Error ? ee.message : "Completion failed";
|
|
8173
8173
|
return o == null || o(Y), {
|
|
@@ -8292,14 +8292,14 @@ function ya(i = {}) {
|
|
|
8292
8292
|
), u = E(
|
|
8293
8293
|
(R = T) => {
|
|
8294
8294
|
const p = w[R];
|
|
8295
|
-
return S([]),
|
|
8295
|
+
return S([]), $(-1), p;
|
|
8296
8296
|
},
|
|
8297
8297
|
[w, T]
|
|
8298
8298
|
), _ = E(() => {
|
|
8299
|
-
S([]),
|
|
8300
|
-
}, []),
|
|
8299
|
+
S([]), $(-1);
|
|
8300
|
+
}, []), P = E(
|
|
8301
8301
|
(R) => {
|
|
8302
|
-
w.length !== 0 &&
|
|
8302
|
+
w.length !== 0 && $((p) => R === "up" ? p <= 0 ? w.length - 1 : p - 1 : p >= w.length - 1 ? 0 : p + 1);
|
|
8303
8303
|
},
|
|
8304
8304
|
[w.length]
|
|
8305
8305
|
), M = E(() => {
|
|
@@ -8317,7 +8317,7 @@ function ya(i = {}) {
|
|
|
8317
8317
|
activeSuggestion: T,
|
|
8318
8318
|
acceptSuggestion: u,
|
|
8319
8319
|
dismissSuggestions: _,
|
|
8320
|
-
navigateSuggestions:
|
|
8320
|
+
navigateSuggestions: P,
|
|
8321
8321
|
// Analysis
|
|
8322
8322
|
explainCode: C,
|
|
8323
8323
|
suggestRefactoring: m,
|
|
@@ -8402,12 +8402,12 @@ function Ii({
|
|
|
8402
8402
|
style: h,
|
|
8403
8403
|
renderEditor: y
|
|
8404
8404
|
}) {
|
|
8405
|
-
const [w, S] = L(i), [T,
|
|
8405
|
+
const [w, S] = L(i), [T, $] = L(null), [N, z] = L(null), [g, d] = L([]), [k, C] = L(null), [m, x] = L(
|
|
8406
8406
|
null
|
|
8407
8407
|
), v = G(null), {
|
|
8408
8408
|
getCompletionsDebounced: u,
|
|
8409
8409
|
suggestions: _,
|
|
8410
|
-
activeSuggestion:
|
|
8410
|
+
activeSuggestion: P,
|
|
8411
8411
|
acceptSuggestion: M,
|
|
8412
8412
|
dismissSuggestions: R,
|
|
8413
8413
|
navigateSuggestions: p,
|
|
@@ -8432,9 +8432,9 @@ function Ii({
|
|
|
8432
8432
|
else if (D.key === "ArrowDown")
|
|
8433
8433
|
D.preventDefault(), p("down");
|
|
8434
8434
|
else if (D.key === "Tab" || D.key === "Enter") {
|
|
8435
|
-
if (
|
|
8435
|
+
if (P >= 0) {
|
|
8436
8436
|
D.preventDefault();
|
|
8437
|
-
const F = M(
|
|
8437
|
+
const F = M(P);
|
|
8438
8438
|
F && (W(F), n == null || n(F));
|
|
8439
8439
|
}
|
|
8440
8440
|
} else D.key === "Escape" && R();
|
|
@@ -8481,7 +8481,7 @@ function Ii({
|
|
|
8481
8481
|
}, J = () => {
|
|
8482
8482
|
if (v.current) {
|
|
8483
8483
|
const D = v.current.selectionStart, F = v.current.selectionEnd;
|
|
8484
|
-
|
|
8484
|
+
$(D !== F ? w.slice(D, F) : null);
|
|
8485
8485
|
}
|
|
8486
8486
|
};
|
|
8487
8487
|
return Y ? y ? /* @__PURE__ */ a("div", { className: `nice-code-editor-ai ${f || ""}`, style: h, children: y({
|
|
@@ -8557,7 +8557,7 @@ function Ii({
|
|
|
8557
8557
|
_.map((D, F) => /* @__PURE__ */ s(
|
|
8558
8558
|
"div",
|
|
8559
8559
|
{
|
|
8560
|
-
className: `nice-code-editor-ai__suggestion ${F ===
|
|
8560
|
+
className: `nice-code-editor-ai__suggestion ${F === P ? "nice-code-editor-ai__suggestion--active" : ""}`,
|
|
8561
8561
|
onClick: () => {
|
|
8562
8562
|
const le = M(F);
|
|
8563
8563
|
le && (W(le), n == null || n(le));
|
|
@@ -8982,16 +8982,16 @@ function Na(i = {}) {
|
|
|
8982
8982
|
existingVariables: n,
|
|
8983
8983
|
onWorkflowGenerated: c,
|
|
8984
8984
|
onError: l
|
|
8985
|
-
} = i, o = ne(), [f, h] = L(!1), [y, w] = L(null), [S, T] = L([]),
|
|
8985
|
+
} = i, o = ne(), [f, h] = L(!1), [y, w] = L(null), [S, T] = L([]), $ = G(null), N = e || (o == null ? void 0 : o.config), z = E(
|
|
8986
8986
|
async (x) => {
|
|
8987
|
-
var u, _,
|
|
8987
|
+
var u, _, P;
|
|
8988
8988
|
if (!N) {
|
|
8989
8989
|
const M = "AI not configured";
|
|
8990
8990
|
return l == null || l(M), { error: M };
|
|
8991
8991
|
}
|
|
8992
8992
|
h(!0);
|
|
8993
8993
|
const v = performance.now();
|
|
8994
|
-
(u =
|
|
8994
|
+
(u = $.current) == null || u.abort(), $.current = new AbortController();
|
|
8995
8995
|
try {
|
|
8996
8996
|
const M = X(N), R = [
|
|
8997
8997
|
r,
|
|
@@ -9010,7 +9010,7 @@ function Na(i = {}) {
|
|
|
9010
9010
|
maxTokens: 2048
|
|
9011
9011
|
}), I = Fe(b), B = {
|
|
9012
9012
|
workflow: I || void 0,
|
|
9013
|
-
rawResponse: (
|
|
9013
|
+
rawResponse: (P = (_ = b.choices[0]) == null ? void 0 : _.message) == null ? void 0 : P.content,
|
|
9014
9014
|
latencyMs: performance.now() - v,
|
|
9015
9015
|
error: I ? void 0 : "Failed to generate workflow",
|
|
9016
9016
|
suggestions: Sa(I)
|
|
@@ -9066,7 +9066,7 @@ function Na(i = {}) {
|
|
|
9066
9066
|
return [];
|
|
9067
9067
|
h(!0);
|
|
9068
9068
|
try {
|
|
9069
|
-
const
|
|
9069
|
+
const P = X(N), M = x.nodes.find((I) => I.id === v), b = (((_ = (u = (await P.chat({
|
|
9070
9070
|
messages: [
|
|
9071
9071
|
{
|
|
9072
9072
|
role: "system",
|
|
@@ -9124,11 +9124,11 @@ Existing nodes: ${x.nodes.map((I) => I.label).join(", ")}`
|
|
|
9124
9124
|
w(null);
|
|
9125
9125
|
}, []), m = E(() => {
|
|
9126
9126
|
var x;
|
|
9127
|
-
(x =
|
|
9127
|
+
(x = $.current) == null || x.abort(), h(!1);
|
|
9128
9128
|
}, []);
|
|
9129
9129
|
return re(() => () => {
|
|
9130
9130
|
var x;
|
|
9131
|
-
(x =
|
|
9131
|
+
(x = $.current) == null || x.abort();
|
|
9132
9132
|
}, []), {
|
|
9133
9133
|
generateWorkflow: z,
|
|
9134
9134
|
optimizeWorkflow: g,
|
|
@@ -9200,7 +9200,7 @@ function Oi({
|
|
|
9200
9200
|
style: f,
|
|
9201
9201
|
renderWorkflow: h
|
|
9202
9202
|
}) {
|
|
9203
|
-
const [y, w] = L(""), [S, T] = L([]),
|
|
9203
|
+
const [y, w] = L(""), [S, T] = L([]), $ = G(null), { generateWorkflow: N, validateWorkflow: z, loading: g, lastResult: d, isConfigured: k } = Na({
|
|
9204
9204
|
config: i,
|
|
9205
9205
|
context: e,
|
|
9206
9206
|
existingRoles: r,
|
|
@@ -9209,7 +9209,7 @@ function Oi({
|
|
|
9209
9209
|
!y.trim() || g || await N(y);
|
|
9210
9210
|
}, m = (u) => {
|
|
9211
9211
|
var _;
|
|
9212
|
-
w(u), (_ =
|
|
9212
|
+
w(u), (_ = $.current) == null || _.focus();
|
|
9213
9213
|
}, x = async () => {
|
|
9214
9214
|
if (!(d != null && d.workflow))
|
|
9215
9215
|
return;
|
|
@@ -9218,15 +9218,15 @@ function Oi({
|
|
|
9218
9218
|
}, v = () => {
|
|
9219
9219
|
if (!(d != null && d.workflow))
|
|
9220
9220
|
return;
|
|
9221
|
-
const u = Aa(d.workflow), _ = new Blob([u], { type: "application/xml" }),
|
|
9222
|
-
M.href =
|
|
9221
|
+
const u = Aa(d.workflow), _ = new Blob([u], { type: "application/xml" }), P = URL.createObjectURL(_), M = document.createElement("a");
|
|
9222
|
+
M.href = P, M.download = `${d.workflow.name.replace(/\s+/g, "_")}.bpmn`, M.click(), URL.revokeObjectURL(P);
|
|
9223
9223
|
};
|
|
9224
9224
|
return k ? /* @__PURE__ */ s("div", { className: `nice-workflow-ai ${o || ""}`, style: f, children: [
|
|
9225
9225
|
/* @__PURE__ */ s("div", { className: "nice-workflow-ai__input-section", children: [
|
|
9226
9226
|
/* @__PURE__ */ a(
|
|
9227
9227
|
"textarea",
|
|
9228
9228
|
{
|
|
9229
|
-
ref:
|
|
9229
|
+
ref: $,
|
|
9230
9230
|
value: y,
|
|
9231
9231
|
onChange: (u) => w(u.target.value),
|
|
9232
9232
|
placeholder: n,
|
|
@@ -9784,39 +9784,39 @@ function ge(i) {
|
|
|
9784
9784
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
9785
9785
|
}
|
|
9786
9786
|
function Ma(i = {}) {
|
|
9787
|
-
const { config: e, dataSources: r, context: t, onReportGenerated: n, onError: c } = i, l = ne(), [o, f] = L(!1), [h, y] = L(null), [w, S] = L([]), T = G(null),
|
|
9787
|
+
const { config: e, dataSources: r, context: t, onReportGenerated: n, onError: c } = i, l = ne(), [o, f] = L(!1), [h, y] = L(null), [w, S] = L([]), T = G(null), $ = e || (l == null ? void 0 : l.config), N = E(
|
|
9788
9788
|
async (m) => {
|
|
9789
9789
|
var v, u, _;
|
|
9790
|
-
if (
|
|
9791
|
-
const
|
|
9792
|
-
return c == null || c(
|
|
9790
|
+
if (!$) {
|
|
9791
|
+
const P = "AI not configured";
|
|
9792
|
+
return c == null || c(P), { error: P };
|
|
9793
9793
|
}
|
|
9794
9794
|
f(!0);
|
|
9795
9795
|
const x = performance.now();
|
|
9796
9796
|
(v = T.current) == null || v.abort(), T.current = new AbortController();
|
|
9797
9797
|
try {
|
|
9798
|
-
const
|
|
9798
|
+
const P = X($), M = r ? r.map((B) => `- ${B.name} (${B.id}): ${B.fields.join(", ")}`).join(`
|
|
9799
9799
|
`) : void 0, R = oe(Te, {
|
|
9800
9800
|
description: m,
|
|
9801
9801
|
data_sources: M,
|
|
9802
9802
|
context: t
|
|
9803
|
-
}), p = await
|
|
9803
|
+
}), p = await P.chat({
|
|
9804
9804
|
messages: [
|
|
9805
9805
|
{ role: "system", content: R.system },
|
|
9806
9806
|
{ role: "user", content: R.user }
|
|
9807
9807
|
],
|
|
9808
9808
|
temperature: 0.5,
|
|
9809
9809
|
maxTokens: 2048
|
|
9810
|
-
}), b =
|
|
9810
|
+
}), b = Pa(p), I = {
|
|
9811
9811
|
layout: b || void 0,
|
|
9812
9812
|
rawResponse: (_ = (u = p.choices[0]) == null ? void 0 : u.message) == null ? void 0 : _.content,
|
|
9813
9813
|
latencyMs: performance.now() - x,
|
|
9814
9814
|
error: b ? void 0 : "Failed to generate report layout",
|
|
9815
|
-
suggestions:
|
|
9815
|
+
suggestions: $a(b)
|
|
9816
9816
|
};
|
|
9817
9817
|
return b && (n == null || n(b)), y(I), S((B) => [...B.slice(-9), { request: m, result: I }]), I;
|
|
9818
|
-
} catch (
|
|
9819
|
-
const M =
|
|
9818
|
+
} catch (P) {
|
|
9819
|
+
const M = P instanceof Error ? P.message : "Report generation failed", R = {
|
|
9820
9820
|
error: M,
|
|
9821
9821
|
latencyMs: performance.now() - x
|
|
9822
9822
|
};
|
|
@@ -9825,15 +9825,15 @@ function Ma(i = {}) {
|
|
|
9825
9825
|
f(!1);
|
|
9826
9826
|
}
|
|
9827
9827
|
},
|
|
9828
|
-
[
|
|
9828
|
+
[$, r, t, n, c]
|
|
9829
9829
|
), z = E(
|
|
9830
9830
|
async (m) => {
|
|
9831
9831
|
var x, v;
|
|
9832
|
-
if (
|
|
9832
|
+
if (!$)
|
|
9833
9833
|
return [];
|
|
9834
9834
|
f(!0);
|
|
9835
9835
|
try {
|
|
9836
|
-
const M = (((v = (x = (await X(
|
|
9836
|
+
const M = (((v = (x = (await X($).chat({
|
|
9837
9837
|
messages: [
|
|
9838
9838
|
{
|
|
9839
9839
|
role: "system",
|
|
@@ -9856,15 +9856,15 @@ Existing sections: ${m.sections.map((R) => R.type).join(", ")}`
|
|
|
9856
9856
|
}
|
|
9857
9857
|
return [];
|
|
9858
9858
|
},
|
|
9859
|
-
[
|
|
9859
|
+
[$]
|
|
9860
9860
|
), g = E(
|
|
9861
9861
|
async (m) => {
|
|
9862
9862
|
var x, v;
|
|
9863
|
-
if (
|
|
9863
|
+
if (!$)
|
|
9864
9864
|
return null;
|
|
9865
9865
|
f(!0);
|
|
9866
9866
|
try {
|
|
9867
|
-
return ((v = (x = (await X(
|
|
9867
|
+
return ((v = (x = (await X($).chat({
|
|
9868
9868
|
messages: [
|
|
9869
9869
|
{
|
|
9870
9870
|
role: "system",
|
|
@@ -9881,14 +9881,14 @@ Existing sections: ${m.sections.map((R) => R.type).join(", ")}`
|
|
|
9881
9881
|
f(!1);
|
|
9882
9882
|
}
|
|
9883
9883
|
},
|
|
9884
|
-
[
|
|
9884
|
+
[$]
|
|
9885
9885
|
), d = E(
|
|
9886
9886
|
async (m, x) => {
|
|
9887
9887
|
var v, u, _;
|
|
9888
|
-
if (
|
|
9888
|
+
if (!$)
|
|
9889
9889
|
return "bar";
|
|
9890
9890
|
try {
|
|
9891
|
-
const
|
|
9891
|
+
const P = X($), M = m.slice(0, 5), p = (_ = (u = (v = (await P.chat({
|
|
9892
9892
|
messages: [
|
|
9893
9893
|
{
|
|
9894
9894
|
role: "system",
|
|
@@ -9919,7 +9919,7 @@ Purpose: ${x}`
|
|
|
9919
9919
|
return "bar";
|
|
9920
9920
|
}
|
|
9921
9921
|
},
|
|
9922
|
-
[
|
|
9922
|
+
[$]
|
|
9923
9923
|
), k = E(() => {
|
|
9924
9924
|
y(null);
|
|
9925
9925
|
}, []), C = E(() => {
|
|
@@ -9939,10 +9939,10 @@ Purpose: ${x}`
|
|
|
9939
9939
|
history: w,
|
|
9940
9940
|
clearResults: k,
|
|
9941
9941
|
abort: C,
|
|
9942
|
-
isConfigured:
|
|
9942
|
+
isConfigured: !!$
|
|
9943
9943
|
};
|
|
9944
9944
|
}
|
|
9945
|
-
function
|
|
9945
|
+
function Pa(i) {
|
|
9946
9946
|
var e, r, t;
|
|
9947
9947
|
try {
|
|
9948
9948
|
const n = ((r = (e = i.choices[0]) == null ? void 0 : e.message) == null ? void 0 : r.content) || "", l = ((t = (n.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, n])[1]) == null ? void 0 : t.trim()) || n, o = JSON.parse(l);
|
|
@@ -9970,7 +9970,7 @@ function $a(i) {
|
|
|
9970
9970
|
}
|
|
9971
9971
|
return null;
|
|
9972
9972
|
}
|
|
9973
|
-
function
|
|
9973
|
+
function $a(i) {
|
|
9974
9974
|
if (!i)
|
|
9975
9975
|
return [];
|
|
9976
9976
|
const e = [], r = new Set(i.sections.map((t) => t.type));
|
|
@@ -10015,13 +10015,13 @@ function ji({
|
|
|
10015
10015
|
style: f,
|
|
10016
10016
|
renderReport: h
|
|
10017
10017
|
}) {
|
|
10018
|
-
const [y, w] = L(""), S = G(null), { generateReport: T, loading:
|
|
10018
|
+
const [y, w] = L(""), S = G(null), { generateReport: T, loading: $, lastResult: N, isConfigured: z } = Ma({
|
|
10019
10019
|
config: i,
|
|
10020
10020
|
dataSources: e,
|
|
10021
10021
|
context: r,
|
|
10022
10022
|
onReportGenerated: t
|
|
10023
10023
|
}), g = async () => {
|
|
10024
|
-
!y.trim() ||
|
|
10024
|
+
!y.trim() || $ || await T(y);
|
|
10025
10025
|
}, d = (C) => {
|
|
10026
10026
|
var m;
|
|
10027
10027
|
w(C.prompt), (m = S.current) == null || m.focus();
|
|
@@ -10055,7 +10055,7 @@ function ji({
|
|
|
10055
10055
|
placeholder: n,
|
|
10056
10056
|
className: "nice-report-ai__input",
|
|
10057
10057
|
rows: 3,
|
|
10058
|
-
disabled:
|
|
10058
|
+
disabled: $
|
|
10059
10059
|
}
|
|
10060
10060
|
),
|
|
10061
10061
|
/* @__PURE__ */ a(
|
|
@@ -10064,8 +10064,8 @@ function ji({
|
|
|
10064
10064
|
type: "button",
|
|
10065
10065
|
onClick: g,
|
|
10066
10066
|
className: "nice-report-ai__submit",
|
|
10067
|
-
disabled:
|
|
10068
|
-
children:
|
|
10067
|
+
disabled: $ || !y.trim(),
|
|
10068
|
+
children: $ ? /* @__PURE__ */ a("span", { className: "nice-report-ai__spinner" }) : "📄 Generate Report"
|
|
10069
10069
|
}
|
|
10070
10070
|
)
|
|
10071
10071
|
] }),
|
|
@@ -10579,13 +10579,13 @@ function Ia(i = {}) {
|
|
|
10579
10579
|
_ = "Extract colors and create a theme from the provided image palette";
|
|
10580
10580
|
break;
|
|
10581
10581
|
}
|
|
10582
|
-
const
|
|
10582
|
+
const P = oe(Re, {
|
|
10583
10583
|
description: _,
|
|
10584
10584
|
generate_dark_mode: r ? "true" : "false"
|
|
10585
10585
|
}), M = await u.chat({
|
|
10586
10586
|
messages: [
|
|
10587
|
-
{ role: "system", content:
|
|
10588
|
-
{ role: "user", content:
|
|
10587
|
+
{ role: "system", content: P.system },
|
|
10588
|
+
{ role: "user", content: P.user }
|
|
10589
10589
|
],
|
|
10590
10590
|
temperature: 0.6,
|
|
10591
10591
|
maxTokens: 2048
|
|
@@ -10599,11 +10599,11 @@ function Ia(i = {}) {
|
|
|
10599
10599
|
};
|
|
10600
10600
|
return R.light && (t == null || t(R.light, R.dark ?? void 0)), h(p), p;
|
|
10601
10601
|
} catch (u) {
|
|
10602
|
-
const _ = u instanceof Error ? u.message : "Theme generation failed",
|
|
10602
|
+
const _ = u instanceof Error ? u.message : "Theme generation failed", P = {
|
|
10603
10603
|
error: _,
|
|
10604
10604
|
latencyMs: performance.now() - k
|
|
10605
10605
|
};
|
|
10606
|
-
return h(
|
|
10606
|
+
return h(P), n == null || n(_), P;
|
|
10607
10607
|
} finally {
|
|
10608
10608
|
o(!1);
|
|
10609
10609
|
}
|
|
@@ -10640,7 +10640,7 @@ Adjustments: ${k}`
|
|
|
10640
10640
|
}
|
|
10641
10641
|
},
|
|
10642
10642
|
[w]
|
|
10643
|
-
),
|
|
10643
|
+
), $ = E((d) => {
|
|
10644
10644
|
const k = [];
|
|
10645
10645
|
return k.push(" /* Colors */"), Object.entries(d.colors).forEach(([C, m]) => {
|
|
10646
10646
|
k.push(` --nice-${be(C)}: ${m};`);
|
|
@@ -10707,7 +10707,7 @@ module.exports = ${JSON.stringify(k, null, 2)}`;
|
|
|
10707
10707
|
}, []), {
|
|
10708
10708
|
generateTheme: S,
|
|
10709
10709
|
adjustTheme: T,
|
|
10710
|
-
toCSSVariables:
|
|
10710
|
+
toCSSVariables: $,
|
|
10711
10711
|
toTailwindConfig: N,
|
|
10712
10712
|
loading: l,
|
|
10713
10713
|
lastResult: f,
|
|
@@ -10853,7 +10853,7 @@ function Di({
|
|
|
10853
10853
|
className: c,
|
|
10854
10854
|
style: l
|
|
10855
10855
|
}) {
|
|
10856
|
-
const [o, f] = L("description"), [h, y] = L(""), [w, S] = L(""), [T,
|
|
10856
|
+
const [o, f] = L("description"), [h, y] = L(""), [w, S] = L(""), [T, $] = L(""), [N, z] = L("var(--nice-primary, #0066cc)"), [g, d] = L("light"), { generateTheme: k, toCSSVariables: C, toTailwindConfig: m, loading: x, lastResult: v, isConfigured: u } = Ia({
|
|
10857
10857
|
config: i,
|
|
10858
10858
|
generateDarkMode: e,
|
|
10859
10859
|
onThemeGenerated: r
|
|
@@ -10876,7 +10876,7 @@ function Di({
|
|
|
10876
10876
|
b = { type: "description", value: h };
|
|
10877
10877
|
}
|
|
10878
10878
|
await k(b);
|
|
10879
|
-
},
|
|
10879
|
+
}, P = (b) => {
|
|
10880
10880
|
f("description"), y(b.prompt);
|
|
10881
10881
|
}, M = () => {
|
|
10882
10882
|
if (!(v != null && v.theme))
|
|
@@ -10895,7 +10895,7 @@ function Di({
|
|
|
10895
10895
|
{
|
|
10896
10896
|
type: "button",
|
|
10897
10897
|
className: "nice-theme-ai__preset",
|
|
10898
|
-
onClick: () =>
|
|
10898
|
+
onClick: () => P(b),
|
|
10899
10899
|
children: [
|
|
10900
10900
|
/* @__PURE__ */ a("span", { className: "nice-theme-ai__preset-icon", children: b.icon }),
|
|
10901
10901
|
/* @__PURE__ */ a("span", { className: "nice-theme-ai__preset-name", children: b.name })
|
|
@@ -10961,7 +10961,7 @@ function Di({
|
|
|
10961
10961
|
{
|
|
10962
10962
|
type: "text",
|
|
10963
10963
|
value: T,
|
|
10964
|
-
onChange: (b) =>
|
|
10964
|
+
onChange: (b) => $(b.target.value),
|
|
10965
10965
|
placeholder: "Industry (optional)",
|
|
10966
10966
|
className: "nice-theme-ai__input",
|
|
10967
10967
|
disabled: x
|
|
@@ -11505,14 +11505,14 @@ Return JSON with this structure:
|
|
|
11505
11505
|
],
|
|
11506
11506
|
temperature: 0.5,
|
|
11507
11507
|
maxTokens: 2048
|
|
11508
|
-
}),
|
|
11509
|
-
layout:
|
|
11508
|
+
}), P = Ea(_), M = {
|
|
11509
|
+
layout: P || void 0,
|
|
11510
11510
|
rawResponse: (x = (m = _.choices[0]) == null ? void 0 : m.message) == null ? void 0 : x.content,
|
|
11511
11511
|
latencyMs: performance.now() - k,
|
|
11512
|
-
error:
|
|
11513
|
-
suggestions: Ba(
|
|
11512
|
+
error: P ? void 0 : "Failed to generate layout",
|
|
11513
|
+
suggestions: Ba(P)
|
|
11514
11514
|
};
|
|
11515
|
-
return
|
|
11515
|
+
return P && (t == null || t(P)), h(M), M;
|
|
11516
11516
|
} catch (v) {
|
|
11517
11517
|
const u = v instanceof Error ? v.message : "Layout generation failed", _ = {
|
|
11518
11518
|
error: u,
|
|
@@ -11583,7 +11583,7 @@ Return JSON with this structure:
|
|
|
11583
11583
|
|
|
11584
11584
|
`);
|
|
11585
11585
|
}), d;
|
|
11586
|
-
}, []),
|
|
11586
|
+
}, []), $ = E((g) => {
|
|
11587
11587
|
const d = g.regions.map(
|
|
11588
11588
|
(k) => ` <div className="${g.id}__${k.id}">{/* ${k.type} */}</div>`
|
|
11589
11589
|
).join(`
|
|
@@ -11610,7 +11610,7 @@ ${d}
|
|
|
11610
11610
|
}, []), {
|
|
11611
11611
|
generateLayout: S,
|
|
11612
11612
|
toCSS: T,
|
|
11613
|
-
toReactComponent:
|
|
11613
|
+
toReactComponent: $,
|
|
11614
11614
|
loading: l,
|
|
11615
11615
|
lastResult: f,
|
|
11616
11616
|
clearResults: N,
|
|
@@ -11682,7 +11682,7 @@ function Hi({
|
|
|
11682
11682
|
style: l,
|
|
11683
11683
|
renderLayout: o
|
|
11684
11684
|
}) {
|
|
11685
|
-
const [f, h] = L(""), [y, w] = L(null), { generateLayout: S, toCSS: T, toReactComponent:
|
|
11685
|
+
const [f, h] = L(""), [y, w] = L(null), { generateLayout: S, toCSS: T, toReactComponent: $, loading: N, lastResult: z, isConfigured: g } = Ha({
|
|
11686
11686
|
config: i,
|
|
11687
11687
|
targetDevice: e,
|
|
11688
11688
|
onLayoutGenerated: r
|
|
@@ -11696,7 +11696,7 @@ function Hi({
|
|
|
11696
11696
|
}, C = () => {
|
|
11697
11697
|
if (!(z != null && z.layout))
|
|
11698
11698
|
return;
|
|
11699
|
-
const m =
|
|
11699
|
+
const m = $(z.layout), x = new Blob([m], { type: "text/javascript" }), v = URL.createObjectURL(x), u = document.createElement("a");
|
|
11700
11700
|
u.href = v, u.download = `${lr(z.layout.name)}.tsx`, u.click(), URL.revokeObjectURL(v);
|
|
11701
11701
|
};
|
|
11702
11702
|
return g ? /* @__PURE__ */ s("div", { className: `nice-layout-ai ${c || ""}`, style: l, children: [
|
|
@@ -12122,7 +12122,7 @@ ${k ? `Context: ${k}
|
|
|
12122
12122
|
passesAAALarge: x >= 4.5
|
|
12123
12123
|
};
|
|
12124
12124
|
return v.passesAA || (v.suggestions = Va(d, k, 4.5)), v;
|
|
12125
|
-
}, []),
|
|
12125
|
+
}, []), $ = E(
|
|
12126
12126
|
async (d) => {
|
|
12127
12127
|
var k, C;
|
|
12128
12128
|
if (!w)
|
|
@@ -12192,7 +12192,7 @@ ${d}` }
|
|
|
12192
12192
|
}, []), {
|
|
12193
12193
|
analyzeHTML: S,
|
|
12194
12194
|
checkContrast: T,
|
|
12195
|
-
validateARIA:
|
|
12195
|
+
validateARIA: $,
|
|
12196
12196
|
suggestAccessibleCode: N,
|
|
12197
12197
|
loading: l,
|
|
12198
12198
|
lastAudit: f,
|
|
@@ -12328,7 +12328,7 @@ function Ei({
|
|
|
12328
12328
|
style: c,
|
|
12329
12329
|
renderIssue: l
|
|
12330
12330
|
}) {
|
|
12331
|
-
const [o, f] = L(""), [h, y] = L("var(--nice-text, #333333)"), [w, S] = L("var(--nice-bg, #fff)"), [T,
|
|
12331
|
+
const [o, f] = L(""), [h, y] = L("var(--nice-text, #333333)"), [w, S] = L("var(--nice-bg, #fff)"), [T, $] = L(null), { analyzeHTML: N, checkContrast: z, suggestAccessibleCode: g, loading: d, lastAudit: k, isConfigured: C } = Ua({
|
|
12332
12332
|
config: i,
|
|
12333
12333
|
wcagLevel: e,
|
|
12334
12334
|
onAuditComplete: r
|
|
@@ -12336,7 +12336,7 @@ function Ei({
|
|
|
12336
12336
|
!o.trim() || d || await N(o);
|
|
12337
12337
|
}, x = () => {
|
|
12338
12338
|
const u = z(h, w);
|
|
12339
|
-
|
|
12339
|
+
$(u);
|
|
12340
12340
|
}, v = async () => {
|
|
12341
12341
|
if (!o.trim())
|
|
12342
12342
|
return;
|
|
@@ -13078,14 +13078,14 @@ function Ga(i = {}) {
|
|
|
13078
13078
|
maxSuggestions: n = 10,
|
|
13079
13079
|
onSuggestion: c,
|
|
13080
13080
|
onError: l
|
|
13081
|
-
} = i, o = ne(), [f, h] = L(!1), [y, w] = L(null), S = G(null), T = e || (o == null ? void 0 : o.config),
|
|
13081
|
+
} = i, o = ne(), [f, h] = L(!1), [y, w] = L(null), S = G(null), T = e || (o == null ? void 0 : o.config), $ = E(
|
|
13082
13082
|
(C) => {
|
|
13083
13083
|
const m = C.toLowerCase(), x = m.split(/\s+/);
|
|
13084
13084
|
return xe.map((v) => {
|
|
13085
13085
|
let u = 0;
|
|
13086
13086
|
return v.name === m ? u += 100 : v.name.includes(m) && (u += 50), x.forEach((_) => {
|
|
13087
|
-
v.keywords.forEach((
|
|
13088
|
-
|
|
13087
|
+
v.keywords.forEach((P) => {
|
|
13088
|
+
P === _ ? u += 30 : (P.includes(_) || _.includes(P)) && (u += 15);
|
|
13089
13089
|
});
|
|
13090
13090
|
}), v.category === m && (u += 20), {
|
|
13091
13091
|
id: `icon_${v.name}`,
|
|
@@ -13103,8 +13103,8 @@ function Ga(i = {}) {
|
|
|
13103
13103
|
[r, t, n]
|
|
13104
13104
|
), N = E(
|
|
13105
13105
|
async (C, m) => {
|
|
13106
|
-
var u, _,
|
|
13107
|
-
const x = performance.now(), v =
|
|
13106
|
+
var u, _, P, M;
|
|
13107
|
+
const x = performance.now(), v = $(C);
|
|
13108
13108
|
if (!T) {
|
|
13109
13109
|
const R = {
|
|
13110
13110
|
query: C,
|
|
@@ -13122,7 +13122,7 @@ Context:
|
|
|
13122
13122
|
- Related icons: ${((_ = m.relatedIcons) == null ? void 0 : _.join(", ")) || "none"}
|
|
13123
13123
|
- Theme: ${m.theme || "light"}
|
|
13124
13124
|
- Preferred style: ${m.preferredStyle || t}
|
|
13125
|
-
- Preferred library: ${m.preferredLibrary || r}` : "", B = (((M = (
|
|
13125
|
+
- Preferred library: ${m.preferredLibrary || r}` : "", B = (((M = (P = (await R.chat({
|
|
13126
13126
|
messages: [
|
|
13127
13127
|
{
|
|
13128
13128
|
role: "system",
|
|
@@ -13146,7 +13146,7 @@ Focus on semantic meaning and common UI patterns.`
|
|
|
13146
13146
|
],
|
|
13147
13147
|
temperature: 0.5,
|
|
13148
13148
|
maxTokens: 1024
|
|
13149
|
-
})).choices[0]) == null ? void 0 :
|
|
13149
|
+
})).choices[0]) == null ? void 0 : P.message) == null ? void 0 : M.content) || "").match(/\[[\s\S]*\]/);
|
|
13150
13150
|
let q = [];
|
|
13151
13151
|
if (B)
|
|
13152
13152
|
try {
|
|
@@ -13181,7 +13181,7 @@ Focus on semantic meaning and common UI patterns.`
|
|
|
13181
13181
|
h(!1);
|
|
13182
13182
|
}
|
|
13183
13183
|
},
|
|
13184
|
-
[T, r, t, n,
|
|
13184
|
+
[T, r, t, n, $, c, l]
|
|
13185
13185
|
), z = E(
|
|
13186
13186
|
(C) => xe.filter((m) => m.category === C).map((m) => ({
|
|
13187
13187
|
id: `icon_${m.name}`,
|
|
@@ -13209,7 +13209,7 @@ Focus on semantic meaning and common UI patterns.`
|
|
|
13209
13209
|
(C = S.current) == null || C.abort();
|
|
13210
13210
|
}, []), {
|
|
13211
13211
|
suggestIcons: N,
|
|
13212
|
-
localSearch:
|
|
13212
|
+
localSearch: $,
|
|
13213
13213
|
getByCategory: z,
|
|
13214
13214
|
categories: g,
|
|
13215
13215
|
loading: f,
|
|
@@ -13238,7 +13238,7 @@ function Bi({
|
|
|
13238
13238
|
className: o,
|
|
13239
13239
|
style: f
|
|
13240
13240
|
}) {
|
|
13241
|
-
const [h, y] = L(""), [w, S] = L(null), [T,
|
|
13241
|
+
const [h, y] = L(""), [w, S] = L(null), [T, $] = L(null), { suggestIcons: N, getByCategory: z, categories: g, loading: d, lastResult: k } = Ga({
|
|
13242
13242
|
config: i,
|
|
13243
13243
|
defaultLibrary: e,
|
|
13244
13244
|
defaultStyle: r,
|
|
@@ -13250,7 +13250,7 @@ function Bi({
|
|
|
13250
13250
|
}, x = (_) => {
|
|
13251
13251
|
w === _ ? S(null) : (S(_), y(""));
|
|
13252
13252
|
}, v = (_) => {
|
|
13253
|
-
|
|
13253
|
+
$(_), n == null || n(_);
|
|
13254
13254
|
}, u = w ? z(w) : (k == null ? void 0 : k.suggestions) || [];
|
|
13255
13255
|
return /* @__PURE__ */ s("div", { className: `nice-icon-ai ${o || ""}`, style: f, children: [
|
|
13256
13256
|
/* @__PURE__ */ s("div", { className: "nice-icon-ai__search", children: [
|
|
@@ -13595,7 +13595,7 @@ export {
|
|
|
13595
13595
|
Ei as NiceAccessibilityAI,
|
|
13596
13596
|
Li as NiceChartAI,
|
|
13597
13597
|
Ii as NiceCodeEditorAI,
|
|
13598
|
-
|
|
13598
|
+
$i as NiceDataGridAI,
|
|
13599
13599
|
Ci as NiceDataLabeler,
|
|
13600
13600
|
zi as NiceFormBuilderAI,
|
|
13601
13601
|
Bi as NiceIconSuggestorAI,
|
|
@@ -13607,7 +13607,7 @@ export {
|
|
|
13607
13607
|
Oi as NiceWorkflowDesignerAI,
|
|
13608
13608
|
ea as OllamaProvider,
|
|
13609
13609
|
Xr as OpenAIProvider,
|
|
13610
|
-
|
|
13610
|
+
$e as PROMPT_TEMPLATES,
|
|
13611
13611
|
Te as REPORT_LAYOUT_TEMPLATE,
|
|
13612
13612
|
pr as RateLimiter,
|
|
13613
13613
|
na as ResilientLLMClient,
|
|
@@ -13639,7 +13639,7 @@ export {
|
|
|
13639
13639
|
me as createLLMProvider,
|
|
13640
13640
|
X as createProviderFromConfig,
|
|
13641
13641
|
sa as createResilientClient,
|
|
13642
|
-
|
|
13642
|
+
Pi as createResilientClientWithDefaults,
|
|
13643
13643
|
wi as dateControlContext,
|
|
13644
13644
|
Ti as getTemplate,
|
|
13645
13645
|
Ri as getTemplatesByCategory,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui-ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Nice2Dev AI Hints — LLM-powered contextual suggestions for UI controls (OpenAI, Azure OpenAI, Ollama, custom endpoints)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"prepublishOnly": "npm run build"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@nice2dev/ui-core": "^1.0.
|
|
36
|
+
"@nice2dev/ui-core": "^1.0.27",
|
|
37
37
|
"react": ">=17.0.0",
|
|
38
38
|
"react-dom": ">=17.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@nice2dev/ui-core": "^1.0.
|
|
41
|
+
"@nice2dev/ui-core": "^1.0.27",
|
|
42
42
|
"@testing-library/jest-dom": "^6.9.1",
|
|
43
43
|
"@testing-library/react": "^14.0.0",
|
|
44
44
|
"@types/react": "^18.2.0",
|