@object-ui/plugin-chatbot 11.4.0 → 11.5.0
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/CHANGELOG.md +13 -0
- package/dist/index.js +475 -462
- package/dist/index.umd.cjs +1 -1
- package/dist/useAgents.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import { Children as t, Fragment as n, createContext as r, isValidElement as i, memo as a, useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
|
-
import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as P, DropdownMenuContent as F, DropdownMenuItem as I, DropdownMenuTrigger as L, Empty as ee, EmptyDescription as te, EmptyHeader as R, EmptyMedia as ne, EmptyTitle as re, HoverCard as z, HoverCardContent as ie, HoverCardTrigger as
|
|
3
|
+
import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as P, DropdownMenuContent as F, DropdownMenuItem as I, DropdownMenuTrigger as L, Empty as ee, EmptyDescription as te, EmptyHeader as R, EmptyMedia as ne, EmptyTitle as re, HoverCard as z, HoverCardContent as ie, HoverCardTrigger as B, Input as ae, Label as V, ScrollArea as oe, ScrollBar as se, Select as ce, SelectContent as le, SelectItem as ue, SelectTrigger as de, SelectValue as fe, Separator as pe, Sheet as me, SheetContent as he, SheetDescription as ge, SheetHeader as _e, SheetTitle as ve, Skeleton as ye, Table as be, TableBody as xe, TableCell as H, TableHead as U, TableHeader as W, TableRow as Se, Tabs as Ce, TabsList as we, TabsTrigger as G, Textarea as K, Tooltip as Te, TooltipContent as Ee, TooltipProvider as De, TooltipTrigger as Oe, cn as q } from "@object-ui/components";
|
|
4
4
|
import { AlertCircle as ke, ArrowDownIcon as J, ArrowRight as Ae, BookIcon as je, Bot as Me, BrainIcon as Ne, Check as Pe, CheckCircle2 as Y, CheckCircleIcon as Fe, CheckIcon as Ie, ChevronDownIcon as Le, ChevronLeftIcon as Re, ChevronRightIcon as ze, CircleIcon as Be, ClipboardList as Ve, Clock as He, Clock3 as Ue, ClockIcon as We, Copy as Ge, CopyIcon as Ke, CornerDownLeft as qe, CornerDownLeftIcon as Je, Eye as Ye, GitCompareArrows as Xe, HelpCircle as Ze, Hourglass as Qe, ImageIcon as $e, Inbox as et, Loader2 as tt, Loader2Icon as nt, Maximize2 as rt, MicIcon as it, Minimize2 as at, PaperclipIcon as ot, PlusIcon as st, RefreshCw as ct, Rocket as lt, Send as ut, ShieldCheck as dt, Sparkles as ft, SquareIcon as pt, Table2 as mt, TriangleAlert as ht, WifiOff as gt, WrenchIcon as _t, X as vt, XCircle as X, XCircleIcon as yt, XIcon as bt } from "lucide-react";
|
|
5
5
|
import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
6
6
|
import { useChat as xt } from "@ai-sdk/react";
|
|
@@ -539,34 +539,47 @@ function gn(e) {
|
|
|
539
539
|
active: e.active !== !1
|
|
540
540
|
}));
|
|
541
541
|
}
|
|
542
|
-
|
|
542
|
+
var _n = 3e4, vn = /* @__PURE__ */ new Map(), yn = /* @__PURE__ */ new Map();
|
|
543
|
+
function bn(e, t, n) {
|
|
544
|
+
if (n) vn.delete(e);
|
|
545
|
+
else {
|
|
546
|
+
let t = vn.get(e);
|
|
547
|
+
if (t && Date.now() - t.timestamp < _n) return Promise.resolve(t.data);
|
|
548
|
+
}
|
|
549
|
+
let r = yn.get(e);
|
|
550
|
+
if (r && !n) return r;
|
|
551
|
+
let i = `${e.replace(/\/$/, "")}/agents`, a = fetch(i, {
|
|
552
|
+
method: "GET",
|
|
553
|
+
headers: {
|
|
554
|
+
Accept: "application/json",
|
|
555
|
+
...t ?? {}
|
|
556
|
+
},
|
|
557
|
+
credentials: "include"
|
|
558
|
+
}).then(async (e) => {
|
|
559
|
+
if (!e.ok) throw Error(`Failed to load agents (${e.status})`);
|
|
560
|
+
let t = await e.json();
|
|
561
|
+
return gn(Array.isArray(t) ? t : t?.agents ?? []);
|
|
562
|
+
}).then((t) => (vn.set(e, {
|
|
563
|
+
data: t,
|
|
564
|
+
timestamp: Date.now()
|
|
565
|
+
}), t)).finally(() => {
|
|
566
|
+
yn.delete(e);
|
|
567
|
+
});
|
|
568
|
+
return yn.set(e, a), a;
|
|
569
|
+
}
|
|
570
|
+
function xn(e = {}) {
|
|
543
571
|
let { apiBase: t, headers: n, enabled: r = !0, fallback: i = [] } = e, [a, s] = d(i), [l, f] = d(!1), [p, m] = d(void 0), [h, g] = d(0), _ = u(n);
|
|
544
572
|
return _.current = n, c(() => {
|
|
545
573
|
if (!r || !t) return;
|
|
546
|
-
let e =
|
|
547
|
-
f(!0), m(void 0)
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
headers: {
|
|
552
|
-
Accept: "application/json",
|
|
553
|
-
..._.current ?? {}
|
|
554
|
-
},
|
|
555
|
-
credentials: "include",
|
|
556
|
-
signal: e.signal
|
|
557
|
-
}).then(async (e) => {
|
|
558
|
-
if (!e.ok) throw Error(`Failed to load agents (${e.status})`);
|
|
559
|
-
return e.json();
|
|
560
|
-
}).then((e) => {
|
|
561
|
-
if (n) return;
|
|
562
|
-
let t = gn(Array.isArray(e) ? e : e?.agents ?? []);
|
|
563
|
-
s(t.length > 0 ? t : i);
|
|
564
|
-
}).catch((e) => {
|
|
565
|
-
n || e.name === "AbortError" || (m(e), s(i));
|
|
574
|
+
let e = !1;
|
|
575
|
+
return f(!0), m(void 0), bn(t, _.current, h > 0).then((t) => {
|
|
576
|
+
e || s(t.length > 0 ? t : i);
|
|
577
|
+
}).catch((t) => {
|
|
578
|
+
e || (m(t), s(i));
|
|
566
579
|
}).finally(() => {
|
|
567
|
-
|
|
580
|
+
e || f(!1);
|
|
568
581
|
}), () => {
|
|
569
|
-
|
|
582
|
+
e = !0;
|
|
570
583
|
};
|
|
571
584
|
}, [
|
|
572
585
|
t,
|
|
@@ -581,13 +594,13 @@ function _n(e = {}) {
|
|
|
581
594
|
}
|
|
582
595
|
//#endregion
|
|
583
596
|
//#region src/useAiModels.ts
|
|
584
|
-
function
|
|
597
|
+
function Sn(e) {
|
|
585
598
|
return e.filter((e) => typeof e?.id == "string" && e.id.length > 0).map((e) => ({
|
|
586
599
|
id: e.id,
|
|
587
600
|
label: e.label || e.id
|
|
588
601
|
}));
|
|
589
602
|
}
|
|
590
|
-
function
|
|
603
|
+
function Cn(e = {}) {
|
|
591
604
|
let { apiBase: t, headers: n, enabled: r = !0 } = e, [i, a] = d([]), [s, l] = d(void 0), [f, p] = d(!1), [m, h] = d(void 0), [g, _] = d(0), v = u(n);
|
|
592
605
|
return v.current = n, c(() => {
|
|
593
606
|
if (!r || !t) return;
|
|
@@ -607,7 +620,7 @@ function yn(e = {}) {
|
|
|
607
620
|
if (!t.ok) throw Error(`Failed to load AI models (${t.status})`);
|
|
608
621
|
let r = await t.json();
|
|
609
622
|
if (n) return;
|
|
610
|
-
let c = Array.isArray(r) ? r : r?.models ?? [], u = Array.isArray(r) ? void 0 : r?.defaultModel, d =
|
|
623
|
+
let c = Array.isArray(r) ? r : r?.models ?? [], u = Array.isArray(r) ? void 0 : r?.defaultModel, d = Sn(c);
|
|
611
624
|
a(d), l(u ?? c.find((e) => e?.default)?.id ?? c[0]?.id), p(!1), d.length === 0 && o < 5 && !n && (o += 1, setTimeout(() => {
|
|
612
625
|
s();
|
|
613
626
|
}, 1200));
|
|
@@ -636,8 +649,8 @@ function yn(e = {}) {
|
|
|
636
649
|
}
|
|
637
650
|
//#endregion
|
|
638
651
|
//#region src/FloatingChatbotProvider.tsx
|
|
639
|
-
var
|
|
640
|
-
function
|
|
652
|
+
var wn = e.createContext(null);
|
|
653
|
+
function Tn({ defaultOpen: t = !1, children: n }) {
|
|
641
654
|
let [r, i] = e.useState(t), [a, o] = e.useState(!1), s = e.useMemo(() => ({
|
|
642
655
|
isOpen: r,
|
|
643
656
|
isFullscreen: a,
|
|
@@ -648,19 +661,19 @@ function xn({ defaultOpen: t = !1, children: n }) {
|
|
|
648
661
|
toggle: () => i((e) => !e),
|
|
649
662
|
toggleFullscreen: () => o((e) => !e)
|
|
650
663
|
}), [r, a]);
|
|
651
|
-
return /* @__PURE__ */ Q(
|
|
664
|
+
return /* @__PURE__ */ Q(wn.Provider, {
|
|
652
665
|
value: s,
|
|
653
666
|
children: n
|
|
654
667
|
});
|
|
655
668
|
}
|
|
656
|
-
function
|
|
657
|
-
let t = e.useContext(
|
|
669
|
+
function En() {
|
|
670
|
+
let t = e.useContext(wn);
|
|
658
671
|
if (!t) throw Error("useFloatingChatbot must be used within a <FloatingChatbotProvider>");
|
|
659
672
|
return t;
|
|
660
673
|
}
|
|
661
674
|
//#endregion
|
|
662
675
|
//#region src/FloatingChatbotTrigger.tsx
|
|
663
|
-
function
|
|
676
|
+
function Dn() {
|
|
664
677
|
try {
|
|
665
678
|
let { t: e } = Tt();
|
|
666
679
|
return (t, n) => {
|
|
@@ -671,7 +684,7 @@ function Cn() {
|
|
|
671
684
|
return (e, t) => t;
|
|
672
685
|
}
|
|
673
686
|
}
|
|
674
|
-
var
|
|
687
|
+
var On = {
|
|
675
688
|
32: "size-8",
|
|
676
689
|
36: "size-9",
|
|
677
690
|
40: "size-10",
|
|
@@ -684,17 +697,17 @@ var wn = {
|
|
|
684
697
|
72: "size-[72px]",
|
|
685
698
|
80: "size-20"
|
|
686
699
|
};
|
|
687
|
-
function
|
|
700
|
+
function kn(e, t) {
|
|
688
701
|
return t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t);
|
|
689
702
|
}
|
|
690
|
-
function
|
|
691
|
-
return
|
|
703
|
+
function An(e) {
|
|
704
|
+
return On[e] ?? On[kn(e, Object.keys(On).map(Number))];
|
|
692
705
|
}
|
|
693
|
-
function
|
|
694
|
-
let { isOpen: r, toggle: i } =
|
|
706
|
+
function jn({ position: e = "bottom-right", size: t = 56, className: n }) {
|
|
707
|
+
let { isOpen: r, toggle: i } = En(), a = Dn();
|
|
695
708
|
return /* @__PURE__ */ Q(v, {
|
|
696
709
|
onClick: i,
|
|
697
|
-
className: q("fixed z-50 rounded-full shadow-lg transition-transform hover:scale-105",
|
|
710
|
+
className: q("fixed z-50 rounded-full shadow-lg transition-transform hover:scale-105", An(t), r && "hidden", e === "bottom-right" ? "right-6 bottom-20 sm:bottom-6" : "left-6 bottom-20 sm:bottom-6", n),
|
|
698
711
|
size: "icon",
|
|
699
712
|
"aria-label": r ? a("closeChat", "Close chat") : a("openChat", "Open chat"),
|
|
700
713
|
"data-testid": "floating-chatbot-trigger",
|
|
@@ -703,7 +716,7 @@ function Dn({ position: e = "bottom-right", size: t = 56, className: n }) {
|
|
|
703
716
|
}
|
|
704
717
|
//#endregion
|
|
705
718
|
//#region src/FloatingChatbotPanel.tsx
|
|
706
|
-
var
|
|
719
|
+
var Mn = {
|
|
707
720
|
300: "sm:w-[300px]",
|
|
708
721
|
320: "sm:w-[320px]",
|
|
709
722
|
340: "sm:w-[340px]",
|
|
@@ -722,7 +735,7 @@ var On = {
|
|
|
722
735
|
640: "sm:w-[640px]",
|
|
723
736
|
720: "sm:w-[720px]",
|
|
724
737
|
800: "sm:w-[800px]"
|
|
725
|
-
},
|
|
738
|
+
}, Nn = {
|
|
726
739
|
360: "h-[min(360px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[360px]",
|
|
727
740
|
400: "h-[min(400px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[400px]",
|
|
728
741
|
420: "h-[min(420px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[420px]",
|
|
@@ -736,19 +749,19 @@ var On = {
|
|
|
736
749
|
720: "h-[min(720px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[720px]",
|
|
737
750
|
800: "h-[min(800px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[800px]"
|
|
738
751
|
};
|
|
739
|
-
function
|
|
752
|
+
function Pn(e, t) {
|
|
740
753
|
return t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t);
|
|
741
754
|
}
|
|
742
|
-
function
|
|
743
|
-
return
|
|
755
|
+
function Fn(e) {
|
|
756
|
+
return Mn[e] ?? Mn[Pn(e, Object.keys(Mn).map(Number))];
|
|
744
757
|
}
|
|
745
|
-
function
|
|
746
|
-
return
|
|
758
|
+
function In(e) {
|
|
759
|
+
return Nn[e] ?? Nn[Pn(e, Object.keys(Nn).map(Number))];
|
|
747
760
|
}
|
|
748
|
-
function
|
|
749
|
-
let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } =
|
|
761
|
+
function Ln({ title: e = "Chat", position: t = "bottom-right", width: n = 400, height: r = 520, children: i, className: a, headerExtra: o, headerActions: s }) {
|
|
762
|
+
let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } = En();
|
|
750
763
|
return c ? /* @__PURE__ */ $("div", {
|
|
751
|
-
className: q("fixed z-50 flex flex-col overflow-hidden border bg-background shadow-xl transition-all", l ? "inset-0 h-svh w-screen rounded-none" : t === "bottom-right" ? q("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:left-auto sm:right-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]",
|
|
764
|
+
className: q("fixed z-50 flex flex-col overflow-hidden border bg-background shadow-xl transition-all", l ? "inset-0 h-svh w-screen rounded-none" : t === "bottom-right" ? q("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:left-auto sm:right-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Fn(n), In(r)) : q("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:right-auto sm:left-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Fn(n), In(r)), a),
|
|
752
765
|
role: "dialog",
|
|
753
766
|
"aria-label": e,
|
|
754
767
|
"data-testid": "floating-chatbot-panel",
|
|
@@ -797,7 +810,7 @@ function Nn({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
|
|
|
797
810
|
}
|
|
798
811
|
//#endregion
|
|
799
812
|
//#region src/tool-display.ts
|
|
800
|
-
var
|
|
813
|
+
var Rn = {
|
|
801
814
|
ai: "AI",
|
|
802
815
|
api: "API",
|
|
803
816
|
crm: "CRM",
|
|
@@ -809,17 +822,17 @@ var Pn = {
|
|
|
809
822
|
url: "URL",
|
|
810
823
|
utc: "UTC"
|
|
811
824
|
};
|
|
812
|
-
function
|
|
825
|
+
function zn(e) {
|
|
813
826
|
if (!e) return "";
|
|
814
827
|
let t = String(e).trim();
|
|
815
828
|
if (!t) return "";
|
|
816
829
|
let n = t.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean);
|
|
817
830
|
return n.length === 0 ? t : n.map((e, t) => {
|
|
818
831
|
let n = e.toLowerCase();
|
|
819
|
-
return
|
|
832
|
+
return Rn[n] ? Rn[n] : t === 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n;
|
|
820
833
|
}).join(" ");
|
|
821
834
|
}
|
|
822
|
-
function
|
|
835
|
+
function Bn(e) {
|
|
823
836
|
if (e == null) return e;
|
|
824
837
|
let t = e;
|
|
825
838
|
for (let e = 0; e < 2; e++) {
|
|
@@ -837,7 +850,7 @@ function In(e) {
|
|
|
837
850
|
}
|
|
838
851
|
return t;
|
|
839
852
|
}
|
|
840
|
-
function
|
|
853
|
+
function Vn(e) {
|
|
841
854
|
let t = (e instanceof Error ? e.message : String(e ?? "")).replace(/\s+/g, " ").trim();
|
|
842
855
|
if (!t) return { summary: "Something went wrong. Please try again." };
|
|
843
856
|
let n = t.replace(/^Failed after \d+ attempts?\.\s*Last error:\s*/i, ""), r = n.match(/^Invalid error response format:\s*(.+)$/i)?.[1]?.trim() ?? n, i = r.match(/^([^:]{8,80}):\s+(.+)$/)?.[1]?.trim() ?? r.match(/^([^.;!?]+[.;!?])\s/)?.[1]?.trim() ?? (r.length > 140 ? `${r.slice(0, 137).trimEnd()}…` : r);
|
|
@@ -846,12 +859,12 @@ function Ln(e) {
|
|
|
846
859
|
details: n.length > i.length ? n : void 0
|
|
847
860
|
};
|
|
848
861
|
}
|
|
849
|
-
var
|
|
862
|
+
var Hn = /* @__PURE__ */ new Set([
|
|
850
863
|
"ai_design_quota_exhausted",
|
|
851
864
|
"ai_data_chat_trial_exhausted",
|
|
852
865
|
"ai_allowance_exhausted"
|
|
853
866
|
]);
|
|
854
|
-
function
|
|
867
|
+
function Un(e) {
|
|
855
868
|
let t = e instanceof Error ? e.message : String(e ?? "");
|
|
856
869
|
if (!t) return null;
|
|
857
870
|
let n = t.replace(/^Failed after \d+ attempts?\.\s*Last error:\s*/i, "").replace(/^Invalid error response format:\s*/i, "").trim(), r = n.indexOf("{"), i = n.lastIndexOf("}");
|
|
@@ -862,7 +875,7 @@ function zn(e) {
|
|
|
862
875
|
} catch {
|
|
863
876
|
return null;
|
|
864
877
|
}
|
|
865
|
-
return !a || typeof a.error != "string" || !
|
|
878
|
+
return !a || typeof a.error != "string" || !Hn.has(a.error) ? null : {
|
|
866
879
|
code: a.error,
|
|
867
880
|
message: typeof a.message == "string" ? a.message : "",
|
|
868
881
|
messageEn: typeof a.messageEn == "string" ? a.messageEn : void 0,
|
|
@@ -870,30 +883,30 @@ function zn(e) {
|
|
|
870
883
|
topUp: a.topUp === !0
|
|
871
884
|
};
|
|
872
885
|
}
|
|
873
|
-
function
|
|
886
|
+
function Wn(e) {
|
|
874
887
|
return !!(e && typeof e == "object" && e.notSent === !0);
|
|
875
888
|
}
|
|
876
|
-
function
|
|
889
|
+
function Gn(e) {
|
|
877
890
|
let t = e && typeof e == "object" ? e.status : void 0;
|
|
878
891
|
return typeof t == "number" ? t : void 0;
|
|
879
892
|
}
|
|
880
|
-
function
|
|
881
|
-
if (
|
|
893
|
+
function Kn(e) {
|
|
894
|
+
if (Gn(e) === 429) return !0;
|
|
882
895
|
let t = e instanceof Error ? e.message : typeof e == "string" ? e : "";
|
|
883
896
|
return /\b429\b|too many requests|rate[\s_-]?limit/i.test(t);
|
|
884
897
|
}
|
|
885
898
|
//#endregion
|
|
886
899
|
//#region src/elements/conversation.tsx
|
|
887
|
-
var
|
|
900
|
+
var qn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
|
|
888
901
|
className: q("relative flex-1 overflow-y-hidden", e),
|
|
889
902
|
initial: "smooth",
|
|
890
903
|
resize: "smooth",
|
|
891
904
|
role: "log",
|
|
892
905
|
...t
|
|
893
|
-
}),
|
|
906
|
+
}), Jn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et.Content, {
|
|
894
907
|
className: q("flex flex-col gap-8 p-4", e),
|
|
895
908
|
...t
|
|
896
|
-
}),
|
|
909
|
+
}), Yn = ({ className: e, title: t = "No messages yet", description: n = "Start a conversation to see messages here", icon: r, children: i, ...a }) => /* @__PURE__ */ Q("div", {
|
|
897
910
|
className: q("flex size-full flex-col items-center justify-center gap-3 p-8 text-center", e),
|
|
898
911
|
...a,
|
|
899
912
|
children: i ?? /* @__PURE__ */ $(Z, { children: [r && /* @__PURE__ */ Q("div", {
|
|
@@ -909,7 +922,7 @@ var Un = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
|
|
|
909
922
|
children: n
|
|
910
923
|
})]
|
|
911
924
|
})] })
|
|
912
|
-
}),
|
|
925
|
+
}), Xn = ({ className: e, ...t }) => {
|
|
913
926
|
let { isAtBottom: n, scrollToBottom: r } = Dt(), i = o(() => {
|
|
914
927
|
r();
|
|
915
928
|
}, [r]);
|
|
@@ -922,23 +935,23 @@ var Un = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
|
|
|
922
935
|
...t,
|
|
923
936
|
children: /* @__PURE__ */ Q(J, { className: "size-4" })
|
|
924
937
|
});
|
|
925
|
-
},
|
|
938
|
+
}, Zn = Ot("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
926
939
|
variants: { orientation: {
|
|
927
940
|
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
928
941
|
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
|
|
929
942
|
} },
|
|
930
943
|
defaultVariants: { orientation: "horizontal" }
|
|
931
944
|
});
|
|
932
|
-
function
|
|
945
|
+
function Qn({ className: e, orientation: t, ...n }) {
|
|
933
946
|
return /* @__PURE__ */ Q("div", {
|
|
934
947
|
role: "group",
|
|
935
948
|
"data-slot": "button-group",
|
|
936
949
|
"data-orientation": t,
|
|
937
|
-
className: q(
|
|
950
|
+
className: q(Zn({ orientation: t }), e),
|
|
938
951
|
...n
|
|
939
952
|
});
|
|
940
953
|
}
|
|
941
|
-
function
|
|
954
|
+
function $n({ className: e, asChild: t = !1, ...n }) {
|
|
942
955
|
return /* @__PURE__ */ Q(t ? kt : "div", {
|
|
943
956
|
className: q("flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", e),
|
|
944
957
|
...n
|
|
@@ -946,18 +959,18 @@ function Yn({ className: e, asChild: t = !1, ...n }) {
|
|
|
946
959
|
}
|
|
947
960
|
//#endregion
|
|
948
961
|
//#region src/elements/message.tsx
|
|
949
|
-
var
|
|
962
|
+
var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
950
963
|
className: q("group flex w-full max-w-[95%] flex-col gap-2", t === "user" ? "is-user ml-auto justify-end" : "is-assistant", e),
|
|
951
964
|
...n
|
|
952
|
-
}),
|
|
965
|
+
}), tr = ({ children: e, className: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
953
966
|
className: q("is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground", t),
|
|
954
967
|
...n,
|
|
955
968
|
children: e
|
|
956
|
-
}),
|
|
969
|
+
}), nr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
957
970
|
className: q("flex items-center gap-1", e),
|
|
958
971
|
...n,
|
|
959
972
|
children: t
|
|
960
|
-
}),
|
|
973
|
+
}), rr = ({ tooltip: e, children: t, label: n, variant: r = "ghost", size: i = "icon", ...a }) => {
|
|
961
974
|
let o = /* @__PURE__ */ $(v, {
|
|
962
975
|
size: i,
|
|
963
976
|
type: "button",
|
|
@@ -972,11 +985,11 @@ var Xn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
972
985
|
asChild: !0,
|
|
973
986
|
children: o
|
|
974
987
|
}), /* @__PURE__ */ Q(Ee, { children: /* @__PURE__ */ Q("p", { children: e }) })] }) }) : o;
|
|
975
|
-
},
|
|
976
|
-
let e = s(
|
|
988
|
+
}, ir = r(null), ar = () => {
|
|
989
|
+
let e = s(ir);
|
|
977
990
|
if (!e) throw Error("MessageBranch components must be used within MessageBranch");
|
|
978
991
|
return e;
|
|
979
|
-
},
|
|
992
|
+
}, or = ({ defaultBranch: e = 0, onBranchChange: t, className: n, ...r }) => {
|
|
980
993
|
let [i, a] = d(e), [o, s] = d([]), c = (e) => {
|
|
981
994
|
a(e), t?.(e);
|
|
982
995
|
}, l = {
|
|
@@ -991,15 +1004,15 @@ var Xn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
991
1004
|
branches: o,
|
|
992
1005
|
setBranches: s
|
|
993
1006
|
};
|
|
994
|
-
return /* @__PURE__ */ Q(
|
|
1007
|
+
return /* @__PURE__ */ Q(ir.Provider, {
|
|
995
1008
|
value: l,
|
|
996
1009
|
children: /* @__PURE__ */ Q("div", {
|
|
997
1010
|
className: q("grid w-full gap-2 [&>div]:pb-0", n),
|
|
998
1011
|
...r
|
|
999
1012
|
})
|
|
1000
1013
|
});
|
|
1001
|
-
},
|
|
1002
|
-
let { currentBranch: n, setBranches: r, branches: i } =
|
|
1014
|
+
}, sr = ({ children: e, ...t }) => {
|
|
1015
|
+
let { currentBranch: n, setBranches: r, branches: i } = ar(), a = Array.isArray(e) ? e : [e];
|
|
1003
1016
|
return c(() => {
|
|
1004
1017
|
i.length !== a.length && r(a);
|
|
1005
1018
|
}, [
|
|
@@ -1011,15 +1024,15 @@ var Xn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1011
1024
|
...t,
|
|
1012
1025
|
children: e
|
|
1013
1026
|
}, e.key));
|
|
1014
|
-
},
|
|
1015
|
-
let { totalBranches: r } =
|
|
1016
|
-
return r <= 1 ? null : /* @__PURE__ */ Q(
|
|
1027
|
+
}, cr = ({ className: e, from: t, ...n }) => {
|
|
1028
|
+
let { totalBranches: r } = ar();
|
|
1029
|
+
return r <= 1 ? null : /* @__PURE__ */ Q(Qn, {
|
|
1017
1030
|
className: "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
|
|
1018
1031
|
orientation: "horizontal",
|
|
1019
1032
|
...n
|
|
1020
1033
|
});
|
|
1021
|
-
},
|
|
1022
|
-
let { goToPrevious: n, totalBranches: r } =
|
|
1034
|
+
}, lr = ({ children: e, ...t }) => {
|
|
1035
|
+
let { goToPrevious: n, totalBranches: r } = ar();
|
|
1023
1036
|
return /* @__PURE__ */ Q(v, {
|
|
1024
1037
|
"aria-label": "Previous branch",
|
|
1025
1038
|
disabled: r <= 1,
|
|
@@ -1030,8 +1043,8 @@ var Xn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1030
1043
|
...t,
|
|
1031
1044
|
children: e ?? /* @__PURE__ */ Q(Re, { size: 14 })
|
|
1032
1045
|
});
|
|
1033
|
-
},
|
|
1034
|
-
let { goToNext: r, totalBranches: i } =
|
|
1046
|
+
}, ur = ({ children: e, className: t, ...n }) => {
|
|
1047
|
+
let { goToNext: r, totalBranches: i } = ar();
|
|
1035
1048
|
return /* @__PURE__ */ Q(v, {
|
|
1036
1049
|
"aria-label": "Next branch",
|
|
1037
1050
|
disabled: i <= 1,
|
|
@@ -1042,9 +1055,9 @@ var Xn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1042
1055
|
...n,
|
|
1043
1056
|
children: e ?? /* @__PURE__ */ Q(ze, { size: 14 })
|
|
1044
1057
|
});
|
|
1045
|
-
},
|
|
1046
|
-
let { currentBranch: n, totalBranches: r } =
|
|
1047
|
-
return /* @__PURE__ */ $(
|
|
1058
|
+
}, dr = ({ className: e, ...t }) => {
|
|
1059
|
+
let { currentBranch: n, totalBranches: r } = ar();
|
|
1060
|
+
return /* @__PURE__ */ $($n, {
|
|
1048
1061
|
className: q("border-none bg-transparent text-muted-foreground shadow-none", e),
|
|
1049
1062
|
...t,
|
|
1050
1063
|
children: [
|
|
@@ -1053,12 +1066,12 @@ var Xn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1053
1066
|
r
|
|
1054
1067
|
]
|
|
1055
1068
|
});
|
|
1056
|
-
},
|
|
1069
|
+
}, fr = a(({ className: e, ...t }) => /* @__PURE__ */ Q(At, {
|
|
1057
1070
|
className: q("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", e),
|
|
1058
1071
|
...t
|
|
1059
1072
|
}), (e, t) => e.children === t.children);
|
|
1060
|
-
|
|
1061
|
-
function
|
|
1073
|
+
fr.displayName = "MessageResponse";
|
|
1074
|
+
function pr({ data: e, className: t, onRemove: n, ...r }) {
|
|
1062
1075
|
let i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
|
|
1063
1076
|
return /* @__PURE__ */ Q("div", {
|
|
1064
1077
|
className: q("group relative size-24 overflow-hidden rounded-lg", t),
|
|
@@ -1102,21 +1115,21 @@ function lr({ data: e, className: t, onRemove: n, ...r }) {
|
|
|
1102
1115
|
})] })
|
|
1103
1116
|
});
|
|
1104
1117
|
}
|
|
1105
|
-
function
|
|
1118
|
+
function mr({ children: e, className: t, ...n }) {
|
|
1106
1119
|
return e ? /* @__PURE__ */ Q("div", {
|
|
1107
1120
|
className: q("ml-auto flex w-fit flex-wrap items-start gap-2", t),
|
|
1108
1121
|
...n,
|
|
1109
1122
|
children: e
|
|
1110
1123
|
}) : null;
|
|
1111
1124
|
}
|
|
1112
|
-
var
|
|
1125
|
+
var hr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
1113
1126
|
className: q("mt-4 flex w-full items-center justify-between gap-4", e),
|
|
1114
1127
|
...n,
|
|
1115
1128
|
children: t
|
|
1116
1129
|
});
|
|
1117
1130
|
//#endregion
|
|
1118
1131
|
//#region src/elements/ui/input-group.tsx
|
|
1119
|
-
function
|
|
1132
|
+
function gr({ className: e, ...t }) {
|
|
1120
1133
|
return /* @__PURE__ */ Q("div", {
|
|
1121
1134
|
"data-slot": "input-group",
|
|
1122
1135
|
role: "group",
|
|
@@ -1124,7 +1137,7 @@ function fr({ className: e, ...t }) {
|
|
|
1124
1137
|
...t
|
|
1125
1138
|
});
|
|
1126
1139
|
}
|
|
1127
|
-
var
|
|
1140
|
+
var _r = Ot("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
|
|
1128
1141
|
variants: { align: {
|
|
1129
1142
|
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
1130
1143
|
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
@@ -1133,19 +1146,19 @@ var pr = Ot("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 te
|
|
|
1133
1146
|
} },
|
|
1134
1147
|
defaultVariants: { align: "inline-start" }
|
|
1135
1148
|
});
|
|
1136
|
-
function
|
|
1149
|
+
function vr({ className: e, align: t = "inline-start", ...n }) {
|
|
1137
1150
|
return /* @__PURE__ */ Q("div", {
|
|
1138
1151
|
role: "group",
|
|
1139
1152
|
"data-slot": "input-group-addon",
|
|
1140
1153
|
"data-align": t,
|
|
1141
|
-
className: q(
|
|
1154
|
+
className: q(_r({ align: t }), e),
|
|
1142
1155
|
onClick: (e) => {
|
|
1143
1156
|
e.target.closest("button") || e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
1144
1157
|
},
|
|
1145
1158
|
...n
|
|
1146
1159
|
});
|
|
1147
1160
|
}
|
|
1148
|
-
var
|
|
1161
|
+
var yr = Ot("flex items-center gap-2 text-sm shadow-none", {
|
|
1149
1162
|
variants: { size: {
|
|
1150
1163
|
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
|
1151
1164
|
sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
|
|
@@ -1154,16 +1167,16 @@ var hr = Ot("flex items-center gap-2 text-sm shadow-none", {
|
|
|
1154
1167
|
} },
|
|
1155
1168
|
defaultVariants: { size: "xs" }
|
|
1156
1169
|
});
|
|
1157
|
-
function
|
|
1170
|
+
function br({ className: e, type: t = "button", variant: n = "ghost", size: r = "xs", ...i }) {
|
|
1158
1171
|
return /* @__PURE__ */ Q(v, {
|
|
1159
1172
|
type: t,
|
|
1160
1173
|
"data-size": r,
|
|
1161
1174
|
variant: n,
|
|
1162
|
-
className: q(
|
|
1175
|
+
className: q(yr({ size: r }), e),
|
|
1163
1176
|
...i
|
|
1164
1177
|
});
|
|
1165
1178
|
}
|
|
1166
|
-
function
|
|
1179
|
+
function xr({ className: e, ...t }) {
|
|
1167
1180
|
return /* @__PURE__ */ Q(K, {
|
|
1168
1181
|
"data-slot": "input-group-control",
|
|
1169
1182
|
className: q("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", e),
|
|
@@ -1172,16 +1185,16 @@ function _r({ className: e, ...t }) {
|
|
|
1172
1185
|
}
|
|
1173
1186
|
//#endregion
|
|
1174
1187
|
//#region src/elements/prompt-input.tsx
|
|
1175
|
-
var
|
|
1176
|
-
let e = s(
|
|
1188
|
+
var Sr = r(null), Cr = r(null), wr = () => {
|
|
1189
|
+
let e = s(Sr);
|
|
1177
1190
|
if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");
|
|
1178
1191
|
return e;
|
|
1179
|
-
},
|
|
1180
|
-
let e = s(
|
|
1192
|
+
}, Tr = () => s(Sr), Er = () => {
|
|
1193
|
+
let e = s(Cr);
|
|
1181
1194
|
if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");
|
|
1182
1195
|
return e;
|
|
1183
|
-
},
|
|
1184
|
-
function
|
|
1196
|
+
}, Dr = () => s(Cr);
|
|
1197
|
+
function Or({ initialInput: e = "", children: t }) {
|
|
1185
1198
|
let [n, r] = d(e), i = o(() => r(""), []), [a, s] = d([]), f = u(null), p = u(() => {}), m = o((e) => {
|
|
1186
1199
|
let t = Array.from(e);
|
|
1187
1200
|
t.length !== 0 && s((e) => e.concat(t.map((e) => ({
|
|
@@ -1236,22 +1249,22 @@ function wr({ initialInput: e = "", children: t }) {
|
|
|
1236
1249
|
y,
|
|
1237
1250
|
b
|
|
1238
1251
|
]);
|
|
1239
|
-
return /* @__PURE__ */ Q(
|
|
1252
|
+
return /* @__PURE__ */ Q(Sr.Provider, {
|
|
1240
1253
|
value: x,
|
|
1241
|
-
children: /* @__PURE__ */ Q(
|
|
1254
|
+
children: /* @__PURE__ */ Q(Cr.Provider, {
|
|
1242
1255
|
value: y,
|
|
1243
1256
|
children: t
|
|
1244
1257
|
})
|
|
1245
1258
|
});
|
|
1246
1259
|
}
|
|
1247
|
-
var
|
|
1248
|
-
let e =
|
|
1260
|
+
var kr = r(null), Ar = () => {
|
|
1261
|
+
let e = Dr(), t = s(kr), n = e ?? t;
|
|
1249
1262
|
if (!n) throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
|
|
1250
1263
|
return n;
|
|
1251
1264
|
};
|
|
1252
|
-
function
|
|
1253
|
-
let r =
|
|
1254
|
-
return /* @__PURE__ */ $(
|
|
1265
|
+
function jr({ data: e, className: t, ...n }) {
|
|
1266
|
+
let r = Ar(), i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
|
|
1267
|
+
return /* @__PURE__ */ $(Qr, { children: [/* @__PURE__ */ Q(B, {
|
|
1255
1268
|
asChild: !0,
|
|
1256
1269
|
children: /* @__PURE__ */ $("div", {
|
|
1257
1270
|
className: q("group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", t),
|
|
@@ -1288,7 +1301,7 @@ function Dr({ data: e, className: t, ...n }) {
|
|
|
1288
1301
|
children: o
|
|
1289
1302
|
})]
|
|
1290
1303
|
}, e.id)
|
|
1291
|
-
}), /* @__PURE__ */ Q(
|
|
1304
|
+
}), /* @__PURE__ */ Q(ei, {
|
|
1292
1305
|
className: "w-auto p-2",
|
|
1293
1306
|
children: /* @__PURE__ */ $("div", {
|
|
1294
1307
|
className: "w-auto space-y-3",
|
|
@@ -1317,16 +1330,16 @@ function Dr({ data: e, className: t, ...n }) {
|
|
|
1317
1330
|
})
|
|
1318
1331
|
})] });
|
|
1319
1332
|
}
|
|
1320
|
-
function
|
|
1321
|
-
let i =
|
|
1333
|
+
function Mr({ children: e, className: t, ...r }) {
|
|
1334
|
+
let i = Ar();
|
|
1322
1335
|
return i.files.length ? /* @__PURE__ */ Q("div", {
|
|
1323
1336
|
className: q("flex flex-wrap items-center gap-2 p-3 w-full", t),
|
|
1324
1337
|
...r,
|
|
1325
1338
|
children: i.files.map((t) => /* @__PURE__ */ Q(n, { children: e(t) }, t.id))
|
|
1326
1339
|
}) : null;
|
|
1327
1340
|
}
|
|
1328
|
-
var
|
|
1329
|
-
let n =
|
|
1341
|
+
var Nr = ({ label: e = "Add photos or files", ...t }) => {
|
|
1342
|
+
let n = Ar();
|
|
1330
1343
|
return /* @__PURE__ */ $(I, {
|
|
1331
1344
|
...t,
|
|
1332
1345
|
onSelect: (e) => {
|
|
@@ -1338,8 +1351,8 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1338
1351
|
e
|
|
1339
1352
|
]
|
|
1340
1353
|
});
|
|
1341
|
-
},
|
|
1342
|
-
let _ =
|
|
1354
|
+
}, Pr = ({ className: e, accept: t, multiple: n, fileInputLabel: r = "Upload files", globalDrop: i, syncHiddenInput: a, maxFiles: s, maxFileSize: f, onError: p, onSubmit: m, children: h, ...g }) => {
|
|
1355
|
+
let _ = Tr(), v = !!_, y = u(null), b = u(null), [x, S] = d([]), C = v ? _.attachments.files : x, w = u(C);
|
|
1343
1356
|
w.current = C;
|
|
1344
1357
|
let T = o(() => {
|
|
1345
1358
|
y.current?.click();
|
|
@@ -1487,20 +1500,20 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1487
1500
|
},
|
|
1488
1501
|
ref: b,
|
|
1489
1502
|
...g,
|
|
1490
|
-
children: /* @__PURE__ */ Q(
|
|
1503
|
+
children: /* @__PURE__ */ Q(gr, {
|
|
1491
1504
|
className: "overflow-hidden",
|
|
1492
1505
|
children: h
|
|
1493
1506
|
})
|
|
1494
1507
|
})] });
|
|
1495
|
-
return v ? L : /* @__PURE__ */ Q(
|
|
1508
|
+
return v ? L : /* @__PURE__ */ Q(kr.Provider, {
|
|
1496
1509
|
value: I,
|
|
1497
1510
|
children: L
|
|
1498
1511
|
});
|
|
1499
|
-
},
|
|
1512
|
+
}, Fr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1500
1513
|
className: q("contents", e),
|
|
1501
1514
|
...t
|
|
1502
|
-
}),
|
|
1503
|
-
let i =
|
|
1515
|
+
}), Ir = ({ onChange: e, className: t, placeholder: n = "What would you like to know?", ...r }) => {
|
|
1516
|
+
let i = Tr(), a = Ar(), [o, s] = d(!1), c = (e) => {
|
|
1504
1517
|
if (e.key === "Enter") {
|
|
1505
1518
|
if (o || e.nativeEvent.isComposing || e.shiftKey) return;
|
|
1506
1519
|
e.preventDefault();
|
|
@@ -1528,7 +1541,7 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1528
1541
|
i.textInput.setInput(t.currentTarget.value), e?.(t);
|
|
1529
1542
|
}
|
|
1530
1543
|
} : { onChange: e };
|
|
1531
|
-
return /* @__PURE__ */ Q(
|
|
1544
|
+
return /* @__PURE__ */ Q(xr, {
|
|
1532
1545
|
className: q("field-sizing-content max-h-48 min-h-16", t),
|
|
1533
1546
|
name: "message",
|
|
1534
1547
|
onCompositionEnd: () => s(!1),
|
|
@@ -1539,43 +1552,43 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1539
1552
|
...r,
|
|
1540
1553
|
...u
|
|
1541
1554
|
});
|
|
1542
|
-
},
|
|
1555
|
+
}, Lr = ({ className: e, ...t }) => /* @__PURE__ */ Q(vr, {
|
|
1543
1556
|
align: "block-end",
|
|
1544
1557
|
className: q("order-first flex-wrap gap-1", e),
|
|
1545
1558
|
...t
|
|
1546
|
-
}),
|
|
1559
|
+
}), Rr = ({ className: e, ...t }) => /* @__PURE__ */ Q(vr, {
|
|
1547
1560
|
align: "block-end",
|
|
1548
1561
|
className: q("justify-between gap-1", e),
|
|
1549
1562
|
...t
|
|
1550
|
-
}),
|
|
1563
|
+
}), zr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1551
1564
|
className: q("flex items-center gap-1", e),
|
|
1552
1565
|
...t
|
|
1553
|
-
}),
|
|
1566
|
+
}), Br = ({ variant: e = "ghost", className: n, size: r, ...i }) => {
|
|
1554
1567
|
let a = r ?? (t.count(i.children) > 1 ? "sm" : "icon-sm");
|
|
1555
|
-
return /* @__PURE__ */ Q(
|
|
1568
|
+
return /* @__PURE__ */ Q(br, {
|
|
1556
1569
|
className: q(n),
|
|
1557
1570
|
size: a,
|
|
1558
1571
|
type: "button",
|
|
1559
1572
|
variant: e,
|
|
1560
1573
|
...i
|
|
1561
1574
|
});
|
|
1562
|
-
},
|
|
1575
|
+
}, Vr = (e) => /* @__PURE__ */ Q(P, { ...e }), Hr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(L, {
|
|
1563
1576
|
asChild: !0,
|
|
1564
|
-
children: /* @__PURE__ */ Q(
|
|
1577
|
+
children: /* @__PURE__ */ Q(Br, {
|
|
1565
1578
|
className: e,
|
|
1566
1579
|
...n,
|
|
1567
1580
|
children: t ?? /* @__PURE__ */ Q(st, { className: "size-4" })
|
|
1568
1581
|
})
|
|
1569
|
-
}),
|
|
1582
|
+
}), Ur = ({ className: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
1570
1583
|
align: "start",
|
|
1571
1584
|
className: q(e),
|
|
1572
1585
|
...t
|
|
1573
|
-
}),
|
|
1586
|
+
}), Wr = ({ className: e, ...t }) => /* @__PURE__ */ Q(I, {
|
|
1574
1587
|
className: q(e),
|
|
1575
1588
|
...t
|
|
1576
|
-
}),
|
|
1589
|
+
}), Gr = ({ className: e, variant: t = "default", size: n = "icon-sm", status: r, children: i, ...a }) => {
|
|
1577
1590
|
let o = /* @__PURE__ */ Q(Je, { className: "size-4" });
|
|
1578
|
-
return r === "submitted" ? o = /* @__PURE__ */ Q(nt, { className: "size-4 animate-spin" }) : r === "streaming" ? o = /* @__PURE__ */ Q(pt, { className: "size-4" }) : r === "error" && (o = /* @__PURE__ */ Q(bt, { className: "size-4" })), /* @__PURE__ */ Q(
|
|
1591
|
+
return r === "submitted" ? o = /* @__PURE__ */ Q(nt, { className: "size-4 animate-spin" }) : r === "streaming" ? o = /* @__PURE__ */ Q(pt, { className: "size-4" }) : r === "error" && (o = /* @__PURE__ */ Q(bt, { className: "size-4" })), /* @__PURE__ */ Q(br, {
|
|
1579
1592
|
"aria-label": "Submit",
|
|
1580
1593
|
className: q(e),
|
|
1581
1594
|
size: n,
|
|
@@ -1584,7 +1597,7 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1584
1597
|
...a,
|
|
1585
1598
|
children: i ?? o
|
|
1586
1599
|
});
|
|
1587
|
-
},
|
|
1600
|
+
}, Kr = ({ className: e, textareaRef: t, onTranscriptionChange: n, ...r }) => {
|
|
1588
1601
|
let [i, a] = d(!1), [s, l] = d(null), f = u(null);
|
|
1589
1602
|
c(() => {
|
|
1590
1603
|
if (typeof window < "u" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window)) {
|
|
@@ -1614,69 +1627,69 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1614
1627
|
let p = o(() => {
|
|
1615
1628
|
s && (i ? s.stop() : s.start());
|
|
1616
1629
|
}, [s, i]);
|
|
1617
|
-
return /* @__PURE__ */ Q(
|
|
1630
|
+
return /* @__PURE__ */ Q(Br, {
|
|
1618
1631
|
className: q("relative transition-all duration-200", i && "animate-pulse bg-accent text-accent-foreground", e),
|
|
1619
1632
|
disabled: !s,
|
|
1620
1633
|
onClick: p,
|
|
1621
1634
|
...r,
|
|
1622
1635
|
children: /* @__PURE__ */ Q(it, { className: "size-4" })
|
|
1623
1636
|
});
|
|
1624
|
-
},
|
|
1637
|
+
}, qr = (e) => /* @__PURE__ */ Q(ce, { ...e }), Jr = ({ className: e, ...t }) => /* @__PURE__ */ Q(de, {
|
|
1625
1638
|
className: q("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors", "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground", e),
|
|
1626
1639
|
...t
|
|
1627
|
-
}),
|
|
1640
|
+
}), Yr = ({ className: e, ...t }) => /* @__PURE__ */ Q(le, {
|
|
1628
1641
|
className: q(e),
|
|
1629
1642
|
...t
|
|
1630
|
-
}),
|
|
1643
|
+
}), Xr = ({ className: e, ...t }) => /* @__PURE__ */ Q(ue, {
|
|
1631
1644
|
className: q(e),
|
|
1632
1645
|
...t
|
|
1633
|
-
}),
|
|
1646
|
+
}), Zr = ({ className: e, ...t }) => /* @__PURE__ */ Q(fe, {
|
|
1634
1647
|
className: q(e),
|
|
1635
1648
|
...t
|
|
1636
|
-
}),
|
|
1649
|
+
}), Qr = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ Q(z, {
|
|
1637
1650
|
closeDelay: t,
|
|
1638
1651
|
openDelay: e,
|
|
1639
1652
|
...n
|
|
1640
|
-
}),
|
|
1653
|
+
}), $r = (e) => /* @__PURE__ */ Q(B, { ...e }), ei = ({ align: e = "start", ...t }) => /* @__PURE__ */ Q(ie, {
|
|
1641
1654
|
align: e,
|
|
1642
1655
|
...t
|
|
1643
|
-
}),
|
|
1656
|
+
}), ti = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1644
1657
|
className: q(e),
|
|
1645
1658
|
...t
|
|
1646
|
-
}),
|
|
1659
|
+
}), ni = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1647
1660
|
className: q(e),
|
|
1648
1661
|
...t
|
|
1649
|
-
}),
|
|
1662
|
+
}), ri = ({ className: e, ...t }) => /* @__PURE__ */ Q("h3", {
|
|
1650
1663
|
className: q("mb-2 px-3 font-medium text-muted-foreground text-xs", e),
|
|
1651
1664
|
...t
|
|
1652
|
-
}),
|
|
1665
|
+
}), ii = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1653
1666
|
className: q("space-y-1", e),
|
|
1654
1667
|
...t
|
|
1655
|
-
}),
|
|
1668
|
+
}), ai = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1656
1669
|
className: q("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent", e),
|
|
1657
1670
|
...t
|
|
1658
|
-
}),
|
|
1671
|
+
}), oi = ({ className: e, ...t }) => /* @__PURE__ */ Q(D, {
|
|
1659
1672
|
className: q(e),
|
|
1660
1673
|
...t
|
|
1661
|
-
}),
|
|
1674
|
+
}), si = ({ className: e, ...t }) => /* @__PURE__ */ Q(A, {
|
|
1662
1675
|
className: q(e),
|
|
1663
1676
|
...t
|
|
1664
|
-
}),
|
|
1677
|
+
}), ci = ({ className: e, ...t }) => /* @__PURE__ */ Q(M, {
|
|
1665
1678
|
className: q(e),
|
|
1666
1679
|
...t
|
|
1667
|
-
}),
|
|
1680
|
+
}), li = ({ className: e, ...t }) => /* @__PURE__ */ Q(O, {
|
|
1668
1681
|
className: q(e),
|
|
1669
1682
|
...t
|
|
1670
|
-
}),
|
|
1683
|
+
}), ui = ({ className: e, ...t }) => /* @__PURE__ */ Q(k, {
|
|
1671
1684
|
className: q(e),
|
|
1672
1685
|
...t
|
|
1673
|
-
}),
|
|
1686
|
+
}), di = ({ className: e, ...t }) => /* @__PURE__ */ Q(j, {
|
|
1674
1687
|
className: q(e),
|
|
1675
1688
|
...t
|
|
1676
|
-
}),
|
|
1689
|
+
}), fi = ({ className: e, ...t }) => /* @__PURE__ */ Q(N, {
|
|
1677
1690
|
className: q(e),
|
|
1678
1691
|
...t
|
|
1679
|
-
}),
|
|
1692
|
+
}), pi = ({ className: e, children: t, ...n }) => /* @__PURE__ */ $(oe, {
|
|
1680
1693
|
className: "w-full overflow-x-auto whitespace-nowrap",
|
|
1681
1694
|
...n,
|
|
1682
1695
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -1686,7 +1699,7 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1686
1699
|
className: "hidden",
|
|
1687
1700
|
orientation: "horizontal"
|
|
1688
1701
|
})]
|
|
1689
|
-
}),
|
|
1702
|
+
}), mi = ({ suggestion: e, onClick: t, className: n, variant: r = "outline", size: i = "sm", children: a, ...o }) => /* @__PURE__ */ Q(v, {
|
|
1690
1703
|
className: q("cursor-pointer rounded-full px-4", n),
|
|
1691
1704
|
onClick: () => {
|
|
1692
1705
|
t?.(e);
|
|
@@ -1696,7 +1709,7 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1696
1709
|
variant: r,
|
|
1697
1710
|
...o,
|
|
1698
1711
|
children: a || e
|
|
1699
|
-
}),
|
|
1712
|
+
}), hi = r({ code: "" }), gi = {
|
|
1700
1713
|
name: "line-numbers",
|
|
1701
1714
|
line(e, t) {
|
|
1702
1715
|
e.children.unshift({
|
|
@@ -1717,8 +1730,8 @@ var kr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1717
1730
|
});
|
|
1718
1731
|
}
|
|
1719
1732
|
};
|
|
1720
|
-
async function
|
|
1721
|
-
let r = n ? [
|
|
1733
|
+
async function _i(e, t, n = !1) {
|
|
1734
|
+
let r = n ? [gi] : [];
|
|
1722
1735
|
return await Promise.all([Mt(e, {
|
|
1723
1736
|
lang: t,
|
|
1724
1737
|
theme: "one-light",
|
|
@@ -1729,9 +1742,9 @@ async function pi(e, t, n = !1) {
|
|
|
1729
1742
|
transformers: r
|
|
1730
1743
|
})]);
|
|
1731
1744
|
}
|
|
1732
|
-
var
|
|
1745
|
+
var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, children: i, ...a }) => {
|
|
1733
1746
|
let [o, s] = d(""), [l, f] = d(""), p = u(!1);
|
|
1734
|
-
return c(() => (
|
|
1747
|
+
return c(() => (_i(e, t, n).then(([e, t]) => {
|
|
1735
1748
|
p.current ||= (s(e), f(t), !0);
|
|
1736
1749
|
}), () => {
|
|
1737
1750
|
p.current = !1;
|
|
@@ -1739,7 +1752,7 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1739
1752
|
e,
|
|
1740
1753
|
t,
|
|
1741
1754
|
n
|
|
1742
|
-
]), /* @__PURE__ */ Q(
|
|
1755
|
+
]), /* @__PURE__ */ Q(hi.Provider, {
|
|
1743
1756
|
value: { code: e },
|
|
1744
1757
|
children: /* @__PURE__ */ Q("div", {
|
|
1745
1758
|
className: q("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", r),
|
|
@@ -1763,8 +1776,8 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1763
1776
|
})
|
|
1764
1777
|
})
|
|
1765
1778
|
});
|
|
1766
|
-
},
|
|
1767
|
-
let [o, c] = d(!1), { code: l } = s(
|
|
1779
|
+
}, yi = ({ onCopy: e, onError: t, timeout: n = 2e3, children: r, className: i, ...a }) => {
|
|
1780
|
+
let [o, c] = d(!1), { code: l } = s(hi), u = async () => {
|
|
1768
1781
|
if (typeof window > "u" || !navigator?.clipboard?.writeText) {
|
|
1769
1782
|
t?.(/* @__PURE__ */ Error("Clipboard API not available"));
|
|
1770
1783
|
return;
|
|
@@ -1783,10 +1796,10 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1783
1796
|
...a,
|
|
1784
1797
|
children: r ?? /* @__PURE__ */ Q(f, { size: 14 })
|
|
1785
1798
|
});
|
|
1786
|
-
},
|
|
1799
|
+
}, bi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
|
|
1787
1800
|
className: q("not-prose mb-4 w-full rounded-md border", e),
|
|
1788
1801
|
...t
|
|
1789
|
-
}),
|
|
1802
|
+
}), xi = (e) => /* @__PURE__ */ $(_, {
|
|
1790
1803
|
className: "gap-1.5 rounded-full text-xs",
|
|
1791
1804
|
variant: "secondary",
|
|
1792
1805
|
children: [{
|
|
@@ -1806,7 +1819,7 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1806
1819
|
"output-error": "Error",
|
|
1807
1820
|
"output-denied": "Denied"
|
|
1808
1821
|
}[e]]
|
|
1809
|
-
}),
|
|
1822
|
+
}), Si = ({ className: e, title: t, type: n, state: r, ...i }) => /* @__PURE__ */ $(E, {
|
|
1810
1823
|
className: q("flex w-full items-center justify-between gap-4 p-3", e),
|
|
1811
1824
|
...i,
|
|
1812
1825
|
children: [/* @__PURE__ */ $("div", {
|
|
@@ -1817,13 +1830,13 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1817
1830
|
className: "font-medium text-sm",
|
|
1818
1831
|
children: t ?? n.split("-").slice(1).join("-")
|
|
1819
1832
|
}),
|
|
1820
|
-
|
|
1833
|
+
xi(r)
|
|
1821
1834
|
]
|
|
1822
1835
|
}), /* @__PURE__ */ Q(Le, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })]
|
|
1823
|
-
}),
|
|
1836
|
+
}), Ci = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
|
|
1824
1837
|
className: q("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
1825
1838
|
...t
|
|
1826
|
-
}),
|
|
1839
|
+
}), wi = ({ className: e, input: t, ...n }) => /* @__PURE__ */ $("div", {
|
|
1827
1840
|
className: q("space-y-2 overflow-hidden p-4", e),
|
|
1828
1841
|
...n,
|
|
1829
1842
|
children: [/* @__PURE__ */ Q("h4", {
|
|
@@ -1831,18 +1844,18 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1831
1844
|
children: "Parameters"
|
|
1832
1845
|
}), /* @__PURE__ */ Q("div", {
|
|
1833
1846
|
className: "rounded-md bg-muted/50",
|
|
1834
|
-
children: /* @__PURE__ */ Q(
|
|
1847
|
+
children: /* @__PURE__ */ Q(vi, {
|
|
1835
1848
|
code: JSON.stringify(t, null, 2),
|
|
1836
1849
|
language: "json"
|
|
1837
1850
|
})
|
|
1838
1851
|
})]
|
|
1839
|
-
}),
|
|
1852
|
+
}), Ti = ({ className: e, output: t, errorText: n, ...r }) => {
|
|
1840
1853
|
if (!(t || n)) return null;
|
|
1841
1854
|
let a = /* @__PURE__ */ Q("div", { children: t });
|
|
1842
|
-
return typeof t == "object" && !i(t) ? a = /* @__PURE__ */ Q(
|
|
1855
|
+
return typeof t == "object" && !i(t) ? a = /* @__PURE__ */ Q(vi, {
|
|
1843
1856
|
code: JSON.stringify(t, null, 2),
|
|
1844
1857
|
language: "json"
|
|
1845
|
-
}) : typeof t == "string" && (a = /* @__PURE__ */ Q(
|
|
1858
|
+
}) : typeof t == "string" && (a = /* @__PURE__ */ Q(vi, {
|
|
1846
1859
|
code: t,
|
|
1847
1860
|
language: "json"
|
|
1848
1861
|
})), /* @__PURE__ */ $("div", {
|
|
@@ -1856,7 +1869,7 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1856
1869
|
children: [n && /* @__PURE__ */ Q("div", { children: n }), a]
|
|
1857
1870
|
})]
|
|
1858
1871
|
});
|
|
1859
|
-
},
|
|
1872
|
+
}, Ei = a(({ children: e, as: t = "p", className: n, duration: r = 2, spread: i = 2 }) => {
|
|
1860
1873
|
let a = Pt.create(t), o = l(() => (e?.length ?? 0) * i, [e, i]);
|
|
1861
1874
|
return /* @__PURE__ */ Q(a, {
|
|
1862
1875
|
animate: { backgroundPosition: "0% center" },
|
|
@@ -1873,11 +1886,11 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1873
1886
|
},
|
|
1874
1887
|
children: e
|
|
1875
1888
|
});
|
|
1876
|
-
}),
|
|
1877
|
-
let e = s(
|
|
1889
|
+
}), Di = r(null), Oi = () => {
|
|
1890
|
+
let e = s(Di);
|
|
1878
1891
|
if (!e) throw Error("Reasoning components must be used within Reasoning");
|
|
1879
1892
|
return e;
|
|
1880
|
-
},
|
|
1893
|
+
}, ki = 1e3, Ai = 1e3, ji = a(({ className: e, isStreaming: t = !1, open: n, defaultOpen: r = !0, onOpenChange: i, duration: a, children: o, ...s }) => {
|
|
1881
1894
|
let [l, u] = Nt({
|
|
1882
1895
|
prop: n,
|
|
1883
1896
|
defaultProp: r,
|
|
@@ -1887,7 +1900,7 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1887
1900
|
defaultProp: void 0
|
|
1888
1901
|
}), [m, h] = d(!1), [g, _] = d(null);
|
|
1889
1902
|
return c(() => {
|
|
1890
|
-
t ? g === null && _(Date.now()) : g !== null && (p(Math.ceil((Date.now() - g) /
|
|
1903
|
+
t ? g === null && _(Date.now()) : g !== null && (p(Math.ceil((Date.now() - g) / Ai)), _(null));
|
|
1891
1904
|
}, [
|
|
1892
1905
|
t,
|
|
1893
1906
|
g,
|
|
@@ -1896,7 +1909,7 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1896
1909
|
if (r && !t && l && !m) {
|
|
1897
1910
|
let e = setTimeout(() => {
|
|
1898
1911
|
u(!1), h(!0);
|
|
1899
|
-
},
|
|
1912
|
+
}, ki);
|
|
1900
1913
|
return () => clearTimeout(e);
|
|
1901
1914
|
}
|
|
1902
1915
|
}, [
|
|
@@ -1905,7 +1918,7 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1905
1918
|
r,
|
|
1906
1919
|
u,
|
|
1907
1920
|
m
|
|
1908
|
-
]), /* @__PURE__ */ Q(
|
|
1921
|
+
]), /* @__PURE__ */ Q(Di.Provider, {
|
|
1909
1922
|
value: {
|
|
1910
1923
|
isStreaming: t,
|
|
1911
1924
|
isOpen: l,
|
|
@@ -1922,15 +1935,15 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1922
1935
|
children: o
|
|
1923
1936
|
})
|
|
1924
1937
|
});
|
|
1925
|
-
}),
|
|
1938
|
+
}), Mi = (e, t) => e || t === 0 ? /* @__PURE__ */ Q(Ei, {
|
|
1926
1939
|
duration: 1,
|
|
1927
1940
|
children: "Thinking..."
|
|
1928
1941
|
}) : t === void 0 ? /* @__PURE__ */ Q("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ $("p", { children: [
|
|
1929
1942
|
"Thought for ",
|
|
1930
1943
|
t,
|
|
1931
1944
|
" seconds"
|
|
1932
|
-
] }),
|
|
1933
|
-
let { isStreaming: i, isOpen: a, duration: o } =
|
|
1945
|
+
] }), Ni = a(({ className: e, children: t, getThinkingMessage: n = Mi, ...r }) => {
|
|
1946
|
+
let { isStreaming: i, isOpen: a, duration: o } = Oi();
|
|
1934
1947
|
return /* @__PURE__ */ Q(E, {
|
|
1935
1948
|
className: q("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground", e),
|
|
1936
1949
|
...r,
|
|
@@ -1940,18 +1953,18 @@ var mi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1940
1953
|
/* @__PURE__ */ Q(Le, { className: q("size-4 transition-transform", a ? "rotate-180" : "rotate-0") })
|
|
1941
1954
|
] })
|
|
1942
1955
|
});
|
|
1943
|
-
}),
|
|
1956
|
+
}), Pi = a(({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(T, {
|
|
1944
1957
|
className: q("mt-4 text-sm", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
1945
1958
|
...n,
|
|
1946
1959
|
children: /* @__PURE__ */ Q(At, { children: t })
|
|
1947
1960
|
}));
|
|
1948
|
-
|
|
1961
|
+
ji.displayName = "Reasoning", Ni.displayName = "ReasoningTrigger", Pi.displayName = "ReasoningContent";
|
|
1949
1962
|
//#endregion
|
|
1950
1963
|
//#region src/elements/sources.tsx
|
|
1951
|
-
var
|
|
1964
|
+
var Fi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
|
|
1952
1965
|
className: q("not-prose mb-4 text-primary text-xs", e),
|
|
1953
1966
|
...t
|
|
1954
|
-
}),
|
|
1967
|
+
}), Ii = ({ className: e, count: t, children: n, ...r }) => /* @__PURE__ */ Q(E, {
|
|
1955
1968
|
className: q("flex items-center gap-2", e),
|
|
1956
1969
|
...r,
|
|
1957
1970
|
children: n ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $("p", {
|
|
@@ -1962,10 +1975,10 @@ var ji = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
|
|
|
1962
1975
|
" sources"
|
|
1963
1976
|
]
|
|
1964
1977
|
}), /* @__PURE__ */ Q(Le, { className: "h-4 w-4" })] })
|
|
1965
|
-
}),
|
|
1978
|
+
}), Li = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
|
|
1966
1979
|
className: q("mt-3 flex w-fit flex-col gap-2", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
1967
1980
|
...t
|
|
1968
|
-
}),
|
|
1981
|
+
}), Ri = ({ href: e, title: t, children: n, ...r }) => /* @__PURE__ */ Q("a", {
|
|
1969
1982
|
className: "flex items-center gap-2",
|
|
1970
1983
|
href: e,
|
|
1971
1984
|
rel: "noreferrer",
|
|
@@ -1978,7 +1991,7 @@ var ji = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
|
|
|
1978
1991
|
});
|
|
1979
1992
|
//#endregion
|
|
1980
1993
|
//#region src/ChatbotEnhanced.tsx
|
|
1981
|
-
function
|
|
1994
|
+
function zi(e) {
|
|
1982
1995
|
let t = e ?? {}, n = t.data && typeof t.data == "object" ? t.data : t, r = n.seedApplied, i = n.probes;
|
|
1983
1996
|
if (!r && !i) return;
|
|
1984
1997
|
let a = {};
|
|
@@ -1992,10 +2005,10 @@ function Fi(e) {
|
|
|
1992
2005
|
message: String(e.message)
|
|
1993
2006
|
}))), a;
|
|
1994
2007
|
}
|
|
1995
|
-
function
|
|
2008
|
+
function Bi(e) {
|
|
1996
2009
|
return e === "user" ? "user" : "assistant";
|
|
1997
2010
|
}
|
|
1998
|
-
function
|
|
2011
|
+
function Vi(e) {
|
|
1999
2012
|
let t = e.trim();
|
|
2000
2013
|
if (t.length < 2 || !(t.startsWith("{") || t.startsWith("[")) || !(t.endsWith("}") || t.endsWith("]"))) return !1;
|
|
2001
2014
|
try {
|
|
@@ -2004,11 +2017,11 @@ function Li(e) {
|
|
|
2004
2017
|
return !1;
|
|
2005
2018
|
}
|
|
2006
2019
|
}
|
|
2007
|
-
function
|
|
2020
|
+
function Hi(e) {
|
|
2008
2021
|
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available");
|
|
2009
2022
|
return t === "output-error" || t === "output-denied" ? "failed" : t === "approval-requested" || t === "approval-responded" ? "awaiting" : t === "output-available" ? "completed" : "running";
|
|
2010
2023
|
}
|
|
2011
|
-
function
|
|
2024
|
+
function Ui(e) {
|
|
2012
2025
|
return [
|
|
2013
2026
|
{
|
|
2014
2027
|
create_object: "新建对象",
|
|
@@ -2024,13 +2037,13 @@ function zi(e) {
|
|
|
2024
2037
|
e.details
|
|
2025
2038
|
].filter(Boolean).join(" ");
|
|
2026
2039
|
}
|
|
2027
|
-
function
|
|
2040
|
+
function Wi(e) {
|
|
2028
2041
|
return e.toolName === "propose_blueprint";
|
|
2029
2042
|
}
|
|
2030
|
-
function
|
|
2031
|
-
return
|
|
2043
|
+
function Gi(e) {
|
|
2044
|
+
return Wi(e) && Hi(e) === "completed" && !e.proposedPlan && !e.proposedChanges && !e.draftReview?.items.length;
|
|
2032
2045
|
}
|
|
2033
|
-
var
|
|
2046
|
+
var Ki = [
|
|
2034
2047
|
"待补",
|
|
2035
2048
|
"后续",
|
|
2036
2049
|
"将在",
|
|
@@ -2056,25 +2069,25 @@ var Hi = [
|
|
|
2056
2069
|
"coming soon",
|
|
2057
2070
|
"tbd"
|
|
2058
2071
|
];
|
|
2059
|
-
function
|
|
2072
|
+
function qi(e) {
|
|
2060
2073
|
let t = [], n = [];
|
|
2061
2074
|
for (let r of e) {
|
|
2062
2075
|
if (typeof r != "string") continue;
|
|
2063
2076
|
let e = r.trim();
|
|
2064
2077
|
if (!e) continue;
|
|
2065
2078
|
let i = e.toLowerCase();
|
|
2066
|
-
|
|
2079
|
+
Ki.some((e) => i.includes(e)) ? n.push(e) : t.push(e);
|
|
2067
2080
|
}
|
|
2068
2081
|
return {
|
|
2069
2082
|
designNotes: t,
|
|
2070
2083
|
deferred: n
|
|
2071
2084
|
};
|
|
2072
2085
|
}
|
|
2073
|
-
function
|
|
2074
|
-
let t =
|
|
2075
|
-
return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan || !!e.proposedChanges ||
|
|
2086
|
+
function Ji(e) {
|
|
2087
|
+
let t = Hi(e);
|
|
2088
|
+
return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan || !!e.proposedChanges || Gi(e);
|
|
2076
2089
|
}
|
|
2077
|
-
function
|
|
2090
|
+
function Yi(e) {
|
|
2078
2091
|
switch (e) {
|
|
2079
2092
|
case "failed": return 4;
|
|
2080
2093
|
case "awaiting": return 3;
|
|
@@ -2082,17 +2095,17 @@ function Gi(e) {
|
|
|
2082
2095
|
case "completed": return 1;
|
|
2083
2096
|
}
|
|
2084
2097
|
}
|
|
2085
|
-
function
|
|
2098
|
+
function Xi(e) {
|
|
2086
2099
|
let t = /* @__PURE__ */ new Map();
|
|
2087
2100
|
for (let n of e) {
|
|
2088
|
-
let e =
|
|
2101
|
+
let e = Hi(n), r = `${n.toolName}:${e}`, i = t.get(r);
|
|
2089
2102
|
if (i) {
|
|
2090
2103
|
i.count += 1, i.errorText = i.errorText ?? n.errorText;
|
|
2091
2104
|
continue;
|
|
2092
2105
|
}
|
|
2093
2106
|
t.set(r, {
|
|
2094
2107
|
key: r,
|
|
2095
|
-
title:
|
|
2108
|
+
title: zn(n.toolName) || n.toolName,
|
|
2096
2109
|
rawName: n.toolName,
|
|
2097
2110
|
count: 1,
|
|
2098
2111
|
state: e,
|
|
@@ -2100,11 +2113,11 @@ function Ki(e) {
|
|
|
2100
2113
|
});
|
|
2101
2114
|
}
|
|
2102
2115
|
return Array.from(t.values()).sort((e, t) => {
|
|
2103
|
-
let n =
|
|
2116
|
+
let n = Yi(t.state) - Yi(e.state);
|
|
2104
2117
|
return n === 0 ? e.title.localeCompare(t.title) : n;
|
|
2105
2118
|
});
|
|
2106
2119
|
}
|
|
2107
|
-
function
|
|
2120
|
+
function Zi({ health: e }) {
|
|
2108
2121
|
if (!e) return null;
|
|
2109
2122
|
let t = e.issues ?? [], n = t.filter((e) => e.severity === "error"), r = t.filter((e) => e.severity !== "error"), i = e.checked, a = !!i && i.seeds + i.views + i.widgets > 0, o = [];
|
|
2110
2123
|
if (typeof e.seededRows == "number" && e.seededRows > 0 && !e.seedError && o.push(`${e.seededRows} sample row${e.seededRows === 1 ? "" : "s"} live`), a && n.length === 0) {
|
|
@@ -2134,7 +2147,7 @@ function qi({ health: e }) {
|
|
|
2134
2147
|
]
|
|
2135
2148
|
});
|
|
2136
2149
|
}
|
|
2137
|
-
var
|
|
2150
|
+
var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, readOnly: u = !1, isLoading: d = !1, error: f, showTimestamp: p = !1, showAvatars: m = !1, userAvatarUrl: h, userAvatarFallback: g = "You", assistantAvatarUrl: _, assistantAvatarFallback: v = "AI", hideClearBar: y = !1, maxHeight: b = "500px", enableMarkdown: x = !0, enableFileUpload: S = !1, acceptedFileTypes: C = "image/*,.pdf,.doc,.docx,.txt", maxFileSize: w = 10 * 1024 * 1024, suggestions: T, labels: E, models: D, selectedModelId: O, onModelChange: k, headerSlot: A, promptOverlaySlot: j, onInputChange: M, onToolApprove: N, toolApproveLabel: P = "Approve", toolDenyLabel: F = "Deny", toolDenyReason: I = "User denied the operation", toolDecisions: L, onReviewDraft: ee, toolReviewLabel: te = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: R, onOpenBuiltApp: ne, openBuiltAppLabel: re = "Open app", onPreviewDraftApp: z, previewDraftLabel: ie = "Preview", onDraftArtifacts: B, onBuildMaterialized: ae, publishDraftsLabel: V = "Publish", publishedLabel: oe = "Published", verifiedLabel: se = "Verified", nextStepsLabel: ce = "What's next", planTitleLabel: le = "Proposed plan", planExtendLabel: ue = "Adding to existing app", planQuestionsLabel: de = "Confirm before building", planAssumptionsLabel: fe = "Assumptions", planDeferredLabel: pe = "Not yet built", planApproveHintLabel: me = "Reply to approve or adjust this plan.", planApproveLabel: he = "Build it", planAdjustLabel: ge = "Adjust", planBuiltLabel: _e = "Built", planReadyLabel: ve = "The plan is ready. Build it now, or tell me what to adjust.", planApproveMessage: ye = "Looks good — build it as proposed.", planApproveDefaultsMessage: be = "Build it with your best assumptions; use sensible defaults for the open questions.", planAnswerMessage: xe = (e, t) => `For "${e}", go with: ${t}.`, fetchPendingDraftCount: H, autoPublishDrafts: U = !1, processVisibility: W = "summary", surface: Se = "card", ...Ce }, we) => {
|
|
2138
2151
|
let G = d ? "streaming" : "ready", K = Se === "plain", [Te, Ee] = e.useState(null), De = e.useRef(""), Oe = e.useRef(null), J = e.useMemo(() => ({
|
|
2139
2152
|
emptyTitle: E?.emptyTitle ?? "Start a conversation",
|
|
2140
2153
|
emptyDescription: E?.emptyDescription ?? "Ask anything — the assistant has access to your current app context.",
|
|
@@ -2161,7 +2174,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2161
2174
|
connectionStalledLabel: E?.connectionStalledLabel ?? "Still working…",
|
|
2162
2175
|
connectionOfflineLabel: E?.connectionOfflineLabel ?? "Connection lost — reconnecting…",
|
|
2163
2176
|
designingPlanLabel: E?.designingPlanLabel ?? "Designing your app…",
|
|
2164
|
-
designingPlanHints: E?.designingPlanHints ??
|
|
2177
|
+
designingPlanHints: E?.designingPlanHints ?? sa
|
|
2165
2178
|
}), [E]), [Ae, je] = e.useState(() => /* @__PURE__ */ new Set()), [Ne, Fe] = e.useState(() => /* @__PURE__ */ new Map()), [Ie, Le] = e.useState(() => /* @__PURE__ */ new Map()), Re = e.useRef(/* @__PURE__ */ new Set()), ze = e.useCallback(async (e) => {
|
|
2166
2179
|
if (H) try {
|
|
2167
2180
|
let t = await H(e);
|
|
@@ -2239,7 +2252,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2239
2252
|
]);
|
|
2240
2253
|
let We = e.useRef(/* @__PURE__ */ new Set());
|
|
2241
2254
|
e.useEffect(() => {
|
|
2242
|
-
if (!
|
|
2255
|
+
if (!B) return;
|
|
2243
2256
|
let e = /* @__PURE__ */ new Map(), t;
|
|
2244
2257
|
for (let r of n) {
|
|
2245
2258
|
for (let t of r.buildProgress?.items ?? []) t?.type && t?.name && e.set(`${t.type}:${t.name}`, t);
|
|
@@ -2251,17 +2264,17 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2251
2264
|
}
|
|
2252
2265
|
let r = We.current, i = !1;
|
|
2253
2266
|
for (let t of e.keys()) r.has(t) || (r.add(t), i = !0);
|
|
2254
|
-
i &&
|
|
2255
|
-
}, [n,
|
|
2267
|
+
i && B([...e.values()], t);
|
|
2268
|
+
}, [n, B]);
|
|
2256
2269
|
let Ke = e.useRef(/* @__PURE__ */ new Set());
|
|
2257
2270
|
e.useEffect(() => {
|
|
2258
|
-
if (
|
|
2271
|
+
if (ae) for (let e of n) for (let t of e.toolInvocations ?? []) {
|
|
2259
2272
|
let e = t.draftReview;
|
|
2260
2273
|
if (!e?.materialized || !t.toolCallId) continue;
|
|
2261
2274
|
let n = e.items.find((e) => e.type === "app");
|
|
2262
|
-
!n || Ke.current.has(t.toolCallId) || (Ke.current.add(t.toolCallId),
|
|
2275
|
+
!n || Ke.current.has(t.toolCallId) || (Ke.current.add(t.toolCallId), ae(n.name));
|
|
2263
2276
|
}
|
|
2264
|
-
}, [n,
|
|
2277
|
+
}, [n, ae]);
|
|
2265
2278
|
let Je = e.useCallback((e) => {
|
|
2266
2279
|
let t = !!e.text?.trim(), n = e.files?.map((e) => e.file).filter(Boolean), r = !!(n && n.length > 0);
|
|
2267
2280
|
if (!(t || r)) return;
|
|
@@ -2280,7 +2293,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2280
2293
|
e && (e.focus(), e.scrollIntoView({ block: "nearest" }));
|
|
2281
2294
|
}, []);
|
|
2282
2295
|
e.useEffect(() => {
|
|
2283
|
-
if (!f || !
|
|
2296
|
+
if (!f || !Wn(f) || Oe.current === f) return;
|
|
2284
2297
|
Oe.current = f;
|
|
2285
2298
|
let e = De.current;
|
|
2286
2299
|
if (!e) return;
|
|
@@ -2291,7 +2304,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2291
2304
|
navigator.clipboard?.writeText(e.content), Ee(e.id), window.setTimeout(() => Ee((t) => t === e.id ? null : t), 1500);
|
|
2292
2305
|
}, []), it = e.useMemo(() => {
|
|
2293
2306
|
let e = /* @__PURE__ */ new Set(), t = [], r = -1, i = 0;
|
|
2294
|
-
for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan ||
|
|
2307
|
+
for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan || Gi(n)) && n.toolCallId && t.push({
|
|
2295
2308
|
id: n.toolCallId,
|
|
2296
2309
|
order: i
|
|
2297
2310
|
}), n.toolName === "apply_blueprint" && (r = i), i += 1;
|
|
@@ -2310,7 +2323,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2310
2323
|
}
|
|
2311
2324
|
return e;
|
|
2312
2325
|
}, [n]), ot = (e) => {
|
|
2313
|
-
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = L?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s =
|
|
2326
|
+
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = L?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = zn(e.toolName), c = Bn(e.result), l = W === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = W === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : Ie.get(d), p = f === void 0 ? Ae.has(e.toolCallId) : f === 0, m = t === "input-streaming" || t === "input-available", h = /* @__PURE__ */ $("span", {
|
|
2314
2327
|
className: "inline-flex min-w-0 items-center gap-2",
|
|
2315
2328
|
children: [
|
|
2316
2329
|
/* @__PURE__ */ Q("span", { children: s || e.toolName }),
|
|
@@ -2318,22 +2331,22 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2318
2331
|
className: "rounded bg-muted px-1 py-px text-[10px] font-mono text-muted-foreground",
|
|
2319
2332
|
children: e.toolName
|
|
2320
2333
|
}) : null,
|
|
2321
|
-
m ?
|
|
2334
|
+
m ? Wi(e) ? /* @__PURE__ */ Q(ua, {
|
|
2322
2335
|
label: J.designingPlanLabel,
|
|
2323
2336
|
hints: J.designingPlanHints,
|
|
2324
2337
|
offlineLabel: J.connectionOfflineLabel
|
|
2325
|
-
}) : /* @__PURE__ */ Q(
|
|
2338
|
+
}) : /* @__PURE__ */ Q(da, { offlineLabel: J.connectionOfflineLabel }) : null
|
|
2326
2339
|
]
|
|
2327
2340
|
});
|
|
2328
|
-
return /* @__PURE__ */ $(
|
|
2329
|
-
defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan || !!e.proposedChanges ||
|
|
2330
|
-
children: [/* @__PURE__ */ Q(
|
|
2341
|
+
return /* @__PURE__ */ $(bi, {
|
|
2342
|
+
defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan || !!e.proposedChanges || Gi(e),
|
|
2343
|
+
children: [/* @__PURE__ */ Q(Si, {
|
|
2331
2344
|
type: n,
|
|
2332
2345
|
state: t,
|
|
2333
2346
|
title: h
|
|
2334
|
-
}), /* @__PURE__ */ $(
|
|
2335
|
-
u && e.args !== void 0 ? /* @__PURE__ */ Q(
|
|
2336
|
-
o ? null : u || t === "output-error" ? /* @__PURE__ */ Q(
|
|
2347
|
+
}), /* @__PURE__ */ $(Ci, { children: [
|
|
2348
|
+
u && e.args !== void 0 ? /* @__PURE__ */ Q(wi, { input: e.args }) : null,
|
|
2349
|
+
o ? null : u || t === "output-error" ? /* @__PURE__ */ Q(xa, {
|
|
2337
2350
|
output: c,
|
|
2338
2351
|
errorText: e.errorText
|
|
2339
2352
|
}) : null,
|
|
@@ -2425,7 +2438,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2425
2438
|
children: [/* @__PURE__ */ Q(ke, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: e.message })]
|
|
2426
2439
|
}, `w${t}`))]
|
|
2427
2440
|
}) : null,
|
|
2428
|
-
Ae.has(e.toolCallId) ? /* @__PURE__ */ Q(
|
|
2441
|
+
Ae.has(e.toolCallId) ? /* @__PURE__ */ Q(Zi, { health: Ne.get(e.toolCallId) }) : null,
|
|
2429
2442
|
e.draftReview.nextSteps && e.draftReview.nextSteps.length > 0 ? /* @__PURE__ */ $("div", {
|
|
2430
2443
|
className: "flex flex-col gap-1 border-t bg-muted/20 px-3 py-2",
|
|
2431
2444
|
"data-testid": "draft-next-steps",
|
|
@@ -2487,7 +2500,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2487
2500
|
}) : null;
|
|
2488
2501
|
})(),
|
|
2489
2502
|
(() => {
|
|
2490
|
-
let { designNotes: t, deferred: n } =
|
|
2503
|
+
let { designNotes: t, deferred: n } = qi(e.proposedPlan.assumptions);
|
|
2491
2504
|
return /* @__PURE__ */ $(Z, { children: [t.length > 0 ? /* @__PURE__ */ $("div", {
|
|
2492
2505
|
className: "flex flex-col gap-0.5",
|
|
2493
2506
|
"data-testid": "proposed-plan-assumptions",
|
|
@@ -2575,7 +2588,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2575
2588
|
})
|
|
2576
2589
|
]
|
|
2577
2590
|
}) : null,
|
|
2578
|
-
|
|
2591
|
+
Gi(e) ? /* @__PURE__ */ $("div", {
|
|
2579
2592
|
className: "flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5",
|
|
2580
2593
|
"data-testid": "proposed-plan-fallback",
|
|
2581
2594
|
children: [
|
|
@@ -2633,7 +2646,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2633
2646
|
className: "flex flex-col gap-1",
|
|
2634
2647
|
children: e.proposedChanges.changes.map((e, t) => /* @__PURE__ */ $("div", {
|
|
2635
2648
|
className: "flex items-start gap-1.5 rounded-md border bg-background px-2 py-1 text-[11px] text-foreground/80",
|
|
2636
|
-
children: [/* @__PURE__ */ Q(mt, { className: "mt-px size-3 shrink-0 text-foreground/40" }), /* @__PURE__ */ Q("span", { children:
|
|
2649
|
+
children: [/* @__PURE__ */ Q(mt, { className: "mt-px size-3 shrink-0 text-foreground/40" }), /* @__PURE__ */ Q("span", { children: Ui(e) })]
|
|
2637
2650
|
}, t))
|
|
2638
2651
|
}),
|
|
2639
2652
|
i ? at.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
|
|
@@ -2688,11 +2701,11 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2688
2701
|
className: q("shrink-0", !K && "border-b bg-background/50"),
|
|
2689
2702
|
children: A
|
|
2690
2703
|
}) : null,
|
|
2691
|
-
/* @__PURE__ */ $(
|
|
2704
|
+
/* @__PURE__ */ $(qn, {
|
|
2692
2705
|
className: "flex-1 min-h-0",
|
|
2693
|
-
children: [/* @__PURE__ */ $(
|
|
2706
|
+
children: [/* @__PURE__ */ $(Jn, {
|
|
2694
2707
|
className: q("space-y-4", K ? "mx-auto w-full max-w-2xl px-4 py-8 sm:px-0" : "px-4 py-3"),
|
|
2695
|
-
children: [n.length === 0 ? /* @__PURE__ */ $(
|
|
2708
|
+
children: [n.length === 0 ? /* @__PURE__ */ $(Yn, {
|
|
2696
2709
|
className: "gap-3 px-0 py-8",
|
|
2697
2710
|
children: [
|
|
2698
2711
|
/* @__PURE__ */ Q("div", {
|
|
@@ -2713,9 +2726,9 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2713
2726
|
children: J.emptyDescription
|
|
2714
2727
|
})]
|
|
2715
2728
|
}),
|
|
2716
|
-
T && T.length > 0 ? /* @__PURE__ */ Q(
|
|
2729
|
+
T && T.length > 0 ? /* @__PURE__ */ Q(pi, {
|
|
2717
2730
|
className: "justify-center gap-2",
|
|
2718
|
-
children: T.map((e) => /* @__PURE__ */ Q(
|
|
2731
|
+
children: T.map((e) => /* @__PURE__ */ Q(mi, {
|
|
2719
2732
|
className: "h-8 border-border/60 bg-background/80 px-3 text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60",
|
|
2720
2733
|
suggestion: e,
|
|
2721
2734
|
onClick: $e
|
|
@@ -2723,19 +2736,19 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2723
2736
|
}) : null
|
|
2724
2737
|
]
|
|
2725
2738
|
}) : n.map((e) => {
|
|
2726
|
-
let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t && !!e.streaming && !e.content && n.length === 0 && !r && !a && !o, l = !t && W === "summary" ? n.filter((e) => !
|
|
2727
|
-
return /* @__PURE__ */ Q(
|
|
2728
|
-
from:
|
|
2739
|
+
let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t && !!e.streaming && !e.content && n.length === 0 && !r && !a && !o, l = !t && W === "summary" ? n.filter((e) => !Ji(e) && !(o && e.toolName === "propose_blueprint")) : [], u = !t && W === "debug" ? n : !t && W !== "debug" ? n.filter(Ji) : [];
|
|
2740
|
+
return /* @__PURE__ */ Q(er, {
|
|
2741
|
+
from: Bi(e.role),
|
|
2729
2742
|
children: /* @__PURE__ */ $("div", {
|
|
2730
2743
|
className: q("flex w-full gap-2.5", m ? t ? "flex-row-reverse items-start" : "flex-row items-start" : "flex-col"),
|
|
2731
|
-
children: [m ? /* @__PURE__ */ Q(
|
|
2744
|
+
children: [m ? /* @__PURE__ */ Q($i, {
|
|
2732
2745
|
isUser: t,
|
|
2733
2746
|
url: t ? h : _,
|
|
2734
2747
|
fallback: t ? g : v
|
|
2735
2748
|
}) : null, /* @__PURE__ */ $("div", {
|
|
2736
2749
|
className: q("flex min-w-0 flex-col gap-2", m && !t && "flex-1"),
|
|
2737
|
-
children: [/* @__PURE__ */ $(
|
|
2738
|
-
o ? /* @__PURE__ */ Q(
|
|
2750
|
+
children: [/* @__PURE__ */ $(tr, { children: [
|
|
2751
|
+
o ? /* @__PURE__ */ Q(ma, {
|
|
2739
2752
|
progress: o,
|
|
2740
2753
|
designingLabel: J.designingPlanLabel,
|
|
2741
2754
|
extendLabel: ue,
|
|
@@ -2743,7 +2756,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2743
2756
|
stalledLabel: J.connectionStalledLabel,
|
|
2744
2757
|
offlineLabel: J.connectionOfflineLabel
|
|
2745
2758
|
}) : null,
|
|
2746
|
-
a ? /* @__PURE__ */ Q(
|
|
2759
|
+
a ? /* @__PURE__ */ Q(ha, {
|
|
2747
2760
|
progress: a,
|
|
2748
2761
|
onOpenBuiltApp: ne,
|
|
2749
2762
|
openBuiltAppLabel: re,
|
|
@@ -2753,20 +2766,20 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2753
2766
|
stalledLabel: J.connectionStalledLabel,
|
|
2754
2767
|
offlineLabel: J.connectionOfflineLabel
|
|
2755
2768
|
}) : null,
|
|
2756
|
-
!t && W === "debug" && r ? /* @__PURE__ */ $(
|
|
2769
|
+
!t && W === "debug" && r ? /* @__PURE__ */ $(ji, {
|
|
2757
2770
|
isStreaming: !!e.streaming && !e.content,
|
|
2758
2771
|
className: "mb-2",
|
|
2759
|
-
children: [/* @__PURE__ */ Q(
|
|
2772
|
+
children: [/* @__PURE__ */ Q(Ni, {}), /* @__PURE__ */ Q(Pi, { children: r })]
|
|
2760
2773
|
}) : null,
|
|
2761
|
-
!t && W === "summary" && l.length > 0 ? /* @__PURE__ */ Q(
|
|
2762
|
-
groups:
|
|
2774
|
+
!t && W === "summary" && l.length > 0 ? /* @__PURE__ */ Q(ga, {
|
|
2775
|
+
groups: Xi(l),
|
|
2763
2776
|
labels: J
|
|
2764
2777
|
}) : null,
|
|
2765
2778
|
!t && u.length > 0 ? u.map(ot) : null,
|
|
2766
2779
|
t ? e.content ? /* @__PURE__ */ Q("div", {
|
|
2767
2780
|
className: "whitespace-pre-wrap break-words",
|
|
2768
2781
|
children: e.content
|
|
2769
|
-
}) : null : c ? /* @__PURE__ */ Q(
|
|
2782
|
+
}) : null : c ? /* @__PURE__ */ Q(ta, {}) : e.content ? /* @__PURE__ */ Q(fr, { children: e.content }) : null,
|
|
2770
2783
|
e.streaming && !c ? /* @__PURE__ */ Q("span", {
|
|
2771
2784
|
"aria-hidden": !0,
|
|
2772
2785
|
className: "ml-0.5 inline-block w-[2px] h-4 align-middle bg-current animate-pulse"
|
|
@@ -2790,7 +2803,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2790
2803
|
} })]
|
|
2791
2804
|
}, t))
|
|
2792
2805
|
}) : null,
|
|
2793
|
-
!t && i.length > 0 ? /* @__PURE__ */ $(
|
|
2806
|
+
!t && i.length > 0 ? /* @__PURE__ */ $(Fi, { children: [/* @__PURE__ */ Q(Ii, { count: i.length }), /* @__PURE__ */ Q(Li, { children: i.map((e, t) => /* @__PURE__ */ Q(Ri, {
|
|
2794
2807
|
href: e.url,
|
|
2795
2808
|
title: e.title ?? e.url
|
|
2796
2809
|
}, e.id ?? e.url ?? t)) })] }) : null,
|
|
@@ -2798,16 +2811,16 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2798
2811
|
className: "text-[10px] opacity-70 mt-1",
|
|
2799
2812
|
children: e.timestamp
|
|
2800
2813
|
}) : null
|
|
2801
|
-
] }), !t && !c ? /* @__PURE__ */ $(
|
|
2814
|
+
] }), !t && !c ? /* @__PURE__ */ $(nr, {
|
|
2802
2815
|
className: "opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
|
|
2803
2816
|
children: [
|
|
2804
|
-
/* @__PURE__ */ Q(
|
|
2817
|
+
/* @__PURE__ */ Q(rr, {
|
|
2805
2818
|
label: Te === e.id ? J.copied : J.copy,
|
|
2806
2819
|
tooltip: Te === e.id ? J.copied : J.copy,
|
|
2807
2820
|
onClick: () => rt(e),
|
|
2808
2821
|
children: Te === e.id ? /* @__PURE__ */ Q(Pe, { className: "size-3.5" }) : /* @__PURE__ */ Q(Ge, { className: "size-3.5" })
|
|
2809
2822
|
}),
|
|
2810
|
-
s ? /* @__PURE__ */ Q(
|
|
2823
|
+
s ? /* @__PURE__ */ Q(rr, {
|
|
2811
2824
|
label: J.regenerate,
|
|
2812
2825
|
tooltip: J.regenerate,
|
|
2813
2826
|
onClick: s,
|
|
@@ -2825,7 +2838,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2825
2838
|
})]
|
|
2826
2839
|
})
|
|
2827
2840
|
}, e.id);
|
|
2828
|
-
}), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Q(
|
|
2841
|
+
}), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Q(ea, {
|
|
2829
2842
|
showAvatar: m,
|
|
2830
2843
|
assistantAvatarUrl: _,
|
|
2831
2844
|
assistantAvatarFallback: v,
|
|
@@ -2833,13 +2846,13 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2833
2846
|
stalledLabel: J.connectionStalledLabel,
|
|
2834
2847
|
offlineLabel: J.connectionOfflineLabel
|
|
2835
2848
|
}) : null]
|
|
2836
|
-
}), /* @__PURE__ */ Q(
|
|
2849
|
+
}), /* @__PURE__ */ Q(Xn, {})]
|
|
2837
2850
|
}),
|
|
2838
|
-
f ?
|
|
2851
|
+
f ? Wn(f) && !Un(f) ? /* @__PURE__ */ Q(ya, {
|
|
2839
2852
|
error: f,
|
|
2840
2853
|
rateLimitedLabel: J.sendFailedRateLimited,
|
|
2841
2854
|
genericLabel: J.sendFailedGeneric
|
|
2842
|
-
}) : /* @__PURE__ */ Q(
|
|
2855
|
+
}) : /* @__PURE__ */ Q(ba, {
|
|
2843
2856
|
error: f,
|
|
2844
2857
|
onReload: s,
|
|
2845
2858
|
onUpgrade: c
|
|
@@ -2850,7 +2863,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2850
2863
|
children: [j ? /* @__PURE__ */ Q("div", {
|
|
2851
2864
|
className: "absolute bottom-full left-0 right-0 z-10 px-3 pb-1",
|
|
2852
2865
|
children: j
|
|
2853
|
-
}) : null, /* @__PURE__ */ $(
|
|
2866
|
+
}) : null, /* @__PURE__ */ $(Pr, {
|
|
2854
2867
|
accept: C,
|
|
2855
2868
|
fileInputLabel: J.uploadFiles,
|
|
2856
2869
|
maxFileSize: w,
|
|
@@ -2859,14 +2872,14 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2859
2872
|
console.warn("[plugin-chatbot] prompt-input error", e);
|
|
2860
2873
|
},
|
|
2861
2874
|
children: [
|
|
2862
|
-
S ? /* @__PURE__ */ Q(
|
|
2863
|
-
/* @__PURE__ */ Q(
|
|
2875
|
+
S ? /* @__PURE__ */ Q(Fr, { children: /* @__PURE__ */ Q(Mr, { children: (e) => /* @__PURE__ */ Q(jr, { data: e }) }) }) : null,
|
|
2876
|
+
/* @__PURE__ */ Q(Ir, {
|
|
2864
2877
|
placeholder: r,
|
|
2865
2878
|
disabled: l || G === "streaming",
|
|
2866
2879
|
onChange: M ? (e) => M(e.currentTarget.value) : void 0
|
|
2867
2880
|
}),
|
|
2868
|
-
/* @__PURE__ */ $(
|
|
2869
|
-
S ? /* @__PURE__ */ $(
|
|
2881
|
+
/* @__PURE__ */ $(Rr, { children: [/* @__PURE__ */ $(zr, { children: [
|
|
2882
|
+
S ? /* @__PURE__ */ $(Vr, { children: [/* @__PURE__ */ Q(Hr, {}), /* @__PURE__ */ Q(Ur, { children: /* @__PURE__ */ Q(Nr, {}) })] }) : null,
|
|
2870
2883
|
D && D.length > 1 ? /* @__PURE__ */ Q("select", {
|
|
2871
2884
|
"aria-label": J.model,
|
|
2872
2885
|
value: O ?? D[0].id,
|
|
@@ -2892,7 +2905,7 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2892
2905
|
})
|
|
2893
2906
|
]
|
|
2894
2907
|
})
|
|
2895
|
-
] }), /* @__PURE__ */ Q(
|
|
2908
|
+
] }), /* @__PURE__ */ Q(Gr, {
|
|
2896
2909
|
"aria-label": G === "streaming" ? J.stopResponse : J.submit,
|
|
2897
2910
|
status: G,
|
|
2898
2911
|
disabled: l,
|
|
@@ -2905,8 +2918,8 @@ var Ji = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2905
2918
|
]
|
|
2906
2919
|
});
|
|
2907
2920
|
});
|
|
2908
|
-
|
|
2909
|
-
function
|
|
2921
|
+
Qi.displayName = "ChatbotEnhanced";
|
|
2922
|
+
function $i({ isUser: e, url: t, fallback: n }) {
|
|
2910
2923
|
return /* @__PURE__ */ Q("div", {
|
|
2911
2924
|
className: q("mt-0.5 flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-medium", e ? "bg-secondary text-secondary-foreground" : "bg-primary/10 text-primary"),
|
|
2912
2925
|
"aria-hidden": "true",
|
|
@@ -2917,21 +2930,21 @@ function Yi({ isUser: e, url: t, fallback: n }) {
|
|
|
2917
2930
|
}) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Q(Me, { className: "size-4" })
|
|
2918
2931
|
});
|
|
2919
2932
|
}
|
|
2920
|
-
function
|
|
2921
|
-
return /* @__PURE__ */ Q(
|
|
2933
|
+
function ea({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n, waitingLabel: r, stalledLabel: i, offlineLabel: a }) {
|
|
2934
|
+
return /* @__PURE__ */ Q(er, {
|
|
2922
2935
|
from: "assistant",
|
|
2923
2936
|
"aria-live": "polite",
|
|
2924
2937
|
children: /* @__PURE__ */ $("div", {
|
|
2925
2938
|
className: q("flex w-full gap-2.5", e ? "flex-row items-start" : "flex-col"),
|
|
2926
|
-
children: [e ? /* @__PURE__ */ Q(
|
|
2939
|
+
children: [e ? /* @__PURE__ */ Q($i, {
|
|
2927
2940
|
isUser: !1,
|
|
2928
2941
|
url: t,
|
|
2929
2942
|
fallback: n
|
|
2930
|
-
}) : null, /* @__PURE__ */ Q(
|
|
2943
|
+
}) : null, /* @__PURE__ */ Q(tr, {
|
|
2931
2944
|
className: "rounded-lg border bg-muted/30 px-3 py-2 text-muted-foreground",
|
|
2932
2945
|
children: /* @__PURE__ */ $("span", {
|
|
2933
2946
|
className: "inline-flex items-center gap-2",
|
|
2934
|
-
children: [/* @__PURE__ */ Q(
|
|
2947
|
+
children: [/* @__PURE__ */ Q(ta, {}), /* @__PURE__ */ Q(oa, {
|
|
2935
2948
|
active: !0,
|
|
2936
2949
|
pending: !0,
|
|
2937
2950
|
activityKey: 0,
|
|
@@ -2944,7 +2957,7 @@ function Xi({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n,
|
|
|
2944
2957
|
})
|
|
2945
2958
|
});
|
|
2946
2959
|
}
|
|
2947
|
-
function
|
|
2960
|
+
function ta() {
|
|
2948
2961
|
return /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("span", {
|
|
2949
2962
|
className: "sr-only",
|
|
2950
2963
|
children: "Assistant is responding"
|
|
@@ -2958,12 +2971,12 @@ function Zi() {
|
|
|
2958
2971
|
]
|
|
2959
2972
|
})] });
|
|
2960
2973
|
}
|
|
2961
|
-
function
|
|
2974
|
+
function na(e) {
|
|
2962
2975
|
let t = Math.floor(e / 60), n = e % 60;
|
|
2963
2976
|
return `${t}:${String(n).padStart(2, "0")}`;
|
|
2964
2977
|
}
|
|
2965
|
-
var
|
|
2966
|
-
function
|
|
2978
|
+
var ra = 6;
|
|
2979
|
+
function ia(t, n) {
|
|
2967
2980
|
let r = e.useRef(0), i = e.useRef(0), [a, o] = e.useState({
|
|
2968
2981
|
elapsed: 0,
|
|
2969
2982
|
quiet: 0
|
|
@@ -2992,10 +3005,10 @@ function ea(t, n) {
|
|
|
2992
3005
|
}, [t]), {
|
|
2993
3006
|
elapsedSeconds: a.elapsed,
|
|
2994
3007
|
quietSeconds: a.quiet,
|
|
2995
|
-
live: a.quiet <
|
|
3008
|
+
live: a.quiet < ra
|
|
2996
3009
|
};
|
|
2997
3010
|
}
|
|
2998
|
-
function
|
|
3011
|
+
function aa() {
|
|
2999
3012
|
let [t, n] = e.useState(() => typeof navigator < "u" && navigator.onLine === !1);
|
|
3000
3013
|
return e.useEffect(() => {
|
|
3001
3014
|
if (typeof window > "u") return;
|
|
@@ -3005,8 +3018,8 @@ function ta() {
|
|
|
3005
3018
|
};
|
|
3006
3019
|
}, []), t;
|
|
3007
3020
|
}
|
|
3008
|
-
function
|
|
3009
|
-
let { elapsedSeconds: o, quietSeconds: s, live: c } =
|
|
3021
|
+
function oa({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
|
|
3022
|
+
let { elapsedSeconds: o, quietSeconds: s, live: c } = ia(e, t), l = aa() ? "offline" : c ? n ? "waiting" : "receiving" : "stalled", u = na(o);
|
|
3010
3023
|
return /* @__PURE__ */ $("span", {
|
|
3011
3024
|
className: q("inline-flex items-center gap-1.5 text-xs tabular-nums", l === "offline" ? "text-red-600 font-medium" : l === "stalled" ? "text-amber-600 font-medium" : "font-normal text-muted-foreground"),
|
|
3012
3025
|
"aria-live": "polite",
|
|
@@ -3029,7 +3042,7 @@ function na({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stall
|
|
|
3029
3042
|
]
|
|
3030
3043
|
});
|
|
3031
3044
|
}
|
|
3032
|
-
var
|
|
3045
|
+
var sa = [
|
|
3033
3046
|
"Mapping out the data you’ll track…",
|
|
3034
3047
|
"Shaping objects and their fields…",
|
|
3035
3048
|
"Connecting related records…",
|
|
@@ -3040,21 +3053,21 @@ var ra = [
|
|
|
3040
3053
|
"Sketching a dashboard to track it…",
|
|
3041
3054
|
"Double-checking the structure hangs together…",
|
|
3042
3055
|
"Pulling the plan together…"
|
|
3043
|
-
],
|
|
3044
|
-
function
|
|
3056
|
+
], ca = 3500;
|
|
3057
|
+
function la(e, t, n = ca) {
|
|
3045
3058
|
if (t <= 0) return -1;
|
|
3046
3059
|
if (t === 1) return 0;
|
|
3047
|
-
let r = Math.floor((Number.isFinite(e) && e > 0 ? e : 0) / (n > 0 ? n :
|
|
3060
|
+
let r = Math.floor((Number.isFinite(e) && e > 0 ? e : 0) / (n > 0 ? n : ca));
|
|
3048
3061
|
return Math.min(r, t - 1);
|
|
3049
3062
|
}
|
|
3050
|
-
function
|
|
3063
|
+
function ua({ label: t, hints: n, offlineLabel: r }) {
|
|
3051
3064
|
let [i, a] = e.useState(0);
|
|
3052
3065
|
e.useEffect(() => {
|
|
3053
3066
|
if (n.length <= 1) return;
|
|
3054
|
-
let e = Date.now(), t = setInterval(() => a(Date.now() - e),
|
|
3067
|
+
let e = Date.now(), t = setInterval(() => a(Date.now() - e), ca);
|
|
3055
3068
|
return () => clearInterval(t);
|
|
3056
3069
|
}, [n.length]);
|
|
3057
|
-
let o =
|
|
3070
|
+
let o = la(i, n.length), s = o >= 0 ? n[o] : void 0, c = n.length > 1 && n.length <= 12;
|
|
3058
3071
|
return /* @__PURE__ */ $("span", {
|
|
3059
3072
|
className: "inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",
|
|
3060
3073
|
"data-testid": "build-proposal-progress",
|
|
@@ -3078,12 +3091,12 @@ function oa({ label: t, hints: n, offlineLabel: r }) {
|
|
|
3078
3091
|
"aria-hidden": !0,
|
|
3079
3092
|
children: n.map((e, t) => /* @__PURE__ */ Q("span", { className: q("size-1 rounded-full transition-colors", t <= o ? "bg-primary/70" : "bg-muted-foreground/25") }, t))
|
|
3080
3093
|
}) : null,
|
|
3081
|
-
/* @__PURE__ */ Q(
|
|
3094
|
+
/* @__PURE__ */ Q(da, { offlineLabel: r })
|
|
3082
3095
|
]
|
|
3083
3096
|
});
|
|
3084
3097
|
}
|
|
3085
|
-
function
|
|
3086
|
-
let [n, r] = e.useState(0), i =
|
|
3098
|
+
function da({ offlineLabel: t }) {
|
|
3099
|
+
let [n, r] = e.useState(0), i = aa();
|
|
3087
3100
|
return e.useEffect(() => {
|
|
3088
3101
|
let e = Date.now(), t = setInterval(() => r(Math.floor((Date.now() - e) / 1e3)), 1e3);
|
|
3089
3102
|
return () => clearInterval(t);
|
|
@@ -3096,25 +3109,25 @@ function sa({ offlineLabel: t }) {
|
|
|
3096
3109
|
className: "size-3 shrink-0",
|
|
3097
3110
|
"aria-hidden": !0
|
|
3098
3111
|
}),
|
|
3099
|
-
/* @__PURE__ */ Q("span", { children:
|
|
3112
|
+
/* @__PURE__ */ Q("span", { children: na(n) }),
|
|
3100
3113
|
i ? /* @__PURE__ */ $("span", { children: ["· ", t] }) : null
|
|
3101
3114
|
]
|
|
3102
3115
|
});
|
|
3103
3116
|
}
|
|
3104
|
-
var
|
|
3117
|
+
var fa = [
|
|
3105
3118
|
"object",
|
|
3106
3119
|
"view",
|
|
3107
3120
|
"dashboard",
|
|
3108
3121
|
"app",
|
|
3109
3122
|
"seed"
|
|
3110
|
-
],
|
|
3123
|
+
], pa = {
|
|
3111
3124
|
object: "Objects",
|
|
3112
3125
|
view: "Views",
|
|
3113
3126
|
dashboard: "Dashboards",
|
|
3114
3127
|
app: "App",
|
|
3115
3128
|
seed: "Sample data"
|
|
3116
3129
|
};
|
|
3117
|
-
function
|
|
3130
|
+
function ma({ progress: e, designingLabel: t = "Designing your app…", extendLabel: n = "Adding to existing app", waitingLabel: r = "Waiting for server…", stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
|
|
3118
3131
|
let { phase: o, summary: s, appLabel: c, targetApp: l, objects: u, counts: d, seq: f } = e, p = o === "done", m = f ?? `${o}:${u.length}`, h = p && (s || c) || t, g = [];
|
|
3119
3132
|
return d?.objects && g.push(`${d.objects} object${d.objects === 1 ? "" : "s"}`), d?.views && g.push(`${d.views} view${d.views === 1 ? "" : "s"}`), d?.dashboards && g.push(`${d.dashboards} dashboard${d.dashboards === 1 ? "" : "s"}`), /* @__PURE__ */ $("div", {
|
|
3120
3133
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
@@ -3141,7 +3154,7 @@ function ua({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3141
3154
|
}) : null,
|
|
3142
3155
|
p ? null : /* @__PURE__ */ Q("span", {
|
|
3143
3156
|
className: "ml-auto shrink-0",
|
|
3144
|
-
children: /* @__PURE__ */ Q(
|
|
3157
|
+
children: /* @__PURE__ */ Q(oa, {
|
|
3145
3158
|
active: !0,
|
|
3146
3159
|
activityKey: m,
|
|
3147
3160
|
waitingLabel: r,
|
|
@@ -3178,13 +3191,13 @@ function ua({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3178
3191
|
]
|
|
3179
3192
|
});
|
|
3180
3193
|
}
|
|
3181
|
-
function
|
|
3194
|
+
function ha({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app", onPreviewDraftApp: r, previewDraftLabel: i = "Preview", waitingLabel: a = "Waiting for server…", stalledLabel: o = "Still working…", offlineLabel: s = "Connection lost — reconnecting…" }) {
|
|
3182
3195
|
let { phase: c, appLabel: l, items: u, done: d, total: f, seq: p } = e, m = c === "done", h = p ?? `${c}:${d}:${u.length}`, g = u.find((e) => e.type === "app"), _ = f > 0 ? Math.min(100, Math.round(d / f * 100)) : m ? 100 : 6, v = /* @__PURE__ */ new Map();
|
|
3183
3196
|
for (let e of u) {
|
|
3184
3197
|
let t = v.get(e.type) ?? [];
|
|
3185
3198
|
t.push(e.name.replace(/_sample$/, "")), v.set(e.type, t);
|
|
3186
3199
|
}
|
|
3187
|
-
let y = [...
|
|
3200
|
+
let y = [...fa.filter((e) => v.has(e)), ...[...v.keys()].filter((e) => !fa.includes(e))];
|
|
3188
3201
|
return /* @__PURE__ */ $("div", {
|
|
3189
3202
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
3190
3203
|
"data-testid": "build-progress",
|
|
@@ -3200,7 +3213,7 @@ function da({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
|
|
|
3200
3213
|
}) : null,
|
|
3201
3214
|
m ? null : /* @__PURE__ */ Q("span", {
|
|
3202
3215
|
className: "ml-auto",
|
|
3203
|
-
children: /* @__PURE__ */ Q(
|
|
3216
|
+
children: /* @__PURE__ */ Q(oa, {
|
|
3204
3217
|
active: !0,
|
|
3205
3218
|
activityKey: h,
|
|
3206
3219
|
waitingLabel: a,
|
|
@@ -3228,7 +3241,7 @@ function da({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
|
|
|
3228
3241
|
children: [
|
|
3229
3242
|
/* @__PURE__ */ Q("span", {
|
|
3230
3243
|
className: "font-medium text-foreground",
|
|
3231
|
-
children:
|
|
3244
|
+
children: pa[e] ?? e
|
|
3232
3245
|
}),
|
|
3233
3246
|
" ",
|
|
3234
3247
|
t.slice(0, 6).join(", "),
|
|
@@ -3257,7 +3270,7 @@ function da({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
|
|
|
3257
3270
|
]
|
|
3258
3271
|
});
|
|
3259
3272
|
}
|
|
3260
|
-
function
|
|
3273
|
+
function ga({ groups: e, labels: t }) {
|
|
3261
3274
|
return e.length === 0 ? null : /* @__PURE__ */ Q("div", {
|
|
3262
3275
|
className: "not-prose mb-2 border-l border-border/70 pl-3",
|
|
3263
3276
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -3267,7 +3280,7 @@ function fa({ groups: e, labels: t }) {
|
|
|
3267
3280
|
children: [/* @__PURE__ */ $("div", {
|
|
3268
3281
|
className: "flex min-w-0 items-center gap-2",
|
|
3269
3282
|
children: [
|
|
3270
|
-
/* @__PURE__ */ Q(
|
|
3283
|
+
/* @__PURE__ */ Q(_a, { state: e.state }),
|
|
3271
3284
|
/* @__PURE__ */ Q("span", {
|
|
3272
3285
|
className: "truncate font-medium text-foreground",
|
|
3273
3286
|
children: e.title
|
|
@@ -3277,22 +3290,22 @@ function fa({ groups: e, labels: t }) {
|
|
|
3277
3290
|
children: ["x", e.count]
|
|
3278
3291
|
}) : null
|
|
3279
3292
|
]
|
|
3280
|
-
}), e.state === "running" ? e.rawName === "propose_blueprint" ? /* @__PURE__ */ Q(
|
|
3293
|
+
}), e.state === "running" ? e.rawName === "propose_blueprint" ? /* @__PURE__ */ Q(ua, {
|
|
3281
3294
|
label: t.designingPlanLabel,
|
|
3282
3295
|
hints: t.designingPlanHints,
|
|
3283
3296
|
offlineLabel: t.connectionOfflineLabel
|
|
3284
|
-
}) : /* @__PURE__ */ Q(
|
|
3297
|
+
}) : /* @__PURE__ */ Q(da, { offlineLabel: t.connectionOfflineLabel }) : /* @__PURE__ */ Q("span", {
|
|
3285
3298
|
className: q("shrink-0 text-[10px] font-medium", e.state === "failed" ? "text-destructive" : e.state === "completed" ? "text-emerald-700 dark:text-emerald-400" : "text-muted-foreground"),
|
|
3286
|
-
children:
|
|
3299
|
+
children: va(e.state, t)
|
|
3287
3300
|
})]
|
|
3288
3301
|
}, e.key))
|
|
3289
3302
|
})
|
|
3290
3303
|
});
|
|
3291
3304
|
}
|
|
3292
|
-
function
|
|
3305
|
+
function _a({ state: e }) {
|
|
3293
3306
|
return e === "failed" ? /* @__PURE__ */ Q(X, { className: "size-3.5 shrink-0 text-destructive" }) : e === "completed" ? /* @__PURE__ */ Q(Y, { className: "size-3.5 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(Ue, { className: "size-3.5 shrink-0 text-muted-foreground" });
|
|
3294
3307
|
}
|
|
3295
|
-
function
|
|
3308
|
+
function va(e, t) {
|
|
3296
3309
|
switch (e) {
|
|
3297
3310
|
case "failed": return t.toolFailed;
|
|
3298
3311
|
case "awaiting": return t.toolAwaitingApproval;
|
|
@@ -3300,8 +3313,8 @@ function ma(e, t) {
|
|
|
3300
3313
|
case "completed": return t.toolCompleted;
|
|
3301
3314
|
}
|
|
3302
3315
|
}
|
|
3303
|
-
function
|
|
3304
|
-
let i = e.useMemo(() =>
|
|
3316
|
+
function ya({ error: t, rateLimitedLabel: n, genericLabel: r }) {
|
|
3317
|
+
let i = e.useMemo(() => Kn(t) ? n : r, [
|
|
3305
3318
|
t,
|
|
3306
3319
|
n,
|
|
3307
3320
|
r
|
|
@@ -3322,8 +3335,8 @@ function ha({ error: t, rateLimitedLabel: n, genericLabel: r }) {
|
|
|
3322
3335
|
})
|
|
3323
3336
|
});
|
|
3324
3337
|
}
|
|
3325
|
-
function
|
|
3326
|
-
let i = e.useMemo(() =>
|
|
3338
|
+
function ba({ error: t, onReload: n, onUpgrade: r }) {
|
|
3339
|
+
let i = e.useMemo(() => Un(t), [t]), { summary: a, details: o } = e.useMemo(() => Vn(t), [t]), [s, c] = e.useState(!1);
|
|
3327
3340
|
if (i) {
|
|
3328
3341
|
let e = typeof navigator < "u" && !!navigator.language?.toLowerCase().startsWith("zh"), t = (e ? i.message : i.messageEn ?? i.message) || (e ? "AI 额度已用完。" : "You have reached your AI quota."), n = i.topUp ? e ? "购买额度包" : "Buy a credit pack" : e ? "升级方案" : "Upgrade plan";
|
|
3329
3342
|
return /* @__PURE__ */ Q("div", {
|
|
@@ -3394,27 +3407,27 @@ function ga({ error: t, onReload: n, onUpgrade: r }) {
|
|
|
3394
3407
|
})
|
|
3395
3408
|
});
|
|
3396
3409
|
}
|
|
3397
|
-
function
|
|
3398
|
-
return t ? /* @__PURE__ */ Q(
|
|
3410
|
+
function xa({ output: e, errorText: t }) {
|
|
3411
|
+
return t ? /* @__PURE__ */ Q(Ti, {
|
|
3399
3412
|
output: void 0,
|
|
3400
3413
|
errorText: t
|
|
3401
|
-
}) : e == null || e === "" ? null : typeof e == "string" && !
|
|
3414
|
+
}) : e == null || e === "" ? null : typeof e == "string" && !Vi(e) ? /* @__PURE__ */ $("div", {
|
|
3402
3415
|
className: "space-y-2 p-4",
|
|
3403
3416
|
children: [/* @__PURE__ */ Q("h4", {
|
|
3404
3417
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
3405
3418
|
children: "Result"
|
|
3406
3419
|
}), /* @__PURE__ */ Q("div", {
|
|
3407
3420
|
className: "overflow-x-auto rounded-md bg-muted/40 px-3 py-2 text-sm text-foreground",
|
|
3408
|
-
children: /* @__PURE__ */ Q(
|
|
3421
|
+
children: /* @__PURE__ */ Q(fr, { children: e })
|
|
3409
3422
|
})]
|
|
3410
|
-
}) : /* @__PURE__ */ Q(
|
|
3423
|
+
}) : /* @__PURE__ */ Q(Ti, {
|
|
3411
3424
|
output: e,
|
|
3412
3425
|
errorText: void 0
|
|
3413
3426
|
});
|
|
3414
3427
|
}
|
|
3415
3428
|
//#endregion
|
|
3416
3429
|
//#region src/FloatingChatbot.tsx
|
|
3417
|
-
function
|
|
3430
|
+
function Sa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
|
|
3418
3431
|
let { position: a = "bottom-right", defaultOpen: o = !1, panelWidth: s = 400, panelHeight: c = 520, title: l = "Chat", triggerSize: u = 56 } = t ?? {}, [d, f] = e.useState(null);
|
|
3419
3432
|
e.useEffect(() => {
|
|
3420
3433
|
let e = document.getElementById("floating-chatbot-portal");
|
|
@@ -3422,19 +3435,19 @@ function va({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
|
|
|
3422
3435
|
e && e.parentNode && !e.hasChildNodes() && e.parentNode.removeChild(e);
|
|
3423
3436
|
};
|
|
3424
3437
|
}, []);
|
|
3425
|
-
let p = /* @__PURE__ */ $(
|
|
3438
|
+
let p = /* @__PURE__ */ $(Tn, {
|
|
3426
3439
|
defaultOpen: o,
|
|
3427
|
-
children: [/* @__PURE__ */ Q(
|
|
3440
|
+
children: [/* @__PURE__ */ Q(jn, {
|
|
3428
3441
|
position: a,
|
|
3429
3442
|
size: u
|
|
3430
|
-
}), /* @__PURE__ */ Q(
|
|
3443
|
+
}), /* @__PURE__ */ Q(Ln, {
|
|
3431
3444
|
title: l,
|
|
3432
3445
|
position: a,
|
|
3433
3446
|
width: s,
|
|
3434
3447
|
height: c,
|
|
3435
3448
|
headerExtra: n,
|
|
3436
3449
|
headerActions: r,
|
|
3437
|
-
children: /* @__PURE__ */ Q(
|
|
3450
|
+
children: /* @__PURE__ */ Q(Qi, {
|
|
3438
3451
|
...i,
|
|
3439
3452
|
maxHeight: "100%",
|
|
3440
3453
|
className: "h-full border-0 rounded-none"
|
|
@@ -3461,7 +3474,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3461
3474
|
autoResponseDelay: e.autoResponseDelay,
|
|
3462
3475
|
onSend: e.onSend
|
|
3463
3476
|
});
|
|
3464
|
-
return /* @__PURE__ */ Q(
|
|
3477
|
+
return /* @__PURE__ */ Q(Ua, {
|
|
3465
3478
|
messages: r,
|
|
3466
3479
|
placeholder: e.placeholder,
|
|
3467
3480
|
onSendMessage: (e) => {
|
|
@@ -3627,7 +3640,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3627
3640
|
autoResponseDelay: e.autoResponseDelay,
|
|
3628
3641
|
onSend: e.onSend
|
|
3629
3642
|
});
|
|
3630
|
-
return /* @__PURE__ */ Q(
|
|
3643
|
+
return /* @__PURE__ */ Q(Qi, {
|
|
3631
3644
|
messages: r,
|
|
3632
3645
|
placeholder: e.placeholder,
|
|
3633
3646
|
onSendMessage: (e, t) => {
|
|
@@ -3814,7 +3827,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3814
3827
|
autoResponseDelay: e.autoResponseDelay,
|
|
3815
3828
|
onSend: e.onSend
|
|
3816
3829
|
});
|
|
3817
|
-
return /* @__PURE__ */ Q(
|
|
3830
|
+
return /* @__PURE__ */ Q(Sa, {
|
|
3818
3831
|
floatingConfig: e.floatingConfig,
|
|
3819
3832
|
messages: r,
|
|
3820
3833
|
placeholder: e.placeholder,
|
|
@@ -3986,7 +3999,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3986
3999
|
});
|
|
3987
4000
|
//#endregion
|
|
3988
4001
|
//#region src/elements/loader.tsx
|
|
3989
|
-
var
|
|
4002
|
+
var Ca = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
|
|
3990
4003
|
height: e,
|
|
3991
4004
|
strokeLinejoin: "round",
|
|
3992
4005
|
style: { color: "currentcolor" },
|
|
@@ -4067,97 +4080,97 @@ var ya = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
|
|
|
4067
4080
|
})
|
|
4068
4081
|
}) })
|
|
4069
4082
|
]
|
|
4070
|
-
}),
|
|
4083
|
+
}), wa = ({ className: e, size: t = 16, ...n }) => /* @__PURE__ */ Q("div", {
|
|
4071
4084
|
className: q("inline-flex animate-spin items-center justify-center", e),
|
|
4072
4085
|
...n,
|
|
4073
|
-
children: /* @__PURE__ */ Q(
|
|
4074
|
-
}),
|
|
4075
|
-
CodeBlock: () =>
|
|
4076
|
-
CodeBlockCopyButton: () =>
|
|
4077
|
-
Conversation: () =>
|
|
4078
|
-
ConversationContent: () =>
|
|
4079
|
-
ConversationEmptyState: () =>
|
|
4080
|
-
ConversationScrollButton: () =>
|
|
4081
|
-
Loader: () =>
|
|
4082
|
-
Message: () =>
|
|
4083
|
-
MessageAction: () =>
|
|
4084
|
-
MessageActions: () =>
|
|
4085
|
-
MessageAttachment: () =>
|
|
4086
|
-
MessageAttachments: () =>
|
|
4087
|
-
MessageBranch: () =>
|
|
4088
|
-
MessageBranchContent: () =>
|
|
4089
|
-
MessageBranchNext: () =>
|
|
4090
|
-
MessageBranchPage: () =>
|
|
4091
|
-
MessageBranchPrevious: () =>
|
|
4092
|
-
MessageBranchSelector: () =>
|
|
4093
|
-
MessageContent: () =>
|
|
4094
|
-
MessageResponse: () =>
|
|
4095
|
-
MessageToolbar: () =>
|
|
4096
|
-
PromptInput: () =>
|
|
4097
|
-
PromptInputActionAddAttachments: () =>
|
|
4098
|
-
PromptInputActionMenu: () =>
|
|
4099
|
-
PromptInputActionMenuContent: () =>
|
|
4100
|
-
PromptInputActionMenuItem: () =>
|
|
4101
|
-
PromptInputActionMenuTrigger: () =>
|
|
4102
|
-
PromptInputAttachment: () =>
|
|
4103
|
-
PromptInputAttachments: () =>
|
|
4104
|
-
PromptInputBody: () =>
|
|
4105
|
-
PromptInputButton: () =>
|
|
4106
|
-
PromptInputCommand: () =>
|
|
4107
|
-
PromptInputCommandEmpty: () =>
|
|
4108
|
-
PromptInputCommandGroup: () =>
|
|
4109
|
-
PromptInputCommandInput: () =>
|
|
4110
|
-
PromptInputCommandItem: () =>
|
|
4111
|
-
PromptInputCommandList: () =>
|
|
4112
|
-
PromptInputCommandSeparator: () =>
|
|
4113
|
-
PromptInputFooter: () =>
|
|
4114
|
-
PromptInputHeader: () =>
|
|
4115
|
-
PromptInputHoverCard: () =>
|
|
4116
|
-
PromptInputHoverCardContent: () =>
|
|
4117
|
-
PromptInputHoverCardTrigger: () =>
|
|
4118
|
-
PromptInputProvider: () =>
|
|
4119
|
-
PromptInputSelect: () =>
|
|
4120
|
-
PromptInputSelectContent: () =>
|
|
4121
|
-
PromptInputSelectItem: () =>
|
|
4122
|
-
PromptInputSelectTrigger: () =>
|
|
4123
|
-
PromptInputSelectValue: () =>
|
|
4124
|
-
PromptInputSpeechButton: () =>
|
|
4125
|
-
PromptInputSubmit: () =>
|
|
4126
|
-
PromptInputTab: () =>
|
|
4127
|
-
PromptInputTabBody: () =>
|
|
4128
|
-
PromptInputTabItem: () =>
|
|
4129
|
-
PromptInputTabLabel: () =>
|
|
4130
|
-
PromptInputTabsList: () =>
|
|
4131
|
-
PromptInputTextarea: () =>
|
|
4132
|
-
PromptInputTools: () =>
|
|
4133
|
-
Reasoning: () =>
|
|
4134
|
-
ReasoningContent: () =>
|
|
4135
|
-
ReasoningTrigger: () =>
|
|
4136
|
-
Shimmer: () =>
|
|
4137
|
-
Source: () =>
|
|
4138
|
-
Sources: () =>
|
|
4139
|
-
SourcesContent: () =>
|
|
4140
|
-
SourcesTrigger: () =>
|
|
4141
|
-
Suggestion: () =>
|
|
4142
|
-
Suggestions: () =>
|
|
4143
|
-
Tool: () =>
|
|
4144
|
-
ToolContent: () =>
|
|
4145
|
-
ToolHeader: () =>
|
|
4146
|
-
ToolInput: () =>
|
|
4147
|
-
ToolOutput: () =>
|
|
4148
|
-
highlightCode: () =>
|
|
4149
|
-
usePromptInputAttachments: () =>
|
|
4150
|
-
usePromptInputController: () =>
|
|
4151
|
-
useProviderAttachments: () =>
|
|
4152
|
-
useReasoning: () =>
|
|
4153
|
-
}),
|
|
4154
|
-
function
|
|
4086
|
+
children: /* @__PURE__ */ Q(Ca, { size: t })
|
|
4087
|
+
}), Ta = /* @__PURE__ */ Lt({
|
|
4088
|
+
CodeBlock: () => vi,
|
|
4089
|
+
CodeBlockCopyButton: () => yi,
|
|
4090
|
+
Conversation: () => qn,
|
|
4091
|
+
ConversationContent: () => Jn,
|
|
4092
|
+
ConversationEmptyState: () => Yn,
|
|
4093
|
+
ConversationScrollButton: () => Xn,
|
|
4094
|
+
Loader: () => wa,
|
|
4095
|
+
Message: () => er,
|
|
4096
|
+
MessageAction: () => rr,
|
|
4097
|
+
MessageActions: () => nr,
|
|
4098
|
+
MessageAttachment: () => pr,
|
|
4099
|
+
MessageAttachments: () => mr,
|
|
4100
|
+
MessageBranch: () => or,
|
|
4101
|
+
MessageBranchContent: () => sr,
|
|
4102
|
+
MessageBranchNext: () => ur,
|
|
4103
|
+
MessageBranchPage: () => dr,
|
|
4104
|
+
MessageBranchPrevious: () => lr,
|
|
4105
|
+
MessageBranchSelector: () => cr,
|
|
4106
|
+
MessageContent: () => tr,
|
|
4107
|
+
MessageResponse: () => fr,
|
|
4108
|
+
MessageToolbar: () => hr,
|
|
4109
|
+
PromptInput: () => Pr,
|
|
4110
|
+
PromptInputActionAddAttachments: () => Nr,
|
|
4111
|
+
PromptInputActionMenu: () => Vr,
|
|
4112
|
+
PromptInputActionMenuContent: () => Ur,
|
|
4113
|
+
PromptInputActionMenuItem: () => Wr,
|
|
4114
|
+
PromptInputActionMenuTrigger: () => Hr,
|
|
4115
|
+
PromptInputAttachment: () => jr,
|
|
4116
|
+
PromptInputAttachments: () => Mr,
|
|
4117
|
+
PromptInputBody: () => Fr,
|
|
4118
|
+
PromptInputButton: () => Br,
|
|
4119
|
+
PromptInputCommand: () => oi,
|
|
4120
|
+
PromptInputCommandEmpty: () => li,
|
|
4121
|
+
PromptInputCommandGroup: () => ui,
|
|
4122
|
+
PromptInputCommandInput: () => si,
|
|
4123
|
+
PromptInputCommandItem: () => di,
|
|
4124
|
+
PromptInputCommandList: () => ci,
|
|
4125
|
+
PromptInputCommandSeparator: () => fi,
|
|
4126
|
+
PromptInputFooter: () => Rr,
|
|
4127
|
+
PromptInputHeader: () => Lr,
|
|
4128
|
+
PromptInputHoverCard: () => Qr,
|
|
4129
|
+
PromptInputHoverCardContent: () => ei,
|
|
4130
|
+
PromptInputHoverCardTrigger: () => $r,
|
|
4131
|
+
PromptInputProvider: () => Or,
|
|
4132
|
+
PromptInputSelect: () => qr,
|
|
4133
|
+
PromptInputSelectContent: () => Yr,
|
|
4134
|
+
PromptInputSelectItem: () => Xr,
|
|
4135
|
+
PromptInputSelectTrigger: () => Jr,
|
|
4136
|
+
PromptInputSelectValue: () => Zr,
|
|
4137
|
+
PromptInputSpeechButton: () => Kr,
|
|
4138
|
+
PromptInputSubmit: () => Gr,
|
|
4139
|
+
PromptInputTab: () => ni,
|
|
4140
|
+
PromptInputTabBody: () => ii,
|
|
4141
|
+
PromptInputTabItem: () => ai,
|
|
4142
|
+
PromptInputTabLabel: () => ri,
|
|
4143
|
+
PromptInputTabsList: () => ti,
|
|
4144
|
+
PromptInputTextarea: () => Ir,
|
|
4145
|
+
PromptInputTools: () => zr,
|
|
4146
|
+
Reasoning: () => ji,
|
|
4147
|
+
ReasoningContent: () => Pi,
|
|
4148
|
+
ReasoningTrigger: () => Ni,
|
|
4149
|
+
Shimmer: () => Ei,
|
|
4150
|
+
Source: () => Ri,
|
|
4151
|
+
Sources: () => Fi,
|
|
4152
|
+
SourcesContent: () => Li,
|
|
4153
|
+
SourcesTrigger: () => Ii,
|
|
4154
|
+
Suggestion: () => mi,
|
|
4155
|
+
Suggestions: () => pi,
|
|
4156
|
+
Tool: () => bi,
|
|
4157
|
+
ToolContent: () => Ci,
|
|
4158
|
+
ToolHeader: () => Si,
|
|
4159
|
+
ToolInput: () => wi,
|
|
4160
|
+
ToolOutput: () => Ti,
|
|
4161
|
+
highlightCode: () => _i,
|
|
4162
|
+
usePromptInputAttachments: () => Ar,
|
|
4163
|
+
usePromptInputController: () => wr,
|
|
4164
|
+
useProviderAttachments: () => Er,
|
|
4165
|
+
useReasoning: () => Oi
|
|
4166
|
+
}), Ea = "/api/v1/ai";
|
|
4167
|
+
function Da(e, t, n) {
|
|
4155
4168
|
let r = e.replace(/\/$/, ""), i = new URLSearchParams();
|
|
4156
4169
|
if (n) for (let [e, t] of Object.entries(n)) t == null || t === "" || i.set(e, String(t));
|
|
4157
4170
|
let a = i.toString();
|
|
4158
4171
|
return `${r}${t}${a ? `?${a}` : ""}`;
|
|
4159
4172
|
}
|
|
4160
|
-
async function
|
|
4173
|
+
async function Oa(e, t, n) {
|
|
4161
4174
|
let r = await fetch(e, {
|
|
4162
4175
|
credentials: "include",
|
|
4163
4176
|
...t,
|
|
@@ -4177,8 +4190,8 @@ async function wa(e, t, n) {
|
|
|
4177
4190
|
}
|
|
4178
4191
|
return i;
|
|
4179
4192
|
}
|
|
4180
|
-
function
|
|
4181
|
-
let { apiBase: n =
|
|
4193
|
+
function ka(t = {}) {
|
|
4194
|
+
let { apiBase: n = Ea, status: r = "pending", conversationId: i, limit: a, headers: o, pollInterval: s = 5e3, enabled: c = !0 } = t, [l, u] = e.useState([]), [d, f] = e.useState(0), [p, m] = e.useState(!1), [h, g] = e.useState(void 0), _ = e.useRef({
|
|
4182
4195
|
apiBase: n,
|
|
4183
4196
|
status: r,
|
|
4184
4197
|
conversationId: i,
|
|
@@ -4196,7 +4209,7 @@ function Ta(t = {}) {
|
|
|
4196
4209
|
let { apiBase: e, status: t, conversationId: n, limit: r, headers: i } = _.current;
|
|
4197
4210
|
m(!0), g(void 0);
|
|
4198
4211
|
try {
|
|
4199
|
-
let a = await
|
|
4212
|
+
let a = await Oa(Da(e, "/pending-actions", {
|
|
4200
4213
|
status: t && t !== "all" ? t : void 0,
|
|
4201
4214
|
conversationId: n,
|
|
4202
4215
|
limit: r
|
|
@@ -4208,9 +4221,9 @@ function Ta(t = {}) {
|
|
|
4208
4221
|
m(!1);
|
|
4209
4222
|
}
|
|
4210
4223
|
}, []), y = e.useCallback(async (e) => {
|
|
4211
|
-
let { apiBase: t, headers: n } = _.current, r =
|
|
4224
|
+
let { apiBase: t, headers: n } = _.current, r = Da(t, `/pending-actions/${encodeURIComponent(e)}/approve`);
|
|
4212
4225
|
try {
|
|
4213
|
-
return await
|
|
4226
|
+
return await Oa(r, {
|
|
4214
4227
|
method: "POST",
|
|
4215
4228
|
body: "{}"
|
|
4216
4229
|
}, n);
|
|
@@ -4218,9 +4231,9 @@ function Ta(t = {}) {
|
|
|
4218
4231
|
v();
|
|
4219
4232
|
}
|
|
4220
4233
|
}, [v]), b = e.useCallback(async (e, t) => {
|
|
4221
|
-
let { apiBase: n, headers: r } = _.current, i =
|
|
4234
|
+
let { apiBase: n, headers: r } = _.current, i = Da(n, `/pending-actions/${encodeURIComponent(e)}/reject`);
|
|
4222
4235
|
try {
|
|
4223
|
-
return await
|
|
4236
|
+
return await Oa(i, {
|
|
4224
4237
|
method: "POST",
|
|
4225
4238
|
body: JSON.stringify(t ? { reason: t } : {})
|
|
4226
4239
|
}, r);
|
|
@@ -4254,7 +4267,7 @@ function Ta(t = {}) {
|
|
|
4254
4267
|
}
|
|
4255
4268
|
//#endregion
|
|
4256
4269
|
//#region src/AiPendingActionsInbox.tsx
|
|
4257
|
-
var
|
|
4270
|
+
var Aa = {
|
|
4258
4271
|
pending: {
|
|
4259
4272
|
variant: "secondary",
|
|
4260
4273
|
label: "Pending"
|
|
@@ -4276,8 +4289,8 @@ var Ea = {
|
|
|
4276
4289
|
label: "Rejected"
|
|
4277
4290
|
}
|
|
4278
4291
|
};
|
|
4279
|
-
function
|
|
4280
|
-
let t =
|
|
4292
|
+
function ja({ status: e }) {
|
|
4293
|
+
let t = Aa[e] ?? {
|
|
4281
4294
|
variant: "outline",
|
|
4282
4295
|
label: e
|
|
4283
4296
|
};
|
|
@@ -4286,7 +4299,7 @@ function Da({ status: e }) {
|
|
|
4286
4299
|
children: t.label
|
|
4287
4300
|
});
|
|
4288
4301
|
}
|
|
4289
|
-
function
|
|
4302
|
+
function Ma(e) {
|
|
4290
4303
|
if (!e) return "—";
|
|
4291
4304
|
let t = Date.parse(e);
|
|
4292
4305
|
if (Number.isNaN(t)) return e;
|
|
@@ -4304,7 +4317,7 @@ function Oa(e) {
|
|
|
4304
4317
|
return e;
|
|
4305
4318
|
}
|
|
4306
4319
|
}
|
|
4307
|
-
function
|
|
4320
|
+
function Na(e) {
|
|
4308
4321
|
if (!e) return null;
|
|
4309
4322
|
try {
|
|
4310
4323
|
return JSON.parse(e);
|
|
@@ -4312,7 +4325,7 @@ function ka(e) {
|
|
|
4312
4325
|
return e;
|
|
4313
4326
|
}
|
|
4314
4327
|
}
|
|
4315
|
-
function
|
|
4328
|
+
function Pa({ value: e, max: t = 320 }) {
|
|
4316
4329
|
let n = typeof e == "string" ? e : JSON.stringify(e, null, 2);
|
|
4317
4330
|
return n == null || n === "" ? /* @__PURE__ */ Q("span", {
|
|
4318
4331
|
className: "text-muted-foreground text-xs",
|
|
@@ -4323,20 +4336,20 @@ function Aa({ value: e, max: t = 320 }) {
|
|
|
4323
4336
|
children: n
|
|
4324
4337
|
});
|
|
4325
4338
|
}
|
|
4326
|
-
function
|
|
4339
|
+
function Fa(e) {
|
|
4327
4340
|
switch (e) {
|
|
4328
4341
|
case "pending": return "pending";
|
|
4329
4342
|
case "all": return "all";
|
|
4330
4343
|
case "decided": return "all";
|
|
4331
4344
|
}
|
|
4332
4345
|
}
|
|
4333
|
-
function
|
|
4334
|
-
let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: P, approve: F, reject: I } =
|
|
4346
|
+
function Ia({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i, variant: a = "card", title: o = "AI Approvals", description: s = "Actions an AI agent proposed that need a human review before execution.", className: c }) {
|
|
4347
|
+
let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: P, approve: F, reject: I } = ka({
|
|
4335
4348
|
apiBase: t,
|
|
4336
4349
|
headers: n,
|
|
4337
4350
|
pollInterval: r,
|
|
4338
4351
|
conversationId: i,
|
|
4339
|
-
status:
|
|
4352
|
+
status: Fa(l)
|
|
4340
4353
|
}), L = e.useMemo(() => l === "decided" ? j.filter((e) => e.status !== "pending") : j, [j, l]), z = e.useMemo(() => d ? j.find((e) => e.id === d) ?? null : null, [d, j]), ie = e.useCallback(async (e) => {
|
|
4341
4354
|
E(e), O(null);
|
|
4342
4355
|
try {
|
|
@@ -4358,7 +4371,7 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4358
4371
|
} finally {
|
|
4359
4372
|
E(null);
|
|
4360
4373
|
}
|
|
4361
|
-
}, [F]),
|
|
4374
|
+
}, [F]), B = e.useCallback(async (e, t) => {
|
|
4362
4375
|
E(e), O(null);
|
|
4363
4376
|
try {
|
|
4364
4377
|
await I(e, t.trim() || void 0), A({
|
|
@@ -4378,7 +4391,7 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4378
4391
|
} finally {
|
|
4379
4392
|
E(null);
|
|
4380
4393
|
}
|
|
4381
|
-
}, [I]),
|
|
4394
|
+
}, [I]), ae = /* @__PURE__ */ $("div", {
|
|
4382
4395
|
className: "space-y-3",
|
|
4383
4396
|
children: [
|
|
4384
4397
|
/* @__PURE__ */ $("div", {
|
|
@@ -4485,7 +4498,7 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4485
4498
|
className: "text-sm",
|
|
4486
4499
|
children: e.object_name
|
|
4487
4500
|
}),
|
|
4488
|
-
/* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(
|
|
4501
|
+
/* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(ja, { status: e.status }) }),
|
|
4489
4502
|
/* @__PURE__ */ Q(H, {
|
|
4490
4503
|
className: "text-xs text-muted-foreground",
|
|
4491
4504
|
children: /* @__PURE__ */ $("span", {
|
|
@@ -4493,7 +4506,7 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4493
4506
|
children: [
|
|
4494
4507
|
/* @__PURE__ */ Q(He, { className: "h-3 w-3" }),
|
|
4495
4508
|
" ",
|
|
4496
|
-
|
|
4509
|
+
Ma(e.proposed_at)
|
|
4497
4510
|
]
|
|
4498
4511
|
})
|
|
4499
4512
|
}),
|
|
@@ -4544,10 +4557,10 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4544
4557
|
o
|
|
4545
4558
|
]
|
|
4546
4559
|
}), s ? /* @__PURE__ */ Q(x, { children: s }) : null]
|
|
4547
|
-
}), /* @__PURE__ */ Q(b, { children:
|
|
4560
|
+
}), /* @__PURE__ */ Q(b, { children: ae })]
|
|
4548
4561
|
}) : /* @__PURE__ */ Q("div", {
|
|
4549
4562
|
className: c,
|
|
4550
|
-
children:
|
|
4563
|
+
children: ae
|
|
4551
4564
|
}),
|
|
4552
4565
|
/* @__PURE__ */ Q(me, {
|
|
4553
4566
|
open: !!d,
|
|
@@ -4582,14 +4595,14 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4582
4595
|
children: "Status"
|
|
4583
4596
|
}), /* @__PURE__ */ Q("div", {
|
|
4584
4597
|
className: "mt-1",
|
|
4585
|
-
children: /* @__PURE__ */ Q(
|
|
4598
|
+
children: /* @__PURE__ */ Q(ja, { status: z.status })
|
|
4586
4599
|
})] }),
|
|
4587
4600
|
/* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4588
4601
|
className: "text-xs text-muted-foreground",
|
|
4589
4602
|
children: "Proposed"
|
|
4590
4603
|
}), /* @__PURE__ */ Q("div", {
|
|
4591
4604
|
className: "mt-1 text-xs",
|
|
4592
|
-
children:
|
|
4605
|
+
children: Ma(z.proposed_at)
|
|
4593
4606
|
})] }),
|
|
4594
4607
|
/* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4595
4608
|
className: "text-xs text-muted-foreground",
|
|
@@ -4623,21 +4636,21 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4623
4636
|
children: "Tool input"
|
|
4624
4637
|
}), /* @__PURE__ */ Q("div", {
|
|
4625
4638
|
className: "mt-1.5",
|
|
4626
|
-
children: /* @__PURE__ */ Q(
|
|
4639
|
+
children: /* @__PURE__ */ Q(Pa, { value: Na(z.tool_input) })
|
|
4627
4640
|
})] }),
|
|
4628
4641
|
z.result ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4629
4642
|
className: "text-xs",
|
|
4630
4643
|
children: "Result"
|
|
4631
4644
|
}), /* @__PURE__ */ Q("div", {
|
|
4632
4645
|
className: "mt-1.5",
|
|
4633
|
-
children: /* @__PURE__ */ Q(
|
|
4646
|
+
children: /* @__PURE__ */ Q(Pa, { value: Na(z.result) })
|
|
4634
4647
|
})] }) : null,
|
|
4635
4648
|
z.error ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4636
4649
|
className: "text-xs text-destructive",
|
|
4637
4650
|
children: "Error"
|
|
4638
4651
|
}), /* @__PURE__ */ Q("div", {
|
|
4639
4652
|
className: "mt-1.5",
|
|
4640
|
-
children: /* @__PURE__ */ Q(
|
|
4653
|
+
children: /* @__PURE__ */ Q(Pa, { value: z.error })
|
|
4641
4654
|
})] }) : null,
|
|
4642
4655
|
z.rejection_reason ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4643
4656
|
className: "text-xs",
|
|
@@ -4695,7 +4708,7 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4695
4708
|
}), /* @__PURE__ */ $(v, {
|
|
4696
4709
|
variant: "destructive",
|
|
4697
4710
|
size: "sm",
|
|
4698
|
-
onClick: () => h && void
|
|
4711
|
+
onClick: () => h && void B(h, _),
|
|
4699
4712
|
disabled: !h || T === h,
|
|
4700
4713
|
"data-testid": "ai-inbox-reject-confirm",
|
|
4701
4714
|
children: [/* @__PURE__ */ Q(X, { className: "h-3.5 w-3.5 mr-1" }), "Reject"]
|
|
@@ -4708,14 +4721,14 @@ function Ma({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4708
4721
|
}
|
|
4709
4722
|
//#endregion
|
|
4710
4723
|
//#region src/useHitlInChat.ts
|
|
4711
|
-
function
|
|
4724
|
+
function La(e) {
|
|
4712
4725
|
return !e || e.length === 0 ? "/api/v1/ai" : e.endsWith("/") ? e.slice(0, -1) : e;
|
|
4713
4726
|
}
|
|
4714
|
-
function
|
|
4727
|
+
function Ra(e, t) {
|
|
4715
4728
|
let n = { ...e ?? {} };
|
|
4716
4729
|
return t && (n["Content-Type"] = "application/json"), n;
|
|
4717
4730
|
}
|
|
4718
|
-
async function
|
|
4731
|
+
async function za(e) {
|
|
4719
4732
|
let t = await e.text();
|
|
4720
4733
|
if (!t) return null;
|
|
4721
4734
|
try {
|
|
@@ -4724,8 +4737,8 @@ async function Fa(e) {
|
|
|
4724
4737
|
return { raw: t };
|
|
4725
4738
|
}
|
|
4726
4739
|
}
|
|
4727
|
-
function
|
|
4728
|
-
let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s =
|
|
4740
|
+
function Ba(t) {
|
|
4741
|
+
let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s = La(r), c = e.useMemo(() => {
|
|
4729
4742
|
let e = /* @__PURE__ */ new Map();
|
|
4730
4743
|
for (let t of n) {
|
|
4731
4744
|
let n = t.toolInvocations ?? [];
|
|
@@ -4768,9 +4781,9 @@ function Ia(t) {
|
|
|
4768
4781
|
let r = `${s}/pending-actions/${encodeURIComponent(l)}/${t ? "approve" : "reject"}`, c = t ? "{}" : JSON.stringify({ reason: n ?? "" }), d = await fetch(r, {
|
|
4769
4782
|
method: "POST",
|
|
4770
4783
|
credentials: "include",
|
|
4771
|
-
headers:
|
|
4784
|
+
headers: Ra(i, !0),
|
|
4772
4785
|
body: c
|
|
4773
|
-
}), f = await
|
|
4786
|
+
}), f = await za(d) ?? {};
|
|
4774
4787
|
if (!d.ok) {
|
|
4775
4788
|
let t = typeof f.error == "string" ? f.error : `Approval failed: HTTP ${d.status}`;
|
|
4776
4789
|
m(e, {
|
|
@@ -4797,7 +4810,7 @@ function Ia(t) {
|
|
|
4797
4810
|
state: "success",
|
|
4798
4811
|
message: `Status: ${p}`
|
|
4799
4812
|
}), h = !0), a?.(e, f), h && o) {
|
|
4800
|
-
let r =
|
|
4813
|
+
let r = Va({
|
|
4801
4814
|
approved: t,
|
|
4802
4815
|
status: p,
|
|
4803
4816
|
toolName: u,
|
|
@@ -4832,24 +4845,24 @@ function Ia(t) {
|
|
|
4832
4845
|
isDeciding: f
|
|
4833
4846
|
};
|
|
4834
4847
|
}
|
|
4835
|
-
function
|
|
4848
|
+
function Va(e) {
|
|
4836
4849
|
let { approved: t, status: n, toolName: r, pendingActionId: i, outcome: a, reason: o } = e, s = `[HITL ${i}]`;
|
|
4837
4850
|
if (t && n === "executed") {
|
|
4838
4851
|
let e = a.result;
|
|
4839
|
-
return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e :
|
|
4852
|
+
return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e : Ha(JSON.stringify(e), 800)}. Acknowledge the outcome concisely and continue the user's task.`;
|
|
4840
4853
|
}
|
|
4841
4854
|
if (!t && n === "rejected") return `${s} The operator rejected the \`${r}\` call.${o && o.trim().length > 0 ? ` Reason: ${o}.` : ""} Acknowledge the rejection and ask whether to try a different approach.`;
|
|
4842
4855
|
if (n === "failed") {
|
|
4843
4856
|
let e = a.error;
|
|
4844
|
-
return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e :
|
|
4857
|
+
return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e : Ha(JSON.stringify(e ?? {}), 400)}. Apologize concisely and offer alternatives.`;
|
|
4845
4858
|
}
|
|
4846
4859
|
}
|
|
4847
|
-
function
|
|
4860
|
+
function Ha(e, t) {
|
|
4848
4861
|
return e.length <= t ? e : `${e.slice(0, t - 1)}…`;
|
|
4849
4862
|
}
|
|
4850
4863
|
//#endregion
|
|
4851
4864
|
//#region src/index.tsx
|
|
4852
|
-
var
|
|
4865
|
+
var Ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, disabled: a = !1, showTimestamp: o = !1, userAvatarUrl: s, userAvatarFallback: c = "You", assistantAvatarUrl: l, assistantAvatarFallback: u = "AI", maxHeight: d = "500px", ...f }, p) => {
|
|
4853
4866
|
let [m, h] = e.useState(""), g = e.useRef(null), _ = e.useRef(null);
|
|
4854
4867
|
e.useEffect(() => {
|
|
4855
4868
|
if (g.current) {
|
|
@@ -4875,7 +4888,7 @@ var za = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
4875
4888
|
children: n.length === 0 ? /* @__PURE__ */ Q("div", {
|
|
4876
4889
|
className: "flex items-center justify-center h-32 text-muted-foreground text-sm",
|
|
4877
4890
|
children: "No messages yet. Start a conversation!"
|
|
4878
|
-
}) : n.map((e) => /* @__PURE__ */ Q(
|
|
4891
|
+
}) : n.map((e) => /* @__PURE__ */ Q(Wa, {
|
|
4879
4892
|
message: e,
|
|
4880
4893
|
showTimestamp: o,
|
|
4881
4894
|
userAvatarUrl: s,
|
|
@@ -4888,7 +4901,7 @@ var za = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
4888
4901
|
className: "border-t p-4",
|
|
4889
4902
|
children: /* @__PURE__ */ $("div", {
|
|
4890
4903
|
className: "flex gap-2",
|
|
4891
|
-
children: [/* @__PURE__ */ Q(
|
|
4904
|
+
children: [/* @__PURE__ */ Q(ae, {
|
|
4892
4905
|
ref: _,
|
|
4893
4906
|
value: m,
|
|
4894
4907
|
onChange: (e) => h(e.target.value),
|
|
@@ -4906,8 +4919,8 @@ var za = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
4906
4919
|
})]
|
|
4907
4920
|
});
|
|
4908
4921
|
});
|
|
4909
|
-
|
|
4910
|
-
var
|
|
4922
|
+
Ua.displayName = "Chatbot";
|
|
4923
|
+
var Wa = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback: r, assistantAvatarUrl: i, assistantAvatarFallback: a }) => {
|
|
4911
4924
|
let o = e.role === "user";
|
|
4912
4925
|
if (e.role === "system") return /* @__PURE__ */ Q("div", {
|
|
4913
4926
|
className: "flex justify-center",
|
|
@@ -4939,7 +4952,7 @@ var Ba = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
4939
4952
|
})]
|
|
4940
4953
|
})]
|
|
4941
4954
|
});
|
|
4942
|
-
},
|
|
4955
|
+
}, Ga = e.forwardRef(({ className: e, avatarSrc: t, avatarFallback: n = "AI", ...r }, i) => /* @__PURE__ */ $("div", {
|
|
4943
4956
|
ref: i,
|
|
4944
4957
|
className: q("flex gap-3", e),
|
|
4945
4958
|
...r,
|
|
@@ -4961,6 +4974,6 @@ var Ba = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
4961
4974
|
})
|
|
4962
4975
|
})]
|
|
4963
4976
|
}));
|
|
4964
|
-
|
|
4977
|
+
Ga.displayName = "TypingIndicator";
|
|
4965
4978
|
//#endregion
|
|
4966
|
-
export { sn as AGENT_ALIAS_GROUPS,
|
|
4979
|
+
export { sn as AGENT_ALIAS_GROUPS, Ta as AIElements, Ia as AiPendingActionsInbox, Ua as Chatbot, Qi as ChatbotEnhanced, Sa as FloatingChatbot, Ln as FloatingChatbotPanel, Tn as FloatingChatbotProvider, jn as FloatingChatbotTrigger, mn as PLATFORM_DEFAULT_AGENT, Ga as TypingIndicator, cn as agentAliasGroup, ln as agentRouteName, Jt as buildProgressFromDraftReview, Kt as detectDraftResult, Wt as detectProposedPlan, zn as humanizeToolName, pn as isAskAgent, fn as isBuildAgent, dn as isBuiltinAgentName, zi as publishHealthFromResponse, un as resolveAgentParam, hn as resolveDefaultAgentName, Vn as summarizeChatError, en as uiMessageToChatMessage, tn as uiMessagesToChatMessages, Bn as unwrapToolResult, xn as useAgents, Cn as useAiModels, En as useFloatingChatbot, Ba as useHitlInChat, on as useObjectChat, ka as usePendingActions };
|