@eloquentai/chat-sdk 0.17.0 → 0.18.0-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
import * as ue from "react";
|
2
|
-
import { version as ql, createContext as Jo, useContext as Xo,
|
2
|
+
import { version as ql, createContext as Jo, useContext as Xo, useState as z, useEffect as ce, useMemo as Et, useRef as Pe, useCallback as $e } from "react";
|
3
3
|
import { jsx as m, jsxs as D, Fragment as xt } from "react/jsx-runtime";
|
4
|
-
import { ChevronDown as Xa,
|
4
|
+
import { ChevronDown as Xa, X as Qa, Copy as Gl, ThumbsUp as Vl, ThumbsDown as Kl, FileSearch as Yl, CheckCircle as Jl, Info as Xl, XCircle as Ql, AlertTriangle as Zl, ArrowUp as ed, RefreshCcw as td } from "lucide-react";
|
5
5
|
import { clsx as nd } from "clsx";
|
6
6
|
import { twMerge as rd } from "tailwind-merge";
|
7
7
|
import { useDebounce as Qo } from "@uidotdev/usehooks";
|
8
|
-
import { useRive as od, Layout as sd, Alignment as id, Fit as ad, useStateMachineInput as cd } from "@rive-app/react-canvas";
|
9
|
-
import * as Ut from "@radix-ui/react-avatar";
|
10
8
|
import * as ot from "@radix-ui/react-scroll-area";
|
11
|
-
import { ScrollArea as
|
9
|
+
import { ScrollArea as od } from "@radix-ui/react-scroll-area";
|
12
10
|
import * as Ae from "@radix-ui/react-dialog";
|
11
|
+
import { useRive as sd, Layout as id, Alignment as ad, Fit as cd, useStateMachineInput as ud } from "@rive-app/react-canvas";
|
12
|
+
import * as Ut from "@radix-ui/react-avatar";
|
13
13
|
import { createPortal as fo } from "react-dom";
|
14
14
|
import { z as se } from "zod";
|
15
15
|
import ld from "react-dom/client";
|
16
16
|
try {
|
17
17
|
let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;
|
18
|
-
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "
|
18
|
+
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "511248d4-26ea-4b50-a512-9017c654f92f", e._sentryDebugIdIdentifier = "sentry-dbid-511248d4-26ea-4b50-a512-9017c654f92f");
|
19
19
|
} catch {
|
20
20
|
}
|
21
21
|
const U = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, st = "9.30.0", $ = globalThis;
|
@@ -10610,9 +10610,9 @@ function $_(e) {
|
|
10610
10610
|
}
|
10611
10611
|
{
|
10612
10612
|
let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
|
10613
|
-
e.SENTRY_RELEASE = { id: "
|
10613
|
+
e.SENTRY_RELEASE = { id: "b240b6dfa15035608128cb54b64837c1493d2697" };
|
10614
10614
|
}
|
10615
|
-
const H_ = "
|
10615
|
+
const H_ = "development";
|
10616
10616
|
$_({
|
10617
10617
|
dsn: void 0,
|
10618
10618
|
environment: H_,
|
@@ -10774,138 +10774,7 @@ const Yu = () => {
|
|
10774
10774
|
if (!e)
|
10775
10775
|
throw new Error("useTheme must be used within a ThemeProvider");
|
10776
10776
|
return e;
|
10777
|
-
},
|
10778
|
-
function Q_() {
|
10779
|
-
return J_;
|
10780
|
-
}
|
10781
|
-
function Z_(e, t, n) {
|
10782
|
-
return {
|
10783
|
-
API: {
|
10784
|
-
Events: {
|
10785
|
-
endpoint: e || "",
|
10786
|
-
region: n || "",
|
10787
|
-
defaultAuthMode: "apiKey",
|
10788
|
-
apiKey: t || ""
|
10789
|
-
}
|
10790
|
-
}
|
10791
|
-
};
|
10792
|
-
}
|
10793
|
-
function Ju({ isWaiting: e = !1, ...t }) {
|
10794
|
-
const { className: n, onLoaded: r, ...o } = t, { RiveComponent: s, rive: i } = od({
|
10795
|
-
src: X_,
|
10796
|
-
stateMachines: "State Machine 1",
|
10797
|
-
autoplay: !0,
|
10798
|
-
layout: new sd({
|
10799
|
-
fit: ad.Cover,
|
10800
|
-
alignment: id.TopCenter
|
10801
|
-
})
|
10802
|
-
}), c = cd(i, "State Machine 1", "waiting");
|
10803
|
-
return ce(() => {
|
10804
|
-
if (c)
|
10805
|
-
try {
|
10806
|
-
c.value = e;
|
10807
|
-
} catch {
|
10808
|
-
}
|
10809
|
-
}, [i, c, e]), ce(() => {
|
10810
|
-
i && r?.();
|
10811
|
-
}, [i]), /* @__PURE__ */ m(
|
10812
|
-
"div",
|
10813
|
-
{
|
10814
|
-
className: A(
|
10815
|
-
"flex items-center justify-center w-full h-full",
|
10816
|
-
n
|
10817
|
-
),
|
10818
|
-
...o,
|
10819
|
-
children: /* @__PURE__ */ m(s, {})
|
10820
|
-
}
|
10821
|
-
);
|
10822
|
-
}
|
10823
|
-
const Xu = Jo(void 0);
|
10824
|
-
function ew({
|
10825
|
-
children: e,
|
10826
|
-
...t
|
10827
|
-
}) {
|
10828
|
-
return /* @__PURE__ */ m(Xu.Provider, { value: t, children: e });
|
10829
|
-
}
|
10830
|
-
function Ur() {
|
10831
|
-
const e = Xo(Xu);
|
10832
|
-
if (!e)
|
10833
|
-
throw new Error(
|
10834
|
-
"useChatInterfaceContext must be used within a ChatInterfaceProvider"
|
10835
|
-
);
|
10836
|
-
return e;
|
10837
|
-
}
|
10838
|
-
const Qu = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
10839
|
-
Ut.Root,
|
10840
|
-
{
|
10841
|
-
ref: n,
|
10842
|
-
className: A(
|
10843
|
-
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
10844
|
-
e
|
10845
|
-
),
|
10846
|
-
...t
|
10847
|
-
}
|
10848
|
-
));
|
10849
|
-
Qu.displayName = Ut.Root.displayName;
|
10850
|
-
const tw = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
10851
|
-
Ut.Image,
|
10852
|
-
{
|
10853
|
-
ref: n,
|
10854
|
-
className: A("aspect-square h-full w-full", e),
|
10855
|
-
...t
|
10856
|
-
}
|
10857
|
-
));
|
10858
|
-
tw.displayName = Ut.Image.displayName;
|
10859
|
-
const nw = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
10860
|
-
Ut.Fallback,
|
10861
|
-
{
|
10862
|
-
ref: n,
|
10863
|
-
className: A(
|
10864
|
-
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
10865
|
-
e
|
10866
|
-
),
|
10867
|
-
...t
|
10868
|
-
}
|
10869
|
-
));
|
10870
|
-
nw.displayName = Ut.Fallback.displayName;
|
10871
|
-
function rw({
|
10872
|
-
onCleanChat: e,
|
10873
|
-
onClose: t
|
10874
|
-
}) {
|
10875
|
-
const n = Ur();
|
10876
|
-
return /* @__PURE__ */ D(Os, { className: "p-4 flex flex-row items-center justify-between shadow-sm space-y-0", children: [
|
10877
|
-
/* @__PURE__ */ D("div", { className: "flex flex-row items-center space-x-3", children: [
|
10878
|
-
/* @__PURE__ */ m(Qu, { className: "h-8 w-8", children: /* @__PURE__ */ m(
|
10879
|
-
Pr,
|
10880
|
-
{
|
10881
|
-
src: n.assistantLogo,
|
10882
|
-
bgColor: "#6F33B7",
|
10883
|
-
fgColor: "#ffffff"
|
10884
|
-
}
|
10885
|
-
) }),
|
10886
|
-
/* @__PURE__ */ m("div", { className: "flex flex-col", children: /* @__PURE__ */ m("h2", { className: "text-foreground font-semibold", children: n.assistantName }) })
|
10887
|
-
] }),
|
10888
|
-
/* @__PURE__ */ D("div", { children: [
|
10889
|
-
n.cleanChatButton && /* @__PURE__ */ m(
|
10890
|
-
"button",
|
10891
|
-
{
|
10892
|
-
onClick: e,
|
10893
|
-
className: "text-gray-400 hover:text-gray-600 p-2",
|
10894
|
-
children: /* @__PURE__ */ m(Gl, { className: "w-4 h-4" })
|
10895
|
-
}
|
10896
|
-
),
|
10897
|
-
n.closeButton === !0 && n.isMobile && /* @__PURE__ */ m(
|
10898
|
-
"button",
|
10899
|
-
{
|
10900
|
-
onClick: t,
|
10901
|
-
className: "text-gray-400 hover:text-gray-600 p-2",
|
10902
|
-
children: /* @__PURE__ */ m(Qa, { className: "w-4 h-4" })
|
10903
|
-
}
|
10904
|
-
)
|
10905
|
-
] })
|
10906
|
-
] });
|
10907
|
-
}
|
10908
|
-
const Zu = ue.forwardRef(({ className: e, children: t, onViewportScroll: n, ...r }, o) => /* @__PURE__ */ D(
|
10777
|
+
}, Ju = ue.forwardRef(({ className: e, children: t, onViewportScroll: n, ...r }, o) => /* @__PURE__ */ D(
|
10909
10778
|
ot.Root,
|
10910
10779
|
{
|
10911
10780
|
ref: o,
|
@@ -10920,13 +10789,13 @@ const Zu = ue.forwardRef(({ className: e, children: t, onViewportScroll: n, ...r
|
|
10920
10789
|
children: t
|
10921
10790
|
}
|
10922
10791
|
),
|
10923
|
-
/* @__PURE__ */ m(
|
10792
|
+
/* @__PURE__ */ m(Xu, {}),
|
10924
10793
|
/* @__PURE__ */ m(ot.Corner, {})
|
10925
10794
|
]
|
10926
10795
|
}
|
10927
10796
|
));
|
10928
|
-
|
10929
|
-
const
|
10797
|
+
Ju.displayName = ot.Root.displayName;
|
10798
|
+
const Xu = ue.forwardRef(({ className: e, orientation: t = "vertical", ...n }, r) => /* @__PURE__ */ m(
|
10930
10799
|
ot.ScrollAreaScrollbar,
|
10931
10800
|
{
|
10932
10801
|
ref: r,
|
@@ -10941,30 +10810,8 @@ const el = ue.forwardRef(({ className: e, orientation: t = "vertical", ...n }, r
|
|
10941
10810
|
children: /* @__PURE__ */ m(ot.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
10942
10811
|
}
|
10943
10812
|
));
|
10944
|
-
|
10945
|
-
|
10946
|
-
const { className: t, src: n, ...r } = e;
|
10947
|
-
return /* @__PURE__ */ m("div", { className: A("w-full h-full", t), ...r, children: n ? /* @__PURE__ */ m(
|
10948
|
-
"img",
|
10949
|
-
{
|
10950
|
-
src: n,
|
10951
|
-
alt: "Assistant Logo",
|
10952
|
-
className: "w-full h-full object-contain"
|
10953
|
-
}
|
10954
|
-
) : /* @__PURE__ */ D("svg", { viewBox: "0 0 80 80", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
10955
|
-
/* @__PURE__ */ m("rect", { width: "80", height: "80", fill: "#6F33B7" }),
|
10956
|
-
/* @__PURE__ */ m(
|
10957
|
-
"path",
|
10958
|
-
{
|
10959
|
-
fillRule: "evenodd",
|
10960
|
-
clipRule: "evenodd",
|
10961
|
-
d: "M41 27C34.2871 27 29 32.41 29 39C29 46.7908 35.2092 53 43 53V61C30.7908 61 21 51.209 21 39C21 28.0512 29.8095 19 41 19C51.2331 19 59 26.828 59 37C59 45.9675 51.9576 53 43 53V45C47.5423 45 51 41.5462 51 37C51 31.2295 46.7981 27 41 27Z",
|
10962
|
-
fill: "white"
|
10963
|
-
}
|
10964
|
-
)
|
10965
|
-
] }) });
|
10966
|
-
}
|
10967
|
-
const sw = Ae.Root, iw = Ae.Portal, tl = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
10813
|
+
Xu.displayName = ot.ScrollAreaScrollbar.displayName;
|
10814
|
+
const K_ = Ae.Root, Y_ = Ae.Portal, Qu = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
10968
10815
|
Ae.Overlay,
|
10969
10816
|
{
|
10970
10817
|
ref: n,
|
@@ -10975,9 +10822,9 @@ const sw = Ae.Root, iw = Ae.Portal, tl = ue.forwardRef(({ className: e, ...t },
|
|
10975
10822
|
...t
|
10976
10823
|
}
|
10977
10824
|
));
|
10978
|
-
|
10979
|
-
const
|
10980
|
-
/* @__PURE__ */ m(
|
10825
|
+
Qu.displayName = Ae.Overlay.displayName;
|
10826
|
+
const Zu = ue.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ D(Y_, { children: [
|
10827
|
+
/* @__PURE__ */ m(Qu, {}),
|
10981
10828
|
/* @__PURE__ */ D(
|
10982
10829
|
Ae.Content,
|
10983
10830
|
{
|
@@ -10997,8 +10844,8 @@ const nl = ue.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE_
|
|
10997
10844
|
}
|
10998
10845
|
)
|
10999
10846
|
] }));
|
11000
|
-
|
11001
|
-
const
|
10847
|
+
Zu.displayName = Ae.Content.displayName;
|
10848
|
+
const el = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
11002
10849
|
Ae.Title,
|
11003
10850
|
{
|
11004
10851
|
ref: n,
|
@@ -11009,8 +10856,8 @@ const rl = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
|
11009
10856
|
...t
|
11010
10857
|
}
|
11011
10858
|
));
|
11012
|
-
|
11013
|
-
const
|
10859
|
+
el.displayName = Ae.Title.displayName;
|
10860
|
+
const tl = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
11014
10861
|
Ae.Description,
|
11015
10862
|
{
|
11016
10863
|
ref: n,
|
@@ -11018,8 +10865,8 @@ const ol = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
|
11018
10865
|
...t
|
11019
10866
|
}
|
11020
10867
|
));
|
11021
|
-
|
11022
|
-
function
|
10868
|
+
tl.displayName = Ae.Description.displayName;
|
10869
|
+
function J_(e, t = 50, n = !0) {
|
11023
10870
|
const [r, o] = z("");
|
11024
10871
|
return ce(() => {
|
11025
10872
|
if (!n) return;
|
@@ -11036,7 +10883,7 @@ function aw(e, t = 50, n = !0) {
|
|
11036
10883
|
}, [e, t, n]), n ? r : e;
|
11037
10884
|
}
|
11038
10885
|
const ua = ["Reviewing...", "Thinking...", "Validating..."];
|
11039
|
-
function
|
10886
|
+
function X_() {
|
11040
10887
|
const [e, t] = z(0);
|
11041
10888
|
return ce(() => {
|
11042
10889
|
const n = setInterval(() => {
|
@@ -11045,6 +10892,67 @@ function cw() {
|
|
11045
10892
|
return () => clearInterval(n);
|
11046
10893
|
}, []), ua[e];
|
11047
10894
|
}
|
10895
|
+
const Q_ = "/assets/logo-waiting-simple.riv", Z_ = "https://cdn.eloquentai.dev", ew = "https://chat.eloquentai.dev", tw = Z_ + Q_;
|
10896
|
+
function nw() {
|
10897
|
+
return ew;
|
10898
|
+
}
|
10899
|
+
function rw(e, t, n) {
|
10900
|
+
return {
|
10901
|
+
API: {
|
10902
|
+
Events: {
|
10903
|
+
endpoint: e || "",
|
10904
|
+
region: n || "",
|
10905
|
+
defaultAuthMode: "apiKey",
|
10906
|
+
apiKey: t || ""
|
10907
|
+
}
|
10908
|
+
}
|
10909
|
+
};
|
10910
|
+
}
|
10911
|
+
function nl({ isWaiting: e = !1, ...t }) {
|
10912
|
+
const { className: n, onLoaded: r, ...o } = t, { RiveComponent: s, rive: i } = sd({
|
10913
|
+
src: tw,
|
10914
|
+
stateMachines: "State Machine 1",
|
10915
|
+
autoplay: !0,
|
10916
|
+
layout: new id({
|
10917
|
+
fit: cd.Cover,
|
10918
|
+
alignment: ad.TopCenter
|
10919
|
+
})
|
10920
|
+
}), c = ud(i, "State Machine 1", "waiting");
|
10921
|
+
return ce(() => {
|
10922
|
+
if (c)
|
10923
|
+
try {
|
10924
|
+
c.value = e;
|
10925
|
+
} catch {
|
10926
|
+
}
|
10927
|
+
}, [i, c, e]), ce(() => {
|
10928
|
+
i && r?.();
|
10929
|
+
}, [i]), /* @__PURE__ */ m(
|
10930
|
+
"div",
|
10931
|
+
{
|
10932
|
+
className: A(
|
10933
|
+
"flex items-center justify-center w-full h-full",
|
10934
|
+
n
|
10935
|
+
),
|
10936
|
+
...o,
|
10937
|
+
children: /* @__PURE__ */ m(s, {})
|
10938
|
+
}
|
10939
|
+
);
|
10940
|
+
}
|
10941
|
+
const rl = Jo(void 0);
|
10942
|
+
function ow({
|
10943
|
+
children: e,
|
10944
|
+
...t
|
10945
|
+
}) {
|
10946
|
+
return /* @__PURE__ */ m(rl.Provider, { value: t, children: e });
|
10947
|
+
}
|
10948
|
+
function Ur() {
|
10949
|
+
const e = Xo(rl);
|
10950
|
+
if (!e)
|
10951
|
+
throw new Error(
|
10952
|
+
"useChatInterfaceContext must be used within a ChatInterfaceProvider"
|
10953
|
+
);
|
10954
|
+
return e;
|
10955
|
+
}
|
11048
10956
|
function la({
|
11049
10957
|
messageData: e,
|
11050
10958
|
nextMessage: t,
|
@@ -11056,7 +10964,7 @@ function la({
|
|
11056
10964
|
}) {
|
11057
10965
|
const c = !t, [a, u] = z(!1), [l, d] = z(
|
11058
10966
|
null
|
11059
|
-
), [f, h] = z(!1), [p, g] = z(!1), y = Yu(), { collectUserFeedback: b, onMessageClick: v } = Ur(), x =
|
10967
|
+
), [f, h] = z(!1), [p, g] = z(!1), y = Yu(), { collectUserFeedback: b, onMessageClick: v } = Ur(), x = X_(), E = !e.isWelcomeMessage && typeof v == "function", _ = J_(
|
11060
10968
|
e.isThinking ? x : e.content,
|
11061
10969
|
15,
|
11062
10970
|
n && c
|
@@ -11170,7 +11078,7 @@ function la({
|
|
11170
11078
|
f && "text-primary"
|
11171
11079
|
),
|
11172
11080
|
title: "Copy message",
|
11173
|
-
children: /* @__PURE__ */ m(
|
11081
|
+
children: /* @__PURE__ */ m(Gl, { size: 16 })
|
11174
11082
|
}
|
11175
11083
|
),
|
11176
11084
|
!e.isWelcomeMessage && b && /* @__PURE__ */ D(xt, { children: [
|
@@ -11182,7 +11090,7 @@ function la({
|
|
11182
11090
|
I,
|
11183
11091
|
l === "up" && "text-primary"
|
11184
11092
|
),
|
11185
|
-
children: /* @__PURE__ */ m(
|
11093
|
+
children: /* @__PURE__ */ m(Vl, { size: 16 })
|
11186
11094
|
}
|
11187
11095
|
),
|
11188
11096
|
/* @__PURE__ */ m(
|
@@ -11195,7 +11103,7 @@ function la({
|
|
11195
11103
|
I,
|
11196
11104
|
l === "down" && "text-primary"
|
11197
11105
|
),
|
11198
|
-
children: /* @__PURE__ */ m(
|
11106
|
+
children: /* @__PURE__ */ m(Kl, { size: 16 })
|
11199
11107
|
}
|
11200
11108
|
)
|
11201
11109
|
] }),
|
@@ -11208,15 +11116,15 @@ function la({
|
|
11208
11116
|
className: A(I, {
|
11209
11117
|
"text-primary": p
|
11210
11118
|
}),
|
11211
|
-
children: /* @__PURE__ */ m(
|
11119
|
+
children: /* @__PURE__ */ m(Yl, { size: 16 })
|
11212
11120
|
}
|
11213
11121
|
)
|
11214
11122
|
] })
|
11215
11123
|
] }) })
|
11216
11124
|
] }),
|
11217
|
-
/* @__PURE__ */ m(
|
11218
|
-
/* @__PURE__ */ m(
|
11219
|
-
/* @__PURE__ */ m(
|
11125
|
+
/* @__PURE__ */ m(K_, { open: a, onOpenChange: u, children: /* @__PURE__ */ D(Zu, { className: "max-w-[90vw] p-0 bg-transparent border-0", children: [
|
11126
|
+
/* @__PURE__ */ m(el, { className: "hidden" }),
|
11127
|
+
/* @__PURE__ */ m(tl, { className: "hidden" }),
|
11220
11128
|
/* @__PURE__ */ m(
|
11221
11129
|
"img",
|
11222
11130
|
{
|
@@ -11228,7 +11136,7 @@ function la({
|
|
11228
11136
|
] }) })
|
11229
11137
|
] });
|
11230
11138
|
}
|
11231
|
-
function
|
11139
|
+
function sw({
|
11232
11140
|
className: e,
|
11233
11141
|
message: t,
|
11234
11142
|
nextMessage: n,
|
@@ -11248,7 +11156,7 @@ function uw({
|
|
11248
11156
|
src: r
|
11249
11157
|
}
|
11250
11158
|
) : /* @__PURE__ */ m(
|
11251
|
-
|
11159
|
+
nl,
|
11252
11160
|
{
|
11253
11161
|
className: u,
|
11254
11162
|
isWaiting: !Array.isArray(t) && t.isThinking
|
@@ -11289,7 +11197,29 @@ function uw({
|
|
11289
11197
|
}
|
11290
11198
|
) }, o);
|
11291
11199
|
}
|
11292
|
-
function
|
11200
|
+
function iw(e) {
|
11201
|
+
const { className: t, src: n, ...r } = e;
|
11202
|
+
return /* @__PURE__ */ m("div", { className: A("w-full h-full", t), ...r, children: n ? /* @__PURE__ */ m(
|
11203
|
+
"img",
|
11204
|
+
{
|
11205
|
+
src: n,
|
11206
|
+
alt: "Assistant Logo",
|
11207
|
+
className: "w-full h-full object-contain"
|
11208
|
+
}
|
11209
|
+
) : /* @__PURE__ */ D("svg", { viewBox: "0 0 80 80", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
11210
|
+
/* @__PURE__ */ m("rect", { width: "80", height: "80", fill: "#6F33B7" }),
|
11211
|
+
/* @__PURE__ */ m(
|
11212
|
+
"path",
|
11213
|
+
{
|
11214
|
+
fillRule: "evenodd",
|
11215
|
+
clipRule: "evenodd",
|
11216
|
+
d: "M41 27C34.2871 27 29 32.41 29 39C29 46.7908 35.2092 53 43 53V61C30.7908 61 21 51.209 21 39C21 28.0512 29.8095 19 41 19C51.2331 19 59 26.828 59 37C59 45.9675 51.9576 53 43 53V45C47.5423 45 51 41.5462 51 37C51 31.2295 46.7981 27 41 27Z",
|
11217
|
+
fill: "white"
|
11218
|
+
}
|
11219
|
+
)
|
11220
|
+
] }) });
|
11221
|
+
}
|
11222
|
+
function aw() {
|
11293
11223
|
const e = Ur(), t = Pe(null), n = Pe(!0), [r, o] = z(!1), [s, i] = z(!1), c = (l) => l.scrollHeight - l.scrollTop <= l.clientHeight + 60, a = (l) => {
|
11294
11224
|
const d = l.target;
|
11295
11225
|
c(d) ? (o(!1), i(!1)) : (o(!0), i(!0));
|
@@ -11315,26 +11245,27 @@ function lw() {
|
|
11315
11245
|
return d.observe(l), () => d.disconnect();
|
11316
11246
|
}, [s]), /* @__PURE__ */ D(As, { className: "relative flex-grow p-0 pl-4 overflow-hidden", children: [
|
11317
11247
|
/* @__PURE__ */ D(
|
11318
|
-
|
11248
|
+
Ju,
|
11319
11249
|
{
|
11320
11250
|
ref: t,
|
11321
11251
|
className: "h-full pr-4",
|
11322
11252
|
onViewportScroll: a,
|
11323
11253
|
children: [
|
11324
11254
|
/* @__PURE__ */ D("div", { className: "chat-interface-head mt-10", children: [
|
11325
|
-
/* @__PURE__ */ m("div", { className: "w-14 h-14 mx-auto rounded-md overflow-hidden", children: /* @__PURE__ */ m(
|
11255
|
+
/* @__PURE__ */ m("div", { className: "w-14 h-14 mx-auto rounded-md overflow-hidden", children: /* @__PURE__ */ m(iw, { src: e.assistantLogo }) }),
|
11326
11256
|
/* @__PURE__ */ D("div", { className: "mt-2 space-y-1", children: [
|
11327
11257
|
/* @__PURE__ */ D("h3", { className: "text-center font-semibold", children: [
|
11328
11258
|
e.assistantName,
|
11329
|
-
"
|
11259
|
+
" ",
|
11260
|
+
e.title
|
11330
11261
|
] }),
|
11331
|
-
/* @__PURE__ */ m("p", { className: "text-muted-foreground text-center text-sm", children:
|
11262
|
+
/* @__PURE__ */ m("p", { className: "text-muted-foreground text-center text-sm", children: e.subtitle })
|
11332
11263
|
] })
|
11333
11264
|
] }),
|
11334
11265
|
/* @__PURE__ */ m("div", { className: "chat-interface-body flex flex-col space-y-4 mb-10", children: e.messages?.map((l, d, f) => {
|
11335
11266
|
const h = Array.isArray(l) ? l.map((p) => p.id).join("-") : l.id;
|
11336
11267
|
return /* @__PURE__ */ m(
|
11337
|
-
|
11268
|
+
sw,
|
11338
11269
|
{
|
11339
11270
|
message: l,
|
11340
11271
|
nextMessage: f[d + 1],
|
@@ -11361,7 +11292,7 @@ function lw() {
|
|
11361
11292
|
)
|
11362
11293
|
] });
|
11363
11294
|
}
|
11364
|
-
const
|
11295
|
+
const ol = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
11365
11296
|
"textarea",
|
11366
11297
|
{
|
11367
11298
|
className: A(
|
@@ -11372,8 +11303,8 @@ const sl = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
|
11372
11303
|
...t
|
11373
11304
|
}
|
11374
11305
|
));
|
11375
|
-
|
11376
|
-
function
|
11306
|
+
ol.displayName = "Textarea";
|
11307
|
+
function cw() {
|
11377
11308
|
const e = Pe(!1), t = Pe(0), n = Pe(0);
|
11378
11309
|
return {
|
11379
11310
|
onMouseDown: (c) => {
|
@@ -11398,7 +11329,7 @@ function dw() {
|
|
11398
11329
|
const da = {
|
11399
11330
|
5031: "The service is currently undergoing maintenance. Please try again later.",
|
11400
11331
|
DEFAULT: "Something went wrong. Please try again later."
|
11401
|
-
},
|
11332
|
+
}, uw = (e) => da[e] || da.DEFAULT, sl = Jo({
|
11402
11333
|
error: null,
|
11403
11334
|
publishApiError: () => {
|
11404
11335
|
},
|
@@ -11407,12 +11338,12 @@ const da = {
|
|
11407
11338
|
clearError: () => {
|
11408
11339
|
}
|
11409
11340
|
}), Ds = () => {
|
11410
|
-
const e = Xo(
|
11341
|
+
const e = Xo(sl);
|
11411
11342
|
if (e === void 0)
|
11412
11343
|
throw new Error("useError must be used within an ErrorProvider");
|
11413
11344
|
return e;
|
11414
|
-
},
|
11415
|
-
const n = Number(t.response.errors[0].error_code), r =
|
11345
|
+
}, lw = (e) => (t) => {
|
11346
|
+
const n = Number(t.response.errors[0].error_code), r = uw(n);
|
11416
11347
|
e({ code: n, message: r });
|
11417
11348
|
}, fa = {
|
11418
11349
|
warning: {
|
@@ -11420,30 +11351,30 @@ const da = {
|
|
11420
11351
|
borderColor: "border-amber-400",
|
11421
11352
|
textColor: "text-amber-800",
|
11422
11353
|
iconColor: "text-amber-500",
|
11423
|
-
icon:
|
11354
|
+
icon: Zl
|
11424
11355
|
},
|
11425
11356
|
error: {
|
11426
11357
|
bgColor: "bg-red-50",
|
11427
11358
|
borderColor: "border-red-500",
|
11428
11359
|
textColor: "text-red-800",
|
11429
11360
|
iconColor: "text-red-500",
|
11430
|
-
icon:
|
11361
|
+
icon: Ql
|
11431
11362
|
},
|
11432
11363
|
info: {
|
11433
11364
|
bgColor: "bg-blue-50",
|
11434
11365
|
borderColor: "border-blue-500",
|
11435
11366
|
textColor: "text-blue-800",
|
11436
11367
|
iconColor: "text-blue-500",
|
11437
|
-
icon:
|
11368
|
+
icon: Xl
|
11438
11369
|
},
|
11439
11370
|
success: {
|
11440
11371
|
bgColor: "bg-green-50",
|
11441
11372
|
borderColor: "border-green-500",
|
11442
11373
|
textColor: "text-green-800",
|
11443
11374
|
iconColor: "text-green-500",
|
11444
|
-
icon:
|
11375
|
+
icon: Jl
|
11445
11376
|
}
|
11446
|
-
},
|
11377
|
+
}, dw = ({ message: e, type: t }) => {
|
11447
11378
|
const n = fa[t] || fa.warning, r = n.icon;
|
11448
11379
|
return /* @__PURE__ */ D(
|
11449
11380
|
"div",
|
@@ -11456,8 +11387,8 @@ const da = {
|
|
11456
11387
|
}
|
11457
11388
|
);
|
11458
11389
|
};
|
11459
|
-
function
|
11460
|
-
const { error: e } = Ds(), t = !!e, n = Ur(), r = Pe(null), [o, s] = z(""), i =
|
11390
|
+
function fw() {
|
11391
|
+
const { error: e } = Ds(), t = !!e, n = Ur(), r = Pe(null), [o, s] = z(""), i = cw(), c = Yu(), a = () => o.trim() && !t ? { backgroundColor: c.userBubbleColor } : {}, u = () => n.suggestedMessages ? /* @__PURE__ */ m(
|
11461
11392
|
"div",
|
11462
11393
|
{
|
11463
11394
|
className: "w-full px-4 pb-10 -mt-20 overflow-x-auto no-scrollbar z-10 cursor-grab",
|
@@ -11500,7 +11431,7 @@ function mw() {
|
|
11500
11431
|
return /* @__PURE__ */ D(Ms, { className: "flex flex-col bg-background p-0", children: [
|
11501
11432
|
u(),
|
11502
11433
|
/* @__PURE__ */ D("div", { className: "flex flex-col w-full items-center px-4 pb-4 -mt-6 z-20", children: [
|
11503
|
-
t && /* @__PURE__ */ m(
|
11434
|
+
t && /* @__PURE__ */ m(dw, { message: e.message, type: "error" }),
|
11504
11435
|
/* @__PURE__ */ D(
|
11505
11436
|
"form",
|
11506
11437
|
{
|
@@ -11508,7 +11439,7 @@ function mw() {
|
|
11508
11439
|
onSubmit: l,
|
11509
11440
|
children: [
|
11510
11441
|
/* @__PURE__ */ m("div", { className: "flex-1 bg-card rounded-3xl shadow-[0_0_4px_0_rgba(0,0,0,0.20)]", children: /* @__PURE__ */ m(
|
11511
|
-
|
11442
|
+
ol,
|
11512
11443
|
{
|
11513
11444
|
ref: r,
|
11514
11445
|
name: "message",
|
@@ -11543,7 +11474,7 @@ function mw() {
|
|
11543
11474
|
o.trim() && !t ? "text-primary-foreground" : "bg-muted-foreground"
|
11544
11475
|
),
|
11545
11476
|
style: a(),
|
11546
|
-
children: /* @__PURE__ */ m(
|
11477
|
+
children: /* @__PURE__ */ m(ed, { className: "h-4 w-4" })
|
11547
11478
|
}
|
11548
11479
|
)
|
11549
11480
|
]
|
@@ -11565,17 +11496,75 @@ function mw() {
|
|
11565
11496
|
] })
|
11566
11497
|
] });
|
11567
11498
|
}
|
11568
|
-
|
11569
|
-
|
11570
|
-
|
11499
|
+
const il = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
11500
|
+
Ut.Root,
|
11501
|
+
{
|
11502
|
+
ref: n,
|
11503
|
+
className: A(
|
11504
|
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
11505
|
+
e
|
11506
|
+
),
|
11507
|
+
...t
|
11508
|
+
}
|
11509
|
+
));
|
11510
|
+
il.displayName = Ut.Root.displayName;
|
11511
|
+
const hw = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
11512
|
+
Ut.Image,
|
11513
|
+
{
|
11514
|
+
ref: n,
|
11515
|
+
className: A("aspect-square h-full w-full", e),
|
11516
|
+
...t
|
11517
|
+
}
|
11518
|
+
));
|
11519
|
+
hw.displayName = Ut.Image.displayName;
|
11520
|
+
const pw = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ m(
|
11521
|
+
Ut.Fallback,
|
11522
|
+
{
|
11523
|
+
ref: n,
|
11524
|
+
className: A(
|
11525
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
11526
|
+
e
|
11527
|
+
),
|
11528
|
+
...t
|
11529
|
+
}
|
11530
|
+
));
|
11531
|
+
pw.displayName = Ut.Fallback.displayName;
|
11532
|
+
function mw({
|
11533
|
+
onCleanChat: e,
|
11534
|
+
onClose: t
|
11571
11535
|
}) {
|
11572
|
-
|
11573
|
-
|
11574
|
-
{
|
11575
|
-
className:
|
11576
|
-
|
11577
|
-
|
11578
|
-
|
11536
|
+
const n = Ur();
|
11537
|
+
return /* @__PURE__ */ D(Os, { className: "p-4 flex flex-row items-center justify-between shadow-sm space-y-0", children: [
|
11538
|
+
/* @__PURE__ */ D("div", { className: "flex flex-row items-center space-x-3", children: [
|
11539
|
+
/* @__PURE__ */ m(il, { className: "h-8 w-8", children: /* @__PURE__ */ m(
|
11540
|
+
Pr,
|
11541
|
+
{
|
11542
|
+
src: n.assistantLogo,
|
11543
|
+
bgColor: "#6F33B7",
|
11544
|
+
fgColor: "#ffffff"
|
11545
|
+
}
|
11546
|
+
) }),
|
11547
|
+
/* @__PURE__ */ m("div", { className: "flex flex-col", children: /* @__PURE__ */ m("h2", { className: "text-foreground font-semibold", children: n.assistantName }) })
|
11548
|
+
] }),
|
11549
|
+
/* @__PURE__ */ D("div", { children: [
|
11550
|
+
n.cleanChatButton && /* @__PURE__ */ m(
|
11551
|
+
"button",
|
11552
|
+
{
|
11553
|
+
onClick: e,
|
11554
|
+
className: "text-gray-400 hover:text-gray-600 p-2",
|
11555
|
+
children: /* @__PURE__ */ m(td, { className: "w-4 h-4" })
|
11556
|
+
}
|
11557
|
+
),
|
11558
|
+
n.closeButton === !0 && n.isMobile && /* @__PURE__ */ m(
|
11559
|
+
"button",
|
11560
|
+
{
|
11561
|
+
onClick: t,
|
11562
|
+
className: "text-gray-400 hover:text-gray-600 p-2",
|
11563
|
+
children: /* @__PURE__ */ m(Qa, { className: "w-4 h-4" })
|
11564
|
+
}
|
11565
|
+
)
|
11566
|
+
] })
|
11567
|
+
] });
|
11579
11568
|
}
|
11580
11569
|
const al = ({
|
11581
11570
|
isOpen: e,
|
@@ -11589,6 +11578,18 @@ const al = ({
|
|
11589
11578
|
"rounded-2xl border": !t
|
11590
11579
|
}
|
11591
11580
|
);
|
11581
|
+
function De({
|
11582
|
+
className: e,
|
11583
|
+
...t
|
11584
|
+
}) {
|
11585
|
+
return /* @__PURE__ */ m(
|
11586
|
+
"div",
|
11587
|
+
{
|
11588
|
+
className: A("animate-pulse rounded-md bg-muted", e),
|
11589
|
+
...t
|
11590
|
+
}
|
11591
|
+
);
|
11592
|
+
}
|
11592
11593
|
function cl({
|
11593
11594
|
isOpen: e = !1,
|
11594
11595
|
isMobile: t
|
@@ -11602,7 +11603,7 @@ function cl({
|
|
11602
11603
|
/* @__PURE__ */ m(De, { className: "h-8 w-8" }),
|
11603
11604
|
/* @__PURE__ */ m(De, { className: "h-6 w-32" })
|
11604
11605
|
] }) }),
|
11605
|
-
/* @__PURE__ */ m(As, { className: "flex-1 px-4 overflow-hidden", children: /* @__PURE__ */ D(
|
11606
|
+
/* @__PURE__ */ m(As, { className: "flex-1 px-4 overflow-hidden", children: /* @__PURE__ */ D(od, { children: [
|
11606
11607
|
/* @__PURE__ */ D("div", { className: "flex flex-col items-center justify-center space-y-2 pt-10", children: [
|
11607
11608
|
/* @__PURE__ */ m(De, { className: "w-14 h-14 mx-auto rounded-md" }),
|
11608
11609
|
/* @__PURE__ */ m("div", { children: /* @__PURE__ */ m(De, { className: "h-6 w-32 mx-auto mt-2" }) }),
|
@@ -11624,25 +11625,25 @@ function gw(e) {
|
|
11624
11625
|
isMobile: n
|
11625
11626
|
}), l = () => c ? /* @__PURE__ */ D(Ns, { className: u, children: [
|
11626
11627
|
/* @__PURE__ */ m(
|
11627
|
-
|
11628
|
+
mw,
|
11628
11629
|
{
|
11629
11630
|
onCleanChat: () => r?.(),
|
11630
11631
|
onClose: () => o?.()
|
11631
11632
|
}
|
11632
11633
|
),
|
11633
|
-
/* @__PURE__ */ m(
|
11634
|
-
/* @__PURE__ */ m(
|
11634
|
+
/* @__PURE__ */ m(aw, {}),
|
11635
|
+
/* @__PURE__ */ m(fw, {})
|
11635
11636
|
] }) : /* @__PURE__ */ D(xt, { children: [
|
11636
11637
|
/* @__PURE__ */ m(cl, { isOpen: t, isMobile: n }),
|
11637
11638
|
!c && /* @__PURE__ */ m(
|
11638
|
-
|
11639
|
+
nl,
|
11639
11640
|
{
|
11640
11641
|
className: "hidden invisible",
|
11641
11642
|
onLoaded: () => a(!0)
|
11642
11643
|
}
|
11643
11644
|
)
|
11644
11645
|
] });
|
11645
|
-
return /* @__PURE__ */ m(V_, { ...s, children: /* @__PURE__ */ m(
|
11646
|
+
return /* @__PURE__ */ m(V_, { ...s, children: /* @__PURE__ */ m(ow, { ...e, children: /* @__PURE__ */ m(
|
11646
11647
|
"main",
|
11647
11648
|
{
|
11648
11649
|
className: A(
|
@@ -11681,7 +11682,9 @@ function bw({
|
|
11681
11682
|
legalText: t.footer_html || void 0,
|
11682
11683
|
suggestedMessages: t.suggested_messages,
|
11683
11684
|
displayWelcomeMessages: t.display_welcome_messages,
|
11684
|
-
collectUserFeedback: t.collect_user_feedback
|
11685
|
+
collectUserFeedback: t.collect_user_feedback,
|
11686
|
+
title: t.title || "responds instantly",
|
11687
|
+
subtitle: t.subtitle || "Ask me anything"
|
11685
11688
|
} : e, [e, t]);
|
11686
11689
|
}
|
11687
11690
|
class $o extends Error {
|
@@ -12907,7 +12910,7 @@ function Sv() {
|
|
12907
12910
|
return e || t;
|
12908
12911
|
}
|
12909
12912
|
function Ev() {
|
12910
|
-
return Bs() && typeof process.env == "object" && "VITE_ENVIRONMENT=
|
12913
|
+
return Bs() && typeof process.env == "object" && "VITE_ENVIRONMENT=dev tsc -b && vite build --mode dev".startsWith("ng ") || !1;
|
12911
12914
|
}
|
12912
12915
|
function xv() {
|
12913
12916
|
return typeof navigator < "u" && typeof navigator.product < "u" && navigator.product === "ReactNative";
|
@@ -14929,7 +14932,7 @@ function P0({
|
|
14929
14932
|
const r = `/default/chat/${e}`, [o, s] = z(!1), i = n?.app_sync_url, c = n?.app_sync_region, a = n?.app_sync_api_key;
|
14930
14933
|
ce(() => {
|
14931
14934
|
(i || c || a) && (qs.configure(
|
14932
|
-
|
14935
|
+
rw(i, a, c)
|
14933
14936
|
), s(!0));
|
14934
14937
|
}, [i, a, c]), ce(() => {
|
14935
14938
|
if (!o || !e) return;
|
@@ -15174,7 +15177,7 @@ function H0({
|
|
15174
15177
|
isConversationExpired: i,
|
15175
15178
|
clearConversationData: c,
|
15176
15179
|
getSavedConversationData: a
|
15177
|
-
} = Ls({ appId: e }), { current: u } = Pe(
|
15180
|
+
} = Ls({ appId: e }), { current: u } = Pe(nw()), [l] = z(
|
15178
15181
|
new F0({
|
15179
15182
|
baseURL: u,
|
15180
15183
|
appId: e
|
@@ -15301,13 +15304,13 @@ function z0({
|
|
15301
15304
|
const j0 = ({
|
15302
15305
|
children: e
|
15303
15306
|
}) => {
|
15304
|
-
const [t, n] = z(null), r =
|
15307
|
+
const [t, n] = z(null), r = lw(n), i = {
|
15305
15308
|
error: t,
|
15306
15309
|
publishApiError: r,
|
15307
15310
|
publishError: (c) => n(c),
|
15308
15311
|
clearError: () => n(null)
|
15309
15312
|
};
|
15310
|
-
return /* @__PURE__ */ m(
|
15313
|
+
return /* @__PURE__ */ m(sl.Provider, { value: i, children: e });
|
15311
15314
|
};
|
15312
15315
|
function q0({
|
15313
15316
|
appId: e,
|