@8wave/ai-elements 0.121.0-beta.57 → 0.121.0-beta.59
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/README.md +16 -1
- package/dist/_chunks/Agent-FDL4Wq0B.js.map +1 -1
- package/dist/ai-elements.es.js +3039 -2713
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/Agent-CZUFbLo7.js.map +1 -1
- package/dist-vue/_chunks/PkAvatar-DwtZWSW4.js +38 -0
- package/dist-vue/_chunks/PkAvatar-DwtZWSW4.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbot-BjD_4yaD.js → PkChatbot-DtyJG8HB.js} +7 -8
- package/dist-vue/_chunks/PkChatbot-DtyJG8HB.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-CMNmmQdu.js → PkChatbotEmptyState-CivaIYxu.js} +2 -3
- package/dist-vue/_chunks/PkChatbotEmptyState-CivaIYxu.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotInput-CdpjDIzr.js → PkChatbotInput-mBl1PWIU.js} +88 -88
- package/dist-vue/_chunks/PkChatbotInput-mBl1PWIU.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-BqFY0Evp.js → PkChatbotViewChat-ZOpF5REL.js} +248 -243
- package/dist-vue/_chunks/PkChatbotViewChat-ZOpF5REL.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-DF_c4X6k.js → PkChatbotViewConversations-THKK5wGp.js} +52 -34
- package/dist-vue/_chunks/PkChatbotViewConversations-THKK5wGp.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewFiles-B76IwGGP.js → PkChatbotViewFiles-BOGd3r0o.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-B76IwGGP.js.map → PkChatbotViewFiles-BOGd3r0o.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-Bt0eH8fO.js → PkChatbotViewProfile-XtL9RfC7.js} +3 -4
- package/dist-vue/_chunks/PkChatbotViewProfile-XtL9RfC7.js.map +1 -0
- package/dist-vue/_chunks/{createChatbotApiClient-BYGLKd_e.js → createChatbotApiClient-Bt387Z64.js} +6 -5
- package/dist-vue/_chunks/createChatbotApiClient-Bt387Z64.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-O0u7mVit.js → useChatbotStore-pnj_3y4N.js} +718 -687
- package/dist-vue/_chunks/useChatbotStore-pnj_3y4N.js.map +1 -0
- package/dist-vue/_chunks/useDialogConfirm-fn7iV-iE.js +86 -0
- package/dist-vue/_chunks/useDialogConfirm-fn7iV-iE.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +4 -4
- package/dist-vue/apps/web-component/src/composables/usePagePresence.d.ts +17 -0
- package/dist-vue/apps/web-component/src/composables/usePageTools.d.ts +4 -3
- package/dist-vue/apps/web-component/src/pageTools/index.d.ts +11 -1
- package/dist-vue/composables.js +14 -6
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +4252 -4009
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +24 -14
- package/dist-vue/packages/components/src/chat/PkAgentPresence.d.ts +34 -0
- package/dist-vue/packages/components/src/chat/PkAvatar.d.ts +6 -7
- package/dist-vue/packages/components/src/chat/PkChatSearchDialog.d.ts +19 -0
- package/dist-vue/packages/components/src/chat/{PkAgentSelectorInline.d.ts → PkChatShortcutsDialog.d.ts} +8 -5
- package/dist-vue/packages/components/src/chat/PkChatSidebar.d.ts +7 -8
- package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +2 -2
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +4 -1
- package/dist-vue/packages/components/src/chat/PkWorkingAurora.d.ts +25 -0
- package/dist-vue/packages/components/src/chat/index.d.ts +1 -2
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +11 -1
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +21 -3
- package/dist-vue/packages/composable/src/chatbot/useConversationActions.d.ts +54 -1
- package/dist-vue/packages/models/src/schema/Chat.d.ts +1 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist-vue/_chunks/PkAvatar-uVRs_DD9.js +0 -43
- package/dist-vue/_chunks/PkAvatar-uVRs_DD9.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-BjD_4yaD.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotEmptyState-CMNmmQdu.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-CdpjDIzr.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-BqFY0Evp.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewConversations-DF_c4X6k.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewProfile-Bt0eH8fO.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BYGLKd_e.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-O0u7mVit.js.map +0 -1
- package/dist-vue/_chunks/useDialogConfirm-CyD9VTKg.js +0 -84
- package/dist-vue/_chunks/useDialogConfirm-CyD9VTKg.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as e, D as t, O as n, S as r, _ as i, a, g as o, h as s, i as c, l, m as u, o as d, p as f, r as p, s as m, u as h, v as g, w as _, x as v } from "./schemas-BO5QlXAp.js";
|
|
2
2
|
import { $ as y, B as b, G as ee, Q as te, W as ne, Y as re, et as ie, q as ae } from "./Agent-CZUFbLo7.js";
|
|
3
|
-
import { r as oe, t as se } from "./createChatbotApiClient-
|
|
3
|
+
import { r as oe, t as se } from "./createChatbotApiClient-Bt387Z64.js";
|
|
4
4
|
import { n as ce } from "./src-B-ZKEhTU.js";
|
|
5
5
|
import { d as le, r as ue } from "./message-DuibQyHy.js";
|
|
6
6
|
import { n as de, t as fe } from "./useSafeLocalStorage-a2eHEqAi.js";
|
|
@@ -531,7 +531,7 @@ function I() {
|
|
|
531
531
|
}
|
|
532
532
|
function bt(e, t) {
|
|
533
533
|
let n = { type: "array" };
|
|
534
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
534
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = q(e.type._def, {
|
|
535
535
|
...t,
|
|
536
536
|
currentPath: [...t.currentPath, "items"]
|
|
537
537
|
})), e.minLength && (n.minItems = e.minLength.value), e.maxLength && (n.maxItems = e.maxLength.value), e.exactLength && (n.minItems = e.exactLength.value, n.maxItems = e.exactLength.value), n;
|
|
@@ -557,12 +557,12 @@ function L() {
|
|
|
557
557
|
return { type: "boolean" };
|
|
558
558
|
}
|
|
559
559
|
function St(e, t) {
|
|
560
|
-
return
|
|
560
|
+
return q(e.type._def, t);
|
|
561
561
|
}
|
|
562
|
-
var
|
|
563
|
-
function
|
|
562
|
+
var Ct = (e, t) => q(e.innerType._def, t);
|
|
563
|
+
function wt(e, t, n) {
|
|
564
564
|
let r = n ?? t.dateStrategy;
|
|
565
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
565
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => wt(e, t, n)) };
|
|
566
566
|
switch (r) {
|
|
567
567
|
case "string":
|
|
568
568
|
case "format:date-time": return {
|
|
@@ -573,10 +573,10 @@ function Ct(e, t, n) {
|
|
|
573
573
|
type: "string",
|
|
574
574
|
format: "date"
|
|
575
575
|
};
|
|
576
|
-
case "integer": return
|
|
576
|
+
case "integer": return Tt(e);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
var
|
|
579
|
+
var Tt = (e) => {
|
|
580
580
|
let t = {
|
|
581
581
|
type: "integer",
|
|
582
582
|
format: "unix-time"
|
|
@@ -589,14 +589,14 @@ var wt = (e) => {
|
|
|
589
589
|
}
|
|
590
590
|
return t;
|
|
591
591
|
};
|
|
592
|
-
function
|
|
592
|
+
function Et(e, t) {
|
|
593
593
|
return {
|
|
594
|
-
...
|
|
594
|
+
...q(e.innerType._def, t),
|
|
595
595
|
default: e.defaultValue()
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
|
-
function
|
|
599
|
-
return t.effectStrategy === "input" ?
|
|
598
|
+
function R(e, t) {
|
|
599
|
+
return t.effectStrategy === "input" ? q(e.schema._def, t) : I();
|
|
600
600
|
}
|
|
601
601
|
function Dt(e) {
|
|
602
602
|
return {
|
|
@@ -606,14 +606,14 @@ function Dt(e) {
|
|
|
606
606
|
}
|
|
607
607
|
var Ot = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
608
608
|
function kt(e, t) {
|
|
609
|
-
let n = [
|
|
609
|
+
let n = [q(e.left._def, {
|
|
610
610
|
...t,
|
|
611
611
|
currentPath: [
|
|
612
612
|
...t.currentPath,
|
|
613
613
|
"allOf",
|
|
614
614
|
"0"
|
|
615
615
|
]
|
|
616
|
-
}),
|
|
616
|
+
}), q(e.right._def, {
|
|
617
617
|
...t,
|
|
618
618
|
currentPath: [
|
|
619
619
|
...t.currentPath,
|
|
@@ -633,19 +633,19 @@ function kt(e, t) {
|
|
|
633
633
|
}
|
|
634
634
|
}), r.length ? { allOf: r } : void 0;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function z(e) {
|
|
637
637
|
let t = typeof e.value;
|
|
638
638
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
639
639
|
type: t === "bigint" ? "integer" : t,
|
|
640
640
|
const: e.value
|
|
641
641
|
};
|
|
642
642
|
}
|
|
643
|
-
var
|
|
643
|
+
var B = void 0, V = {
|
|
644
644
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
645
645
|
cuid2: /^[0-9a-z]+$/,
|
|
646
646
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
647
647
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
648
|
-
emoji: () => (
|
|
648
|
+
emoji: () => (B === void 0 && (B = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), B),
|
|
649
649
|
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
650
650
|
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
651
651
|
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
@@ -656,7 +656,7 @@ var jt = void 0, z = {
|
|
|
656
656
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
657
657
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
658
658
|
};
|
|
659
|
-
function
|
|
659
|
+
function At(e, t) {
|
|
660
660
|
let n = { type: "string" };
|
|
661
661
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
662
662
|
case "min":
|
|
@@ -668,108 +668,108 @@ function B(e, t) {
|
|
|
668
668
|
case "email":
|
|
669
669
|
switch (t.emailStrategy) {
|
|
670
670
|
case "format:email":
|
|
671
|
-
|
|
671
|
+
H(n, "email", r.message, t);
|
|
672
672
|
break;
|
|
673
673
|
case "format:idn-email":
|
|
674
|
-
|
|
674
|
+
H(n, "idn-email", r.message, t);
|
|
675
675
|
break;
|
|
676
|
-
case "pattern:zod":
|
|
676
|
+
case "pattern:zod": U(n, V.email, r.message, t);
|
|
677
677
|
}
|
|
678
678
|
break;
|
|
679
679
|
case "url":
|
|
680
|
-
|
|
680
|
+
H(n, "uri", r.message, t);
|
|
681
681
|
break;
|
|
682
682
|
case "uuid":
|
|
683
|
-
|
|
683
|
+
H(n, "uuid", r.message, t);
|
|
684
684
|
break;
|
|
685
685
|
case "regex":
|
|
686
|
-
|
|
686
|
+
U(n, r.regex, r.message, t);
|
|
687
687
|
break;
|
|
688
688
|
case "cuid":
|
|
689
|
-
|
|
689
|
+
U(n, V.cuid, r.message, t);
|
|
690
690
|
break;
|
|
691
691
|
case "cuid2":
|
|
692
|
-
|
|
692
|
+
U(n, V.cuid2, r.message, t);
|
|
693
693
|
break;
|
|
694
694
|
case "startsWith":
|
|
695
|
-
|
|
695
|
+
U(n, RegExp(`^${jt(r.value, t)}`), r.message, t);
|
|
696
696
|
break;
|
|
697
697
|
case "endsWith":
|
|
698
|
-
|
|
698
|
+
U(n, RegExp(`${jt(r.value, t)}$`), r.message, t);
|
|
699
699
|
break;
|
|
700
700
|
case "datetime":
|
|
701
|
-
|
|
701
|
+
H(n, "date-time", r.message, t);
|
|
702
702
|
break;
|
|
703
703
|
case "date":
|
|
704
|
-
|
|
704
|
+
H(n, "date", r.message, t);
|
|
705
705
|
break;
|
|
706
706
|
case "time":
|
|
707
|
-
|
|
707
|
+
H(n, "time", r.message, t);
|
|
708
708
|
break;
|
|
709
709
|
case "duration":
|
|
710
|
-
|
|
710
|
+
H(n, "duration", r.message, t);
|
|
711
711
|
break;
|
|
712
712
|
case "length":
|
|
713
713
|
n.minLength = typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, n.maxLength = typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value;
|
|
714
714
|
break;
|
|
715
715
|
case "includes":
|
|
716
|
-
|
|
716
|
+
U(n, RegExp(jt(r.value, t)), r.message, t);
|
|
717
717
|
break;
|
|
718
718
|
case "ip":
|
|
719
|
-
r.version !== "v6" &&
|
|
719
|
+
r.version !== "v6" && H(n, "ipv4", r.message, t), r.version !== "v4" && H(n, "ipv6", r.message, t);
|
|
720
720
|
break;
|
|
721
721
|
case "base64url":
|
|
722
|
-
|
|
722
|
+
U(n, V.base64url, r.message, t);
|
|
723
723
|
break;
|
|
724
724
|
case "jwt":
|
|
725
|
-
|
|
725
|
+
U(n, V.jwt, r.message, t);
|
|
726
726
|
break;
|
|
727
727
|
case "cidr":
|
|
728
|
-
r.version !== "v6" &&
|
|
728
|
+
r.version !== "v6" && U(n, V.ipv4Cidr, r.message, t), r.version !== "v4" && U(n, V.ipv6Cidr, r.message, t);
|
|
729
729
|
break;
|
|
730
730
|
case "emoji":
|
|
731
|
-
|
|
731
|
+
U(n, V.emoji(), r.message, t);
|
|
732
732
|
break;
|
|
733
733
|
case "ulid":
|
|
734
|
-
|
|
734
|
+
U(n, V.ulid, r.message, t);
|
|
735
735
|
break;
|
|
736
736
|
case "base64":
|
|
737
737
|
switch (t.base64Strategy) {
|
|
738
738
|
case "format:binary":
|
|
739
|
-
|
|
739
|
+
H(n, "binary", r.message, t);
|
|
740
740
|
break;
|
|
741
741
|
case "contentEncoding:base64":
|
|
742
742
|
n.contentEncoding = "base64";
|
|
743
743
|
break;
|
|
744
|
-
case "pattern:zod":
|
|
744
|
+
case "pattern:zod": U(n, V.base64, r.message, t);
|
|
745
745
|
}
|
|
746
746
|
break;
|
|
747
|
-
case "nanoid":
|
|
747
|
+
case "nanoid": U(n, V.nanoid, r.message, t);
|
|
748
748
|
}
|
|
749
749
|
return n;
|
|
750
750
|
}
|
|
751
|
-
function
|
|
752
|
-
return t.patternStrategy === "escape" ?
|
|
751
|
+
function jt(e, t) {
|
|
752
|
+
return t.patternStrategy === "escape" ? Nt(e) : e;
|
|
753
753
|
}
|
|
754
|
-
var
|
|
755
|
-
function
|
|
754
|
+
var Mt = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
755
|
+
function Nt(e) {
|
|
756
756
|
let t = "";
|
|
757
|
-
for (let n = 0; n < e.length; n++)
|
|
757
|
+
for (let n = 0; n < e.length; n++) Mt.has(e[n]) || (t += "\\"), t += e[n];
|
|
758
758
|
return t;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function H(e, t, n, r) {
|
|
761
761
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
762
762
|
format: t,
|
|
763
763
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
764
764
|
})) : e.format = t;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function U(e, t, n, r) {
|
|
767
767
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
768
|
-
pattern:
|
|
768
|
+
pattern: W(t, r),
|
|
769
769
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
770
|
-
})) : e.pattern =
|
|
770
|
+
})) : e.pattern = W(t, r);
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function W(e, t) {
|
|
773
773
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
774
774
|
let n = {
|
|
775
775
|
i: e.flags.includes("i"),
|
|
@@ -808,16 +808,16 @@ function Nt(e, t) {
|
|
|
808
808
|
}
|
|
809
809
|
return i;
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function G(e, t) {
|
|
812
812
|
let n = {
|
|
813
813
|
type: "object",
|
|
814
|
-
additionalProperties:
|
|
814
|
+
additionalProperties: q(e.valueType._def, {
|
|
815
815
|
...t,
|
|
816
816
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
817
817
|
}) ?? t.allowedAdditionalProperties
|
|
818
818
|
};
|
|
819
819
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
820
|
-
let { type: r, ...i } =
|
|
820
|
+
let { type: r, ...i } = At(e.keyType._def, t);
|
|
821
821
|
return {
|
|
822
822
|
...n,
|
|
823
823
|
propertyNames: i
|
|
@@ -836,13 +836,13 @@ function Pt(e, t) {
|
|
|
836
836
|
}
|
|
837
837
|
return n;
|
|
838
838
|
}
|
|
839
|
-
function
|
|
840
|
-
return t.mapStrategy === "record" ?
|
|
839
|
+
function Pt(e, t) {
|
|
840
|
+
return t.mapStrategy === "record" ? G(e, t) : {
|
|
841
841
|
type: "array",
|
|
842
842
|
maxItems: 125,
|
|
843
843
|
items: {
|
|
844
844
|
type: "array",
|
|
845
|
-
items: [
|
|
845
|
+
items: [q(e.keyType._def, {
|
|
846
846
|
...t,
|
|
847
847
|
currentPath: [
|
|
848
848
|
...t.currentPath,
|
|
@@ -850,7 +850,7 @@ function Ft(e, t) {
|
|
|
850
850
|
"items",
|
|
851
851
|
"0"
|
|
852
852
|
]
|
|
853
|
-
}) || I(),
|
|
853
|
+
}) || I(), q(e.valueType._def, {
|
|
854
854
|
...t,
|
|
855
855
|
currentPath: [
|
|
856
856
|
...t.currentPath,
|
|
@@ -864,31 +864,31 @@ function Ft(e, t) {
|
|
|
864
864
|
}
|
|
865
865
|
};
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function Ft(e) {
|
|
868
868
|
let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
|
|
869
869
|
return {
|
|
870
870
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
871
871
|
enum: n
|
|
872
872
|
};
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function It() {
|
|
875
875
|
return { not: I() };
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function Lt() {
|
|
878
878
|
return { type: "null" };
|
|
879
879
|
}
|
|
880
|
-
var
|
|
880
|
+
var Rt = {
|
|
881
881
|
ZodString: "string",
|
|
882
882
|
ZodNumber: "number",
|
|
883
883
|
ZodBigInt: "integer",
|
|
884
884
|
ZodBoolean: "boolean",
|
|
885
885
|
ZodNull: "null"
|
|
886
886
|
};
|
|
887
|
-
function
|
|
887
|
+
function zt(e, t) {
|
|
888
888
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
889
|
-
if (n.every((e) => e._def.typeName in
|
|
889
|
+
if (n.every((e) => e._def.typeName in Rt && (!e._def.checks || !e._def.checks.length))) {
|
|
890
890
|
let e = n.reduce((e, t) => {
|
|
891
|
-
let n =
|
|
891
|
+
let n = Rt[t._def.typeName];
|
|
892
892
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
893
893
|
}, []);
|
|
894
894
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -916,10 +916,10 @@ function Bt(e, t) {
|
|
|
916
916
|
type: "string",
|
|
917
917
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
918
918
|
};
|
|
919
|
-
return
|
|
919
|
+
return Bt(e, t);
|
|
920
920
|
}
|
|
921
|
-
var
|
|
922
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
921
|
+
var Bt = (e, t) => {
|
|
922
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => q(e._def, {
|
|
923
923
|
...t,
|
|
924
924
|
currentPath: [
|
|
925
925
|
...t.currentPath,
|
|
@@ -929,15 +929,15 @@ var Vt = (e, t) => {
|
|
|
929
929
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
930
930
|
return n.length ? { anyOf: n } : void 0;
|
|
931
931
|
};
|
|
932
|
-
function
|
|
932
|
+
function Vt(e, t) {
|
|
933
933
|
if ([
|
|
934
934
|
"ZodString",
|
|
935
935
|
"ZodNumber",
|
|
936
936
|
"ZodBigInt",
|
|
937
937
|
"ZodBoolean",
|
|
938
938
|
"ZodNull"
|
|
939
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
940
|
-
let n =
|
|
939
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Rt[e.innerType._def.typeName], "null"] };
|
|
940
|
+
let n = q(e.innerType._def, {
|
|
941
941
|
...t,
|
|
942
942
|
currentPath: [
|
|
943
943
|
...t.currentPath,
|
|
@@ -947,7 +947,7 @@ function Ht(e, t) {
|
|
|
947
947
|
});
|
|
948
948
|
return n && { anyOf: [n, { type: "null" }] };
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function Ht(e) {
|
|
951
951
|
let t = { type: "number" };
|
|
952
952
|
if (!e.checks) return t;
|
|
953
953
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -964,7 +964,7 @@ function Ut(e) {
|
|
|
964
964
|
}
|
|
965
965
|
return t;
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function Ut(e, t) {
|
|
968
968
|
let n = {
|
|
969
969
|
type: "object",
|
|
970
970
|
properties: {}
|
|
@@ -972,7 +972,7 @@ function Wt(e, t) {
|
|
|
972
972
|
for (let e in i) {
|
|
973
973
|
let a = i[e];
|
|
974
974
|
if (a === void 0 || a._def === void 0) continue;
|
|
975
|
-
let o =
|
|
975
|
+
let o = Gt(a), s = q(a._def, {
|
|
976
976
|
...t,
|
|
977
977
|
currentPath: [
|
|
978
978
|
...t.currentPath,
|
|
@@ -988,11 +988,11 @@ function Wt(e, t) {
|
|
|
988
988
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
989
989
|
}
|
|
990
990
|
r.length && (n.required = r);
|
|
991
|
-
let a =
|
|
991
|
+
let a = Wt(e, t);
|
|
992
992
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
993
993
|
}
|
|
994
|
-
function
|
|
995
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
994
|
+
function Wt(e, t) {
|
|
995
|
+
if (e.catchall._def.typeName !== "ZodNever") return q(e.catchall._def, {
|
|
996
996
|
...t,
|
|
997
997
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
998
998
|
});
|
|
@@ -1002,16 +1002,16 @@ function Gt(e, t) {
|
|
|
1002
1002
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function Gt(e) {
|
|
1006
1006
|
try {
|
|
1007
1007
|
return e.isOptional();
|
|
1008
1008
|
} catch {
|
|
1009
1009
|
return !0;
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
|
-
var
|
|
1013
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1014
|
-
let n =
|
|
1012
|
+
var Kt = (e, t) => {
|
|
1013
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return q(e.innerType._def, t);
|
|
1014
|
+
let n = q(e.innerType._def, {
|
|
1015
1015
|
...t,
|
|
1016
1016
|
currentPath: [
|
|
1017
1017
|
...t.currentPath,
|
|
@@ -1020,10 +1020,10 @@ var qt = (e, t) => {
|
|
|
1020
1020
|
]
|
|
1021
1021
|
});
|
|
1022
1022
|
return n ? { anyOf: [{ not: I() }, n] } : I();
|
|
1023
|
-
},
|
|
1024
|
-
if (t.pipeStrategy === "input") return
|
|
1025
|
-
if (t.pipeStrategy === "output") return
|
|
1026
|
-
let n =
|
|
1023
|
+
}, qt = (e, t) => {
|
|
1024
|
+
if (t.pipeStrategy === "input") return q(e.in._def, t);
|
|
1025
|
+
if (t.pipeStrategy === "output") return q(e.out._def, t);
|
|
1026
|
+
let n = q(e.in._def, {
|
|
1027
1027
|
...t,
|
|
1028
1028
|
currentPath: [
|
|
1029
1029
|
...t.currentPath,
|
|
@@ -1031,7 +1031,7 @@ var qt = (e, t) => {
|
|
|
1031
1031
|
"0"
|
|
1032
1032
|
]
|
|
1033
1033
|
});
|
|
1034
|
-
return { allOf: [n,
|
|
1034
|
+
return { allOf: [n, q(e.out._def, {
|
|
1035
1035
|
...t,
|
|
1036
1036
|
currentPath: [
|
|
1037
1037
|
...t.currentPath,
|
|
@@ -1041,13 +1041,13 @@ var qt = (e, t) => {
|
|
|
1041
1041
|
})].filter((e) => e !== void 0) };
|
|
1042
1042
|
};
|
|
1043
1043
|
function Jt(e, t) {
|
|
1044
|
-
return
|
|
1044
|
+
return q(e.type._def, t);
|
|
1045
1045
|
}
|
|
1046
1046
|
function Yt(e, t) {
|
|
1047
1047
|
let n = {
|
|
1048
1048
|
type: "array",
|
|
1049
1049
|
uniqueItems: !0,
|
|
1050
|
-
items:
|
|
1050
|
+
items: q(e.valueType._def, {
|
|
1051
1051
|
...t,
|
|
1052
1052
|
currentPath: [...t.currentPath, "items"]
|
|
1053
1053
|
})
|
|
@@ -1058,7 +1058,7 @@ function Xt(e, t) {
|
|
|
1058
1058
|
return e.rest ? {
|
|
1059
1059
|
type: "array",
|
|
1060
1060
|
minItems: e.items.length,
|
|
1061
|
-
items: e.items.map((e, n) =>
|
|
1061
|
+
items: e.items.map((e, n) => q(e._def, {
|
|
1062
1062
|
...t,
|
|
1063
1063
|
currentPath: [
|
|
1064
1064
|
...t.currentPath,
|
|
@@ -1066,7 +1066,7 @@ function Xt(e, t) {
|
|
|
1066
1066
|
`${n}`
|
|
1067
1067
|
]
|
|
1068
1068
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1069
|
-
additionalItems:
|
|
1069
|
+
additionalItems: q(e.rest._def, {
|
|
1070
1070
|
...t,
|
|
1071
1071
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1072
1072
|
})
|
|
@@ -1074,7 +1074,7 @@ function Xt(e, t) {
|
|
|
1074
1074
|
type: "array",
|
|
1075
1075
|
minItems: e.items.length,
|
|
1076
1076
|
maxItems: e.items.length,
|
|
1077
|
-
items: e.items.map((e, n) =>
|
|
1077
|
+
items: e.items.map((e, n) => q(e._def, {
|
|
1078
1078
|
...t,
|
|
1079
1079
|
currentPath: [
|
|
1080
1080
|
...t.currentPath,
|
|
@@ -1090,41 +1090,41 @@ function Zt() {
|
|
|
1090
1090
|
function Qt() {
|
|
1091
1091
|
return I();
|
|
1092
1092
|
}
|
|
1093
|
-
var $t = (e, t) =>
|
|
1093
|
+
var $t = (e, t) => q(e.innerType._def, t), K = (e, t, n) => {
|
|
1094
1094
|
switch (t) {
|
|
1095
|
-
case "ZodString": return
|
|
1096
|
-
case "ZodNumber": return
|
|
1097
|
-
case "ZodObject": return
|
|
1095
|
+
case "ZodString": return At(e, n);
|
|
1096
|
+
case "ZodNumber": return Ht(e);
|
|
1097
|
+
case "ZodObject": return Ut(e, n);
|
|
1098
1098
|
case "ZodBigInt": return xt(e);
|
|
1099
1099
|
case "ZodBoolean": return L();
|
|
1100
|
-
case "ZodDate": return
|
|
1100
|
+
case "ZodDate": return wt(e, n);
|
|
1101
1101
|
case "ZodUndefined": return Zt();
|
|
1102
|
-
case "ZodNull": return
|
|
1102
|
+
case "ZodNull": return Lt();
|
|
1103
1103
|
case "ZodArray": return bt(e, n);
|
|
1104
1104
|
case "ZodUnion":
|
|
1105
|
-
case "ZodDiscriminatedUnion": return
|
|
1105
|
+
case "ZodDiscriminatedUnion": return zt(e, n);
|
|
1106
1106
|
case "ZodIntersection": return kt(e, n);
|
|
1107
1107
|
case "ZodTuple": return Xt(e, n);
|
|
1108
|
-
case "ZodRecord": return
|
|
1109
|
-
case "ZodLiteral": return
|
|
1108
|
+
case "ZodRecord": return G(e, n);
|
|
1109
|
+
case "ZodLiteral": return z(e);
|
|
1110
1110
|
case "ZodEnum": return Dt(e);
|
|
1111
|
-
case "ZodNativeEnum": return
|
|
1112
|
-
case "ZodNullable": return
|
|
1113
|
-
case "ZodOptional": return
|
|
1114
|
-
case "ZodMap": return
|
|
1111
|
+
case "ZodNativeEnum": return Ft(e);
|
|
1112
|
+
case "ZodNullable": return Vt(e, n);
|
|
1113
|
+
case "ZodOptional": return Kt(e, n);
|
|
1114
|
+
case "ZodMap": return Pt(e, n);
|
|
1115
1115
|
case "ZodSet": return Yt(e, n);
|
|
1116
1116
|
case "ZodLazy": return () => e.getter()._def;
|
|
1117
1117
|
case "ZodPromise": return Jt(e, n);
|
|
1118
1118
|
case "ZodNaN":
|
|
1119
|
-
case "ZodNever": return
|
|
1120
|
-
case "ZodEffects": return
|
|
1119
|
+
case "ZodNever": return It();
|
|
1120
|
+
case "ZodEffects": return R(e, n);
|
|
1121
1121
|
case "ZodAny": return I();
|
|
1122
1122
|
case "ZodUnknown": return Qt();
|
|
1123
|
-
case "ZodDefault": return
|
|
1123
|
+
case "ZodDefault": return Et(e, n);
|
|
1124
1124
|
case "ZodBranded": return St(e, n);
|
|
1125
1125
|
case "ZodReadonly": return $t(e, n);
|
|
1126
|
-
case "ZodCatch": return
|
|
1127
|
-
case "ZodPipeline": return
|
|
1126
|
+
case "ZodCatch": return Ct(e, n);
|
|
1127
|
+
case "ZodPipeline": return qt(e, n);
|
|
1128
1128
|
case "ZodFunction":
|
|
1129
1129
|
case "ZodVoid":
|
|
1130
1130
|
case "ZodSymbol": return;
|
|
@@ -1132,19 +1132,19 @@ var $t = (e, t) => K(e.innerType._def, t), en = (e, t, n) => {
|
|
|
1132
1132
|
/* c8 ignore next */
|
|
1133
1133
|
return ((e) => void 0)(t);
|
|
1134
1134
|
}
|
|
1135
|
-
},
|
|
1135
|
+
}, en = (e, t) => {
|
|
1136
1136
|
let n = 0;
|
|
1137
1137
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1138
1138
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1139
1139
|
};
|
|
1140
|
-
function
|
|
1140
|
+
function q(e, t, n = !1) {
|
|
1141
1141
|
let r = t.seen.get(e);
|
|
1142
1142
|
if (t.override) {
|
|
1143
1143
|
let i = t.override?.(e, t, r, n);
|
|
1144
1144
|
if (i !== _t) return i;
|
|
1145
1145
|
}
|
|
1146
1146
|
if (r && !n) {
|
|
1147
|
-
let e =
|
|
1147
|
+
let e = tn(r, t);
|
|
1148
1148
|
if (e !== void 0) return e;
|
|
1149
1149
|
}
|
|
1150
1150
|
let i = {
|
|
@@ -1153,21 +1153,21 @@ function K(e, t, n = !1) {
|
|
|
1153
1153
|
jsonSchema: void 0
|
|
1154
1154
|
};
|
|
1155
1155
|
t.seen.set(e, i);
|
|
1156
|
-
let a =
|
|
1157
|
-
if (o &&
|
|
1156
|
+
let a = K(e, e.typeName, t), o = typeof a == "function" ? q(a(), t) : a;
|
|
1157
|
+
if (o && nn(e, t, o), t.postProcess) {
|
|
1158
1158
|
let n = t.postProcess(o, e, t);
|
|
1159
1159
|
return i.jsonSchema = o, n;
|
|
1160
1160
|
}
|
|
1161
1161
|
return i.jsonSchema = o, o;
|
|
1162
1162
|
}
|
|
1163
|
-
var
|
|
1163
|
+
var tn = (e, t) => {
|
|
1164
1164
|
switch (t.$refStrategy) {
|
|
1165
1165
|
case "root": return { $ref: e.path.join("/") };
|
|
1166
|
-
case "relative": return { $ref:
|
|
1166
|
+
case "relative": return { $ref: en(t.currentPath, e.path) };
|
|
1167
1167
|
case "none":
|
|
1168
1168
|
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), I()) : t.$refStrategy === "seen" ? I() : void 0;
|
|
1169
1169
|
}
|
|
1170
|
-
},
|
|
1170
|
+
}, nn = (e, t, n) => (e.description && (n.description = e.description), n), rn = (e) => {
|
|
1171
1171
|
let t = yt(e), n = t.name === void 0 ? t.basePath : [
|
|
1172
1172
|
...t.basePath,
|
|
1173
1173
|
t.definitionPath,
|
|
@@ -1187,10 +1187,10 @@ var nn = (e, t) => {
|
|
|
1187
1187
|
jsonSchema: void 0
|
|
1188
1188
|
}]))
|
|
1189
1189
|
};
|
|
1190
|
-
},
|
|
1191
|
-
let n =
|
|
1190
|
+
}, an = (e, t) => {
|
|
1191
|
+
let n = rn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1192
1192
|
...e,
|
|
1193
|
-
[t]:
|
|
1193
|
+
[t]: q(r._def, {
|
|
1194
1194
|
...n,
|
|
1195
1195
|
currentPath: [
|
|
1196
1196
|
...n.basePath,
|
|
@@ -1198,7 +1198,7 @@ var nn = (e, t) => {
|
|
|
1198
1198
|
t
|
|
1199
1199
|
]
|
|
1200
1200
|
}, !0) ?? I()
|
|
1201
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1201
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = q(e._def, i === void 0 ? n : {
|
|
1202
1202
|
...n,
|
|
1203
1203
|
currentPath: [
|
|
1204
1204
|
...n.basePath,
|
|
@@ -1222,14 +1222,14 @@ var nn = (e, t) => {
|
|
|
1222
1222
|
}
|
|
1223
1223
|
};
|
|
1224
1224
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1225
|
-
},
|
|
1226
|
-
function
|
|
1225
|
+
}, on = Symbol.for("vercel.ai.schema");
|
|
1226
|
+
function sn(e) {
|
|
1227
1227
|
let t;
|
|
1228
1228
|
return () => (t ??= e(), t);
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1230
|
+
function cn(e, { validate: t } = {}) {
|
|
1231
1231
|
return {
|
|
1232
|
-
[
|
|
1232
|
+
[on]: !0,
|
|
1233
1233
|
_type: void 0,
|
|
1234
1234
|
get jsonSchema() {
|
|
1235
1235
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1237,19 +1237,19 @@ function ln(e, { validate: t } = {}) {
|
|
|
1237
1237
|
validate: t
|
|
1238
1238
|
};
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1241
|
-
return typeof e == "object" && !!e &&
|
|
1240
|
+
function ln(e) {
|
|
1241
|
+
return typeof e == "object" && !!e && on in e && e[on] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
return e == null ?
|
|
1243
|
+
function un(e) {
|
|
1244
|
+
return e == null ? cn({
|
|
1245
1245
|
type: "object",
|
|
1246
1246
|
properties: {},
|
|
1247
1247
|
additionalProperties: !1
|
|
1248
|
-
}) :
|
|
1248
|
+
}) : ln(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? gn(e) : dn(e) : e();
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1251
|
-
return
|
|
1252
|
-
if (!
|
|
1250
|
+
function dn(e) {
|
|
1251
|
+
return cn(() => {
|
|
1252
|
+
if (!fn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1253
1253
|
return gt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1254
1254
|
}, { validate: async (t) => {
|
|
1255
1255
|
let n = await e["~standard"].validate(t);
|
|
@@ -1265,12 +1265,12 @@ function fn(e) {
|
|
|
1265
1265
|
};
|
|
1266
1266
|
} });
|
|
1267
1267
|
}
|
|
1268
|
-
function
|
|
1268
|
+
function fn(e) {
|
|
1269
1269
|
return e["~standard"].jsonSchema != null;
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1271
|
+
function pn(e, t) {
|
|
1272
1272
|
let n = t?.useReferences ?? !1;
|
|
1273
|
-
return
|
|
1273
|
+
return cn(() => an(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1274
1274
|
let n = await e.safeParseAsync(t);
|
|
1275
1275
|
return n.success ? {
|
|
1276
1276
|
success: !0,
|
|
@@ -1281,9 +1281,9 @@ function mn(e, t) {
|
|
|
1281
1281
|
};
|
|
1282
1282
|
} });
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function mn(e, r) {
|
|
1285
1285
|
let i = r?.useReferences ?? !1;
|
|
1286
|
-
return
|
|
1286
|
+
return cn(() => gt(n(e, {
|
|
1287
1287
|
target: "draft-7",
|
|
1288
1288
|
io: "input",
|
|
1289
1289
|
reused: i ? "ref" : "inline"
|
|
@@ -1298,11 +1298,11 @@ function hn(e, r) {
|
|
|
1298
1298
|
};
|
|
1299
1299
|
} });
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1301
|
+
function hn(e) {
|
|
1302
1302
|
return "_zod" in e;
|
|
1303
1303
|
}
|
|
1304
1304
|
function gn(e, t) {
|
|
1305
|
-
return
|
|
1305
|
+
return hn(e) ? mn(e, t) : pn(e, t);
|
|
1306
1306
|
}
|
|
1307
1307
|
async function _n({ value: e, schema: t, context: n }) {
|
|
1308
1308
|
let r = await vn({
|
|
@@ -1318,7 +1318,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1318
1318
|
return r.value;
|
|
1319
1319
|
}
|
|
1320
1320
|
async function vn({ value: e, schema: t, context: n }) {
|
|
1321
|
-
let r =
|
|
1321
|
+
let r = un(t);
|
|
1322
1322
|
try {
|
|
1323
1323
|
if (r.validate == null) return {
|
|
1324
1324
|
success: !0,
|
|
@@ -1386,28 +1386,28 @@ async function xn(e) {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
new TextDecoder();
|
|
1388
1388
|
// ../../node_modules/.pnpm/ai@7.0.154_zod@4.6.7/node_modules/ai/dist/index.js
|
|
1389
|
-
var
|
|
1389
|
+
var J = "AI_InvalidArgumentError", Sn = `vercel.ai.error.${J}`, Cn = Symbol.for(Sn), wn = class extends w {
|
|
1390
1390
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1391
1391
|
super({
|
|
1392
|
-
name:
|
|
1392
|
+
name: J,
|
|
1393
1393
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1394
|
-
}), this[
|
|
1394
|
+
}), this[Cn] = !0, this.parameter = e, this.value = t;
|
|
1395
1395
|
}
|
|
1396
1396
|
static isInstance(e) {
|
|
1397
|
-
return w.hasMarker(e,
|
|
1397
|
+
return w.hasMarker(e, Sn);
|
|
1398
1398
|
}
|
|
1399
|
-
},
|
|
1399
|
+
}, Tn = "AI_UIMessageStreamError", En = `vercel.ai.error.${Tn}`, Dn = Symbol.for(En), Y = class extends w {
|
|
1400
1400
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1401
1401
|
super({
|
|
1402
|
-
name:
|
|
1402
|
+
name: Tn,
|
|
1403
1403
|
message: n
|
|
1404
|
-
}), this[
|
|
1404
|
+
}), this[Dn] = !0, this.chunkType = e, this.chunkId = t;
|
|
1405
1405
|
}
|
|
1406
1406
|
static isInstance(e) {
|
|
1407
|
-
return w.hasMarker(e,
|
|
1407
|
+
return w.hasMarker(e, En);
|
|
1408
1408
|
}
|
|
1409
1409
|
};
|
|
1410
|
-
function
|
|
1410
|
+
function On(e, t) {
|
|
1411
1411
|
if (e === void 0 && t === void 0) return;
|
|
1412
1412
|
if (e === void 0) return t;
|
|
1413
1413
|
if (t === void 0) return e;
|
|
@@ -1416,11 +1416,11 @@ function kn(e, t) {
|
|
|
1416
1416
|
let i = t[r];
|
|
1417
1417
|
if (i === void 0) continue;
|
|
1418
1418
|
let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
|
|
1419
|
-
n[r] = o && s ?
|
|
1419
|
+
n[r] = o && s ? On(a, i) : i;
|
|
1420
1420
|
}
|
|
1421
1421
|
return n;
|
|
1422
1422
|
}
|
|
1423
|
-
var
|
|
1423
|
+
var X = {
|
|
1424
1424
|
array: d,
|
|
1425
1425
|
boolean: m,
|
|
1426
1426
|
custom: l,
|
|
@@ -1438,214 +1438,214 @@ var Y = {
|
|
|
1438
1438
|
string: r,
|
|
1439
1439
|
union: e,
|
|
1440
1440
|
unknown: _
|
|
1441
|
-
},
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
])), Z =
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
]), jn =
|
|
1454
|
-
type:
|
|
1455
|
-
text:
|
|
1441
|
+
}, kn = X.lazy(() => X.union([
|
|
1442
|
+
X.null(),
|
|
1443
|
+
X.string(),
|
|
1444
|
+
X.number(),
|
|
1445
|
+
X.boolean(),
|
|
1446
|
+
X.record(X.string(), kn.optional()),
|
|
1447
|
+
X.array(kn)
|
|
1448
|
+
])), Z = X.record(X.string(), X.record(X.string(), kn.optional())), An = X.union([
|
|
1449
|
+
X.string(),
|
|
1450
|
+
X.instanceof(Uint8Array),
|
|
1451
|
+
X.instanceof(ArrayBuffer),
|
|
1452
|
+
X.custom(P, { message: "Must be a Buffer" })
|
|
1453
|
+
]), jn = X.record(X.string(), X.string()), Mn = X.object({
|
|
1454
|
+
type: X.literal("text"),
|
|
1455
|
+
text: X.string(),
|
|
1456
1456
|
providerOptions: Z.optional()
|
|
1457
|
-
}), Nn =
|
|
1458
|
-
type:
|
|
1459
|
-
image:
|
|
1457
|
+
}), Nn = X.object({
|
|
1458
|
+
type: X.literal("image"),
|
|
1459
|
+
image: X.union([
|
|
1460
1460
|
An,
|
|
1461
|
-
|
|
1461
|
+
X.instanceof(URL),
|
|
1462
1462
|
jn
|
|
1463
1463
|
]),
|
|
1464
|
-
mediaType:
|
|
1464
|
+
mediaType: X.string().optional(),
|
|
1465
1465
|
providerOptions: Z.optional()
|
|
1466
|
-
}), Pn =
|
|
1467
|
-
|
|
1468
|
-
type:
|
|
1466
|
+
}), Pn = X.discriminatedUnion("type", [
|
|
1467
|
+
X.object({
|
|
1468
|
+
type: X.literal("data"),
|
|
1469
1469
|
data: An
|
|
1470
1470
|
}),
|
|
1471
|
-
|
|
1472
|
-
type:
|
|
1473
|
-
url:
|
|
1471
|
+
X.object({
|
|
1472
|
+
type: X.literal("url"),
|
|
1473
|
+
url: X.instanceof(URL)
|
|
1474
1474
|
}),
|
|
1475
|
-
|
|
1476
|
-
type:
|
|
1475
|
+
X.object({
|
|
1476
|
+
type: X.literal("reference"),
|
|
1477
1477
|
reference: jn
|
|
1478
1478
|
}),
|
|
1479
|
-
|
|
1480
|
-
type:
|
|
1481
|
-
text:
|
|
1479
|
+
X.object({
|
|
1480
|
+
type: X.literal("text"),
|
|
1481
|
+
text: X.string()
|
|
1482
1482
|
})
|
|
1483
|
-
]), Fn =
|
|
1484
|
-
type:
|
|
1483
|
+
]), Fn = X.discriminatedUnion("type", [X.object({
|
|
1484
|
+
type: X.literal("data"),
|
|
1485
1485
|
data: An
|
|
1486
|
-
}),
|
|
1487
|
-
type:
|
|
1488
|
-
url:
|
|
1489
|
-
})]), In =
|
|
1490
|
-
type:
|
|
1491
|
-
data:
|
|
1486
|
+
}), X.object({
|
|
1487
|
+
type: X.literal("url"),
|
|
1488
|
+
url: X.instanceof(URL)
|
|
1489
|
+
})]), In = X.object({
|
|
1490
|
+
type: X.literal("file"),
|
|
1491
|
+
data: X.union([
|
|
1492
1492
|
Pn,
|
|
1493
1493
|
An,
|
|
1494
|
-
|
|
1494
|
+
X.instanceof(URL),
|
|
1495
1495
|
jn
|
|
1496
1496
|
]),
|
|
1497
|
-
filename:
|
|
1498
|
-
mediaType:
|
|
1497
|
+
filename: X.string().optional(),
|
|
1498
|
+
mediaType: X.string(),
|
|
1499
1499
|
providerOptions: Z.optional()
|
|
1500
|
-
}), Ln =
|
|
1501
|
-
type:
|
|
1502
|
-
text:
|
|
1500
|
+
}), Ln = X.object({
|
|
1501
|
+
type: X.literal("reasoning"),
|
|
1502
|
+
text: X.string(),
|
|
1503
1503
|
providerOptions: Z.optional()
|
|
1504
|
-
}), Rn =
|
|
1505
|
-
type:
|
|
1506
|
-
kind:
|
|
1504
|
+
}), Rn = X.object({
|
|
1505
|
+
type: X.literal("custom"),
|
|
1506
|
+
kind: X.string().transform((e) => e),
|
|
1507
1507
|
providerOptions: Z.optional()
|
|
1508
|
-
}), zn =
|
|
1509
|
-
type:
|
|
1510
|
-
data:
|
|
1508
|
+
}), zn = X.object({
|
|
1509
|
+
type: X.literal("reasoning-file"),
|
|
1510
|
+
data: X.union([
|
|
1511
1511
|
Fn,
|
|
1512
1512
|
An,
|
|
1513
|
-
|
|
1513
|
+
X.instanceof(URL)
|
|
1514
1514
|
]),
|
|
1515
|
-
mediaType:
|
|
1515
|
+
mediaType: X.string(),
|
|
1516
1516
|
providerOptions: Z.optional()
|
|
1517
|
-
}), Bn =
|
|
1518
|
-
type:
|
|
1519
|
-
toolCallId:
|
|
1520
|
-
toolName:
|
|
1521
|
-
input:
|
|
1517
|
+
}), Bn = X.object({
|
|
1518
|
+
type: X.literal("tool-call"),
|
|
1519
|
+
toolCallId: X.string(),
|
|
1520
|
+
toolName: X.string(),
|
|
1521
|
+
input: X.unknown(),
|
|
1522
1522
|
providerOptions: Z.optional(),
|
|
1523
|
-
providerExecuted:
|
|
1524
|
-
}), Vn =
|
|
1525
|
-
|
|
1526
|
-
type:
|
|
1527
|
-
value:
|
|
1523
|
+
providerExecuted: X.boolean().optional()
|
|
1524
|
+
}), Vn = X.discriminatedUnion("type", [
|
|
1525
|
+
X.object({
|
|
1526
|
+
type: X.literal("text"),
|
|
1527
|
+
value: X.string(),
|
|
1528
1528
|
providerOptions: Z.optional()
|
|
1529
1529
|
}),
|
|
1530
|
-
|
|
1531
|
-
type:
|
|
1532
|
-
value:
|
|
1530
|
+
X.object({
|
|
1531
|
+
type: X.literal("json"),
|
|
1532
|
+
value: kn,
|
|
1533
1533
|
providerOptions: Z.optional()
|
|
1534
1534
|
}),
|
|
1535
|
-
|
|
1536
|
-
type:
|
|
1537
|
-
reason:
|
|
1535
|
+
X.object({
|
|
1536
|
+
type: X.literal("execution-denied"),
|
|
1537
|
+
reason: X.string().optional(),
|
|
1538
1538
|
providerOptions: Z.optional()
|
|
1539
1539
|
}),
|
|
1540
|
-
|
|
1541
|
-
type:
|
|
1542
|
-
value:
|
|
1540
|
+
X.object({
|
|
1541
|
+
type: X.literal("error-text"),
|
|
1542
|
+
value: X.string(),
|
|
1543
1543
|
providerOptions: Z.optional()
|
|
1544
1544
|
}),
|
|
1545
|
-
|
|
1546
|
-
type:
|
|
1547
|
-
value:
|
|
1545
|
+
X.object({
|
|
1546
|
+
type: X.literal("error-json"),
|
|
1547
|
+
value: kn,
|
|
1548
1548
|
providerOptions: Z.optional()
|
|
1549
1549
|
}),
|
|
1550
|
-
|
|
1551
|
-
type:
|
|
1552
|
-
value:
|
|
1553
|
-
|
|
1554
|
-
type:
|
|
1555
|
-
text:
|
|
1550
|
+
X.object({
|
|
1551
|
+
type: X.literal("content"),
|
|
1552
|
+
value: X.array(X.union([
|
|
1553
|
+
X.object({
|
|
1554
|
+
type: X.literal("text"),
|
|
1555
|
+
text: X.string(),
|
|
1556
1556
|
providerOptions: Z.optional()
|
|
1557
1557
|
}),
|
|
1558
|
-
|
|
1559
|
-
type:
|
|
1558
|
+
X.object({
|
|
1559
|
+
type: X.literal("file"),
|
|
1560
1560
|
data: Pn,
|
|
1561
|
-
mediaType:
|
|
1562
|
-
filename:
|
|
1561
|
+
mediaType: X.string(),
|
|
1562
|
+
filename: X.string().optional(),
|
|
1563
1563
|
providerOptions: Z.optional()
|
|
1564
1564
|
}),
|
|
1565
|
-
|
|
1566
|
-
type:
|
|
1567
|
-
data:
|
|
1568
|
-
mediaType:
|
|
1569
|
-
filename:
|
|
1565
|
+
X.object({
|
|
1566
|
+
type: X.literal("file-data"),
|
|
1567
|
+
data: X.string(),
|
|
1568
|
+
mediaType: X.string(),
|
|
1569
|
+
filename: X.string().optional(),
|
|
1570
1570
|
providerOptions: Z.optional()
|
|
1571
1571
|
}),
|
|
1572
|
-
|
|
1573
|
-
type:
|
|
1574
|
-
url:
|
|
1575
|
-
mediaType:
|
|
1572
|
+
X.object({
|
|
1573
|
+
type: X.literal("file-url"),
|
|
1574
|
+
url: X.string(),
|
|
1575
|
+
mediaType: X.string().optional(),
|
|
1576
1576
|
providerOptions: Z.optional()
|
|
1577
1577
|
}),
|
|
1578
|
-
|
|
1579
|
-
type:
|
|
1580
|
-
fileId:
|
|
1578
|
+
X.object({
|
|
1579
|
+
type: X.literal("file-id"),
|
|
1580
|
+
fileId: X.union([X.string(), X.record(X.string(), X.string())]),
|
|
1581
1581
|
providerOptions: Z.optional()
|
|
1582
1582
|
}),
|
|
1583
|
-
|
|
1584
|
-
type:
|
|
1585
|
-
providerReference:
|
|
1583
|
+
X.object({
|
|
1584
|
+
type: X.literal("file-reference"),
|
|
1585
|
+
providerReference: X.record(X.string(), X.string()),
|
|
1586
1586
|
providerOptions: Z.optional()
|
|
1587
1587
|
}),
|
|
1588
|
-
|
|
1589
|
-
type:
|
|
1590
|
-
data:
|
|
1591
|
-
mediaType:
|
|
1588
|
+
X.object({
|
|
1589
|
+
type: X.literal("image-data"),
|
|
1590
|
+
data: X.string(),
|
|
1591
|
+
mediaType: X.string(),
|
|
1592
1592
|
providerOptions: Z.optional()
|
|
1593
1593
|
}),
|
|
1594
|
-
|
|
1595
|
-
type:
|
|
1596
|
-
url:
|
|
1594
|
+
X.object({
|
|
1595
|
+
type: X.literal("image-url"),
|
|
1596
|
+
url: X.string(),
|
|
1597
1597
|
providerOptions: Z.optional()
|
|
1598
1598
|
}),
|
|
1599
|
-
|
|
1600
|
-
type:
|
|
1601
|
-
fileId:
|
|
1599
|
+
X.object({
|
|
1600
|
+
type: X.literal("image-file-id"),
|
|
1601
|
+
fileId: X.union([X.string(), X.record(X.string(), X.string())]),
|
|
1602
1602
|
providerOptions: Z.optional()
|
|
1603
1603
|
}),
|
|
1604
|
-
|
|
1605
|
-
type:
|
|
1606
|
-
providerReference:
|
|
1604
|
+
X.object({
|
|
1605
|
+
type: X.literal("image-file-reference"),
|
|
1606
|
+
providerReference: X.record(X.string(), X.string()),
|
|
1607
1607
|
providerOptions: Z.optional()
|
|
1608
1608
|
}),
|
|
1609
|
-
|
|
1610
|
-
type:
|
|
1609
|
+
X.object({
|
|
1610
|
+
type: X.literal("custom"),
|
|
1611
1611
|
providerOptions: Z.optional()
|
|
1612
1612
|
})
|
|
1613
1613
|
]))
|
|
1614
1614
|
})
|
|
1615
|
-
]), Hn =
|
|
1616
|
-
type:
|
|
1617
|
-
toolCallId:
|
|
1618
|
-
toolName:
|
|
1615
|
+
]), Hn = X.object({
|
|
1616
|
+
type: X.literal("tool-result"),
|
|
1617
|
+
toolCallId: X.string(),
|
|
1618
|
+
toolName: X.string(),
|
|
1619
1619
|
output: Vn,
|
|
1620
1620
|
providerOptions: Z.optional()
|
|
1621
|
-
}), Un =
|
|
1622
|
-
type:
|
|
1623
|
-
approvalId:
|
|
1624
|
-
toolCallId:
|
|
1625
|
-
reason:
|
|
1626
|
-
isAutomatic:
|
|
1627
|
-
signature:
|
|
1628
|
-
inputSchemaInput:
|
|
1629
|
-
}), Wn =
|
|
1630
|
-
type:
|
|
1631
|
-
approvalId:
|
|
1632
|
-
approved:
|
|
1633
|
-
reason:
|
|
1634
|
-
}), Gn =
|
|
1635
|
-
role:
|
|
1636
|
-
content:
|
|
1621
|
+
}), Un = X.object({
|
|
1622
|
+
type: X.literal("tool-approval-request"),
|
|
1623
|
+
approvalId: X.string(),
|
|
1624
|
+
toolCallId: X.string(),
|
|
1625
|
+
reason: X.string().optional(),
|
|
1626
|
+
isAutomatic: X.boolean().optional(),
|
|
1627
|
+
signature: X.string().optional(),
|
|
1628
|
+
inputSchemaInput: X.unknown().optional()
|
|
1629
|
+
}), Wn = X.object({
|
|
1630
|
+
type: X.literal("tool-approval-response"),
|
|
1631
|
+
approvalId: X.string(),
|
|
1632
|
+
approved: X.boolean(),
|
|
1633
|
+
reason: X.string().optional()
|
|
1634
|
+
}), Gn = X.object({
|
|
1635
|
+
role: X.literal("system"),
|
|
1636
|
+
content: X.string(),
|
|
1637
1637
|
providerOptions: Z.optional()
|
|
1638
|
-
}), Kn =
|
|
1639
|
-
role:
|
|
1640
|
-
content:
|
|
1638
|
+
}), Kn = X.object({
|
|
1639
|
+
role: X.literal("user"),
|
|
1640
|
+
content: X.union([X.string(), X.array(X.union([
|
|
1641
1641
|
Mn,
|
|
1642
1642
|
Nn,
|
|
1643
1643
|
In
|
|
1644
1644
|
]))]),
|
|
1645
1645
|
providerOptions: Z.optional()
|
|
1646
|
-
}), qn =
|
|
1647
|
-
role:
|
|
1648
|
-
content:
|
|
1646
|
+
}), qn = X.object({
|
|
1647
|
+
role: X.literal("assistant"),
|
|
1648
|
+
content: X.union([X.string(), X.array(X.union([
|
|
1649
1649
|
Mn,
|
|
1650
1650
|
Rn,
|
|
1651
1651
|
In,
|
|
@@ -1656,12 +1656,12 @@ var Y = {
|
|
|
1656
1656
|
Un
|
|
1657
1657
|
]))]),
|
|
1658
1658
|
providerOptions: Z.optional()
|
|
1659
|
-
}), Jn =
|
|
1660
|
-
role:
|
|
1661
|
-
content:
|
|
1659
|
+
}), Jn = X.object({
|
|
1660
|
+
role: X.literal("tool"),
|
|
1661
|
+
content: X.array(X.union([Hn, Wn])),
|
|
1662
1662
|
providerOptions: Z.optional()
|
|
1663
1663
|
});
|
|
1664
|
-
|
|
1664
|
+
X.union([
|
|
1665
1665
|
Gn,
|
|
1666
1666
|
Kn,
|
|
1667
1667
|
qn,
|
|
@@ -1876,193 +1876,193 @@ N({
|
|
|
1876
1876
|
prefix: "call",
|
|
1877
1877
|
size: 24
|
|
1878
1878
|
}), TransformStream;
|
|
1879
|
-
var Zn =
|
|
1880
|
-
source:
|
|
1881
|
-
type:
|
|
1882
|
-
sourceType:
|
|
1883
|
-
id:
|
|
1884
|
-
url:
|
|
1885
|
-
title:
|
|
1879
|
+
var Zn = X.object({
|
|
1880
|
+
source: X.discriminatedUnion("sourceType", [X.object({
|
|
1881
|
+
type: X.literal("source"),
|
|
1882
|
+
sourceType: X.literal("url"),
|
|
1883
|
+
id: X.string(),
|
|
1884
|
+
url: X.string(),
|
|
1885
|
+
title: X.string().optional(),
|
|
1886
1886
|
providerMetadata: Z.optional()
|
|
1887
|
-
}),
|
|
1888
|
-
type:
|
|
1889
|
-
sourceType:
|
|
1890
|
-
id:
|
|
1891
|
-
mediaType:
|
|
1892
|
-
title:
|
|
1893
|
-
filename:
|
|
1887
|
+
}), X.object({
|
|
1888
|
+
type: X.literal("source"),
|
|
1889
|
+
sourceType: X.literal("document"),
|
|
1890
|
+
id: X.string(),
|
|
1891
|
+
mediaType: X.string(),
|
|
1892
|
+
title: X.string(),
|
|
1893
|
+
filename: X.string().optional(),
|
|
1894
1894
|
providerMetadata: Z.optional()
|
|
1895
1895
|
})]),
|
|
1896
|
-
startIndex:
|
|
1897
|
-
endIndex:
|
|
1898
|
-
citedText:
|
|
1899
|
-
}), Qn =
|
|
1900
|
-
|
|
1901
|
-
type:
|
|
1902
|
-
id:
|
|
1896
|
+
startIndex: X.number().int().nonnegative().optional(),
|
|
1897
|
+
endIndex: X.number().int().nonnegative().optional(),
|
|
1898
|
+
citedText: X.string().optional()
|
|
1899
|
+
}), Qn = X.record(X.string(), kn.optional()), $n = sn(() => gn(X.union([
|
|
1900
|
+
X.looseObject({
|
|
1901
|
+
type: X.literal("text-start"),
|
|
1902
|
+
id: X.string(),
|
|
1903
1903
|
providerMetadata: Z.optional()
|
|
1904
1904
|
}),
|
|
1905
|
-
|
|
1906
|
-
type:
|
|
1907
|
-
id:
|
|
1908
|
-
delta:
|
|
1905
|
+
X.looseObject({
|
|
1906
|
+
type: X.literal("text-delta"),
|
|
1907
|
+
id: X.string(),
|
|
1908
|
+
delta: X.string(),
|
|
1909
1909
|
providerMetadata: Z.optional()
|
|
1910
1910
|
}),
|
|
1911
|
-
|
|
1912
|
-
type:
|
|
1913
|
-
id:
|
|
1914
|
-
citations:
|
|
1911
|
+
X.looseObject({
|
|
1912
|
+
type: X.literal("text-end"),
|
|
1913
|
+
id: X.string(),
|
|
1914
|
+
citations: X.array(Zn).optional(),
|
|
1915
1915
|
providerMetadata: Z.optional()
|
|
1916
1916
|
}),
|
|
1917
|
-
|
|
1918
|
-
type:
|
|
1919
|
-
errorText:
|
|
1917
|
+
X.looseObject({
|
|
1918
|
+
type: X.literal("error"),
|
|
1919
|
+
errorText: X.string()
|
|
1920
1920
|
}),
|
|
1921
|
-
|
|
1922
|
-
type:
|
|
1923
|
-
toolCallId:
|
|
1924
|
-
toolName:
|
|
1925
|
-
inputEncoding:
|
|
1926
|
-
providerExecuted:
|
|
1921
|
+
X.looseObject({
|
|
1922
|
+
type: X.literal("tool-input-start"),
|
|
1923
|
+
toolCallId: X.string(),
|
|
1924
|
+
toolName: X.string(),
|
|
1925
|
+
inputEncoding: X.enum(["json", "text"]).optional(),
|
|
1926
|
+
providerExecuted: X.boolean().optional(),
|
|
1927
1927
|
providerMetadata: Z.optional(),
|
|
1928
1928
|
toolMetadata: Qn.optional(),
|
|
1929
|
-
dynamic:
|
|
1930
|
-
title:
|
|
1929
|
+
dynamic: X.boolean().optional(),
|
|
1930
|
+
title: X.string().optional()
|
|
1931
1931
|
}),
|
|
1932
|
-
|
|
1933
|
-
type:
|
|
1934
|
-
toolCallId:
|
|
1935
|
-
inputTextDelta:
|
|
1932
|
+
X.looseObject({
|
|
1933
|
+
type: X.literal("tool-input-delta"),
|
|
1934
|
+
toolCallId: X.string(),
|
|
1935
|
+
inputTextDelta: X.string()
|
|
1936
1936
|
}),
|
|
1937
|
-
|
|
1938
|
-
type:
|
|
1939
|
-
toolCallId:
|
|
1940
|
-
toolName:
|
|
1941
|
-
input:
|
|
1942
|
-
providerExecuted:
|
|
1937
|
+
X.looseObject({
|
|
1938
|
+
type: X.literal("tool-input-available"),
|
|
1939
|
+
toolCallId: X.string(),
|
|
1940
|
+
toolName: X.string(),
|
|
1941
|
+
input: X.unknown(),
|
|
1942
|
+
providerExecuted: X.boolean().optional(),
|
|
1943
1943
|
providerMetadata: Z.optional(),
|
|
1944
1944
|
toolMetadata: Qn.optional(),
|
|
1945
|
-
dynamic:
|
|
1946
|
-
title:
|
|
1945
|
+
dynamic: X.boolean().optional(),
|
|
1946
|
+
title: X.string().optional()
|
|
1947
1947
|
}),
|
|
1948
|
-
|
|
1949
|
-
type:
|
|
1950
|
-
toolCallId:
|
|
1951
|
-
toolName:
|
|
1952
|
-
input:
|
|
1953
|
-
providerExecuted:
|
|
1948
|
+
X.looseObject({
|
|
1949
|
+
type: X.literal("tool-input-error"),
|
|
1950
|
+
toolCallId: X.string(),
|
|
1951
|
+
toolName: X.string(),
|
|
1952
|
+
input: X.unknown(),
|
|
1953
|
+
providerExecuted: X.boolean().optional(),
|
|
1954
1954
|
providerMetadata: Z.optional(),
|
|
1955
1955
|
toolMetadata: Qn.optional(),
|
|
1956
|
-
dynamic:
|
|
1957
|
-
errorText:
|
|
1958
|
-
title:
|
|
1956
|
+
dynamic: X.boolean().optional(),
|
|
1957
|
+
errorText: X.string(),
|
|
1958
|
+
title: X.string().optional()
|
|
1959
1959
|
}),
|
|
1960
|
-
|
|
1961
|
-
type:
|
|
1962
|
-
approvalId:
|
|
1963
|
-
toolCallId:
|
|
1964
|
-
approvalDescriptor:
|
|
1965
|
-
inputSchemaInput:
|
|
1966
|
-
reason:
|
|
1967
|
-
isAutomatic:
|
|
1968
|
-
signature:
|
|
1960
|
+
X.looseObject({
|
|
1961
|
+
type: X.literal("tool-approval-request"),
|
|
1962
|
+
approvalId: X.string(),
|
|
1963
|
+
toolCallId: X.string(),
|
|
1964
|
+
approvalDescriptor: X.unknown().optional(),
|
|
1965
|
+
inputSchemaInput: X.unknown().optional(),
|
|
1966
|
+
reason: X.string().optional(),
|
|
1967
|
+
isAutomatic: X.boolean().optional(),
|
|
1968
|
+
signature: X.string().optional()
|
|
1969
1969
|
}),
|
|
1970
|
-
|
|
1971
|
-
type:
|
|
1972
|
-
approvalId:
|
|
1973
|
-
approved:
|
|
1974
|
-
reason:
|
|
1975
|
-
providerExecuted:
|
|
1970
|
+
X.looseObject({
|
|
1971
|
+
type: X.literal("tool-approval-response"),
|
|
1972
|
+
approvalId: X.string(),
|
|
1973
|
+
approved: X.boolean(),
|
|
1974
|
+
reason: X.string().optional(),
|
|
1975
|
+
providerExecuted: X.boolean().optional(),
|
|
1976
1976
|
providerMetadata: Z.optional()
|
|
1977
1977
|
}),
|
|
1978
|
-
|
|
1979
|
-
type:
|
|
1980
|
-
toolCallId:
|
|
1981
|
-
output:
|
|
1982
|
-
providerExecuted:
|
|
1978
|
+
X.looseObject({
|
|
1979
|
+
type: X.literal("tool-output-available"),
|
|
1980
|
+
toolCallId: X.string(),
|
|
1981
|
+
output: X.unknown(),
|
|
1982
|
+
providerExecuted: X.boolean().optional(),
|
|
1983
1983
|
providerMetadata: Z.optional(),
|
|
1984
1984
|
toolMetadata: Qn.optional(),
|
|
1985
|
-
dynamic:
|
|
1986
|
-
preliminary:
|
|
1985
|
+
dynamic: X.boolean().optional(),
|
|
1986
|
+
preliminary: X.boolean().optional()
|
|
1987
1987
|
}),
|
|
1988
|
-
|
|
1989
|
-
type:
|
|
1990
|
-
toolCallId:
|
|
1991
|
-
errorText:
|
|
1992
|
-
providerExecuted:
|
|
1988
|
+
X.looseObject({
|
|
1989
|
+
type: X.literal("tool-output-error"),
|
|
1990
|
+
toolCallId: X.string(),
|
|
1991
|
+
errorText: X.string(),
|
|
1992
|
+
providerExecuted: X.boolean().optional(),
|
|
1993
1993
|
providerMetadata: Z.optional(),
|
|
1994
1994
|
toolMetadata: Qn.optional(),
|
|
1995
|
-
dynamic:
|
|
1995
|
+
dynamic: X.boolean().optional()
|
|
1996
1996
|
}),
|
|
1997
|
-
|
|
1998
|
-
type:
|
|
1999
|
-
toolCallId:
|
|
1997
|
+
X.looseObject({
|
|
1998
|
+
type: X.literal("tool-output-denied"),
|
|
1999
|
+
toolCallId: X.string()
|
|
2000
2000
|
}),
|
|
2001
|
-
|
|
2002
|
-
type:
|
|
2003
|
-
id:
|
|
2001
|
+
X.looseObject({
|
|
2002
|
+
type: X.literal("reasoning-start"),
|
|
2003
|
+
id: X.string(),
|
|
2004
2004
|
providerMetadata: Z.optional()
|
|
2005
2005
|
}),
|
|
2006
|
-
|
|
2007
|
-
type:
|
|
2008
|
-
id:
|
|
2009
|
-
delta:
|
|
2006
|
+
X.looseObject({
|
|
2007
|
+
type: X.literal("reasoning-delta"),
|
|
2008
|
+
id: X.string(),
|
|
2009
|
+
delta: X.string(),
|
|
2010
2010
|
providerMetadata: Z.optional()
|
|
2011
2011
|
}),
|
|
2012
|
-
|
|
2013
|
-
type:
|
|
2014
|
-
id:
|
|
2012
|
+
X.looseObject({
|
|
2013
|
+
type: X.literal("reasoning-end"),
|
|
2014
|
+
id: X.string(),
|
|
2015
2015
|
providerMetadata: Z.optional()
|
|
2016
2016
|
}),
|
|
2017
|
-
|
|
2018
|
-
type:
|
|
2019
|
-
kind:
|
|
2017
|
+
X.looseObject({
|
|
2018
|
+
type: X.literal("custom"),
|
|
2019
|
+
kind: X.string().transform((e) => e),
|
|
2020
2020
|
providerMetadata: Z.optional()
|
|
2021
2021
|
}),
|
|
2022
|
-
|
|
2023
|
-
type:
|
|
2024
|
-
sourceId:
|
|
2025
|
-
url:
|
|
2026
|
-
title:
|
|
2022
|
+
X.looseObject({
|
|
2023
|
+
type: X.literal("source-url"),
|
|
2024
|
+
sourceId: X.string(),
|
|
2025
|
+
url: X.string(),
|
|
2026
|
+
title: X.string().optional(),
|
|
2027
2027
|
providerMetadata: Z.optional()
|
|
2028
2028
|
}),
|
|
2029
|
-
|
|
2030
|
-
type:
|
|
2031
|
-
sourceId:
|
|
2032
|
-
mediaType:
|
|
2033
|
-
title:
|
|
2034
|
-
filename:
|
|
2029
|
+
X.looseObject({
|
|
2030
|
+
type: X.literal("source-document"),
|
|
2031
|
+
sourceId: X.string(),
|
|
2032
|
+
mediaType: X.string(),
|
|
2033
|
+
title: X.string(),
|
|
2034
|
+
filename: X.string().optional(),
|
|
2035
2035
|
providerMetadata: Z.optional()
|
|
2036
2036
|
}),
|
|
2037
|
-
|
|
2038
|
-
type:
|
|
2039
|
-
url:
|
|
2040
|
-
mediaType:
|
|
2037
|
+
X.looseObject({
|
|
2038
|
+
type: X.literal("file"),
|
|
2039
|
+
url: X.string(),
|
|
2040
|
+
mediaType: X.string(),
|
|
2041
2041
|
providerMetadata: Z.optional()
|
|
2042
2042
|
}),
|
|
2043
|
-
|
|
2044
|
-
type:
|
|
2045
|
-
url:
|
|
2046
|
-
mediaType:
|
|
2043
|
+
X.looseObject({
|
|
2044
|
+
type: X.literal("reasoning-file"),
|
|
2045
|
+
url: X.string(),
|
|
2046
|
+
mediaType: X.string(),
|
|
2047
2047
|
providerMetadata: Z.optional()
|
|
2048
2048
|
}),
|
|
2049
|
-
|
|
2050
|
-
type:
|
|
2051
|
-
id:
|
|
2052
|
-
data:
|
|
2053
|
-
transient:
|
|
2049
|
+
X.looseObject({
|
|
2050
|
+
type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
2051
|
+
id: X.string().optional(),
|
|
2052
|
+
data: X.unknown(),
|
|
2053
|
+
transient: X.boolean().optional()
|
|
2054
2054
|
}),
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
type:
|
|
2060
|
-
messageId:
|
|
2061
|
-
messageMetadata:
|
|
2055
|
+
X.looseObject({ type: X.literal("start-step") }),
|
|
2056
|
+
X.looseObject({ type: X.literal("finish-step") }),
|
|
2057
|
+
X.looseObject({ type: X.literal("reset-step") }),
|
|
2058
|
+
X.looseObject({
|
|
2059
|
+
type: X.literal("start"),
|
|
2060
|
+
messageId: X.string().optional(),
|
|
2061
|
+
messageMetadata: X.unknown().optional()
|
|
2062
2062
|
}),
|
|
2063
|
-
|
|
2064
|
-
type:
|
|
2065
|
-
finishReason:
|
|
2063
|
+
X.looseObject({
|
|
2064
|
+
type: X.literal("finish"),
|
|
2065
|
+
finishReason: X.enum([
|
|
2066
2066
|
"stop",
|
|
2067
2067
|
"length",
|
|
2068
2068
|
"content-filter",
|
|
@@ -2071,15 +2071,15 @@ var Zn = Y.object({
|
|
|
2071
2071
|
"interrupted",
|
|
2072
2072
|
"other"
|
|
2073
2073
|
]).optional(),
|
|
2074
|
-
messageMetadata:
|
|
2074
|
+
messageMetadata: X.unknown().optional()
|
|
2075
2075
|
}),
|
|
2076
|
-
|
|
2077
|
-
type:
|
|
2078
|
-
reason:
|
|
2076
|
+
X.looseObject({
|
|
2077
|
+
type: X.literal("abort"),
|
|
2078
|
+
reason: X.string().optional()
|
|
2079
2079
|
}),
|
|
2080
|
-
|
|
2081
|
-
type:
|
|
2082
|
-
messageMetadata:
|
|
2080
|
+
X.looseObject({
|
|
2081
|
+
type: X.literal("message-metadata"),
|
|
2082
|
+
messageMetadata: X.unknown()
|
|
2083
2083
|
})
|
|
2084
2084
|
])));
|
|
2085
2085
|
function er(e) {
|
|
@@ -2151,7 +2151,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
2153
2153
|
}
|
|
2154
|
-
if (t == null) throw new
|
|
2154
|
+
if (t == null) throw new Y({
|
|
2155
2155
|
chunkType: "tool-invocation",
|
|
2156
2156
|
chunkId: e,
|
|
2157
2157
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2160,7 +2160,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2160
2160
|
}
|
|
2161
2161
|
function h(e) {
|
|
2162
2162
|
let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
|
|
2163
|
-
if (t == null) throw new
|
|
2163
|
+
if (t == null) throw new Y({
|
|
2164
2164
|
chunkType: "tool-approval-response",
|
|
2165
2165
|
chunkId: e,
|
|
2166
2166
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2225,7 +2225,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2225
2225
|
}
|
|
2226
2226
|
async function v(e) {
|
|
2227
2227
|
if (e != null) {
|
|
2228
|
-
let n = r.message.metadata == null ? e :
|
|
2228
|
+
let n = r.message.metadata == null ? e : On(r.message.metadata, e);
|
|
2229
2229
|
t != null && await _n({
|
|
2230
2230
|
value: n,
|
|
2231
2231
|
schema: t,
|
|
@@ -2249,7 +2249,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2249
2249
|
}
|
|
2250
2250
|
case "text-delta": {
|
|
2251
2251
|
let t = r.activeTextParts[e.id];
|
|
2252
|
-
if (t == null) throw new
|
|
2252
|
+
if (t == null) throw new Y({
|
|
2253
2253
|
chunkType: "text-delta",
|
|
2254
2254
|
chunkId: e.id,
|
|
2255
2255
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2259,7 +2259,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2259
2259
|
}
|
|
2260
2260
|
case "text-end": {
|
|
2261
2261
|
let t = r.activeTextParts[e.id];
|
|
2262
|
-
if (t == null) throw new
|
|
2262
|
+
if (t == null) throw new Y({
|
|
2263
2263
|
chunkType: "text-end",
|
|
2264
2264
|
chunkId: e.id,
|
|
2265
2265
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2289,7 +2289,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2289
2289
|
}
|
|
2290
2290
|
case "reasoning-delta": {
|
|
2291
2291
|
let t = r.activeReasoningParts[e.id];
|
|
2292
|
-
if (t == null) throw new
|
|
2292
|
+
if (t == null) throw new Y({
|
|
2293
2293
|
chunkType: "reasoning-delta",
|
|
2294
2294
|
chunkId: e.id,
|
|
2295
2295
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2299,7 +2299,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2299
2299
|
}
|
|
2300
2300
|
case "reasoning-end": {
|
|
2301
2301
|
let t = r.activeReasoningParts[e.id];
|
|
2302
|
-
if (t == null) throw new
|
|
2302
|
+
if (t == null) throw new Y({
|
|
2303
2303
|
chunkType: "reasoning-end",
|
|
2304
2304
|
chunkId: e.id,
|
|
2305
2305
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2370,7 +2370,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2370
2370
|
}
|
|
2371
2371
|
case "tool-input-delta": {
|
|
2372
2372
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2373
|
-
if (t == null) throw new
|
|
2373
|
+
if (t == null) throw new Y({
|
|
2374
2374
|
chunkType: "tool-input-delta",
|
|
2375
2375
|
chunkId: e.toolCallId,
|
|
2376
2376
|
message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
|
|
@@ -2612,7 +2612,7 @@ N({
|
|
|
2612
2612
|
}), N({
|
|
2613
2613
|
prefix: "call",
|
|
2614
2614
|
size: 24
|
|
2615
|
-
}),
|
|
2615
|
+
}), X.record(X.string(), kn.optional()), X.record(X.string(), X.string()), N({
|
|
2616
2616
|
prefix: "call",
|
|
2617
2617
|
size: 24
|
|
2618
2618
|
}), N({
|
|
@@ -2663,9 +2663,9 @@ N({
|
|
|
2663
2663
|
}), N({
|
|
2664
2664
|
prefix: "call",
|
|
2665
2665
|
size: 24
|
|
2666
|
-
}),
|
|
2667
|
-
token:
|
|
2668
|
-
url:
|
|
2666
|
+
}), X.object({
|
|
2667
|
+
token: X.string().refine((e) => e.trim().length > 0),
|
|
2668
|
+
url: X.string().refine((e) => {
|
|
2669
2669
|
try {
|
|
2670
2670
|
let t = new URL(e);
|
|
2671
2671
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2673,12 +2673,12 @@ N({
|
|
|
2673
2673
|
return !1;
|
|
2674
2674
|
}
|
|
2675
2675
|
}),
|
|
2676
|
-
expiresAt:
|
|
2677
|
-
tools:
|
|
2678
|
-
type:
|
|
2679
|
-
name:
|
|
2680
|
-
description:
|
|
2681
|
-
parameters:
|
|
2676
|
+
expiresAt: X.number().positive().max(2 ** 53 - 1).optional(),
|
|
2677
|
+
tools: X.array(X.object({
|
|
2678
|
+
type: X.literal("function"),
|
|
2679
|
+
name: X.string().min(1),
|
|
2680
|
+
description: X.string().optional(),
|
|
2681
|
+
parameters: X.record(X.string(), X.unknown())
|
|
2682
2682
|
})).optional()
|
|
2683
2683
|
}), N({
|
|
2684
2684
|
prefix: "call",
|
|
@@ -2787,7 +2787,7 @@ var mr = class {
|
|
|
2787
2787
|
requestMetadata: e.metadata
|
|
2788
2788
|
}), o = a?.api;
|
|
2789
2789
|
if (o == null) {
|
|
2790
|
-
if (e.chatId === "." || e.chatId === "..") throw new
|
|
2790
|
+
if (e.chatId === "." || e.chatId === "..") throw new wn({
|
|
2791
2791
|
parameter: "chatId",
|
|
2792
2792
|
value: e.chatId,
|
|
2793
2793
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
@@ -2866,12 +2866,12 @@ var mr = class {
|
|
|
2866
2866
|
} else n = e;
|
|
2867
2867
|
if (e.messageId != null) {
|
|
2868
2868
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
2869
|
-
if (t === -1) throw new
|
|
2869
|
+
if (t === -1) throw new wn({
|
|
2870
2870
|
parameter: "message.messageId",
|
|
2871
2871
|
value: e.messageId,
|
|
2872
2872
|
message: `message with id ${e.messageId} not found`
|
|
2873
2873
|
});
|
|
2874
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
2874
|
+
if (this.state.messages[t].role !== "user") throw new wn({
|
|
2875
2875
|
parameter: "message.messageId",
|
|
2876
2876
|
value: e.messageId,
|
|
2877
2877
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -2895,7 +2895,7 @@ var mr = class {
|
|
|
2895
2895
|
});
|
|
2896
2896
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
2897
2897
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
2898
|
-
if (n === -1) throw new
|
|
2898
|
+
if (n === -1) throw new wn({
|
|
2899
2899
|
parameter: "messageId",
|
|
2900
2900
|
value: e,
|
|
2901
2901
|
message: `message ${e} not found`
|
|
@@ -3767,7 +3767,7 @@ function ui(e) {
|
|
|
3767
3767
|
}
|
|
3768
3768
|
});
|
|
3769
3769
|
async function k() {
|
|
3770
|
-
A(), ke.value = void 0, Pe.value = !1,
|
|
3770
|
+
A(), ke.value = void 0, Pe.value = !1, G.value = "", await F.value.stop();
|
|
3771
3771
|
}
|
|
3772
3772
|
function A() {
|
|
3773
3773
|
it.cancelAll(), O.value?.answer(!1);
|
|
@@ -3781,7 +3781,7 @@ function ui(e) {
|
|
|
3781
3781
|
M.value.includes(e) || (M.value = [...M.value, e]), dt.set(e, Date.now()), n ? ft.add(e) : ft.delete(e), t && (P.value = {
|
|
3782
3782
|
...P.value,
|
|
3783
3783
|
[e]: t
|
|
3784
|
-
}),
|
|
3784
|
+
}), J || wn();
|
|
3785
3785
|
}
|
|
3786
3786
|
function mt(e) {
|
|
3787
3787
|
P.value = Object.fromEntries(Object.entries(P.value).filter(([t]) => t !== e));
|
|
@@ -3849,15 +3849,15 @@ function ui(e) {
|
|
|
3849
3849
|
},
|
|
3850
3850
|
onFinish: () => {
|
|
3851
3851
|
let e = E.value;
|
|
3852
|
-
!T.value && !L.value.some((t) => t.id === e) &&
|
|
3852
|
+
!T.value && !L.value.some((t) => t.id === e) && Ut(o.value);
|
|
3853
3853
|
}
|
|
3854
3854
|
})), F = x(() => _e(gt)), _t = () => F.value.messages[F.value.messages.length - 1];
|
|
3855
3855
|
C(E, (e, t) => {
|
|
3856
|
-
if (t && !T.value && (
|
|
3856
|
+
if (t && !T.value && (K() || j?.chatId === t)) {
|
|
3857
3857
|
let e = F.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
|
|
3858
3858
|
pt(t, n ? ue(n) ?? "" : "", F.value.status === "streaming" || j?.chatId === t);
|
|
3859
3859
|
}
|
|
3860
|
-
ht(e), ct = void 0, clearTimeout(
|
|
3860
|
+
ht(e), ct = void 0, clearTimeout(vn), _n.value = !1, F.value.stop();
|
|
3861
3861
|
}, { flush: "sync" });
|
|
3862
3862
|
let vt = x(() => {
|
|
3863
3863
|
let e = u.value?.initialMessage;
|
|
@@ -3892,29 +3892,29 @@ function ui(e) {
|
|
|
3892
3892
|
}), xt = x(() => {
|
|
3893
3893
|
let e = u.value?.messagePlaceholder;
|
|
3894
3894
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3895
|
-
}), L = S([]), St = S(!1), R = S([]),
|
|
3896
|
-
function
|
|
3897
|
-
let n = Object.fromEntries(Object.entries(
|
|
3898
|
-
|
|
3895
|
+
}), L = S([]), St = S(!1), Ct = S(1), wt = S(!1), Tt = S(!1), Et, R = S([]), Dt = S(!1), Ot = S("chat"), kt = S(0), z = S([]), B = S(), V = S(!1), At = S(!1), jt = S(), Mt = S(!1), Nt = S(!1), H = S(), U = S(""), W = S([]), G = S(""), Pt = S(0), Ft = de(x(() => `${o.value}-queue`), {}), It = x(() => Ft.value[E.value] ?? []), Lt = x(() => !T.value);
|
|
3896
|
+
function Rt(e, t) {
|
|
3897
|
+
let n = Object.fromEntries(Object.entries(Ft.value).filter(([t]) => t !== e));
|
|
3898
|
+
Ft.value = t.length > 0 ? {
|
|
3899
3899
|
...n,
|
|
3900
3900
|
[e]: t
|
|
3901
3901
|
} : n;
|
|
3902
3902
|
}
|
|
3903
|
-
function
|
|
3904
|
-
let t = (
|
|
3905
|
-
return
|
|
3903
|
+
function zt(e) {
|
|
3904
|
+
let t = (Ft.value[e] ?? []).join(oi);
|
|
3905
|
+
return Rt(e, []), t;
|
|
3906
3906
|
}
|
|
3907
|
-
function
|
|
3908
|
-
e && (
|
|
3907
|
+
function Bt(e) {
|
|
3908
|
+
e && (U.value = U.value ? `${U.value}${oi}${e}` : e);
|
|
3909
3909
|
}
|
|
3910
|
-
function
|
|
3911
|
-
|
|
3910
|
+
function Vt(e) {
|
|
3911
|
+
Rt(E.value, It.value.filter((t, n) => n !== e));
|
|
3912
3912
|
}
|
|
3913
|
-
function
|
|
3914
|
-
let t =
|
|
3915
|
-
|
|
3913
|
+
function Ht(e) {
|
|
3914
|
+
let t = It.value[e];
|
|
3915
|
+
Vt(e), Bt(t ?? "");
|
|
3916
3916
|
}
|
|
3917
|
-
async function
|
|
3917
|
+
async function Ut(e) {
|
|
3918
3918
|
if (T.value) L.value = [];
|
|
3919
3919
|
else {
|
|
3920
3920
|
St.value = !0;
|
|
@@ -3926,58 +3926,80 @@ function ui(e) {
|
|
|
3926
3926
|
summary: null,
|
|
3927
3927
|
messages: [],
|
|
3928
3928
|
lastMessageAt: /* @__PURE__ */ new Date()
|
|
3929
|
-
}))
|
|
3930
|
-
|
|
3929
|
+
})), i = `${e}:${l.value ?? ""}`;
|
|
3930
|
+
i !== Et && (Ct.value = 1);
|
|
3931
|
+
let a = new Set(r.map((e) => e.id)), o = Ct.value > 1 ? L.value.filter((e) => !n.has(e.id) && !a.has(e.id)) : [];
|
|
3932
|
+
L.value = [
|
|
3933
|
+
...r,
|
|
3934
|
+
...t,
|
|
3935
|
+
...o
|
|
3936
|
+
], Et = i, Ct.value === 1 && (wt.value = t.length >= 100);
|
|
3931
3937
|
} catch {
|
|
3932
|
-
L.value = [];
|
|
3938
|
+
L.value = [], Ct.value = 1, Et = void 0, wt.value = !1;
|
|
3933
3939
|
return;
|
|
3934
3940
|
} finally {
|
|
3935
3941
|
St.value = !1;
|
|
3936
3942
|
}
|
|
3937
|
-
|
|
3943
|
+
Tn([.../* @__PURE__ */ new Set([...bn(), ...L.value.map((e) => e.id)])]);
|
|
3944
|
+
}
|
|
3945
|
+
}
|
|
3946
|
+
async function Wt() {
|
|
3947
|
+
if (!wt.value || Tt.value || T.value) return;
|
|
3948
|
+
Tt.value = !0;
|
|
3949
|
+
let e = Et;
|
|
3950
|
+
try {
|
|
3951
|
+
let t = Ct.value + 1, n = await D.value.getConversations(o.value, l.value, { page: t });
|
|
3952
|
+
if (e !== Et) return;
|
|
3953
|
+
let r = new Set(L.value.map((e) => e.id));
|
|
3954
|
+
L.value = [...L.value, ...n.filter((e) => !r.has(e.id))], Ct.value = t, wt.value = n.length >= 100;
|
|
3955
|
+
} catch {} finally {
|
|
3956
|
+
Tt.value = !1;
|
|
3938
3957
|
}
|
|
3939
3958
|
}
|
|
3940
|
-
async function
|
|
3959
|
+
async function Gt(e) {
|
|
3960
|
+
return T.value ? [] : D.value.getConversations(o.value, l.value, { search: e });
|
|
3961
|
+
}
|
|
3962
|
+
async function Kt() {
|
|
3941
3963
|
let e = E.value;
|
|
3942
3964
|
if (!e) R.value = [];
|
|
3943
3965
|
else {
|
|
3944
|
-
|
|
3966
|
+
Dt.value = !0;
|
|
3945
3967
|
try {
|
|
3946
3968
|
R.value = await D.value.getChatFiles(e);
|
|
3947
3969
|
} catch {
|
|
3948
3970
|
R.value = [];
|
|
3949
3971
|
} finally {
|
|
3950
|
-
|
|
3972
|
+
Dt.value = !1;
|
|
3951
3973
|
}
|
|
3952
3974
|
}
|
|
3953
3975
|
}
|
|
3954
|
-
function
|
|
3976
|
+
function qt(e, t = !1) {
|
|
3955
3977
|
return D.value.getChatFileDownloadUrl(e, t);
|
|
3956
3978
|
}
|
|
3957
|
-
function
|
|
3979
|
+
function Jt(e) {
|
|
3958
3980
|
return D.value.getChatFilePreviewUrl(e);
|
|
3959
3981
|
}
|
|
3960
|
-
async function
|
|
3982
|
+
async function Yt(e) {
|
|
3961
3983
|
await D.value.deleteChatFile(e);
|
|
3962
3984
|
let t = R.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
3963
3985
|
R.value = R.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
3964
3986
|
}
|
|
3965
|
-
async function
|
|
3987
|
+
async function Xt(e, t) {
|
|
3966
3988
|
if (!T.value) try {
|
|
3967
3989
|
let n = await D.value.getChat(e, t);
|
|
3968
3990
|
if (t !== E.value || F.value.status !== "ready" || F.value.messages.length > 0) return;
|
|
3969
|
-
n && (F.value.messages = n.messages, Ye.value = n.blocked ?? !1,
|
|
3991
|
+
n && (F.value.messages = n.messages, Ye.value = n.blocked ?? !1, Zt(e, t, n.turnInProgress === !0));
|
|
3970
3992
|
} catch {}
|
|
3971
3993
|
}
|
|
3972
|
-
async function
|
|
3973
|
-
n && (await
|
|
3994
|
+
async function Zt(e, t, n) {
|
|
3995
|
+
n && (await Qt(t), t !== E.value || K()) || (await $t(e, t), t === E.value && await nn());
|
|
3974
3996
|
}
|
|
3975
|
-
async function
|
|
3997
|
+
async function Qt(e) {
|
|
3976
3998
|
let t = { chatId: e };
|
|
3977
3999
|
j = t, st.value = e;
|
|
3978
4000
|
let n = () => j === t && e === E.value, r = Date.now() + Qr;
|
|
3979
4001
|
try {
|
|
3980
|
-
for (; n() && !
|
|
4002
|
+
for (; n() && !K() && Date.now() < r;) {
|
|
3981
4003
|
ot = !0;
|
|
3982
4004
|
try {
|
|
3983
4005
|
await F.value.resumeStream();
|
|
@@ -3987,7 +4009,7 @@ function ui(e) {
|
|
|
3987
4009
|
if (!n()) return;
|
|
3988
4010
|
F.value.clearError();
|
|
3989
4011
|
let t = await D.value.getChat(o.value, e).catch(() => null);
|
|
3990
|
-
if (!t || !n() ||
|
|
4012
|
+
if (!t || !n() || K()) return;
|
|
3991
4013
|
if (!t.turnInProgress) {
|
|
3992
4014
|
F.value.messages = t.messages;
|
|
3993
4015
|
return;
|
|
@@ -3998,7 +4020,7 @@ function ui(e) {
|
|
|
3998
4020
|
j === t && (j = void 0, st.value = void 0);
|
|
3999
4021
|
}
|
|
4000
4022
|
}
|
|
4001
|
-
async function
|
|
4023
|
+
async function $t(e, t) {
|
|
4002
4024
|
let n;
|
|
4003
4025
|
try {
|
|
4004
4026
|
n = Number(sessionStorage.getItem(Oe)), sessionStorage.removeItem(Oe);
|
|
@@ -4031,93 +4053,93 @@ function ui(e) {
|
|
|
4031
4053
|
}
|
|
4032
4054
|
}
|
|
4033
4055
|
}
|
|
4034
|
-
let
|
|
4056
|
+
let K = () => {
|
|
4035
4057
|
let e = F.value.status;
|
|
4036
4058
|
return e === "submitted" || e === "streaming";
|
|
4037
|
-
},
|
|
4059
|
+
}, en = () => K() || j?.chatId === E.value || me.value > 0, q = () => {
|
|
4038
4060
|
let e = _t();
|
|
4039
4061
|
return O.value !== void 0 || qr(e) || ci(e);
|
|
4040
|
-
},
|
|
4041
|
-
async function
|
|
4062
|
+
}, tn = /* @__PURE__ */ new Set();
|
|
4063
|
+
async function nn() {
|
|
4042
4064
|
let e = E.value;
|
|
4043
|
-
if (!(
|
|
4044
|
-
if (
|
|
4065
|
+
if (!(tn.has(e) || It.value.length === 0 || en() || Je.value)) {
|
|
4066
|
+
if (q()) Bt(zt(e));
|
|
4045
4067
|
else {
|
|
4046
|
-
|
|
4068
|
+
tn.add(e);
|
|
4047
4069
|
try {
|
|
4048
4070
|
let t = Date.now() + ri;
|
|
4049
4071
|
for (; Date.now() < t && (await Promise.race([D.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), ai))])).includes(e);) await new Promise((e) => setTimeout(e, ii));
|
|
4050
|
-
if (e !== E.value ||
|
|
4051
|
-
let n =
|
|
4052
|
-
n &&
|
|
4072
|
+
if (e !== E.value || en()) return;
|
|
4073
|
+
let n = zt(e);
|
|
4074
|
+
n && pn(n);
|
|
4053
4075
|
} finally {
|
|
4054
|
-
|
|
4076
|
+
tn.delete(e);
|
|
4055
4077
|
}
|
|
4056
4078
|
}
|
|
4057
4079
|
}
|
|
4058
4080
|
}
|
|
4059
|
-
let
|
|
4060
|
-
async function
|
|
4061
|
-
if (T.value ||
|
|
4062
|
-
let e = E.value, t =
|
|
4081
|
+
let rn = 0, an = 0;
|
|
4082
|
+
async function on() {
|
|
4083
|
+
if (T.value || K()) return "indeterminate";
|
|
4084
|
+
let e = E.value, t = rn += 1;
|
|
4063
4085
|
try {
|
|
4064
4086
|
let n = await D.value.getChat(o.value, e);
|
|
4065
|
-
if (!n || e !== E.value ||
|
|
4066
|
-
|
|
4087
|
+
if (!n || e !== E.value || K() || t <= an) return "indeterminate";
|
|
4088
|
+
an = t;
|
|
4067
4089
|
let r = n.messages, i = Zr(r, F.value.messages);
|
|
4068
4090
|
return F.value.messages = [...r, ...i], Ye.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
4069
4091
|
} catch {}
|
|
4070
4092
|
return "indeterminate";
|
|
4071
4093
|
}
|
|
4072
|
-
function
|
|
4094
|
+
function sn(e) {
|
|
4073
4095
|
F.value.messages = [...F.value.messages, e];
|
|
4074
4096
|
}
|
|
4075
|
-
async function
|
|
4097
|
+
async function cn(e) {
|
|
4076
4098
|
try {
|
|
4077
|
-
|
|
4099
|
+
z.value = await D.value.getMessageFeedbacks(e);
|
|
4078
4100
|
} catch {
|
|
4079
|
-
|
|
4101
|
+
z.value = [];
|
|
4080
4102
|
}
|
|
4081
4103
|
}
|
|
4082
|
-
function
|
|
4083
|
-
let t =
|
|
4084
|
-
t >= 0 ?
|
|
4104
|
+
function ln(e) {
|
|
4105
|
+
let t = z.value.findIndex((t) => t.messageId === e.messageId);
|
|
4106
|
+
t >= 0 ? z.value[t] = e : z.value.push(e);
|
|
4085
4107
|
}
|
|
4086
|
-
function
|
|
4108
|
+
function un(e) {
|
|
4087
4109
|
let t = bt.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
4088
4110
|
return {
|
|
4089
4111
|
userQuestion: ue(i ?? e) ?? "",
|
|
4090
4112
|
assistantMessage: r
|
|
4091
4113
|
};
|
|
4092
4114
|
}
|
|
4093
|
-
async function
|
|
4115
|
+
async function dn(e, t) {
|
|
4094
4116
|
await Promise.all([
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4117
|
+
Xt(e, t),
|
|
4118
|
+
Ut(e),
|
|
4119
|
+
cn(t)
|
|
4098
4120
|
]), $e.value || De((e, t) => D.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
4099
4121
|
e && ($e.value = e);
|
|
4100
4122
|
});
|
|
4101
4123
|
}
|
|
4102
|
-
async function
|
|
4103
|
-
let e =
|
|
4124
|
+
async function fn() {
|
|
4125
|
+
let e = U.value.trim(), t = W.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
4104
4126
|
type: "file",
|
|
4105
4127
|
mediaType: e.mediaSource.mimeType,
|
|
4106
4128
|
url: e.localUrl,
|
|
4107
4129
|
filename: e.mediaSource.name,
|
|
4108
4130
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
4109
4131
|
}));
|
|
4110
|
-
!T.value &&
|
|
4132
|
+
!T.value && en() ? e && t.length === 0 && (Rt(E.value, [...It.value, e]), U.value = "") : (T.value && bt.value.length > 0 && await X(), pn(e, t), U.value = "", On());
|
|
4111
4133
|
}
|
|
4112
|
-
function
|
|
4113
|
-
A(),
|
|
4134
|
+
function pn(e, t = []) {
|
|
4135
|
+
A(), G.value = e, Pt.value = F.value.messages.length;
|
|
4114
4136
|
let n = F.value.sendMessage;
|
|
4115
4137
|
n({
|
|
4116
4138
|
text: e,
|
|
4117
4139
|
files: t.length > 0 ? t : void 0
|
|
4118
4140
|
});
|
|
4119
4141
|
}
|
|
4120
|
-
function
|
|
4142
|
+
function mn(e) {
|
|
4121
4143
|
let t = e.trim();
|
|
4122
4144
|
if (!t) return;
|
|
4123
4145
|
if (F.value.status !== "ready") {
|
|
@@ -4127,25 +4149,25 @@ function ui(e) {
|
|
|
4127
4149
|
let n = F.value.sendMessage;
|
|
4128
4150
|
A(), n({ text: t });
|
|
4129
4151
|
}
|
|
4130
|
-
async function
|
|
4131
|
-
let e = F.value.messages.slice(
|
|
4132
|
-
|
|
4152
|
+
async function hn() {
|
|
4153
|
+
let e = F.value.messages.slice(Pt.value).some((e) => e.parts.some(ie)), t = G.value, n = t.length > 0 && !e, r = E.value, i = Pt.value, a = j?.chatId === r, s = ct, c = zt(r), l = (e = "") => {
|
|
4154
|
+
U.value = [
|
|
4133
4155
|
e,
|
|
4134
4156
|
c,
|
|
4135
|
-
|
|
4157
|
+
U.value
|
|
4136
4158
|
].filter(Boolean).join(oi);
|
|
4137
|
-
}, u = () => r === E.value && !
|
|
4159
|
+
}, u = () => r === E.value && !K() && Pt.value === i ? !1 : (c && Rt(r, [c, ...Ft.value[r] ?? []]), !0);
|
|
4138
4160
|
j = void 0, st.value = void 0, A(), await F.value.stop();
|
|
4139
4161
|
let d = T.value || e && !a || await D.value.stopChatTurn(o.value, r, s).catch(() => !0);
|
|
4140
4162
|
if (!u()) {
|
|
4141
4163
|
if (a || !d) {
|
|
4142
|
-
if (await
|
|
4143
|
-
if (a || F.value.messages.length >
|
|
4144
|
-
|
|
4164
|
+
if (await on(), u()) return;
|
|
4165
|
+
if (a || F.value.messages.length > Pt.value) {
|
|
4166
|
+
G.value = "", l();
|
|
4145
4167
|
return;
|
|
4146
4168
|
}
|
|
4147
4169
|
}
|
|
4148
|
-
n ? (l(t), F.value.messages = F.value.messages.slice(0,
|
|
4170
|
+
n ? (l(t), F.value.messages = F.value.messages.slice(0, Pt.value), G.value = "") : l();
|
|
4149
4171
|
}
|
|
4150
4172
|
}
|
|
4151
4173
|
C(() => F.value.messages, (e) => {
|
|
@@ -4154,88 +4176,88 @@ function ui(e) {
|
|
|
4154
4176
|
}), C(() => F.value.status, (e) => {
|
|
4155
4177
|
e === "submitted" && (w.value++, ct = void 0);
|
|
4156
4178
|
});
|
|
4157
|
-
let
|
|
4179
|
+
let gn;
|
|
4158
4180
|
C(() => [F.value.status, me.value], ([e, t]) => {
|
|
4159
|
-
clearTimeout(
|
|
4181
|
+
clearTimeout(gn), e === "ready" && t === 0 && (gn = setTimeout(() => {
|
|
4160
4182
|
Pe.value = !1;
|
|
4161
4183
|
}, 1500));
|
|
4162
4184
|
});
|
|
4163
|
-
let
|
|
4164
|
-
C(() => !O.value && !qr(_t()) && (
|
|
4165
|
-
clearTimeout(
|
|
4166
|
-
|
|
4185
|
+
let _n = S(!1), vn;
|
|
4186
|
+
C(() => !O.value && !qr(_t()) && (K() || me.value > 0), (e) => {
|
|
4187
|
+
clearTimeout(vn), e ? _n.value = !0 : vn = setTimeout(() => {
|
|
4188
|
+
_n.value = !1;
|
|
4167
4189
|
}, 400);
|
|
4168
4190
|
}, { immediate: !0 });
|
|
4169
|
-
let
|
|
4191
|
+
let yn = x(() => {
|
|
4170
4192
|
let e = lt.value.filter((e) => e !== E.value);
|
|
4171
|
-
return
|
|
4172
|
-
}),
|
|
4173
|
-
function
|
|
4174
|
-
clearTimeout(
|
|
4175
|
-
|
|
4193
|
+
return _n.value || st.value === E.value ? [...e, E.value] : e;
|
|
4194
|
+
}), bn = () => [.../* @__PURE__ */ new Set([...lt.value, ...M.value])], xn = Ce(), J, Sn = 0, Cn = 0;
|
|
4195
|
+
function wn() {
|
|
4196
|
+
clearTimeout(J), J = void 0, bn().length !== 0 && xn.value === "visible" && (J = setTimeout(() => {
|
|
4197
|
+
J = void 0, Tn(bn());
|
|
4176
4198
|
}, ei));
|
|
4177
4199
|
}
|
|
4178
|
-
async function
|
|
4200
|
+
async function Tn(e) {
|
|
4179
4201
|
let t = e.slice(0, ti);
|
|
4180
4202
|
if (T.value || t.length === 0) {
|
|
4181
|
-
|
|
4203
|
+
wn();
|
|
4182
4204
|
return;
|
|
4183
4205
|
}
|
|
4184
|
-
let n =
|
|
4206
|
+
let n = Sn += 1, r;
|
|
4185
4207
|
try {
|
|
4186
4208
|
r = await D.value.getRunningTurns(o.value, t);
|
|
4187
4209
|
} catch {
|
|
4188
|
-
|
|
4210
|
+
wn();
|
|
4189
4211
|
return;
|
|
4190
4212
|
}
|
|
4191
|
-
if (n <=
|
|
4192
|
-
|
|
4213
|
+
if (n <= Cn) return;
|
|
4214
|
+
Cn = n;
|
|
4193
4215
|
for (let e of r) ft.add(e);
|
|
4194
|
-
let i = new Set(t), a =
|
|
4216
|
+
let i = new Set(t), a = bn().filter((e) => i.has(e) && !r.includes(e)), s = (e) => M.value.includes(e) && !ft.has(e), c = a.filter((e) => s(e) && Date.now() - (dt.get(e) ?? 0) > ni), l = a.filter((e) => !s(e));
|
|
4195
4217
|
lt.value = [...lt.value.filter((e) => !i.has(e)), ...r];
|
|
4196
4218
|
let u = l.filter((e) => M.value.includes(e));
|
|
4197
|
-
(u.length > 0 || c.length > 0) && (M.value = M.value.filter((e) => !u.includes(e) && !c.includes(e)), N.value = [...N.value, ...u.filter((e) => e !== E.value && !N.value.includes(e))]), l.length > 0 &&
|
|
4219
|
+
(u.length > 0 || c.length > 0) && (M.value = M.value.filter((e) => !u.includes(e) && !c.includes(e)), N.value = [...N.value, ...u.filter((e) => e !== E.value && !N.value.includes(e))]), l.length > 0 && Ut(o.value), wn();
|
|
4198
4220
|
}
|
|
4199
|
-
C(
|
|
4200
|
-
e === "visible" ?
|
|
4201
|
-
}), ge(() => clearTimeout(
|
|
4202
|
-
let
|
|
4221
|
+
C(xn, (e) => {
|
|
4222
|
+
e === "visible" ? Tn(bn()) : (clearTimeout(J), J = void 0);
|
|
4223
|
+
}), ge(() => clearTimeout(J));
|
|
4224
|
+
let En = x(() => N.value.map((e) => ({
|
|
4203
4225
|
chatId: e,
|
|
4204
4226
|
title: L.value.find((t) => t.id === e)?.title || P.value[e] || void 0
|
|
4205
4227
|
})));
|
|
4206
|
-
function
|
|
4207
|
-
ht(e), E.value = e,
|
|
4228
|
+
function Dn(e) {
|
|
4229
|
+
ht(e), E.value = e, qn("chat");
|
|
4208
4230
|
}
|
|
4209
|
-
function
|
|
4231
|
+
function Y(e) {
|
|
4210
4232
|
N.value = N.value.filter((t) => t !== e), mt(e);
|
|
4211
4233
|
}
|
|
4212
4234
|
C(() => [F.value.status, F.value.id], ([e, t], [n, r]) => {
|
|
4213
4235
|
if (t === r) {
|
|
4214
|
-
if (e === "error") j?.chatId !== E.value &&
|
|
4236
|
+
if (e === "error") j?.chatId !== E.value && Bt(zt(E.value));
|
|
4215
4237
|
else if (e === "ready" && (n === "streaming" || n === "submitted")) {
|
|
4216
|
-
if (
|
|
4217
|
-
|
|
4238
|
+
if (q()) {
|
|
4239
|
+
Bt(zt(E.value));
|
|
4218
4240
|
return;
|
|
4219
4241
|
}
|
|
4220
|
-
|
|
4242
|
+
nn();
|
|
4221
4243
|
}
|
|
4222
4244
|
}
|
|
4223
4245
|
}), C(me, (e) => {
|
|
4224
|
-
e === 0 && F.value.status === "ready" &&
|
|
4246
|
+
e === 0 && F.value.status === "ready" && nn();
|
|
4225
4247
|
}), C(() => F.value.status, (e) => {
|
|
4226
|
-
e === "ready" &&
|
|
4248
|
+
e === "ready" && G.value.length > 0 && (G.value = "");
|
|
4227
4249
|
});
|
|
4228
|
-
function
|
|
4229
|
-
for (let t of
|
|
4230
|
-
|
|
4250
|
+
function On(e = !1) {
|
|
4251
|
+
for (let t of W.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
4252
|
+
W.value = [], In.value = null;
|
|
4231
4253
|
}
|
|
4232
|
-
async function
|
|
4233
|
-
return
|
|
4254
|
+
async function X() {
|
|
4255
|
+
return G.value = "", Ne.value = {}, E.value = ut(), await he(), F.value.clearError(), Je.value = void 0, Ye.value = !1, On(!0), qn("chat"), E.value;
|
|
4234
4256
|
}
|
|
4235
|
-
async function
|
|
4236
|
-
F.value.status !== "ready" && (
|
|
4257
|
+
async function kn(e) {
|
|
4258
|
+
F.value.status !== "ready" && (G.value = "", await hn()), A(), await F.value.regenerate(e);
|
|
4237
4259
|
}
|
|
4238
|
-
function
|
|
4260
|
+
function Z(e) {
|
|
4239
4261
|
if (e.tool === "requestGeolocation") {
|
|
4240
4262
|
let t = e.output;
|
|
4241
4263
|
"latitude" in t && ($e.value = {
|
|
@@ -4247,23 +4269,23 @@ function ui(e) {
|
|
|
4247
4269
|
}
|
|
4248
4270
|
F.value.addToolOutput(e);
|
|
4249
4271
|
}
|
|
4250
|
-
function
|
|
4272
|
+
function An(e) {
|
|
4251
4273
|
F.value.addToolApprovalResponse(e);
|
|
4252
4274
|
}
|
|
4253
|
-
let
|
|
4254
|
-
|
|
4275
|
+
let jn = x(() => F.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Mn = x(() => _.value?.maxFilesPerMessage ?? 5), Nn = x(() => _.value?.maxFilesPerChat ?? 20), Pn = x(() => Math.max(0, Math.min(Mn.value - W.value.length, Nn.value - jn.value - W.value.length))), Fn = x(() => Pn.value <= 0), In = S(null), Ln = () => {
|
|
4276
|
+
In.value = null;
|
|
4255
4277
|
};
|
|
4256
|
-
C(
|
|
4257
|
-
e || (
|
|
4278
|
+
C(Fn, (e) => {
|
|
4279
|
+
e || (In.value = null);
|
|
4258
4280
|
});
|
|
4259
|
-
async function
|
|
4260
|
-
if (
|
|
4261
|
-
|
|
4281
|
+
async function Rn(e) {
|
|
4282
|
+
if (Fn.value) {
|
|
4283
|
+
In.value = Nn.value - jn.value - W.value.length <= Mn.value - W.value.length ? {
|
|
4262
4284
|
reason: "per-chat",
|
|
4263
|
-
max:
|
|
4285
|
+
max: Nn.value
|
|
4264
4286
|
} : {
|
|
4265
4287
|
reason: "per-message",
|
|
4266
|
-
max:
|
|
4288
|
+
max: Mn.value
|
|
4267
4289
|
};
|
|
4268
4290
|
return;
|
|
4269
4291
|
}
|
|
@@ -4273,26 +4295,26 @@ function ui(e) {
|
|
|
4273
4295
|
localUrl: URL.createObjectURL(e),
|
|
4274
4296
|
state: "uploading"
|
|
4275
4297
|
};
|
|
4276
|
-
|
|
4298
|
+
W.value = [...W.value, n];
|
|
4277
4299
|
try {
|
|
4278
4300
|
let n = await D.value.uploadMedia(o.value, E.value, e);
|
|
4279
|
-
|
|
4301
|
+
W.value = W.value.map((e) => e.id === t ? {
|
|
4280
4302
|
...e,
|
|
4281
4303
|
state: "done",
|
|
4282
4304
|
mediaSource: n
|
|
4283
4305
|
} : e);
|
|
4284
4306
|
} catch (e) {
|
|
4285
4307
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
4286
|
-
|
|
4308
|
+
W.value = W.value.map((e) => e.id === t ? {
|
|
4287
4309
|
...e,
|
|
4288
4310
|
state: "error",
|
|
4289
4311
|
error: n
|
|
4290
4312
|
} : e);
|
|
4291
4313
|
}
|
|
4292
4314
|
}
|
|
4293
|
-
async function
|
|
4294
|
-
let { userQuestion: n, assistantMessage: r } =
|
|
4295
|
-
|
|
4315
|
+
async function zn(e, t) {
|
|
4316
|
+
let { userQuestion: n, assistantMessage: r } = un(e);
|
|
4317
|
+
ln(await D.value.submitMessageFeedback({
|
|
4296
4318
|
messageId: e.id,
|
|
4297
4319
|
chatId: E.value,
|
|
4298
4320
|
agentId: o.value,
|
|
@@ -4301,70 +4323,73 @@ function ui(e) {
|
|
|
4301
4323
|
assistantMessage: r
|
|
4302
4324
|
}));
|
|
4303
4325
|
}
|
|
4304
|
-
async function
|
|
4305
|
-
await
|
|
4326
|
+
async function Bn(e) {
|
|
4327
|
+
await zn(e, "upvote");
|
|
4306
4328
|
}
|
|
4307
|
-
async function
|
|
4308
|
-
await
|
|
4329
|
+
async function Vn(e) {
|
|
4330
|
+
await zn(e, "downvote");
|
|
4309
4331
|
}
|
|
4310
|
-
function
|
|
4311
|
-
|
|
4332
|
+
function Hn(e) {
|
|
4333
|
+
At.value = !1, jt.value = void 0, B.value = e;
|
|
4312
4334
|
}
|
|
4313
|
-
async function
|
|
4314
|
-
if (
|
|
4315
|
-
|
|
4316
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
4317
|
-
|
|
4318
|
-
messageId:
|
|
4335
|
+
async function Un(e) {
|
|
4336
|
+
if (B.value) try {
|
|
4337
|
+
V.value = !0, At.value = !1, jt.value = void 0;
|
|
4338
|
+
let { userQuestion: t, assistantMessage: n } = un(B.value);
|
|
4339
|
+
ln(await D.value.submitMessageFeedback({
|
|
4340
|
+
messageId: B.value.id,
|
|
4319
4341
|
chatId: E.value,
|
|
4320
4342
|
agentId: o.value,
|
|
4321
4343
|
userQuestion: t,
|
|
4322
4344
|
assistantMessage: n,
|
|
4323
4345
|
comment: e
|
|
4324
|
-
})),
|
|
4346
|
+
})), At.value = !0, await cn(E.value);
|
|
4325
4347
|
} catch {
|
|
4326
|
-
|
|
4348
|
+
jt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4327
4349
|
} finally {
|
|
4328
|
-
|
|
4350
|
+
V.value = !1;
|
|
4329
4351
|
}
|
|
4330
4352
|
}
|
|
4331
|
-
async function
|
|
4353
|
+
async function Wn(e) {
|
|
4332
4354
|
try {
|
|
4333
|
-
|
|
4355
|
+
Nt.value = !0, Mt.value = !1, H.value = void 0, await D.value.submitLead({
|
|
4334
4356
|
agentId: o.value,
|
|
4335
4357
|
chatId: E.value,
|
|
4336
4358
|
...e
|
|
4337
|
-
}),
|
|
4359
|
+
}), Mt.value = !0;
|
|
4338
4360
|
} catch {
|
|
4339
|
-
|
|
4361
|
+
H.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4340
4362
|
} finally {
|
|
4341
|
-
|
|
4363
|
+
Nt.value = !1;
|
|
4342
4364
|
}
|
|
4343
4365
|
}
|
|
4344
|
-
async function
|
|
4366
|
+
async function Gn(e, t) {
|
|
4345
4367
|
let n = await D.value.updateChatTitle(o.value, e, t);
|
|
4346
4368
|
L.value = L.value.map((t) => t.id === e ? {
|
|
4347
4369
|
...t,
|
|
4348
4370
|
title: n.title
|
|
4349
4371
|
} : t);
|
|
4350
4372
|
}
|
|
4351
|
-
async function
|
|
4352
|
-
await D.value.deleteChat(o.value, e), L.value = L.value.filter((t) => t.id !== e), E.value === e && await
|
|
4373
|
+
async function Kn(e) {
|
|
4374
|
+
await D.value.deleteChat(o.value, e), L.value = L.value.filter((t) => t.id !== e), E.value === e && await X();
|
|
4353
4375
|
}
|
|
4354
|
-
function
|
|
4355
|
-
|
|
4376
|
+
function qn(e) {
|
|
4377
|
+
Ot.value = e;
|
|
4356
4378
|
}
|
|
4357
|
-
|
|
4358
|
-
|
|
4379
|
+
function Jn() {
|
|
4380
|
+
qn("chat"), kt.value++;
|
|
4381
|
+
}
|
|
4382
|
+
let Yn;
|
|
4383
|
+
function Xn(e) {
|
|
4359
4384
|
let t = () => D.value.getChat(o.value, e).then((e) => e !== null);
|
|
4360
4385
|
return t().catch(() => t().catch(() => !1));
|
|
4361
4386
|
}
|
|
4362
4387
|
return C(l, async (e) => {
|
|
4363
|
-
if (!e || e ===
|
|
4364
|
-
let t =
|
|
4365
|
-
if (
|
|
4366
|
-
let n = E.value, r = !T.value && await
|
|
4367
|
-
l.value === e && E.value === n && (r ?
|
|
4388
|
+
if (!e || e === Yn) return;
|
|
4389
|
+
let t = Yn;
|
|
4390
|
+
if (Yn = e, t === void 0) return;
|
|
4391
|
+
let n = E.value, r = !T.value && await Xn(n);
|
|
4392
|
+
l.value === e && E.value === n && (r ? Ut(o.value) : (L.value = [], z.value = [], R.value = [], lt.value = [], M.value = [], N.value = [], P.value = {}, await X(), U.value = ""));
|
|
4368
4393
|
}), {
|
|
4369
4394
|
apiClient: D,
|
|
4370
4395
|
baseUrl: i,
|
|
@@ -4395,7 +4420,7 @@ function ui(e) {
|
|
|
4395
4420
|
pageAction: ke,
|
|
4396
4421
|
hostStepTitles: Ne,
|
|
4397
4422
|
pageControlActive: Pe,
|
|
4398
|
-
isWorking:
|
|
4423
|
+
isWorking: _n,
|
|
4399
4424
|
stopHostActions: k,
|
|
4400
4425
|
pageNoticeLevel: Ke,
|
|
4401
4426
|
closePageNotice: qe,
|
|
@@ -4411,63 +4436,69 @@ function ui(e) {
|
|
|
4411
4436
|
messages: bt,
|
|
4412
4437
|
conversations: L,
|
|
4413
4438
|
isLoadingConversations: St,
|
|
4439
|
+
hasMoreConversations: wt,
|
|
4440
|
+
isLoadingMoreConversations: Tt,
|
|
4414
4441
|
chatFiles: R,
|
|
4415
|
-
isLoadingChatFiles:
|
|
4416
|
-
input:
|
|
4417
|
-
pendingAttachments:
|
|
4418
|
-
isAttachmentLimitReached:
|
|
4419
|
-
fileLimitError:
|
|
4442
|
+
isLoadingChatFiles: Dt,
|
|
4443
|
+
input: U,
|
|
4444
|
+
pendingAttachments: W,
|
|
4445
|
+
isAttachmentLimitReached: Fn,
|
|
4446
|
+
fileLimitError: In,
|
|
4420
4447
|
localChatId: E,
|
|
4421
4448
|
isConversationBlocked: Ye,
|
|
4422
4449
|
inputMessagePlaceholder: xt,
|
|
4423
4450
|
chatError: Je,
|
|
4424
|
-
runningChatIds:
|
|
4425
|
-
backgroundAnswers:
|
|
4426
|
-
openBackgroundAnswer:
|
|
4427
|
-
dismissBackgroundAnswer:
|
|
4428
|
-
canQueue:
|
|
4429
|
-
queuedMessages:
|
|
4430
|
-
removeQueuedMessage:
|
|
4431
|
-
editQueuedMessage:
|
|
4432
|
-
activeView:
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4451
|
+
runningChatIds: yn,
|
|
4452
|
+
backgroundAnswers: En,
|
|
4453
|
+
openBackgroundAnswer: Dn,
|
|
4454
|
+
dismissBackgroundAnswer: Y,
|
|
4455
|
+
canQueue: Lt,
|
|
4456
|
+
queuedMessages: It,
|
|
4457
|
+
removeQueuedMessage: Vt,
|
|
4458
|
+
editQueuedMessage: Ht,
|
|
4459
|
+
activeView: Ot,
|
|
4460
|
+
inputFocusRequest: kt,
|
|
4461
|
+
messageFeedbacks: z,
|
|
4462
|
+
feedbackDialogMessage: B,
|
|
4463
|
+
isFeedbackSubmitting: V,
|
|
4464
|
+
isFeedbackSubmitted: At,
|
|
4465
|
+
feedbackSubmitError: jt,
|
|
4466
|
+
isLeadSubmitted: Mt,
|
|
4467
|
+
isLoadingSubmitLead: Nt,
|
|
4468
|
+
submitLeadError: H,
|
|
4441
4469
|
buildDeviceContext: et,
|
|
4442
|
-
initialize:
|
|
4443
|
-
loadConversations:
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4470
|
+
initialize: dn,
|
|
4471
|
+
loadConversations: Ut,
|
|
4472
|
+
loadMoreConversations: Wt,
|
|
4473
|
+
searchConversations: Gt,
|
|
4474
|
+
loadChatFiles: Kt,
|
|
4475
|
+
refreshMessages: on,
|
|
4476
|
+
appendMessage: sn,
|
|
4477
|
+
getChatFileUrl: qt,
|
|
4478
|
+
getChatFilePreviewUrl: Jt,
|
|
4479
|
+
deleteChatFile: Yt,
|
|
4480
|
+
handleSubmit: fn,
|
|
4481
|
+
sendMessage: mn,
|
|
4482
|
+
stopGeneration: hn,
|
|
4483
|
+
startNewChat: X,
|
|
4484
|
+
regenerate: kn,
|
|
4485
|
+
addToolOutput: Z,
|
|
4486
|
+
addToolApprovalResponse: An,
|
|
4487
|
+
handleFileSelect: Rn,
|
|
4488
|
+
clearFileLimitError: Ln,
|
|
4489
|
+
clearPendingAttachments: On,
|
|
4490
|
+
onUpvote: Bn,
|
|
4491
|
+
onDownvote: Vn,
|
|
4492
|
+
onFeedback: Hn,
|
|
4493
|
+
onFeedbackSubmit: Un,
|
|
4494
|
+
onLeadSubmit: Wn,
|
|
4495
|
+
navigate: qn,
|
|
4496
|
+
focusInput: Jn,
|
|
4497
|
+
renameChatTitle: Gn,
|
|
4498
|
+
deleteChat: Kn
|
|
4468
4499
|
};
|
|
4469
4500
|
})();
|
|
4470
4501
|
}
|
|
4471
4502
|
export { ut as a, hr as i, ui as n, Gr as r, Kr as t };
|
|
4472
4503
|
|
|
4473
|
-
//# sourceMappingURL=useChatbotStore-
|
|
4504
|
+
//# sourceMappingURL=useChatbotStore-pnj_3y4N.js.map
|