@8wave/ai-elements 0.102.0-beta.1 → 0.103.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Agent-Cq-9OZHI.js → Agent-hWgZhu7L.js} +99 -100
- package/dist/_chunks/{Agent-Cq-9OZHI.js.map → Agent-hWgZhu7L.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-hAaQJW-t.js → PkToolRequestGeolocation-T16QI-Uv.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-hAaQJW-t.js.map → PkToolRequestGeolocation-T16QI-Uv.js.map} +1 -1
- package/dist/_chunks/PkToolRequestOAuthConnection-C8e5np2q.js +116 -0
- package/dist/_chunks/PkToolRequestOAuthConnection-C8e5np2q.js.map +1 -0
- package/dist/_chunks/{PkToolShowForm-CdUUAjPc.js → PkToolShowForm-ztQFyFd9.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-CdUUAjPc.js.map → PkToolShowForm-ztQFyFd9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-BvHgjMQ4.js → PkToolShowSuggestedReply-Dqe4gtEY.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-BvHgjMQ4.js.map → PkToolShowSuggestedReply-Dqe4gtEY.js.map} +1 -1
- package/dist/ai-elements.es.js +5987 -5995
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotMessages.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-Cy-XE9N1.js → Agent-CGp48ayw.js} +62 -63
- package/dist-vue/_chunks/{Agent-Cy-XE9N1.js.map → Agent-CGp48ayw.js.map} +1 -1
- package/dist-vue/_chunks/{Document-B6xVkCfQ.js → Document-CjfNDh6w.js} +15 -15
- package/dist-vue/_chunks/{Document-B6xVkCfQ.js.map → Document-CjfNDh6w.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-CHe6t-LR.js → PkChatbot-C4SPneVX.js} +6 -6
- package/dist-vue/_chunks/{PkChatbot-CHe6t-LR.js.map → PkChatbot-C4SPneVX.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotMessages-BgsyN-mB.js +771 -0
- package/dist-vue/_chunks/PkChatbotMessages-BgsyN-mB.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-DeeGCFJf.js → PkChatbotViewChat-BMr1DpNY.js} +912 -898
- package/dist-vue/_chunks/PkChatbotViewChat-BMr1DpNY.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-DXwqumyn.js → PkChatbotViewConversations-p72SEhU-.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-DXwqumyn.js.map → PkChatbotViewConversations-p72SEhU-.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-B4u87oH6.js → PkChatbotViewFiles-C2PUVFV2.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-B4u87oH6.js.map → PkChatbotViewFiles-C2PUVFV2.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-C_A0AP8x.js → PkChatbotViewProfile-BqWLlla-.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-C_A0AP8x.js.map → PkChatbotViewProfile-BqWLlla-.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-CaHo_418.js → PkToolRequestGeolocation-CsQghLEb.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-CaHo_418.js.map → PkToolRequestGeolocation-CsQghLEb.js.map} +1 -1
- package/dist-vue/_chunks/PkToolRequestOAuthConnection-D5Jq6UZh.js +116 -0
- package/dist-vue/_chunks/PkToolRequestOAuthConnection-D5Jq6UZh.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowDiagram-CuQyY0uv.js → PkToolShowDiagram-DoklcF3f.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-CuQyY0uv.js.map → PkToolShowDiagram-DoklcF3f.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-vXgu3bZO.js → PkToolShowForm-CpY1KKUt.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowForm-vXgu3bZO.js.map → PkToolShowForm-CpY1KKUt.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-Die_j1bn.js → PkToolShowSources-CLsbqcDd.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-Die_j1bn.js.map → PkToolShowSources-CLsbqcDd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-CryAdy6t.js → PkToolShowSuggestedReply-B-QwwART.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-CryAdy6t.js.map → PkToolShowSuggestedReply-B-QwwART.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-CoTSUkuj.js → createChatbotApiClient-nOLu9GAQ.js} +32 -28
- package/dist-vue/_chunks/{createChatbotApiClient-CoTSUkuj.js.map → createChatbotApiClient-nOLu9GAQ.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-BcLvyaIV.js → useChatbotStore-DhWHlZwO.js} +756 -783
- package/dist-vue/_chunks/{useChatbotStore-BcLvyaIV.js.map → useChatbotStore-DhWHlZwO.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +2 -2
- package/dist-vue/index.js +304 -304
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +6 -2
- package/dist-vue/packages/components/src/chat/PkToolRequestOAuthConnection.d.ts +4 -0
- package/dist-vue/packages/components/src/chat/useVoiceSession.d.ts +0 -7
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +4 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +6 -14
- package/dist-vue/packages/models/src/schema/Agent.d.ts +12 -5
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +2 -2
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +2 -2
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkToolRequestOAuthConnection-Bf_zoT2r.js +0 -73
- package/dist/_chunks/PkToolRequestOAuthConnection-Bf_zoT2r.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-CWPSx2ce.js +0 -770
- package/dist-vue/_chunks/PkChatbotMessages-CWPSx2ce.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-DeeGCFJf.js.map +0 -1
- package/dist-vue/_chunks/PkToolRequestOAuthConnection-URjYDFhm.js +0 -73
- package/dist-vue/_chunks/PkToolRequestOAuthConnection-URjYDFhm.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { C as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, v as g, w as _, y as ee } from "./schemas-COkEQ0wM.js";
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as
|
|
7
|
-
import { computed as v, getCurrentScope as
|
|
2
|
+
import { E as te } from "./Agent-CGp48ayw.js";
|
|
3
|
+
import { r as ne, t as re } from "./createChatbotApiClient-nOLu9GAQ.js";
|
|
4
|
+
import { t as ie } from "./src-BbpxM17m.js";
|
|
5
|
+
import { n as ae } from "./message-RohfrdWS.js";
|
|
6
|
+
import { t as oe } from "./useSafeLocalStorage-D5Aa7nQY.js";
|
|
7
|
+
import { computed as v, getCurrentScope as se, isReadonly as ce, onScopeDispose as le, reactive as ue, ref as y, toRefs as de, watch as fe, watchEffect as pe } from "vue";
|
|
8
8
|
import { useI18n as me } from "vue-i18n";
|
|
9
9
|
import { usePreferredDark as he } from "@vueuse/core";
|
|
10
|
-
import { defineStore as
|
|
10
|
+
import { defineStore as b } from "pinia";
|
|
11
11
|
//#region ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function ge() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function _e() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function _e(e) {
|
|
43
43
|
if (!navigator.geolocation || !navigator.permissions) return null;
|
|
44
44
|
try {
|
|
45
45
|
if ((await navigator.permissions.query({ name: "geolocation" })).state !== "granted") return null;
|
|
@@ -58,12 +58,12 @@ async function ve(e) {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.7/node_modules/@ai-sdk/provider/dist/index.js
|
|
61
|
-
var
|
|
61
|
+
var ve = "vercel.ai.error", ye = Symbol.for(ve), x, S, C = class e extends (S = Error, x = ye, S) {
|
|
62
62
|
constructor({ name: e, message: t, cause: n }) {
|
|
63
|
-
super(t), this[
|
|
63
|
+
super(t), this[x] = !0, this.name = e, this.cause = n;
|
|
64
64
|
}
|
|
65
65
|
static isInstance(t) {
|
|
66
|
-
return e.hasMarker(t,
|
|
66
|
+
return e.hasMarker(t, ve);
|
|
67
67
|
}
|
|
68
68
|
static hasMarker(e, t) {
|
|
69
69
|
let n = Symbol.for(t);
|
|
@@ -73,7 +73,7 @@ var ye = "vercel.ai.error", x = Symbol.for(ye), S, C, w = class e extends (C = E
|
|
|
73
73
|
function be(e) {
|
|
74
74
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
75
75
|
}
|
|
76
|
-
var xe = "AI_InvalidArgumentError",
|
|
76
|
+
var xe = "AI_InvalidArgumentError", Se = `vercel.ai.error.${xe}`, w = Symbol.for(Se), Ce, we, T = class extends (we = C, Ce = w, we) {
|
|
77
77
|
constructor({ message: e, cause: t, argument: n }) {
|
|
78
78
|
super({
|
|
79
79
|
name: xe,
|
|
@@ -82,9 +82,9 @@ var xe = "AI_InvalidArgumentError", T = `vercel.ai.error.${xe}`, Se = Symbol.for
|
|
|
82
82
|
}), this[Ce] = !0, this.argument = n;
|
|
83
83
|
}
|
|
84
84
|
static isInstance(e) {
|
|
85
|
-
return
|
|
85
|
+
return C.hasMarker(e, Se);
|
|
86
86
|
}
|
|
87
|
-
}, Te = "AI_JSONParseError", Ee = `vercel.ai.error.${Te}`, De = Symbol.for(Ee), Oe,
|
|
87
|
+
}, Te = "AI_JSONParseError", Ee = `vercel.ai.error.${Te}`, De = Symbol.for(Ee), Oe, ke, E = class extends (ke = C, Oe = De, ke) {
|
|
88
88
|
constructor({ text: e, cause: t }) {
|
|
89
89
|
super({
|
|
90
90
|
name: Te,
|
|
@@ -94,9 +94,9 @@ Error message: ${be(t)}`,
|
|
|
94
94
|
}), this[Oe] = !0, this.text = e;
|
|
95
95
|
}
|
|
96
96
|
static isInstance(e) {
|
|
97
|
-
return
|
|
97
|
+
return C.hasMarker(e, Ee);
|
|
98
98
|
}
|
|
99
|
-
},
|
|
99
|
+
}, Ae = "AI_TypeValidationError", D = `vercel.ai.error.${Ae}`, je = Symbol.for(D), Me, O, k = class e extends (O = C, Me = je, O) {
|
|
100
100
|
constructor({ value: e, cause: t, context: n }) {
|
|
101
101
|
let r = "Type validation failed";
|
|
102
102
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -105,14 +105,14 @@ Error message: ${be(t)}`,
|
|
|
105
105
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
106
106
|
}
|
|
107
107
|
super({
|
|
108
|
-
name:
|
|
108
|
+
name: Ae,
|
|
109
109
|
message: `${r}: Value: ${JSON.stringify(e)}.
|
|
110
110
|
Error message: ${be(t)}`,
|
|
111
111
|
cause: t
|
|
112
|
-
}), this[
|
|
112
|
+
}), this[Me] = !0, this.value = e, this.context = n;
|
|
113
113
|
}
|
|
114
114
|
static isInstance(e) {
|
|
115
|
-
return
|
|
115
|
+
return C.hasMarker(e, D);
|
|
116
116
|
}
|
|
117
117
|
static wrap({ value: t, cause: n, context: r }) {
|
|
118
118
|
return e.isInstance(n) && n.value === t && n.context?.field === r?.field && n.context?.entityName === r?.entityName && n.context?.entityId === r?.entityId ? n : new e({
|
|
@@ -121,15 +121,15 @@ Error message: ${be(t)}`,
|
|
|
121
121
|
context: r
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
},
|
|
124
|
+
}, Ne = class extends Error {
|
|
125
125
|
constructor(e, t) {
|
|
126
126
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
127
127
|
}
|
|
128
|
-
},
|
|
129
|
-
function
|
|
130
|
-
function
|
|
128
|
+
}, Pe = 10, Fe = 13, A = 32;
|
|
129
|
+
function j(e) {}
|
|
130
|
+
function Ie(e) {
|
|
131
131
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
132
|
-
let { onEvent: t =
|
|
132
|
+
let { onEvent: t = j, onError: n = j, onRetry: r = j, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
133
133
|
function m(e) {
|
|
134
134
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
135
135
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -148,7 +148,7 @@ function Fe(e) {
|
|
|
148
148
|
n !== "" && (o.push(n), s = n.length), h();
|
|
149
149
|
}
|
|
150
150
|
function h() {
|
|
151
|
-
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new
|
|
151
|
+
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new Ne(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
152
152
|
}
|
|
153
153
|
function g(e) {
|
|
154
154
|
let n = 0;
|
|
@@ -164,9 +164,9 @@ function Fe(e) {
|
|
|
164
164
|
continue;
|
|
165
165
|
}
|
|
166
166
|
let i = e.charCodeAt(n);
|
|
167
|
-
if (
|
|
168
|
-
let i = e.charCodeAt(n + 5) ===
|
|
169
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
167
|
+
if (M(e, n, i)) {
|
|
168
|
+
let i = e.charCodeAt(n + 5) === A ? n + 6 : n + 5, a = e.slice(i, r);
|
|
169
|
+
if (d === 0 && e.charCodeAt(r + 1) === Pe) {
|
|
170
170
|
t({
|
|
171
171
|
id: l,
|
|
172
172
|
event: f,
|
|
@@ -176,7 +176,7 @@ function Fe(e) {
|
|
|
176
176
|
}
|
|
177
177
|
u = d === 0 ? a : `${u}
|
|
178
178
|
${a}`, d++;
|
|
179
|
-
} else
|
|
179
|
+
} else N(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === A ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
180
180
|
n = r + 1, r = e.indexOf("\n", n);
|
|
181
181
|
}
|
|
182
182
|
return e.slice(n);
|
|
@@ -184,7 +184,7 @@ ${a}`, d++;
|
|
|
184
184
|
for (; n < e.length;) {
|
|
185
185
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
186
186
|
if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
|
|
187
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
187
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Fe && e.charCodeAt(n) === Pe && n++;
|
|
188
188
|
}
|
|
189
189
|
return e.slice(n);
|
|
190
190
|
}
|
|
@@ -194,25 +194,25 @@ ${a}`, d++;
|
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
let r = e.charCodeAt(t);
|
|
197
|
-
if (
|
|
198
|
-
let r = e.charCodeAt(t + 5) ===
|
|
197
|
+
if (M(e, t, r)) {
|
|
198
|
+
let r = e.charCodeAt(t + 5) === A ? t + 6 : t + 5, i = e.slice(r, n);
|
|
199
199
|
u = d === 0 ? i : `${u}
|
|
200
200
|
${i}`, d++;
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
|
-
if (
|
|
204
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
203
|
+
if (N(e, t, r)) {
|
|
204
|
+
f = e.slice(e.charCodeAt(t + 6) === A ? t + 7 : t + 6, n) || void 0;
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
208
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
208
|
+
let r = e.slice(e.charCodeAt(t + 3) === A ? t + 4 : t + 3, n);
|
|
209
209
|
l = r.includes("\0") ? void 0 : r;
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
212
|
if (r === 58) {
|
|
213
213
|
if (i) {
|
|
214
214
|
let r = e.slice(t, n);
|
|
215
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
215
|
+
i(r.slice(e.charCodeAt(t + 1) === A ? 2 : 1));
|
|
216
216
|
}
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
@@ -221,7 +221,7 @@ ${i}`, d++;
|
|
|
221
221
|
ee(a, "", a);
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
224
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === A ? 2 : 1;
|
|
225
225
|
ee(s, a.slice(o + c), a);
|
|
226
226
|
}
|
|
227
227
|
function ee(e, t, i) {
|
|
@@ -237,13 +237,13 @@ ${t}`, d++;
|
|
|
237
237
|
l = t.includes("\0") ? void 0 : t;
|
|
238
238
|
break;
|
|
239
239
|
case "retry":
|
|
240
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
240
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Ne(`Invalid \`retry\` value: "${t}"`, {
|
|
241
241
|
type: "invalid-retry",
|
|
242
242
|
value: t,
|
|
243
243
|
line: i
|
|
244
244
|
}));
|
|
245
245
|
break;
|
|
246
|
-
default: n(new
|
|
246
|
+
default: n(new Ne(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
247
247
|
type: "unknown-field",
|
|
248
248
|
field: e,
|
|
249
249
|
value: t,
|
|
@@ -270,20 +270,20 @@ ${t}`, d++;
|
|
|
270
270
|
reset: ne
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function M(e, t, n) {
|
|
274
274
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function N(e, t, n) {
|
|
277
277
|
return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
|
|
278
278
|
}
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
281
|
-
var
|
|
281
|
+
var P = class extends TransformStream {
|
|
282
282
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
283
283
|
let i;
|
|
284
284
|
super({
|
|
285
285
|
start(a) {
|
|
286
|
-
i =
|
|
286
|
+
i = Ie({
|
|
287
287
|
onEvent: (e) => {
|
|
288
288
|
a.enqueue(e);
|
|
289
289
|
},
|
|
@@ -309,20 +309,20 @@ function Be(e) {
|
|
|
309
309
|
let t = Function.prototype.toString.call(e);
|
|
310
310
|
return t.includes("internal/deps/undici") || t.includes("lazy loading of undici");
|
|
311
311
|
}
|
|
312
|
-
var
|
|
312
|
+
var F = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
313
313
|
let i = () => {
|
|
314
314
|
let e = n.length, r = Array(t);
|
|
315
315
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
316
316
|
return r.join("");
|
|
317
317
|
};
|
|
318
318
|
if (e == null) return i;
|
|
319
|
-
if (n.includes(r)) throw new
|
|
319
|
+
if (n.includes(r)) throw new T({
|
|
320
320
|
argument: "separator",
|
|
321
321
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
322
322
|
});
|
|
323
323
|
return () => `${e}${r}${i()}`;
|
|
324
|
-
},
|
|
325
|
-
function
|
|
324
|
+
}, I = F();
|
|
325
|
+
function L(e) {
|
|
326
326
|
if (e == null) return {};
|
|
327
327
|
let t = {};
|
|
328
328
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -373,16 +373,16 @@ function Ke(e) {
|
|
|
373
373
|
function qe(e) {
|
|
374
374
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
375
375
|
let { additionalProperties: t } = e;
|
|
376
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
376
|
+
e.additionalProperties = t != null && typeof t != "boolean" && R(t);
|
|
377
377
|
let { properties: n } = e;
|
|
378
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
378
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = R(n[e]);
|
|
379
379
|
}
|
|
380
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
380
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(R) : R(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(R)), e.allOf != null && (e.allOf = e.allOf.map(R)), e.oneOf != null && (e.oneOf = e.oneOf.map(R));
|
|
381
381
|
let { definitions: t } = e;
|
|
382
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
382
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = R(t[e]);
|
|
383
383
|
return e;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function R(e) {
|
|
386
386
|
return typeof e == "boolean" ? e : qe(e);
|
|
387
387
|
}
|
|
388
388
|
var Je = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use"), Ye = {
|
|
@@ -412,12 +412,12 @@ var Je = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to u
|
|
|
412
412
|
...Ye,
|
|
413
413
|
...e
|
|
414
414
|
};
|
|
415
|
-
function
|
|
415
|
+
function z() {
|
|
416
416
|
return {};
|
|
417
417
|
}
|
|
418
418
|
function Ze(e, t) {
|
|
419
419
|
let n = { type: "array" };
|
|
420
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
420
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = U(e.type._def, {
|
|
421
421
|
...t,
|
|
422
422
|
currentPath: [...t.currentPath, "items"]
|
|
423
423
|
})), 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;
|
|
@@ -443,9 +443,9 @@ function $e() {
|
|
|
443
443
|
return { type: "boolean" };
|
|
444
444
|
}
|
|
445
445
|
function et(e, t) {
|
|
446
|
-
return
|
|
446
|
+
return U(e.type._def, t);
|
|
447
447
|
}
|
|
448
|
-
var tt = (e, t) =>
|
|
448
|
+
var tt = (e, t) => U(e.innerType._def, t);
|
|
449
449
|
function nt(e, t, n) {
|
|
450
450
|
let r = n ?? t.dateStrategy;
|
|
451
451
|
if (Array.isArray(r)) return { anyOf: r.map((n) => nt(e, t, n)) };
|
|
@@ -477,12 +477,12 @@ var rt = (e) => {
|
|
|
477
477
|
};
|
|
478
478
|
function it(e, t) {
|
|
479
479
|
return {
|
|
480
|
-
...
|
|
480
|
+
...U(e.innerType._def, t),
|
|
481
481
|
default: e.defaultValue()
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
484
|
function at(e, t) {
|
|
485
|
-
return t.effectStrategy === "input" ?
|
|
485
|
+
return t.effectStrategy === "input" ? U(e.schema._def, t) : z();
|
|
486
486
|
}
|
|
487
487
|
function ot(e) {
|
|
488
488
|
return {
|
|
@@ -492,14 +492,14 @@ function ot(e) {
|
|
|
492
492
|
}
|
|
493
493
|
var st = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
494
494
|
function ct(e, t) {
|
|
495
|
-
let n = [
|
|
495
|
+
let n = [U(e.left._def, {
|
|
496
496
|
...t,
|
|
497
497
|
currentPath: [
|
|
498
498
|
...t.currentPath,
|
|
499
499
|
"allOf",
|
|
500
500
|
"0"
|
|
501
501
|
]
|
|
502
|
-
}),
|
|
502
|
+
}), U(e.right._def, {
|
|
503
503
|
...t,
|
|
504
504
|
currentPath: [
|
|
505
505
|
...t.currentPath,
|
|
@@ -526,7 +526,7 @@ function lt(e) {
|
|
|
526
526
|
const: e.value
|
|
527
527
|
};
|
|
528
528
|
}
|
|
529
|
-
var ut = void 0,
|
|
529
|
+
var ut = void 0, B = {
|
|
530
530
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
531
531
|
cuid2: /^[0-9a-z]+$/,
|
|
532
532
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
@@ -554,83 +554,83 @@ function dt(e, t) {
|
|
|
554
554
|
case "email":
|
|
555
555
|
switch (t.emailStrategy) {
|
|
556
556
|
case "format:email":
|
|
557
|
-
|
|
557
|
+
V(n, "email", r.message, t);
|
|
558
558
|
break;
|
|
559
559
|
case "format:idn-email":
|
|
560
|
-
|
|
560
|
+
V(n, "idn-email", r.message, t);
|
|
561
561
|
break;
|
|
562
|
-
case "pattern:zod":
|
|
562
|
+
case "pattern:zod": H(n, B.email, r.message, t);
|
|
563
563
|
}
|
|
564
564
|
break;
|
|
565
565
|
case "url":
|
|
566
|
-
|
|
566
|
+
V(n, "uri", r.message, t);
|
|
567
567
|
break;
|
|
568
568
|
case "uuid":
|
|
569
|
-
|
|
569
|
+
V(n, "uuid", r.message, t);
|
|
570
570
|
break;
|
|
571
571
|
case "regex":
|
|
572
|
-
|
|
572
|
+
H(n, r.regex, r.message, t);
|
|
573
573
|
break;
|
|
574
574
|
case "cuid":
|
|
575
|
-
|
|
575
|
+
H(n, B.cuid, r.message, t);
|
|
576
576
|
break;
|
|
577
577
|
case "cuid2":
|
|
578
|
-
|
|
578
|
+
H(n, B.cuid2, r.message, t);
|
|
579
579
|
break;
|
|
580
580
|
case "startsWith":
|
|
581
|
-
|
|
581
|
+
H(n, RegExp(`^${ft(r.value, t)}`), r.message, t);
|
|
582
582
|
break;
|
|
583
583
|
case "endsWith":
|
|
584
|
-
|
|
584
|
+
H(n, RegExp(`${ft(r.value, t)}$`), r.message, t);
|
|
585
585
|
break;
|
|
586
586
|
case "datetime":
|
|
587
|
-
|
|
587
|
+
V(n, "date-time", r.message, t);
|
|
588
588
|
break;
|
|
589
589
|
case "date":
|
|
590
|
-
|
|
590
|
+
V(n, "date", r.message, t);
|
|
591
591
|
break;
|
|
592
592
|
case "time":
|
|
593
|
-
|
|
593
|
+
V(n, "time", r.message, t);
|
|
594
594
|
break;
|
|
595
595
|
case "duration":
|
|
596
|
-
|
|
596
|
+
V(n, "duration", r.message, t);
|
|
597
597
|
break;
|
|
598
598
|
case "length":
|
|
599
599
|
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;
|
|
600
600
|
break;
|
|
601
601
|
case "includes":
|
|
602
|
-
|
|
602
|
+
H(n, RegExp(ft(r.value, t)), r.message, t);
|
|
603
603
|
break;
|
|
604
604
|
case "ip":
|
|
605
|
-
r.version !== "v6" &&
|
|
605
|
+
r.version !== "v6" && V(n, "ipv4", r.message, t), r.version !== "v4" && V(n, "ipv6", r.message, t);
|
|
606
606
|
break;
|
|
607
607
|
case "base64url":
|
|
608
|
-
|
|
608
|
+
H(n, B.base64url, r.message, t);
|
|
609
609
|
break;
|
|
610
610
|
case "jwt":
|
|
611
|
-
|
|
611
|
+
H(n, B.jwt, r.message, t);
|
|
612
612
|
break;
|
|
613
613
|
case "cidr":
|
|
614
|
-
r.version !== "v6" &&
|
|
614
|
+
r.version !== "v6" && H(n, B.ipv4Cidr, r.message, t), r.version !== "v4" && H(n, B.ipv6Cidr, r.message, t);
|
|
615
615
|
break;
|
|
616
616
|
case "emoji":
|
|
617
|
-
|
|
617
|
+
H(n, B.emoji(), r.message, t);
|
|
618
618
|
break;
|
|
619
619
|
case "ulid":
|
|
620
|
-
|
|
620
|
+
H(n, B.ulid, r.message, t);
|
|
621
621
|
break;
|
|
622
622
|
case "base64":
|
|
623
623
|
switch (t.base64Strategy) {
|
|
624
624
|
case "format:binary":
|
|
625
|
-
|
|
625
|
+
V(n, "binary", r.message, t);
|
|
626
626
|
break;
|
|
627
627
|
case "contentEncoding:base64":
|
|
628
628
|
n.contentEncoding = "base64";
|
|
629
629
|
break;
|
|
630
|
-
case "pattern:zod":
|
|
630
|
+
case "pattern:zod": H(n, B.base64, r.message, t);
|
|
631
631
|
}
|
|
632
632
|
break;
|
|
633
|
-
case "nanoid":
|
|
633
|
+
case "nanoid": H(n, B.nanoid, r.message, t);
|
|
634
634
|
}
|
|
635
635
|
return n;
|
|
636
636
|
}
|
|
@@ -643,13 +643,13 @@ function mt(e) {
|
|
|
643
643
|
for (let n = 0; n < e.length; n++) pt.has(e[n]) || (t += "\\"), t += e[n];
|
|
644
644
|
return t;
|
|
645
645
|
}
|
|
646
|
-
function
|
|
646
|
+
function V(e, t, n, r) {
|
|
647
647
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
648
648
|
format: t,
|
|
649
649
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
650
650
|
})) : e.format = t;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function H(e, t, n, r) {
|
|
653
653
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
654
654
|
pattern: ht(t, r),
|
|
655
655
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
@@ -706,7 +706,7 @@ function ht(e, t) {
|
|
|
706
706
|
function gt(e, t) {
|
|
707
707
|
let n = {
|
|
708
708
|
type: "object",
|
|
709
|
-
additionalProperties:
|
|
709
|
+
additionalProperties: U(e.valueType._def, {
|
|
710
710
|
...t,
|
|
711
711
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
712
712
|
}) ?? t.allowedAdditionalProperties
|
|
@@ -737,7 +737,7 @@ function _t(e, t) {
|
|
|
737
737
|
maxItems: 125,
|
|
738
738
|
items: {
|
|
739
739
|
type: "array",
|
|
740
|
-
items: [
|
|
740
|
+
items: [U(e.keyType._def, {
|
|
741
741
|
...t,
|
|
742
742
|
currentPath: [
|
|
743
743
|
...t.currentPath,
|
|
@@ -745,7 +745,7 @@ function _t(e, t) {
|
|
|
745
745
|
"items",
|
|
746
746
|
"0"
|
|
747
747
|
]
|
|
748
|
-
}) ||
|
|
748
|
+
}) || z(), U(e.valueType._def, {
|
|
749
749
|
...t,
|
|
750
750
|
currentPath: [
|
|
751
751
|
...t.currentPath,
|
|
@@ -753,7 +753,7 @@ function _t(e, t) {
|
|
|
753
753
|
"items",
|
|
754
754
|
"1"
|
|
755
755
|
]
|
|
756
|
-
}) ||
|
|
756
|
+
}) || z()],
|
|
757
757
|
minItems: 2,
|
|
758
758
|
maxItems: 2
|
|
759
759
|
}
|
|
@@ -767,7 +767,7 @@ function vt(e) {
|
|
|
767
767
|
};
|
|
768
768
|
}
|
|
769
769
|
function yt() {
|
|
770
|
-
return { not:
|
|
770
|
+
return { not: z() };
|
|
771
771
|
}
|
|
772
772
|
function bt() {
|
|
773
773
|
return { type: "null" };
|
|
@@ -814,7 +814,7 @@ function St(e, t) {
|
|
|
814
814
|
return Ct(e, t);
|
|
815
815
|
}
|
|
816
816
|
var Ct = (e, t) => {
|
|
817
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
817
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => U(e._def, {
|
|
818
818
|
...t,
|
|
819
819
|
currentPath: [
|
|
820
820
|
...t.currentPath,
|
|
@@ -832,7 +832,7 @@ function wt(e, t) {
|
|
|
832
832
|
"ZodBoolean",
|
|
833
833
|
"ZodNull"
|
|
834
834
|
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [xt[e.innerType._def.typeName], "null"] };
|
|
835
|
-
let n =
|
|
835
|
+
let n = U(e.innerType._def, {
|
|
836
836
|
...t,
|
|
837
837
|
currentPath: [
|
|
838
838
|
...t.currentPath,
|
|
@@ -867,7 +867,7 @@ function Et(e, t) {
|
|
|
867
867
|
for (let e in i) {
|
|
868
868
|
let a = i[e];
|
|
869
869
|
if (a === void 0 || a._def === void 0) continue;
|
|
870
|
-
let o = Ot(a), s =
|
|
870
|
+
let o = Ot(a), s = U(a._def, {
|
|
871
871
|
...t,
|
|
872
872
|
currentPath: [
|
|
873
873
|
...t.currentPath,
|
|
@@ -887,7 +887,7 @@ function Et(e, t) {
|
|
|
887
887
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
888
888
|
}
|
|
889
889
|
function Dt(e, t) {
|
|
890
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
890
|
+
if (e.catchall._def.typeName !== "ZodNever") return U(e.catchall._def, {
|
|
891
891
|
...t,
|
|
892
892
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
893
893
|
});
|
|
@@ -905,8 +905,8 @@ function Ot(e) {
|
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
907
|
var kt = (e, t) => {
|
|
908
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
909
|
-
let n =
|
|
908
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return U(e.innerType._def, t);
|
|
909
|
+
let n = U(e.innerType._def, {
|
|
910
910
|
...t,
|
|
911
911
|
currentPath: [
|
|
912
912
|
...t.currentPath,
|
|
@@ -914,11 +914,11 @@ var kt = (e, t) => {
|
|
|
914
914
|
"1"
|
|
915
915
|
]
|
|
916
916
|
});
|
|
917
|
-
return n ? { anyOf: [{ not:
|
|
917
|
+
return n ? { anyOf: [{ not: z() }, n] } : z();
|
|
918
918
|
}, At = (e, t) => {
|
|
919
|
-
if (t.pipeStrategy === "input") return
|
|
920
|
-
if (t.pipeStrategy === "output") return
|
|
921
|
-
let n =
|
|
919
|
+
if (t.pipeStrategy === "input") return U(e.in._def, t);
|
|
920
|
+
if (t.pipeStrategy === "output") return U(e.out._def, t);
|
|
921
|
+
let n = U(e.in._def, {
|
|
922
922
|
...t,
|
|
923
923
|
currentPath: [
|
|
924
924
|
...t.currentPath,
|
|
@@ -926,7 +926,7 @@ var kt = (e, t) => {
|
|
|
926
926
|
"0"
|
|
927
927
|
]
|
|
928
928
|
});
|
|
929
|
-
return { allOf: [n,
|
|
929
|
+
return { allOf: [n, U(e.out._def, {
|
|
930
930
|
...t,
|
|
931
931
|
currentPath: [
|
|
932
932
|
...t.currentPath,
|
|
@@ -936,13 +936,13 @@ var kt = (e, t) => {
|
|
|
936
936
|
})].filter((e) => e !== void 0) };
|
|
937
937
|
};
|
|
938
938
|
function jt(e, t) {
|
|
939
|
-
return
|
|
939
|
+
return U(e.type._def, t);
|
|
940
940
|
}
|
|
941
941
|
function Mt(e, t) {
|
|
942
942
|
let n = {
|
|
943
943
|
type: "array",
|
|
944
944
|
uniqueItems: !0,
|
|
945
|
-
items:
|
|
945
|
+
items: U(e.valueType._def, {
|
|
946
946
|
...t,
|
|
947
947
|
currentPath: [...t.currentPath, "items"]
|
|
948
948
|
})
|
|
@@ -953,7 +953,7 @@ function Nt(e, t) {
|
|
|
953
953
|
return e.rest ? {
|
|
954
954
|
type: "array",
|
|
955
955
|
minItems: e.items.length,
|
|
956
|
-
items: e.items.map((e, n) =>
|
|
956
|
+
items: e.items.map((e, n) => U(e._def, {
|
|
957
957
|
...t,
|
|
958
958
|
currentPath: [
|
|
959
959
|
...t.currentPath,
|
|
@@ -961,7 +961,7 @@ function Nt(e, t) {
|
|
|
961
961
|
`${n}`
|
|
962
962
|
]
|
|
963
963
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
964
|
-
additionalItems:
|
|
964
|
+
additionalItems: U(e.rest._def, {
|
|
965
965
|
...t,
|
|
966
966
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
967
967
|
})
|
|
@@ -969,7 +969,7 @@ function Nt(e, t) {
|
|
|
969
969
|
type: "array",
|
|
970
970
|
minItems: e.items.length,
|
|
971
971
|
maxItems: e.items.length,
|
|
972
|
-
items: e.items.map((e, n) =>
|
|
972
|
+
items: e.items.map((e, n) => U(e._def, {
|
|
973
973
|
...t,
|
|
974
974
|
currentPath: [
|
|
975
975
|
...t.currentPath,
|
|
@@ -980,12 +980,12 @@ function Nt(e, t) {
|
|
|
980
980
|
};
|
|
981
981
|
}
|
|
982
982
|
function Pt() {
|
|
983
|
-
return { not:
|
|
983
|
+
return { not: z() };
|
|
984
984
|
}
|
|
985
985
|
function Ft() {
|
|
986
|
-
return
|
|
986
|
+
return z();
|
|
987
987
|
}
|
|
988
|
-
var It = (e, t) =>
|
|
988
|
+
var It = (e, t) => U(e.innerType._def, t), Lt = (e, t, n) => {
|
|
989
989
|
switch (t) {
|
|
990
990
|
case "ZodString": return dt(e, n);
|
|
991
991
|
case "ZodNumber": return Tt(e);
|
|
@@ -1013,7 +1013,7 @@ var It = (e, t) => W(e.innerType._def, t), Lt = (e, t, n) => {
|
|
|
1013
1013
|
case "ZodNaN":
|
|
1014
1014
|
case "ZodNever": return yt();
|
|
1015
1015
|
case "ZodEffects": return at(e, n);
|
|
1016
|
-
case "ZodAny": return
|
|
1016
|
+
case "ZodAny": return z();
|
|
1017
1017
|
case "ZodUnknown": return Ft();
|
|
1018
1018
|
case "ZodDefault": return it(e, n);
|
|
1019
1019
|
case "ZodBranded": return et(e, n);
|
|
@@ -1030,7 +1030,7 @@ var It = (e, t) => W(e.innerType._def, t), Lt = (e, t, n) => {
|
|
|
1030
1030
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1031
1031
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1032
1032
|
};
|
|
1033
|
-
function
|
|
1033
|
+
function U(e, t, n = !1) {
|
|
1034
1034
|
let r = t.seen.get(e);
|
|
1035
1035
|
if (t.override) {
|
|
1036
1036
|
let i = t.override?.call(t, e, t, r, n);
|
|
@@ -1046,7 +1046,7 @@ function W(e, t, n = !1) {
|
|
|
1046
1046
|
jsonSchema: void 0
|
|
1047
1047
|
};
|
|
1048
1048
|
t.seen.set(e, i);
|
|
1049
|
-
let a = Lt(e, e.typeName, t), o = typeof a == "function" ?
|
|
1049
|
+
let a = Lt(e, e.typeName, t), o = typeof a == "function" ? U(a(), t) : a;
|
|
1050
1050
|
if (o && Bt(e, t, o), t.postProcess) {
|
|
1051
1051
|
let n = t.postProcess(o, e, t);
|
|
1052
1052
|
return i.jsonSchema = o, n;
|
|
@@ -1058,7 +1058,7 @@ var zt = (e, t) => {
|
|
|
1058
1058
|
case "root": return { $ref: e.path.join("/") };
|
|
1059
1059
|
case "relative": return { $ref: Rt(t.currentPath, e.path) };
|
|
1060
1060
|
case "none":
|
|
1061
|
-
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`),
|
|
1061
|
+
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`), z()) : t.$refStrategy === "seen" ? z() : void 0;
|
|
1062
1062
|
}
|
|
1063
1063
|
}, Bt = (e, t, n) => (e.description && (n.description = e.description), n), Vt = (e) => {
|
|
1064
1064
|
let t = Xe(e), n = t.name === void 0 ? t.basePath : [
|
|
@@ -1083,22 +1083,22 @@ var zt = (e, t) => {
|
|
|
1083
1083
|
}, Ht = (e, t) => {
|
|
1084
1084
|
let n = Vt(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1085
1085
|
...e,
|
|
1086
|
-
[t]:
|
|
1086
|
+
[t]: U(r._def, {
|
|
1087
1087
|
...n,
|
|
1088
1088
|
currentPath: [
|
|
1089
1089
|
...n.basePath,
|
|
1090
1090
|
n.definitionPath,
|
|
1091
1091
|
t
|
|
1092
1092
|
]
|
|
1093
|
-
}, !0) ??
|
|
1094
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1093
|
+
}, !0) ?? z()
|
|
1094
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = U(e._def, i === void 0 ? n : {
|
|
1095
1095
|
...n,
|
|
1096
1096
|
currentPath: [
|
|
1097
1097
|
...n.basePath,
|
|
1098
1098
|
n.definitionPath,
|
|
1099
1099
|
i
|
|
1100
1100
|
]
|
|
1101
|
-
}, !1) ??
|
|
1101
|
+
}, !1) ?? z(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1102
1102
|
o !== void 0 && (a.title = o);
|
|
1103
1103
|
let s = i === void 0 ? r ? {
|
|
1104
1104
|
...a,
|
|
@@ -1151,7 +1151,7 @@ function Jt(e) {
|
|
|
1151
1151
|
value: n.value
|
|
1152
1152
|
} : {
|
|
1153
1153
|
success: !1,
|
|
1154
|
-
error: new
|
|
1154
|
+
error: new k({
|
|
1155
1155
|
value: t,
|
|
1156
1156
|
cause: n.issues
|
|
1157
1157
|
})
|
|
@@ -1203,7 +1203,7 @@ async function en({ value: e, schema: t, context: n }) {
|
|
|
1203
1203
|
schema: t,
|
|
1204
1204
|
context: n
|
|
1205
1205
|
});
|
|
1206
|
-
if (!r.success) throw
|
|
1206
|
+
if (!r.success) throw k.wrap({
|
|
1207
1207
|
value: e,
|
|
1208
1208
|
cause: r.error,
|
|
1209
1209
|
context: n
|
|
@@ -1225,7 +1225,7 @@ async function tn({ value: e, schema: t, context: n }) {
|
|
|
1225
1225
|
rawValue: e
|
|
1226
1226
|
} : {
|
|
1227
1227
|
success: !1,
|
|
1228
|
-
error:
|
|
1228
|
+
error: k.wrap({
|
|
1229
1229
|
value: e,
|
|
1230
1230
|
cause: t.error,
|
|
1231
1231
|
context: n
|
|
@@ -1235,7 +1235,7 @@ async function tn({ value: e, schema: t, context: n }) {
|
|
|
1235
1235
|
} catch (t) {
|
|
1236
1236
|
return {
|
|
1237
1237
|
success: !1,
|
|
1238
|
-
error:
|
|
1238
|
+
error: k.wrap({
|
|
1239
1239
|
value: e,
|
|
1240
1240
|
cause: t,
|
|
1241
1241
|
context: n
|
|
@@ -1244,7 +1244,7 @@ async function tn({ value: e, schema: t, context: n }) {
|
|
|
1244
1244
|
};
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
|
-
async function
|
|
1247
|
+
async function W({ text: e, schema: t }) {
|
|
1248
1248
|
try {
|
|
1249
1249
|
let n = Ke(e);
|
|
1250
1250
|
return t == null ? {
|
|
@@ -1258,7 +1258,7 @@ async function G({ text: e, schema: t }) {
|
|
|
1258
1258
|
} catch (t) {
|
|
1259
1259
|
return {
|
|
1260
1260
|
success: !1,
|
|
1261
|
-
error:
|
|
1261
|
+
error: E.isInstance(t) ? t : new E({
|
|
1262
1262
|
text: e,
|
|
1263
1263
|
cause: t
|
|
1264
1264
|
}),
|
|
@@ -1267,14 +1267,14 @@ async function G({ text: e, schema: t }) {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
1269
|
function nn({ stream: e, schema: t }) {
|
|
1270
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1271
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1270
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new P()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1271
|
+
e !== "[DONE]" && n.enqueue(await W({
|
|
1272
1272
|
text: e,
|
|
1273
1273
|
schema: t
|
|
1274
1274
|
}));
|
|
1275
1275
|
} }));
|
|
1276
1276
|
}
|
|
1277
|
-
async function
|
|
1277
|
+
async function G(e) {
|
|
1278
1278
|
return typeof e == "function" && (e = e()), Promise.resolve(e);
|
|
1279
1279
|
}
|
|
1280
1280
|
new TextDecoder();
|
|
@@ -1283,7 +1283,7 @@ var rn = Object.defineProperty, an = (e, t) => {
|
|
|
1283
1283
|
get: t[n],
|
|
1284
1284
|
enumerable: !0
|
|
1285
1285
|
});
|
|
1286
|
-
}, on = "AI_NoObjectGeneratedError", sn = `vercel.ai.error.${on}`, cn = Symbol.for(sn), ln,
|
|
1286
|
+
}, on = "AI_NoObjectGeneratedError", sn = `vercel.ai.error.${on}`, cn = Symbol.for(sn), ln, K = class extends C {
|
|
1287
1287
|
constructor({ message: e = "No object generated.", cause: t, text: n, response: r, usage: i, finishReason: a }) {
|
|
1288
1288
|
super({
|
|
1289
1289
|
name: on,
|
|
@@ -1292,11 +1292,11 @@ var rn = Object.defineProperty, an = (e, t) => {
|
|
|
1292
1292
|
}), this[ln] = !0, this.text = n, this.response = r, this.usage = i, this.finishReason = a;
|
|
1293
1293
|
}
|
|
1294
1294
|
static isInstance(e) {
|
|
1295
|
-
return
|
|
1295
|
+
return C.hasMarker(e, sn);
|
|
1296
1296
|
}
|
|
1297
1297
|
};
|
|
1298
1298
|
ln = cn;
|
|
1299
|
-
var un = "AI_UIMessageStreamError", dn = `vercel.ai.error.${un}`, fn = Symbol.for(dn), pn,
|
|
1299
|
+
var un = "AI_UIMessageStreamError", dn = `vercel.ai.error.${un}`, fn = Symbol.for(dn), pn, q = class extends C {
|
|
1300
1300
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1301
1301
|
super({
|
|
1302
1302
|
name: un,
|
|
@@ -1304,7 +1304,7 @@ var un = "AI_UIMessageStreamError", dn = `vercel.ai.error.${un}`, fn = Symbol.fo
|
|
|
1304
1304
|
}), this[pn] = !0, this.chunkType = e, this.chunkId = t;
|
|
1305
1305
|
}
|
|
1306
1306
|
static isInstance(e) {
|
|
1307
|
-
return
|
|
1307
|
+
return C.hasMarker(e, dn);
|
|
1308
1308
|
}
|
|
1309
1309
|
};
|
|
1310
1310
|
pn = fn;
|
|
@@ -1321,7 +1321,7 @@ function mn(e, t) {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
return n;
|
|
1323
1323
|
}
|
|
1324
|
-
var
|
|
1324
|
+
var J = {
|
|
1325
1325
|
array: n,
|
|
1326
1326
|
boolean: p,
|
|
1327
1327
|
custom: i,
|
|
@@ -1339,210 +1339,210 @@ var Y = {
|
|
|
1339
1339
|
string: g,
|
|
1340
1340
|
union: ee,
|
|
1341
1341
|
unknown: r
|
|
1342
|
-
},
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
])),
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
]), gn =
|
|
1355
|
-
type:
|
|
1356
|
-
text:
|
|
1357
|
-
providerOptions:
|
|
1358
|
-
}), vn =
|
|
1359
|
-
type:
|
|
1360
|
-
image:
|
|
1342
|
+
}, Y = J.lazy(() => J.union([
|
|
1343
|
+
J.null(),
|
|
1344
|
+
J.string(),
|
|
1345
|
+
J.number(),
|
|
1346
|
+
J.boolean(),
|
|
1347
|
+
J.record(J.string(), Y.optional()),
|
|
1348
|
+
J.array(Y)
|
|
1349
|
+
])), X = J.record(J.string(), J.record(J.string(), Y.optional())), hn = J.union([
|
|
1350
|
+
J.string(),
|
|
1351
|
+
J.instanceof(Uint8Array),
|
|
1352
|
+
J.instanceof(ArrayBuffer),
|
|
1353
|
+
J.custom(Ve, { message: "Must be a Buffer" })
|
|
1354
|
+
]), gn = J.record(J.string(), J.string()), _n = J.object({
|
|
1355
|
+
type: J.literal("text"),
|
|
1356
|
+
text: J.string(),
|
|
1357
|
+
providerOptions: X.optional()
|
|
1358
|
+
}), vn = J.object({
|
|
1359
|
+
type: J.literal("image"),
|
|
1360
|
+
image: J.union([
|
|
1361
1361
|
hn,
|
|
1362
|
-
|
|
1362
|
+
J.instanceof(URL),
|
|
1363
1363
|
gn
|
|
1364
1364
|
]),
|
|
1365
|
-
mediaType:
|
|
1366
|
-
providerOptions:
|
|
1367
|
-
}), yn =
|
|
1368
|
-
|
|
1369
|
-
type:
|
|
1365
|
+
mediaType: J.string().optional(),
|
|
1366
|
+
providerOptions: X.optional()
|
|
1367
|
+
}), yn = J.discriminatedUnion("type", [
|
|
1368
|
+
J.object({
|
|
1369
|
+
type: J.literal("data"),
|
|
1370
1370
|
data: hn
|
|
1371
1371
|
}),
|
|
1372
|
-
|
|
1373
|
-
type:
|
|
1374
|
-
url:
|
|
1372
|
+
J.object({
|
|
1373
|
+
type: J.literal("url"),
|
|
1374
|
+
url: J.instanceof(URL)
|
|
1375
1375
|
}),
|
|
1376
|
-
|
|
1377
|
-
type:
|
|
1376
|
+
J.object({
|
|
1377
|
+
type: J.literal("reference"),
|
|
1378
1378
|
reference: gn
|
|
1379
1379
|
}),
|
|
1380
|
-
|
|
1381
|
-
type:
|
|
1382
|
-
text:
|
|
1380
|
+
J.object({
|
|
1381
|
+
type: J.literal("text"),
|
|
1382
|
+
text: J.string()
|
|
1383
1383
|
})
|
|
1384
|
-
]), bn =
|
|
1385
|
-
type:
|
|
1384
|
+
]), bn = J.discriminatedUnion("type", [J.object({
|
|
1385
|
+
type: J.literal("data"),
|
|
1386
1386
|
data: hn
|
|
1387
|
-
}),
|
|
1388
|
-
type:
|
|
1389
|
-
url:
|
|
1390
|
-
})]), xn =
|
|
1391
|
-
type:
|
|
1392
|
-
data:
|
|
1387
|
+
}), J.object({
|
|
1388
|
+
type: J.literal("url"),
|
|
1389
|
+
url: J.instanceof(URL)
|
|
1390
|
+
})]), xn = J.object({
|
|
1391
|
+
type: J.literal("file"),
|
|
1392
|
+
data: J.union([
|
|
1393
1393
|
yn,
|
|
1394
1394
|
hn,
|
|
1395
|
-
|
|
1395
|
+
J.instanceof(URL),
|
|
1396
1396
|
gn
|
|
1397
1397
|
]),
|
|
1398
|
-
filename:
|
|
1399
|
-
mediaType:
|
|
1400
|
-
providerOptions:
|
|
1401
|
-
}), Sn =
|
|
1402
|
-
type:
|
|
1403
|
-
text:
|
|
1404
|
-
providerOptions:
|
|
1405
|
-
}), Cn =
|
|
1406
|
-
type:
|
|
1407
|
-
kind:
|
|
1408
|
-
providerOptions:
|
|
1409
|
-
}), wn =
|
|
1410
|
-
type:
|
|
1411
|
-
data:
|
|
1398
|
+
filename: J.string().optional(),
|
|
1399
|
+
mediaType: J.string(),
|
|
1400
|
+
providerOptions: X.optional()
|
|
1401
|
+
}), Sn = J.object({
|
|
1402
|
+
type: J.literal("reasoning"),
|
|
1403
|
+
text: J.string(),
|
|
1404
|
+
providerOptions: X.optional()
|
|
1405
|
+
}), Cn = J.object({
|
|
1406
|
+
type: J.literal("custom"),
|
|
1407
|
+
kind: J.string().transform((e) => e),
|
|
1408
|
+
providerOptions: X.optional()
|
|
1409
|
+
}), wn = J.object({
|
|
1410
|
+
type: J.literal("reasoning-file"),
|
|
1411
|
+
data: J.union([
|
|
1412
1412
|
bn,
|
|
1413
1413
|
hn,
|
|
1414
|
-
|
|
1414
|
+
J.instanceof(URL)
|
|
1415
1415
|
]),
|
|
1416
|
-
mediaType:
|
|
1417
|
-
providerOptions:
|
|
1418
|
-
}), Tn =
|
|
1419
|
-
type:
|
|
1420
|
-
toolCallId:
|
|
1421
|
-
toolName:
|
|
1422
|
-
input:
|
|
1423
|
-
providerOptions:
|
|
1424
|
-
providerExecuted:
|
|
1425
|
-
}), En =
|
|
1426
|
-
|
|
1427
|
-
type:
|
|
1428
|
-
value:
|
|
1429
|
-
providerOptions:
|
|
1416
|
+
mediaType: J.string(),
|
|
1417
|
+
providerOptions: X.optional()
|
|
1418
|
+
}), Tn = J.object({
|
|
1419
|
+
type: J.literal("tool-call"),
|
|
1420
|
+
toolCallId: J.string(),
|
|
1421
|
+
toolName: J.string(),
|
|
1422
|
+
input: J.unknown(),
|
|
1423
|
+
providerOptions: X.optional(),
|
|
1424
|
+
providerExecuted: J.boolean().optional()
|
|
1425
|
+
}), En = J.discriminatedUnion("type", [
|
|
1426
|
+
J.object({
|
|
1427
|
+
type: J.literal("text"),
|
|
1428
|
+
value: J.string(),
|
|
1429
|
+
providerOptions: X.optional()
|
|
1430
1430
|
}),
|
|
1431
|
-
|
|
1432
|
-
type:
|
|
1433
|
-
value:
|
|
1434
|
-
providerOptions:
|
|
1431
|
+
J.object({
|
|
1432
|
+
type: J.literal("json"),
|
|
1433
|
+
value: Y,
|
|
1434
|
+
providerOptions: X.optional()
|
|
1435
1435
|
}),
|
|
1436
|
-
|
|
1437
|
-
type:
|
|
1438
|
-
reason:
|
|
1439
|
-
providerOptions:
|
|
1436
|
+
J.object({
|
|
1437
|
+
type: J.literal("execution-denied"),
|
|
1438
|
+
reason: J.string().optional(),
|
|
1439
|
+
providerOptions: X.optional()
|
|
1440
1440
|
}),
|
|
1441
|
-
|
|
1442
|
-
type:
|
|
1443
|
-
value:
|
|
1444
|
-
providerOptions:
|
|
1441
|
+
J.object({
|
|
1442
|
+
type: J.literal("error-text"),
|
|
1443
|
+
value: J.string(),
|
|
1444
|
+
providerOptions: X.optional()
|
|
1445
1445
|
}),
|
|
1446
|
-
|
|
1447
|
-
type:
|
|
1448
|
-
value:
|
|
1449
|
-
providerOptions:
|
|
1446
|
+
J.object({
|
|
1447
|
+
type: J.literal("error-json"),
|
|
1448
|
+
value: Y,
|
|
1449
|
+
providerOptions: X.optional()
|
|
1450
1450
|
}),
|
|
1451
|
-
|
|
1452
|
-
type:
|
|
1453
|
-
value:
|
|
1454
|
-
|
|
1455
|
-
type:
|
|
1456
|
-
text:
|
|
1457
|
-
providerOptions:
|
|
1451
|
+
J.object({
|
|
1452
|
+
type: J.literal("content"),
|
|
1453
|
+
value: J.array(J.union([
|
|
1454
|
+
J.object({
|
|
1455
|
+
type: J.literal("text"),
|
|
1456
|
+
text: J.string(),
|
|
1457
|
+
providerOptions: X.optional()
|
|
1458
1458
|
}),
|
|
1459
|
-
|
|
1460
|
-
type:
|
|
1459
|
+
J.object({
|
|
1460
|
+
type: J.literal("file"),
|
|
1461
1461
|
data: yn,
|
|
1462
|
-
mediaType:
|
|
1463
|
-
filename:
|
|
1464
|
-
providerOptions:
|
|
1462
|
+
mediaType: J.string(),
|
|
1463
|
+
filename: J.string().optional(),
|
|
1464
|
+
providerOptions: X.optional()
|
|
1465
1465
|
}),
|
|
1466
|
-
|
|
1467
|
-
type:
|
|
1468
|
-
data:
|
|
1469
|
-
mediaType:
|
|
1470
|
-
filename:
|
|
1471
|
-
providerOptions:
|
|
1466
|
+
J.object({
|
|
1467
|
+
type: J.literal("file-data"),
|
|
1468
|
+
data: J.string(),
|
|
1469
|
+
mediaType: J.string(),
|
|
1470
|
+
filename: J.string().optional(),
|
|
1471
|
+
providerOptions: X.optional()
|
|
1472
1472
|
}),
|
|
1473
|
-
|
|
1474
|
-
type:
|
|
1475
|
-
url:
|
|
1476
|
-
mediaType:
|
|
1477
|
-
providerOptions:
|
|
1473
|
+
J.object({
|
|
1474
|
+
type: J.literal("file-url"),
|
|
1475
|
+
url: J.string(),
|
|
1476
|
+
mediaType: J.string().optional(),
|
|
1477
|
+
providerOptions: X.optional()
|
|
1478
1478
|
}),
|
|
1479
|
-
|
|
1480
|
-
type:
|
|
1481
|
-
fileId:
|
|
1482
|
-
providerOptions:
|
|
1479
|
+
J.object({
|
|
1480
|
+
type: J.literal("file-id"),
|
|
1481
|
+
fileId: J.union([J.string(), J.record(J.string(), J.string())]),
|
|
1482
|
+
providerOptions: X.optional()
|
|
1483
1483
|
}),
|
|
1484
|
-
|
|
1485
|
-
type:
|
|
1486
|
-
providerReference:
|
|
1487
|
-
providerOptions:
|
|
1484
|
+
J.object({
|
|
1485
|
+
type: J.literal("file-reference"),
|
|
1486
|
+
providerReference: J.record(J.string(), J.string()),
|
|
1487
|
+
providerOptions: X.optional()
|
|
1488
1488
|
}),
|
|
1489
|
-
|
|
1490
|
-
type:
|
|
1491
|
-
data:
|
|
1492
|
-
mediaType:
|
|
1493
|
-
providerOptions:
|
|
1489
|
+
J.object({
|
|
1490
|
+
type: J.literal("image-data"),
|
|
1491
|
+
data: J.string(),
|
|
1492
|
+
mediaType: J.string(),
|
|
1493
|
+
providerOptions: X.optional()
|
|
1494
1494
|
}),
|
|
1495
|
-
|
|
1496
|
-
type:
|
|
1497
|
-
url:
|
|
1498
|
-
providerOptions:
|
|
1495
|
+
J.object({
|
|
1496
|
+
type: J.literal("image-url"),
|
|
1497
|
+
url: J.string(),
|
|
1498
|
+
providerOptions: X.optional()
|
|
1499
1499
|
}),
|
|
1500
|
-
|
|
1501
|
-
type:
|
|
1502
|
-
fileId:
|
|
1503
|
-
providerOptions:
|
|
1500
|
+
J.object({
|
|
1501
|
+
type: J.literal("image-file-id"),
|
|
1502
|
+
fileId: J.union([J.string(), J.record(J.string(), J.string())]),
|
|
1503
|
+
providerOptions: X.optional()
|
|
1504
1504
|
}),
|
|
1505
|
-
|
|
1506
|
-
type:
|
|
1507
|
-
providerReference:
|
|
1508
|
-
providerOptions:
|
|
1505
|
+
J.object({
|
|
1506
|
+
type: J.literal("image-file-reference"),
|
|
1507
|
+
providerReference: J.record(J.string(), J.string()),
|
|
1508
|
+
providerOptions: X.optional()
|
|
1509
1509
|
}),
|
|
1510
|
-
|
|
1511
|
-
type:
|
|
1512
|
-
providerOptions:
|
|
1510
|
+
J.object({
|
|
1511
|
+
type: J.literal("custom"),
|
|
1512
|
+
providerOptions: X.optional()
|
|
1513
1513
|
})
|
|
1514
1514
|
]))
|
|
1515
1515
|
})
|
|
1516
|
-
]), Dn =
|
|
1517
|
-
type:
|
|
1518
|
-
toolCallId:
|
|
1519
|
-
toolName:
|
|
1516
|
+
]), Dn = J.object({
|
|
1517
|
+
type: J.literal("tool-result"),
|
|
1518
|
+
toolCallId: J.string(),
|
|
1519
|
+
toolName: J.string(),
|
|
1520
1520
|
output: En,
|
|
1521
|
-
providerOptions:
|
|
1522
|
-
}), On =
|
|
1523
|
-
type:
|
|
1524
|
-
approvalId:
|
|
1525
|
-
toolCallId:
|
|
1526
|
-
}), kn =
|
|
1527
|
-
type:
|
|
1528
|
-
approvalId:
|
|
1529
|
-
approved:
|
|
1530
|
-
reason:
|
|
1531
|
-
}), An =
|
|
1532
|
-
role:
|
|
1533
|
-
content:
|
|
1534
|
-
providerOptions:
|
|
1535
|
-
}), jn =
|
|
1536
|
-
role:
|
|
1537
|
-
content:
|
|
1521
|
+
providerOptions: X.optional()
|
|
1522
|
+
}), On = J.object({
|
|
1523
|
+
type: J.literal("tool-approval-request"),
|
|
1524
|
+
approvalId: J.string(),
|
|
1525
|
+
toolCallId: J.string()
|
|
1526
|
+
}), kn = J.object({
|
|
1527
|
+
type: J.literal("tool-approval-response"),
|
|
1528
|
+
approvalId: J.string(),
|
|
1529
|
+
approved: J.boolean(),
|
|
1530
|
+
reason: J.string().optional()
|
|
1531
|
+
}), An = J.object({
|
|
1532
|
+
role: J.literal("system"),
|
|
1533
|
+
content: J.string(),
|
|
1534
|
+
providerOptions: X.optional()
|
|
1535
|
+
}), jn = J.object({
|
|
1536
|
+
role: J.literal("user"),
|
|
1537
|
+
content: J.union([J.string(), J.array(J.union([
|
|
1538
1538
|
_n,
|
|
1539
1539
|
vn,
|
|
1540
1540
|
xn
|
|
1541
1541
|
]))]),
|
|
1542
|
-
providerOptions:
|
|
1543
|
-
}), Mn =
|
|
1544
|
-
role:
|
|
1545
|
-
content:
|
|
1542
|
+
providerOptions: X.optional()
|
|
1543
|
+
}), Mn = J.object({
|
|
1544
|
+
role: J.literal("assistant"),
|
|
1545
|
+
content: J.union([J.string(), J.array(J.union([
|
|
1546
1546
|
_n,
|
|
1547
1547
|
Cn,
|
|
1548
1548
|
xn,
|
|
@@ -1552,13 +1552,13 @@ var Y = {
|
|
|
1552
1552
|
Dn,
|
|
1553
1553
|
On
|
|
1554
1554
|
]))]),
|
|
1555
|
-
providerOptions:
|
|
1556
|
-
}), Nn =
|
|
1557
|
-
role:
|
|
1558
|
-
content:
|
|
1559
|
-
providerOptions:
|
|
1555
|
+
providerOptions: X.optional()
|
|
1556
|
+
}), Nn = J.object({
|
|
1557
|
+
role: J.literal("tool"),
|
|
1558
|
+
content: J.array(J.union([Dn, kn])),
|
|
1559
|
+
providerOptions: X.optional()
|
|
1560
1560
|
});
|
|
1561
|
-
|
|
1561
|
+
J.union([
|
|
1562
1562
|
An,
|
|
1563
1563
|
jn,
|
|
1564
1564
|
Mn,
|
|
@@ -1757,11 +1757,11 @@ async function Fn(e) {
|
|
|
1757
1757
|
value: void 0,
|
|
1758
1758
|
state: "undefined-input"
|
|
1759
1759
|
};
|
|
1760
|
-
let t = await
|
|
1760
|
+
let t = await W({ text: e });
|
|
1761
1761
|
return t.success ? {
|
|
1762
1762
|
value: t.value,
|
|
1763
1763
|
state: "successful-parse"
|
|
1764
|
-
} : (t = await
|
|
1764
|
+
} : (t = await W({ text: Pn(e) }), t.success ? {
|
|
1765
1765
|
value: t.value,
|
|
1766
1766
|
state: "repaired-parse"
|
|
1767
1767
|
} : {
|
|
@@ -1783,15 +1783,15 @@ var In = () => ({
|
|
|
1783
1783
|
let r = qt(e);
|
|
1784
1784
|
return {
|
|
1785
1785
|
name: "object",
|
|
1786
|
-
responseFormat:
|
|
1786
|
+
responseFormat: G(r.jsonSchema).then((e) => ({
|
|
1787
1787
|
type: "json",
|
|
1788
1788
|
schema: e,
|
|
1789
1789
|
...t != null && { name: t },
|
|
1790
1790
|
...n != null && { description: n }
|
|
1791
1791
|
})),
|
|
1792
1792
|
async parseCompleteOutput({ text: e }, t) {
|
|
1793
|
-
let n = await
|
|
1794
|
-
if (!n.success) throw new
|
|
1793
|
+
let n = await W({ text: e });
|
|
1794
|
+
if (!n.success) throw new K({
|
|
1795
1795
|
message: "No object generated: could not parse the response.",
|
|
1796
1796
|
cause: n.error,
|
|
1797
1797
|
text: e,
|
|
@@ -1803,7 +1803,7 @@ var In = () => ({
|
|
|
1803
1803
|
value: n.value,
|
|
1804
1804
|
schema: r
|
|
1805
1805
|
});
|
|
1806
|
-
if (!i.success) throw new
|
|
1806
|
+
if (!i.success) throw new K({
|
|
1807
1807
|
message: "No object generated: response did not match schema.",
|
|
1808
1808
|
cause: i.error,
|
|
1809
1809
|
text: e,
|
|
@@ -1828,7 +1828,7 @@ var In = () => ({
|
|
|
1828
1828
|
let r = qt(e);
|
|
1829
1829
|
return {
|
|
1830
1830
|
name: "array",
|
|
1831
|
-
responseFormat:
|
|
1831
|
+
responseFormat: G(r.jsonSchema).then((e) => {
|
|
1832
1832
|
let { $schema: r, definitions: i, $defs: a, ...o } = e;
|
|
1833
1833
|
return {
|
|
1834
1834
|
type: "json",
|
|
@@ -1849,8 +1849,8 @@ var In = () => ({
|
|
|
1849
1849
|
};
|
|
1850
1850
|
}),
|
|
1851
1851
|
async parseCompleteOutput({ text: e }, t) {
|
|
1852
|
-
let n = await
|
|
1853
|
-
if (!n.success) throw new
|
|
1852
|
+
let n = await W({ text: e });
|
|
1853
|
+
if (!n.success) throw new K({
|
|
1854
1854
|
message: "No object generated: could not parse the response.",
|
|
1855
1855
|
cause: n.error,
|
|
1856
1856
|
text: e,
|
|
@@ -1859,9 +1859,9 @@ var In = () => ({
|
|
|
1859
1859
|
finishReason: t.finishReason
|
|
1860
1860
|
});
|
|
1861
1861
|
let i = n.value;
|
|
1862
|
-
if (typeof i != "object" || !i || !("elements" in i) || !Array.isArray(i.elements)) throw new
|
|
1862
|
+
if (typeof i != "object" || !i || !("elements" in i) || !Array.isArray(i.elements)) throw new K({
|
|
1863
1863
|
message: "No object generated: response did not match schema.",
|
|
1864
|
-
cause: new
|
|
1864
|
+
cause: new k({
|
|
1865
1865
|
value: i,
|
|
1866
1866
|
cause: "response must be an object with an elements array"
|
|
1867
1867
|
}),
|
|
@@ -1876,7 +1876,7 @@ var In = () => ({
|
|
|
1876
1876
|
value: n,
|
|
1877
1877
|
schema: r
|
|
1878
1878
|
});
|
|
1879
|
-
if (!i.success) throw new
|
|
1879
|
+
if (!i.success) throw new K({
|
|
1880
1880
|
message: "No object generated: response did not match schema.",
|
|
1881
1881
|
cause: i.error,
|
|
1882
1882
|
text: e,
|
|
@@ -1934,8 +1934,8 @@ var In = () => ({
|
|
|
1934
1934
|
...n != null && { description: n }
|
|
1935
1935
|
}),
|
|
1936
1936
|
async parseCompleteOutput({ text: t }, n) {
|
|
1937
|
-
let r = await
|
|
1938
|
-
if (!r.success) throw new
|
|
1937
|
+
let r = await W({ text: t });
|
|
1938
|
+
if (!r.success) throw new K({
|
|
1939
1939
|
message: "No object generated: could not parse the response.",
|
|
1940
1940
|
cause: r.error,
|
|
1941
1941
|
text: t,
|
|
@@ -1944,9 +1944,9 @@ var In = () => ({
|
|
|
1944
1944
|
finishReason: n.finishReason
|
|
1945
1945
|
});
|
|
1946
1946
|
let i = r.value;
|
|
1947
|
-
if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new
|
|
1947
|
+
if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new K({
|
|
1948
1948
|
message: "No object generated: response did not match schema.",
|
|
1949
|
-
cause: new
|
|
1949
|
+
cause: new k({
|
|
1950
1950
|
value: i,
|
|
1951
1951
|
cause: "response must be an object that contains a choice value."
|
|
1952
1952
|
}),
|
|
@@ -1980,8 +1980,8 @@ var In = () => ({
|
|
|
1980
1980
|
...t != null && { description: t }
|
|
1981
1981
|
}),
|
|
1982
1982
|
async parseCompleteOutput({ text: e }, t) {
|
|
1983
|
-
let n = await
|
|
1984
|
-
if (!n.success) throw new
|
|
1983
|
+
let n = await W({ text: e });
|
|
1984
|
+
if (!n.success) throw new K({
|
|
1985
1985
|
message: "No object generated: could not parse the response.",
|
|
1986
1986
|
cause: n.error,
|
|
1987
1987
|
text: e,
|
|
@@ -2002,175 +2002,175 @@ var In = () => ({
|
|
|
2002
2002
|
},
|
|
2003
2003
|
createElementStreamTransform() {}
|
|
2004
2004
|
});
|
|
2005
|
-
new TextEncoder(), new TextEncoder(),
|
|
2005
|
+
new TextEncoder(), new TextEncoder(), F({
|
|
2006
2006
|
prefix: "aitxt",
|
|
2007
2007
|
size: 24
|
|
2008
|
-
}),
|
|
2008
|
+
}), F({
|
|
2009
2009
|
prefix: "call",
|
|
2010
2010
|
size: 24
|
|
2011
2011
|
}), TransformStream;
|
|
2012
|
-
var Vn =
|
|
2013
|
-
|
|
2014
|
-
type:
|
|
2015
|
-
id:
|
|
2016
|
-
providerMetadata:
|
|
2012
|
+
var Vn = J.record(J.string(), Y.optional()), Hn = Wt(() => $t(J.union([
|
|
2013
|
+
J.looseObject({
|
|
2014
|
+
type: J.literal("text-start"),
|
|
2015
|
+
id: J.string(),
|
|
2016
|
+
providerMetadata: X.optional()
|
|
2017
2017
|
}),
|
|
2018
|
-
|
|
2019
|
-
type:
|
|
2020
|
-
id:
|
|
2021
|
-
delta:
|
|
2022
|
-
providerMetadata:
|
|
2018
|
+
J.looseObject({
|
|
2019
|
+
type: J.literal("text-delta"),
|
|
2020
|
+
id: J.string(),
|
|
2021
|
+
delta: J.string(),
|
|
2022
|
+
providerMetadata: X.optional()
|
|
2023
2023
|
}),
|
|
2024
|
-
|
|
2025
|
-
type:
|
|
2026
|
-
id:
|
|
2027
|
-
providerMetadata:
|
|
2024
|
+
J.looseObject({
|
|
2025
|
+
type: J.literal("text-end"),
|
|
2026
|
+
id: J.string(),
|
|
2027
|
+
providerMetadata: X.optional()
|
|
2028
2028
|
}),
|
|
2029
|
-
|
|
2030
|
-
type:
|
|
2031
|
-
errorText:
|
|
2029
|
+
J.looseObject({
|
|
2030
|
+
type: J.literal("error"),
|
|
2031
|
+
errorText: J.string()
|
|
2032
2032
|
}),
|
|
2033
|
-
|
|
2034
|
-
type:
|
|
2035
|
-
toolCallId:
|
|
2036
|
-
toolName:
|
|
2037
|
-
providerExecuted:
|
|
2038
|
-
providerMetadata:
|
|
2033
|
+
J.looseObject({
|
|
2034
|
+
type: J.literal("tool-input-start"),
|
|
2035
|
+
toolCallId: J.string(),
|
|
2036
|
+
toolName: J.string(),
|
|
2037
|
+
providerExecuted: J.boolean().optional(),
|
|
2038
|
+
providerMetadata: X.optional(),
|
|
2039
2039
|
toolMetadata: Vn.optional(),
|
|
2040
|
-
dynamic:
|
|
2041
|
-
title:
|
|
2040
|
+
dynamic: J.boolean().optional(),
|
|
2041
|
+
title: J.string().optional()
|
|
2042
2042
|
}),
|
|
2043
|
-
|
|
2044
|
-
type:
|
|
2045
|
-
toolCallId:
|
|
2046
|
-
inputTextDelta:
|
|
2043
|
+
J.looseObject({
|
|
2044
|
+
type: J.literal("tool-input-delta"),
|
|
2045
|
+
toolCallId: J.string(),
|
|
2046
|
+
inputTextDelta: J.string()
|
|
2047
2047
|
}),
|
|
2048
|
-
|
|
2049
|
-
type:
|
|
2050
|
-
toolCallId:
|
|
2051
|
-
toolName:
|
|
2052
|
-
input:
|
|
2053
|
-
providerExecuted:
|
|
2054
|
-
providerMetadata:
|
|
2048
|
+
J.looseObject({
|
|
2049
|
+
type: J.literal("tool-input-available"),
|
|
2050
|
+
toolCallId: J.string(),
|
|
2051
|
+
toolName: J.string(),
|
|
2052
|
+
input: J.unknown(),
|
|
2053
|
+
providerExecuted: J.boolean().optional(),
|
|
2054
|
+
providerMetadata: X.optional(),
|
|
2055
2055
|
toolMetadata: Vn.optional(),
|
|
2056
|
-
dynamic:
|
|
2057
|
-
title:
|
|
2056
|
+
dynamic: J.boolean().optional(),
|
|
2057
|
+
title: J.string().optional()
|
|
2058
2058
|
}),
|
|
2059
|
-
|
|
2060
|
-
type:
|
|
2061
|
-
toolCallId:
|
|
2062
|
-
toolName:
|
|
2063
|
-
input:
|
|
2064
|
-
providerExecuted:
|
|
2065
|
-
providerMetadata:
|
|
2059
|
+
J.looseObject({
|
|
2060
|
+
type: J.literal("tool-input-error"),
|
|
2061
|
+
toolCallId: J.string(),
|
|
2062
|
+
toolName: J.string(),
|
|
2063
|
+
input: J.unknown(),
|
|
2064
|
+
providerExecuted: J.boolean().optional(),
|
|
2065
|
+
providerMetadata: X.optional(),
|
|
2066
2066
|
toolMetadata: Vn.optional(),
|
|
2067
|
-
dynamic:
|
|
2068
|
-
errorText:
|
|
2069
|
-
title:
|
|
2067
|
+
dynamic: J.boolean().optional(),
|
|
2068
|
+
errorText: J.string(),
|
|
2069
|
+
title: J.string().optional()
|
|
2070
2070
|
}),
|
|
2071
|
-
|
|
2072
|
-
type:
|
|
2073
|
-
approvalId:
|
|
2074
|
-
toolCallId:
|
|
2075
|
-
isAutomatic:
|
|
2076
|
-
signature:
|
|
2071
|
+
J.looseObject({
|
|
2072
|
+
type: J.literal("tool-approval-request"),
|
|
2073
|
+
approvalId: J.string(),
|
|
2074
|
+
toolCallId: J.string(),
|
|
2075
|
+
isAutomatic: J.boolean().optional(),
|
|
2076
|
+
signature: J.string().optional()
|
|
2077
2077
|
}),
|
|
2078
|
-
|
|
2079
|
-
type:
|
|
2080
|
-
approvalId:
|
|
2081
|
-
approved:
|
|
2082
|
-
reason:
|
|
2083
|
-
providerExecuted:
|
|
2084
|
-
providerMetadata:
|
|
2078
|
+
J.looseObject({
|
|
2079
|
+
type: J.literal("tool-approval-response"),
|
|
2080
|
+
approvalId: J.string(),
|
|
2081
|
+
approved: J.boolean(),
|
|
2082
|
+
reason: J.string().optional(),
|
|
2083
|
+
providerExecuted: J.boolean().optional(),
|
|
2084
|
+
providerMetadata: X.optional()
|
|
2085
2085
|
}),
|
|
2086
|
-
|
|
2087
|
-
type:
|
|
2088
|
-
toolCallId:
|
|
2089
|
-
output:
|
|
2090
|
-
providerExecuted:
|
|
2091
|
-
providerMetadata:
|
|
2086
|
+
J.looseObject({
|
|
2087
|
+
type: J.literal("tool-output-available"),
|
|
2088
|
+
toolCallId: J.string(),
|
|
2089
|
+
output: J.unknown(),
|
|
2090
|
+
providerExecuted: J.boolean().optional(),
|
|
2091
|
+
providerMetadata: X.optional(),
|
|
2092
2092
|
toolMetadata: Vn.optional(),
|
|
2093
|
-
dynamic:
|
|
2094
|
-
preliminary:
|
|
2093
|
+
dynamic: J.boolean().optional(),
|
|
2094
|
+
preliminary: J.boolean().optional()
|
|
2095
2095
|
}),
|
|
2096
|
-
|
|
2097
|
-
type:
|
|
2098
|
-
toolCallId:
|
|
2099
|
-
errorText:
|
|
2100
|
-
providerExecuted:
|
|
2101
|
-
providerMetadata:
|
|
2096
|
+
J.looseObject({
|
|
2097
|
+
type: J.literal("tool-output-error"),
|
|
2098
|
+
toolCallId: J.string(),
|
|
2099
|
+
errorText: J.string(),
|
|
2100
|
+
providerExecuted: J.boolean().optional(),
|
|
2101
|
+
providerMetadata: X.optional(),
|
|
2102
2102
|
toolMetadata: Vn.optional(),
|
|
2103
|
-
dynamic:
|
|
2103
|
+
dynamic: J.boolean().optional()
|
|
2104
2104
|
}),
|
|
2105
|
-
|
|
2106
|
-
type:
|
|
2107
|
-
toolCallId:
|
|
2105
|
+
J.looseObject({
|
|
2106
|
+
type: J.literal("tool-output-denied"),
|
|
2107
|
+
toolCallId: J.string()
|
|
2108
2108
|
}),
|
|
2109
|
-
|
|
2110
|
-
type:
|
|
2111
|
-
id:
|
|
2112
|
-
providerMetadata:
|
|
2109
|
+
J.looseObject({
|
|
2110
|
+
type: J.literal("reasoning-start"),
|
|
2111
|
+
id: J.string(),
|
|
2112
|
+
providerMetadata: X.optional()
|
|
2113
2113
|
}),
|
|
2114
|
-
|
|
2115
|
-
type:
|
|
2116
|
-
id:
|
|
2117
|
-
delta:
|
|
2118
|
-
providerMetadata:
|
|
2114
|
+
J.looseObject({
|
|
2115
|
+
type: J.literal("reasoning-delta"),
|
|
2116
|
+
id: J.string(),
|
|
2117
|
+
delta: J.string(),
|
|
2118
|
+
providerMetadata: X.optional()
|
|
2119
2119
|
}),
|
|
2120
|
-
|
|
2121
|
-
type:
|
|
2122
|
-
id:
|
|
2123
|
-
providerMetadata:
|
|
2120
|
+
J.looseObject({
|
|
2121
|
+
type: J.literal("reasoning-end"),
|
|
2122
|
+
id: J.string(),
|
|
2123
|
+
providerMetadata: X.optional()
|
|
2124
2124
|
}),
|
|
2125
|
-
|
|
2126
|
-
type:
|
|
2127
|
-
kind:
|
|
2128
|
-
providerMetadata:
|
|
2125
|
+
J.looseObject({
|
|
2126
|
+
type: J.literal("custom"),
|
|
2127
|
+
kind: J.string().transform((e) => e),
|
|
2128
|
+
providerMetadata: X.optional()
|
|
2129
2129
|
}),
|
|
2130
|
-
|
|
2131
|
-
type:
|
|
2132
|
-
sourceId:
|
|
2133
|
-
url:
|
|
2134
|
-
title:
|
|
2135
|
-
providerMetadata:
|
|
2130
|
+
J.looseObject({
|
|
2131
|
+
type: J.literal("source-url"),
|
|
2132
|
+
sourceId: J.string(),
|
|
2133
|
+
url: J.string(),
|
|
2134
|
+
title: J.string().optional(),
|
|
2135
|
+
providerMetadata: X.optional()
|
|
2136
2136
|
}),
|
|
2137
|
-
|
|
2138
|
-
type:
|
|
2139
|
-
sourceId:
|
|
2140
|
-
mediaType:
|
|
2141
|
-
title:
|
|
2142
|
-
filename:
|
|
2143
|
-
providerMetadata:
|
|
2137
|
+
J.looseObject({
|
|
2138
|
+
type: J.literal("source-document"),
|
|
2139
|
+
sourceId: J.string(),
|
|
2140
|
+
mediaType: J.string(),
|
|
2141
|
+
title: J.string(),
|
|
2142
|
+
filename: J.string().optional(),
|
|
2143
|
+
providerMetadata: X.optional()
|
|
2144
2144
|
}),
|
|
2145
|
-
|
|
2146
|
-
type:
|
|
2147
|
-
url:
|
|
2148
|
-
mediaType:
|
|
2149
|
-
providerMetadata:
|
|
2145
|
+
J.looseObject({
|
|
2146
|
+
type: J.literal("file"),
|
|
2147
|
+
url: J.string(),
|
|
2148
|
+
mediaType: J.string(),
|
|
2149
|
+
providerMetadata: X.optional()
|
|
2150
2150
|
}),
|
|
2151
|
-
|
|
2152
|
-
type:
|
|
2153
|
-
url:
|
|
2154
|
-
mediaType:
|
|
2155
|
-
providerMetadata:
|
|
2151
|
+
J.looseObject({
|
|
2152
|
+
type: J.literal("reasoning-file"),
|
|
2153
|
+
url: J.string(),
|
|
2154
|
+
mediaType: J.string(),
|
|
2155
|
+
providerMetadata: X.optional()
|
|
2156
2156
|
}),
|
|
2157
|
-
|
|
2158
|
-
type:
|
|
2159
|
-
id:
|
|
2160
|
-
data:
|
|
2161
|
-
transient:
|
|
2157
|
+
J.looseObject({
|
|
2158
|
+
type: J.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
2159
|
+
id: J.string().optional(),
|
|
2160
|
+
data: J.unknown(),
|
|
2161
|
+
transient: J.boolean().optional()
|
|
2162
2162
|
}),
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
type:
|
|
2168
|
-
messageId:
|
|
2169
|
-
messageMetadata:
|
|
2163
|
+
J.looseObject({ type: J.literal("start-step") }),
|
|
2164
|
+
J.looseObject({ type: J.literal("finish-step") }),
|
|
2165
|
+
J.looseObject({ type: J.literal("reset-step") }),
|
|
2166
|
+
J.looseObject({
|
|
2167
|
+
type: J.literal("start"),
|
|
2168
|
+
messageId: J.string().optional(),
|
|
2169
|
+
messageMetadata: J.unknown().optional()
|
|
2170
2170
|
}),
|
|
2171
|
-
|
|
2172
|
-
type:
|
|
2173
|
-
finishReason:
|
|
2171
|
+
J.looseObject({
|
|
2172
|
+
type: J.literal("finish"),
|
|
2173
|
+
finishReason: J.enum([
|
|
2174
2174
|
"stop",
|
|
2175
2175
|
"length",
|
|
2176
2176
|
"content-filter",
|
|
@@ -2178,21 +2178,21 @@ var Vn = Y.record(Y.string(), X.optional()), Hn = Wt(() => $t(Y.union([
|
|
|
2178
2178
|
"error",
|
|
2179
2179
|
"other"
|
|
2180
2180
|
]).optional(),
|
|
2181
|
-
messageMetadata:
|
|
2181
|
+
messageMetadata: J.unknown().optional()
|
|
2182
2182
|
}),
|
|
2183
|
-
|
|
2184
|
-
type:
|
|
2185
|
-
reason:
|
|
2183
|
+
J.looseObject({
|
|
2184
|
+
type: J.literal("abort"),
|
|
2185
|
+
reason: J.string().optional()
|
|
2186
2186
|
}),
|
|
2187
|
-
|
|
2188
|
-
type:
|
|
2189
|
-
messageMetadata:
|
|
2187
|
+
J.looseObject({
|
|
2188
|
+
type: J.literal("message-metadata"),
|
|
2189
|
+
messageMetadata: J.unknown()
|
|
2190
2190
|
})
|
|
2191
2191
|
])));
|
|
2192
2192
|
function Un(e) {
|
|
2193
2193
|
return e.type.startsWith("data-");
|
|
2194
2194
|
}
|
|
2195
|
-
function
|
|
2195
|
+
function Z() {
|
|
2196
2196
|
return /* @__PURE__ */ Object.create(null);
|
|
2197
2197
|
}
|
|
2198
2198
|
function Wn(e) {
|
|
@@ -2201,13 +2201,13 @@ function Wn(e) {
|
|
|
2201
2201
|
function Gn(e) {
|
|
2202
2202
|
return e.type === "dynamic-tool";
|
|
2203
2203
|
}
|
|
2204
|
-
function
|
|
2204
|
+
function Q(e) {
|
|
2205
2205
|
return Wn(e) || Gn(e);
|
|
2206
2206
|
}
|
|
2207
|
-
function
|
|
2207
|
+
function Kn(e) {
|
|
2208
2208
|
return e.type.split("-").slice(1).join("-");
|
|
2209
2209
|
}
|
|
2210
|
-
function
|
|
2210
|
+
function qn({ lastMessage: e, messageId: t }) {
|
|
2211
2211
|
return {
|
|
2212
2212
|
message: e?.role === "assistant" ? e : {
|
|
2213
2213
|
id: t,
|
|
@@ -2215,12 +2215,12 @@ function Jn({ lastMessage: e, messageId: t }) {
|
|
|
2215
2215
|
role: "assistant",
|
|
2216
2216
|
parts: []
|
|
2217
2217
|
},
|
|
2218
|
-
activeTextParts:
|
|
2219
|
-
activeReasoningParts:
|
|
2220
|
-
partialToolCalls:
|
|
2218
|
+
activeTextParts: Z(),
|
|
2219
|
+
activeReasoningParts: Z(),
|
|
2220
|
+
partialToolCalls: Z()
|
|
2221
2221
|
};
|
|
2222
2222
|
}
|
|
2223
|
-
function
|
|
2223
|
+
function Jn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o }) {
|
|
2224
2224
|
return e.pipeThrough(new TransformStream({ async transform(e, s) {
|
|
2225
2225
|
await r(async ({ state: r, write: c }) => {
|
|
2226
2226
|
function l() {
|
|
@@ -2229,7 +2229,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2229
2229
|
return e.slice(t + 1);
|
|
2230
2230
|
}
|
|
2231
2231
|
function u() {
|
|
2232
|
-
return l().filter(
|
|
2232
|
+
return l().filter(Q);
|
|
2233
2233
|
}
|
|
2234
2234
|
function d(e) {
|
|
2235
2235
|
let t = u().find((t) => t.toolCallId === e);
|
|
@@ -2237,13 +2237,13 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2237
2237
|
let n = r.message.parts;
|
|
2238
2238
|
for (let r = n.length - 1; r >= 0; r--) {
|
|
2239
2239
|
let i = n[r];
|
|
2240
|
-
if (
|
|
2240
|
+
if (Q(i) && i.toolCallId === e) {
|
|
2241
2241
|
t = i;
|
|
2242
2242
|
break;
|
|
2243
2243
|
}
|
|
2244
2244
|
}
|
|
2245
2245
|
}
|
|
2246
|
-
if (t == null) throw new
|
|
2246
|
+
if (t == null) throw new q({
|
|
2247
2247
|
chunkType: "tool-invocation",
|
|
2248
2248
|
chunkId: e,
|
|
2249
2249
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2251,8 +2251,8 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2251
2251
|
return t;
|
|
2252
2252
|
}
|
|
2253
2253
|
function f(e) {
|
|
2254
|
-
let t = r.message.parts.filter(
|
|
2255
|
-
if (t == null) throw new
|
|
2254
|
+
let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
|
|
2255
|
+
if (t == null) throw new q({
|
|
2256
2256
|
chunkType: "tool-approval-response",
|
|
2257
2257
|
chunkId: e,
|
|
2258
2258
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2339,7 +2339,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2339
2339
|
}
|
|
2340
2340
|
case "text-delta": {
|
|
2341
2341
|
let t = r.activeTextParts[e.id];
|
|
2342
|
-
if (t == null) throw new
|
|
2342
|
+
if (t == null) throw new q({
|
|
2343
2343
|
chunkType: "text-delta",
|
|
2344
2344
|
chunkId: e.id,
|
|
2345
2345
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2349,7 +2349,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2349
2349
|
}
|
|
2350
2350
|
case "text-end": {
|
|
2351
2351
|
let t = r.activeTextParts[e.id];
|
|
2352
|
-
if (t == null) throw new
|
|
2352
|
+
if (t == null) throw new q({
|
|
2353
2353
|
chunkType: "text-end",
|
|
2354
2354
|
chunkId: e.id,
|
|
2355
2355
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2379,7 +2379,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2379
2379
|
}
|
|
2380
2380
|
case "reasoning-delta": {
|
|
2381
2381
|
let t = r.activeReasoningParts[e.id];
|
|
2382
|
-
if (t == null) throw new
|
|
2382
|
+
if (t == null) throw new q({
|
|
2383
2383
|
chunkType: "reasoning-delta",
|
|
2384
2384
|
chunkId: e.id,
|
|
2385
2385
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2389,7 +2389,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2389
2389
|
}
|
|
2390
2390
|
case "reasoning-end": {
|
|
2391
2391
|
let t = r.activeReasoningParts[e.id];
|
|
2392
|
-
if (t == null) throw new
|
|
2392
|
+
if (t == null) throw new q({
|
|
2393
2393
|
chunkType: "reasoning-end",
|
|
2394
2394
|
chunkId: e.id,
|
|
2395
2395
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2457,7 +2457,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2457
2457
|
}
|
|
2458
2458
|
case "tool-input-delta": {
|
|
2459
2459
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2460
|
-
if (t == null) throw new
|
|
2460
|
+
if (t == null) throw new q({
|
|
2461
2461
|
chunkType: "tool-input-delta",
|
|
2462
2462
|
chunkId: e.toolCallId,
|
|
2463
2463
|
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.`
|
|
@@ -2503,7 +2503,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2503
2503
|
}), c(), a && !e.providerExecuted && await a({ toolCall: e });
|
|
2504
2504
|
break;
|
|
2505
2505
|
case "tool-input-error": {
|
|
2506
|
-
let t = l().filter(
|
|
2506
|
+
let t = l().filter(Q).find((t) => t.toolCallId === e.toolCallId);
|
|
2507
2507
|
(t == null ? e.dynamic : t.type === "dynamic-tool") ? m({
|
|
2508
2508
|
toolCallId: e.toolCallId,
|
|
2509
2509
|
toolName: e.toolName,
|
|
@@ -2566,7 +2566,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2566
2566
|
toolMetadata: t.toolMetadata
|
|
2567
2567
|
}, t) : p({
|
|
2568
2568
|
toolCallId: e.toolCallId,
|
|
2569
|
-
toolName:
|
|
2569
|
+
toolName: Kn(t),
|
|
2570
2570
|
state: "output-available",
|
|
2571
2571
|
input: t.input,
|
|
2572
2572
|
output: e.output,
|
|
@@ -2592,7 +2592,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2592
2592
|
toolMetadata: t.toolMetadata
|
|
2593
2593
|
}, t) : p({
|
|
2594
2594
|
toolCallId: e.toolCallId,
|
|
2595
|
-
toolName:
|
|
2595
|
+
toolName: Kn(t),
|
|
2596
2596
|
state: "output-error",
|
|
2597
2597
|
input: t.input,
|
|
2598
2598
|
rawInput: t.rawInput,
|
|
@@ -2608,11 +2608,11 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2608
2608
|
r.message.parts.push({ type: "step-start" });
|
|
2609
2609
|
break;
|
|
2610
2610
|
case "finish-step":
|
|
2611
|
-
r.activeTextParts =
|
|
2611
|
+
r.activeTextParts = Z(), r.activeReasoningParts = Z();
|
|
2612
2612
|
break;
|
|
2613
2613
|
case "reset-step": {
|
|
2614
2614
|
let e = l();
|
|
2615
|
-
r.activeTextParts =
|
|
2615
|
+
r.activeTextParts = Z(), r.activeReasoningParts = Z(), r.partialToolCalls = Z(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), c());
|
|
2616
2616
|
break;
|
|
2617
2617
|
}
|
|
2618
2618
|
case "start":
|
|
@@ -2653,7 +2653,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2653
2653
|
});
|
|
2654
2654
|
} }));
|
|
2655
2655
|
}
|
|
2656
|
-
async function
|
|
2656
|
+
async function Yn({ stream: e, onError: t, abortSignal: n }) {
|
|
2657
2657
|
let r = e.getReader(), i = () => {
|
|
2658
2658
|
r.cancel().catch(() => {});
|
|
2659
2659
|
};
|
|
@@ -2669,29 +2669,29 @@ async function Xn({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2669
2669
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2670
2670
|
}
|
|
2671
2671
|
}
|
|
2672
|
-
|
|
2672
|
+
F({
|
|
2673
2673
|
prefix: "aitxt",
|
|
2674
2674
|
size: 24
|
|
2675
|
-
}),
|
|
2675
|
+
}), F({
|
|
2676
2676
|
prefix: "call",
|
|
2677
2677
|
size: 24
|
|
2678
|
-
}),
|
|
2678
|
+
}), F({
|
|
2679
2679
|
prefix: "aitxt",
|
|
2680
2680
|
size: 24
|
|
2681
|
-
}),
|
|
2681
|
+
}), F({
|
|
2682
2682
|
prefix: "call",
|
|
2683
2683
|
size: 24
|
|
2684
|
-
}),
|
|
2684
|
+
}), J.record(J.string(), Y.optional()), J.record(J.string(), J.string()), F({
|
|
2685
2685
|
prefix: "call",
|
|
2686
2686
|
size: 24
|
|
2687
|
-
}),
|
|
2687
|
+
}), F({
|
|
2688
2688
|
prefix: "call",
|
|
2689
2689
|
size: 24
|
|
2690
|
-
}),
|
|
2690
|
+
}), F({
|
|
2691
2691
|
prefix: "aiobj",
|
|
2692
2692
|
size: 24
|
|
2693
2693
|
});
|
|
2694
|
-
var
|
|
2694
|
+
var Xn = class {
|
|
2695
2695
|
constructor() {
|
|
2696
2696
|
this.queue = [], this.isProcessing = !1;
|
|
2697
2697
|
}
|
|
@@ -2713,14 +2713,14 @@ var Zn = class {
|
|
|
2713
2713
|
});
|
|
2714
2714
|
}
|
|
2715
2715
|
};
|
|
2716
|
-
|
|
2716
|
+
F({
|
|
2717
2717
|
prefix: "aiobj",
|
|
2718
2718
|
size: 24
|
|
2719
|
-
}),
|
|
2719
|
+
}), F({
|
|
2720
2720
|
prefix: "call",
|
|
2721
2721
|
size: 24
|
|
2722
2722
|
});
|
|
2723
|
-
async function
|
|
2723
|
+
async function Zn(e) {
|
|
2724
2724
|
if (e == null) return [];
|
|
2725
2725
|
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw Error("FileList is not supported in the current environment");
|
|
2726
2726
|
return Promise.all(Array.from(e).map(async (e) => {
|
|
@@ -2738,14 +2738,14 @@ async function Qn(e) {
|
|
|
2738
2738
|
};
|
|
2739
2739
|
}));
|
|
2740
2740
|
}
|
|
2741
|
-
var
|
|
2741
|
+
var Qn = class {
|
|
2742
2742
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
2743
2743
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2744
2744
|
}
|
|
2745
2745
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2746
|
-
let n = await
|
|
2747
|
-
...
|
|
2748
|
-
...
|
|
2746
|
+
let n = await G(this.body), r = await G(this.headers), i = await G(this.credentials), a = {
|
|
2747
|
+
...L(r),
|
|
2748
|
+
...L(t.headers)
|
|
2749
2749
|
}, o = await this.prepareSendMessagesRequest?.call(this, {
|
|
2750
2750
|
api: this.api,
|
|
2751
2751
|
id: t.chatId,
|
|
@@ -2759,7 +2759,7 @@ var $n = class {
|
|
|
2759
2759
|
requestMetadata: t.metadata,
|
|
2760
2760
|
trigger: t.trigger,
|
|
2761
2761
|
messageId: t.messageId
|
|
2762
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
2762
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : L(o.headers), l = o?.body === void 0 ? {
|
|
2763
2763
|
...n,
|
|
2764
2764
|
...t.body,
|
|
2765
2765
|
id: t.chatId,
|
|
@@ -2781,9 +2781,9 @@ var $n = class {
|
|
|
2781
2781
|
return this.processResponseStream(d.body);
|
|
2782
2782
|
}
|
|
2783
2783
|
async reconnectToStream(e) {
|
|
2784
|
-
let t = await
|
|
2785
|
-
...
|
|
2786
|
-
...
|
|
2784
|
+
let t = await G(this.body), n = await G(this.headers), r = await G(this.credentials), i = {
|
|
2785
|
+
...L(n),
|
|
2786
|
+
...L(e.headers)
|
|
2787
2787
|
}, a = await this.prepareReconnectToStreamRequest?.call(this, {
|
|
2788
2788
|
api: this.api,
|
|
2789
2789
|
id: e.chatId,
|
|
@@ -2794,7 +2794,7 @@ var $n = class {
|
|
|
2794
2794
|
headers: i,
|
|
2795
2795
|
credentials: r,
|
|
2796
2796
|
requestMetadata: e.metadata
|
|
2797
|
-
}), o = a?.api ?? `${this.api}/${e.chatId}/stream`, s = a?.headers === void 0 ? i :
|
|
2797
|
+
}), o = a?.api ?? `${this.api}/${e.chatId}/stream`, s = a?.headers === void 0 ? i : L(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2798
2798
|
method: "GET",
|
|
2799
2799
|
headers: s,
|
|
2800
2800
|
credentials: c,
|
|
@@ -2805,7 +2805,7 @@ var $n = class {
|
|
|
2805
2805
|
if (!l.body) throw Error("The response body is empty.");
|
|
2806
2806
|
return this.processResponseStream(l.body);
|
|
2807
2807
|
}
|
|
2808
|
-
},
|
|
2808
|
+
}, $n = class extends Qn {
|
|
2809
2809
|
constructor(e = {}) {
|
|
2810
2810
|
super(e);
|
|
2811
2811
|
}
|
|
@@ -2818,9 +2818,9 @@ var $n = class {
|
|
|
2818
2818
|
t.enqueue(e.value);
|
|
2819
2819
|
} }));
|
|
2820
2820
|
}
|
|
2821
|
-
},
|
|
2822
|
-
constructor({ generateId: e =
|
|
2823
|
-
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new
|
|
2821
|
+
}, er = class {
|
|
2822
|
+
constructor({ generateId: e = I, id: t = e(), transport: n = new $n(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
2823
|
+
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new Xn(), this.sendMessage = async (e, t) => {
|
|
2824
2824
|
if (e == null) {
|
|
2825
2825
|
await this.makeRequest({
|
|
2826
2826
|
trigger: "submit-message",
|
|
@@ -2835,7 +2835,7 @@ var $n = class {
|
|
|
2835
2835
|
this.pendingMessagePreparations.add(t);
|
|
2836
2836
|
let r;
|
|
2837
2837
|
try {
|
|
2838
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
2838
|
+
r = Array.isArray(e.files) ? e.files : await Zn(e.files);
|
|
2839
2839
|
} finally {
|
|
2840
2840
|
this.pendingMessagePreparations.delete(t);
|
|
2841
2841
|
}
|
|
@@ -2882,7 +2882,7 @@ var $n = class {
|
|
|
2882
2882
|
}, this.clearError = () => {
|
|
2883
2883
|
this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
|
|
2884
2884
|
}, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
|
|
2885
|
-
let i = this.state.messages, a = i[i.length - 1], o = (r) =>
|
|
2885
|
+
let i = this.state.messages, a = i[i.length - 1], o = (r) => Q(r) && r.state === "approval-requested" && r.approval.id === e ? {
|
|
2886
2886
|
...r,
|
|
2887
2887
|
state: "approval-responded",
|
|
2888
2888
|
approval: {
|
|
@@ -2903,7 +2903,7 @@ var $n = class {
|
|
|
2903
2903
|
});
|
|
2904
2904
|
});
|
|
2905
2905
|
}), this.addToolOutput = async ({ state: e = "output-available", toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
|
|
2906
|
-
let a = this.state.messages, o = a[a.length - 1], s = (i) =>
|
|
2906
|
+
let a = this.state.messages, o = a[a.length - 1], s = (i) => Q(i) && i.toolCallId === t ? {
|
|
2907
2907
|
...i,
|
|
2908
2908
|
state: e,
|
|
2909
2909
|
output: n,
|
|
@@ -2991,7 +2991,7 @@ var $n = class {
|
|
|
2991
2991
|
let f = this.lastMessage, p = !1, m = !1, h = !1, g;
|
|
2992
2992
|
try {
|
|
2993
2993
|
let a = {
|
|
2994
|
-
state:
|
|
2994
|
+
state: qn({
|
|
2995
2995
|
lastMessage: e === "resume-stream" || e === "regenerate-message" ? void 0 : this.state.snapshot(f),
|
|
2996
2996
|
messageId: this.generateId()
|
|
2997
2997
|
}),
|
|
@@ -3010,8 +3010,8 @@ var $n = class {
|
|
|
3010
3010
|
body: r,
|
|
3011
3011
|
trigger: e,
|
|
3012
3012
|
messageId: i
|
|
3013
|
-
}), await
|
|
3014
|
-
stream:
|
|
3013
|
+
}), await Yn({
|
|
3014
|
+
stream: Jn({
|
|
3015
3015
|
stream: o,
|
|
3016
3016
|
onToolCall: this.onToolCall,
|
|
3017
3017
|
onData: this.onData,
|
|
@@ -3063,39 +3063,39 @@ var $n = class {
|
|
|
3063
3063
|
});
|
|
3064
3064
|
}
|
|
3065
3065
|
};
|
|
3066
|
-
function
|
|
3066
|
+
function tr({ messages: e }) {
|
|
3067
3067
|
let t = e[e.length - 1];
|
|
3068
3068
|
if (!t || t.role !== "assistant") return !1;
|
|
3069
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(
|
|
3069
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
|
|
3070
3070
|
return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" || e.state === "output-error" || e.state === "approval-responded");
|
|
3071
3071
|
}
|
|
3072
3072
|
//#endregion
|
|
3073
3073
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.41_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
|
|
3074
|
-
var
|
|
3075
|
-
function
|
|
3074
|
+
var nr = /* @__PURE__ */ new WeakMap(), rr = 0;
|
|
3075
|
+
function ir(e) {
|
|
3076
3076
|
if (!e.length) return "";
|
|
3077
3077
|
for (var t = "arg", n = 0; n < e.length; ++n) {
|
|
3078
3078
|
var r = void 0;
|
|
3079
|
-
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) :
|
|
3079
|
+
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : nr.has(e[n]) ? r = nr.get(e[n]) : (r = rr, nr.set(e[n], rr++)), t += "@" + r;
|
|
3080
3080
|
}
|
|
3081
3081
|
return t;
|
|
3082
3082
|
}
|
|
3083
3083
|
//#endregion
|
|
3084
3084
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.41_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
|
|
3085
|
-
function
|
|
3085
|
+
function ar(e) {
|
|
3086
3086
|
if (typeof e == "function") try {
|
|
3087
3087
|
e = e();
|
|
3088
3088
|
} catch {
|
|
3089
3089
|
e = "";
|
|
3090
3090
|
}
|
|
3091
|
-
return e = Array.isArray(e) ?
|
|
3091
|
+
return e = Array.isArray(e) ? ir(e) : String(e || ""), e;
|
|
3092
3092
|
}
|
|
3093
|
-
var
|
|
3093
|
+
var or = function() {
|
|
3094
3094
|
function e(e) {
|
|
3095
3095
|
e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
|
|
3096
3096
|
}
|
|
3097
3097
|
return e.prototype.serializeKey = function(e) {
|
|
3098
|
-
return
|
|
3098
|
+
return ar(e);
|
|
3099
3099
|
}, e.prototype.get = function(e) {
|
|
3100
3100
|
var t = this.serializeKey(e);
|
|
3101
3101
|
return this.items.get(t);
|
|
@@ -3117,15 +3117,15 @@ var sr = function() {
|
|
|
3117
3117
|
}();
|
|
3118
3118
|
//#endregion
|
|
3119
3119
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.41_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
|
|
3120
|
-
function
|
|
3120
|
+
function sr() {
|
|
3121
3121
|
return navigator.onLine === void 0 || navigator.onLine;
|
|
3122
3122
|
}
|
|
3123
|
-
function
|
|
3123
|
+
function cr() {
|
|
3124
3124
|
return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
|
|
3125
3125
|
}
|
|
3126
|
-
var
|
|
3127
|
-
isOnline:
|
|
3128
|
-
isDocumentVisible:
|
|
3126
|
+
var lr = {
|
|
3127
|
+
isOnline: sr,
|
|
3128
|
+
isDocumentVisible: cr,
|
|
3129
3129
|
fetcher: function(e) {
|
|
3130
3130
|
return fetch(e).then(function(e) {
|
|
3131
3131
|
return e.json();
|
|
@@ -3136,7 +3136,7 @@ var ur = {
|
|
|
3136
3136
|
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
3137
3137
|
return e;
|
|
3138
3138
|
}, $.apply(this, arguments);
|
|
3139
|
-
},
|
|
3139
|
+
}, ur = function(e, t, n, r) {
|
|
3140
3140
|
function i(e) {
|
|
3141
3141
|
return e instanceof n ? e : new n(function(t) {
|
|
3142
3142
|
t(e);
|
|
@@ -3162,7 +3162,7 @@ var ur = {
|
|
|
3162
3162
|
}
|
|
3163
3163
|
c((r = r.apply(e, t || [])).next());
|
|
3164
3164
|
});
|
|
3165
|
-
},
|
|
3165
|
+
}, dr = function(e, t) {
|
|
3166
3166
|
var n = {
|
|
3167
3167
|
label: 0,
|
|
3168
3168
|
sent: function() {
|
|
@@ -3235,7 +3235,7 @@ var ur = {
|
|
|
3235
3235
|
done: !0
|
|
3236
3236
|
};
|
|
3237
3237
|
}
|
|
3238
|
-
},
|
|
3238
|
+
}, fr = function(e, t) {
|
|
3239
3239
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
3240
3240
|
if (!n) return e;
|
|
3241
3241
|
var r = n.call(e), i, a = [], o;
|
|
@@ -3251,11 +3251,11 @@ var ur = {
|
|
|
3251
3251
|
}
|
|
3252
3252
|
}
|
|
3253
3253
|
return a;
|
|
3254
|
-
},
|
|
3254
|
+
}, pr = function(e, t, n) {
|
|
3255
3255
|
if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
|
|
3256
3256
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
3257
|
-
},
|
|
3258
|
-
cache:
|
|
3257
|
+
}, mr = new or(), hr = new or(), gr = new or(), _r = {
|
|
3258
|
+
cache: mr,
|
|
3259
3259
|
refreshInterval: 0,
|
|
3260
3260
|
ttl: 0,
|
|
3261
3261
|
serverTTL: 1e3,
|
|
@@ -3265,15 +3265,15 @@ var ur = {
|
|
|
3265
3265
|
shouldRetryOnError: !0,
|
|
3266
3266
|
errorRetryInterval: 5e3,
|
|
3267
3267
|
errorRetryCount: 5,
|
|
3268
|
-
fetcher:
|
|
3269
|
-
isOnline:
|
|
3270
|
-
isDocumentVisible:
|
|
3268
|
+
fetcher: lr.fetcher,
|
|
3269
|
+
isOnline: lr.isOnline,
|
|
3270
|
+
isDocumentVisible: lr.isDocumentVisible
|
|
3271
3271
|
};
|
|
3272
|
-
function
|
|
3273
|
-
var r =
|
|
3274
|
-
r ? r.data.push(t) :
|
|
3272
|
+
function vr(e, t, n) {
|
|
3273
|
+
var r = hr.get(e);
|
|
3274
|
+
r ? r.data.push(t) : hr.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3275
3275
|
}
|
|
3276
|
-
function
|
|
3276
|
+
function yr(e, t, n) {
|
|
3277
3277
|
if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
|
|
3278
3278
|
var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
|
|
3279
3279
|
setTimeout(function() {
|
|
@@ -3284,17 +3284,17 @@ function br(e, t, n) {
|
|
|
3284
3284
|
}, i);
|
|
3285
3285
|
}
|
|
3286
3286
|
}
|
|
3287
|
-
function
|
|
3287
|
+
function br(e) {
|
|
3288
3288
|
var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
|
|
3289
|
-
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n :
|
|
3289
|
+
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : _r.shouldRetryOnError;
|
|
3290
3290
|
}
|
|
3291
|
-
var
|
|
3292
|
-
return n === void 0 && (n =
|
|
3291
|
+
var xr = function(e, t, n, r) {
|
|
3292
|
+
return n === void 0 && (n = mr), r === void 0 && (r = _r.ttl), ur(void 0, void 0, void 0, function() {
|
|
3293
3293
|
var i, a, o, s, c, l, u;
|
|
3294
|
-
return
|
|
3294
|
+
return dr(this, function(d) {
|
|
3295
3295
|
switch (d.label) {
|
|
3296
3296
|
case 0:
|
|
3297
|
-
if (!
|
|
3297
|
+
if (!Cr(t)) return [3, 5];
|
|
3298
3298
|
d.label = 1;
|
|
3299
3299
|
case 1: return d.trys.push([
|
|
3300
3300
|
1,
|
|
@@ -3316,7 +3316,7 @@ var Sr = function(e, t, n, r) {
|
|
|
3316
3316
|
} catch (e) {
|
|
3317
3317
|
console.error("swrv(mutate): failed to set cache", e);
|
|
3318
3318
|
}
|
|
3319
|
-
return l =
|
|
3319
|
+
return l = hr.get(e), l && l.data.length && (u = l.data.filter(function(t) {
|
|
3320
3320
|
return t.key === e;
|
|
3321
3321
|
}), u.forEach(function(e, t) {
|
|
3322
3322
|
c.data !== void 0 && (e.data = c.data), e.error = c.error, e.isValidating = c.isValidating, e.isLoading = c.isValidating, t !== u.length - 1 && delete u[t];
|
|
@@ -3325,16 +3325,16 @@ var Sr = function(e, t, n, r) {
|
|
|
3325
3325
|
});
|
|
3326
3326
|
});
|
|
3327
3327
|
};
|
|
3328
|
-
function
|
|
3328
|
+
function Sr() {
|
|
3329
3329
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3330
|
-
var r, i, a = $({},
|
|
3331
|
-
if (!
|
|
3330
|
+
var r, i, a = $({}, _r), o = !1, s = !1;
|
|
3331
|
+
if (!se()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3332
3332
|
var c = typeof window > "u" || typeof document > "u";
|
|
3333
3333
|
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
|
|
3334
3334
|
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : y(r);
|
|
3335
3335
|
i === void 0 && (i = a.fetcher);
|
|
3336
3336
|
var d = null;
|
|
3337
|
-
d ||=
|
|
3337
|
+
d ||= ue({
|
|
3338
3338
|
data: void 0,
|
|
3339
3339
|
error: void 0,
|
|
3340
3340
|
isValidating: !0,
|
|
@@ -3342,32 +3342,32 @@ function Cr() {
|
|
|
3342
3342
|
key: null
|
|
3343
3343
|
});
|
|
3344
3344
|
var f = function(t, n) {
|
|
3345
|
-
return
|
|
3345
|
+
return ur(e, void 0, void 0, function() {
|
|
3346
3346
|
var e, r, s, c, p, m, h, g = this;
|
|
3347
|
-
return
|
|
3347
|
+
return dr(this, function(_) {
|
|
3348
3348
|
switch (_.label) {
|
|
3349
3349
|
case 0: return e = d.data === void 0, r = u.value, r ? (s = a.cache.get(r), c = s && s.data, d.isValidating = !0, d.isLoading = !c, c && (d.data = c.data, d.error = c.error), p = t || i, !p || !a.isDocumentVisible() && !e || n?.forceRevalidate !== void 0 && !n?.forceRevalidate || s && (m = !!(Date.now() - s.createdAt >= a.dedupingInterval || n?.forceRevalidate), !m) ? (d.isValidating = !1, d.isLoading = !1, [2]) : (h = function() {
|
|
3350
|
-
return
|
|
3350
|
+
return ur(g, void 0, void 0, function() {
|
|
3351
3351
|
var e, t, i, s, c, u;
|
|
3352
|
-
return
|
|
3352
|
+
return dr(this, function(m) {
|
|
3353
3353
|
switch (m.label) {
|
|
3354
|
-
case 0: return e =
|
|
3354
|
+
case 0: return e = gr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, pr([], fr(t), !1)), gr.set(r, i, a.dedupingInterval), [4, xr(r, i, a.cache, l)]);
|
|
3355
3355
|
case 1: return m.sent(), [3, 4];
|
|
3356
|
-
case 2: return [4,
|
|
3356
|
+
case 2: return [4, xr(r, e.data, a.cache, l)];
|
|
3357
3357
|
case 3: m.sent(), m.label = 4;
|
|
3358
|
-
case 4: return d.isValidating = !1, d.isLoading = !1,
|
|
3358
|
+
case 4: return d.isValidating = !1, d.isLoading = !1, gr.delete(r), d.error !== void 0 && (s = br({
|
|
3359
3359
|
shouldRetry: a.shouldRetryOnError,
|
|
3360
3360
|
error: d.error
|
|
3361
|
-
}), c =
|
|
3361
|
+
}), c = br({
|
|
3362
3362
|
shouldRetry: !n || n.shouldRetryOnError,
|
|
3363
3363
|
error: d.error
|
|
3364
|
-
}), u = !o && s && c, u &&
|
|
3364
|
+
}), u = !o && s && c, u && yr(f, n ? n.errorRetryCount : 1, a)), [2];
|
|
3365
3365
|
}
|
|
3366
3366
|
});
|
|
3367
3367
|
});
|
|
3368
3368
|
}, c && a.revalidateDebounce ? (setTimeout(function() {
|
|
3369
|
-
return
|
|
3370
|
-
return
|
|
3369
|
+
return ur(g, void 0, void 0, function() {
|
|
3370
|
+
return dr(this, function(e) {
|
|
3371
3371
|
switch (e.label) {
|
|
3372
3372
|
case 0: return o ? [3, 2] : [4, h()];
|
|
3373
3373
|
case 1: e.sent(), e.label = 2;
|
|
@@ -3383,16 +3383,16 @@ function Cr() {
|
|
|
3383
3383
|
});
|
|
3384
3384
|
});
|
|
3385
3385
|
}, p = function() {
|
|
3386
|
-
return
|
|
3387
|
-
return
|
|
3386
|
+
return ur(e, void 0, void 0, function() {
|
|
3387
|
+
return dr(this, function(e) {
|
|
3388
3388
|
return [2, f(null, { shouldRetryOnError: !1 })];
|
|
3389
3389
|
});
|
|
3390
3390
|
});
|
|
3391
3391
|
}, m = null;
|
|
3392
3392
|
if (!c) {
|
|
3393
3393
|
var h = function() {
|
|
3394
|
-
return
|
|
3395
|
-
return
|
|
3394
|
+
return ur(e, void 0, void 0, function() {
|
|
3395
|
+
return dr(this, function(e) {
|
|
3396
3396
|
switch (e.label) {
|
|
3397
3397
|
case 0: return !d.error && a.isOnline() ? [4, f()] : [3, 2];
|
|
3398
3398
|
case 1: return e.sent(), [3, 3];
|
|
@@ -3404,30 +3404,30 @@ function Cr() {
|
|
|
3404
3404
|
};
|
|
3405
3405
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3406
3406
|
}
|
|
3407
|
-
|
|
3407
|
+
le(function() {
|
|
3408
3408
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3409
|
-
var e =
|
|
3409
|
+
var e = hr.get(u.value);
|
|
3410
3410
|
e && (e.data = e.data.filter(function(e) {
|
|
3411
3411
|
return e !== d;
|
|
3412
3412
|
}));
|
|
3413
3413
|
});
|
|
3414
3414
|
try {
|
|
3415
3415
|
fe(u, function(e) {
|
|
3416
|
-
|
|
3416
|
+
ce(u) || (u.value = e), d.key = e, d.isValidating = !!e, vr(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3417
3417
|
}, { immediate: !0 });
|
|
3418
3418
|
} catch {}
|
|
3419
|
-
return $($({},
|
|
3419
|
+
return $($({}, de(d)), { mutate: function(e, t) {
|
|
3420
3420
|
return f(e, $($({}, t), { forceRevalidate: !0 }));
|
|
3421
3421
|
} });
|
|
3422
3422
|
}
|
|
3423
|
-
function
|
|
3423
|
+
function Cr(e) {
|
|
3424
3424
|
return typeof e == "object" && !!e && typeof e.then == "function";
|
|
3425
3425
|
}
|
|
3426
3426
|
//#endregion
|
|
3427
3427
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.41_typescript@6.0.3_/node_modules/swrv/esm/index.js
|
|
3428
|
-
var
|
|
3429
|
-
|
|
3430
|
-
var
|
|
3428
|
+
var wr = Sr;
|
|
3429
|
+
wr.default, wr.default;
|
|
3430
|
+
var Tr = class {
|
|
3431
3431
|
constructor(e) {
|
|
3432
3432
|
this.statusRef = y("ready"), this.errorRef = y(void 0), this.pushMessage = (e) => {
|
|
3433
3433
|
this.messagesRef.value = [...this.messagesRef.value, e];
|
|
@@ -3455,78 +3455,52 @@ var Er = class {
|
|
|
3455
3455
|
set error(e) {
|
|
3456
3456
|
this.errorRef.value = e;
|
|
3457
3457
|
}
|
|
3458
|
-
},
|
|
3458
|
+
}, Er = class extends er {
|
|
3459
3459
|
constructor({ messages: e, ...t }) {
|
|
3460
3460
|
super({
|
|
3461
3461
|
...t,
|
|
3462
|
-
state: new
|
|
3462
|
+
state: new Tr(e)
|
|
3463
3463
|
});
|
|
3464
3464
|
}
|
|
3465
|
-
},
|
|
3466
|
-
let n = e
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
n = n.slice(e.length).trim();
|
|
3471
|
-
}
|
|
3472
|
-
}, Fr = (e, t) => Pr(kr(e), Nr(t)).length === 0, Ir = 8, Lr = (e, t, n = []) => {
|
|
3473
|
-
let r = Nr(n), i = e.flatMap((e) => {
|
|
3474
|
-
let t = [{
|
|
3475
|
-
role: e.role,
|
|
3476
|
-
text: Ar(e),
|
|
3477
|
-
isNewestAgentLine: !1,
|
|
3478
|
-
taken: !1
|
|
3479
|
-
}], n = e.role === "assistant" ? Mr(e) : void 0;
|
|
3480
|
-
return n && t.push({
|
|
3481
|
-
role: e.role,
|
|
3482
|
-
text: kr(n),
|
|
3483
|
-
isNewestAgentLine: !1,
|
|
3484
|
-
taken: !1
|
|
3485
|
-
}), t;
|
|
3486
|
-
});
|
|
3487
|
-
for (let e = i.length - 1; e >= 0; --e) {
|
|
3488
|
-
let t = i[e];
|
|
3489
|
-
if (t.role === "assistant" && t.text.length > 0) {
|
|
3490
|
-
t.isNewestAgentLine = !0;
|
|
3491
|
-
break;
|
|
3492
|
-
}
|
|
3493
|
-
}
|
|
3465
|
+
}, Dr = "voice-", Or = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), kr = (e) => Or(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Ar = 8, jr = (e, t) => {
|
|
3466
|
+
let n = e.filter((e) => e.role === "user").map((e) => ({
|
|
3467
|
+
text: kr(e),
|
|
3468
|
+
taken: !1
|
|
3469
|
+
}));
|
|
3494
3470
|
return t.filter((e) => {
|
|
3495
|
-
if (!e.id.startsWith("voice-")) return !1;
|
|
3496
|
-
let t =
|
|
3497
|
-
|
|
3498
|
-
let o = i.find((r) => !r.taken && r.role === e.role && r.text.length > 0 && (r.text === t || r.text.length >= Ir && t.endsWith(r.text) || n && (r.text === a || r.isNewestAgentLine && a.length >= Ir && r.text.startsWith(a))));
|
|
3499
|
-
return !o || (o.taken = !0, !1);
|
|
3471
|
+
if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
|
|
3472
|
+
let t = kr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Ar && t.endsWith(e.text)));
|
|
3473
|
+
return !r || (r.taken = !0, !1);
|
|
3500
3474
|
});
|
|
3501
|
-
},
|
|
3475
|
+
}, Mr = (e) => {
|
|
3502
3476
|
let t = e.type ?? "";
|
|
3503
3477
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
3504
|
-
},
|
|
3478
|
+
}, Nr = ({ messages: e }) => {
|
|
3505
3479
|
let t = e[e.length - 1];
|
|
3506
3480
|
if (!t || t.role !== "assistant") return !1;
|
|
3507
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && te(
|
|
3508
|
-
return r.length > 0 && r.every((e) =>
|
|
3481
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && te(Mr(e)));
|
|
3482
|
+
return r.length > 0 && r.every((e) => ne.has(e.state ?? ""));
|
|
3509
3483
|
};
|
|
3510
|
-
function
|
|
3511
|
-
return
|
|
3512
|
-
let { t, te: n, locale: r } = me({ useScope: "global" }), i = y(""), a = y(), o = y(e), s = y(), c = y(), l = y(), u = y(), d = y(), f = y(), p = y(), m = y(), h = y(), g = y(), _ = y(), ee = y(), te = y(), ne = y(),
|
|
3484
|
+
function Pr(e) {
|
|
3485
|
+
return b(`chatbot-${e}`, () => {
|
|
3486
|
+
let { t, te: n, locale: r } = me({ useScope: "global" }), i = y(""), a = y(), o = y(e), s = y(), c = y(), l = y(), u = y(), d = y(), f = y(), p = y(), m = y(), h = y(), g = y(), _ = y(), ee = y(), te = y(), ne = y(), se = y(), ce = y(), le = y(!1), ue = he(), de = v(() => {
|
|
3513
3487
|
let e = u.value?.theme;
|
|
3514
3488
|
return (!e || e === "auto") && (e = ce.value), e ? e === "dark" : ue.value;
|
|
3515
|
-
}), b = v(() => c.value === "reasoning"),
|
|
3489
|
+
}), b = v(() => c.value === "reasoning"), ve = v(() => b.value ? g.value?.filter((e) => ![
|
|
3516
3490
|
"upvote",
|
|
3517
3491
|
"downvote",
|
|
3518
3492
|
"feedback"
|
|
3519
|
-
].includes(e)) : g.value), ye =
|
|
3493
|
+
].includes(e)) : g.value), ye = oe(v(() => `${o.value}-chatId`), null);
|
|
3520
3494
|
pe(() => {
|
|
3521
|
-
ye.value ||=
|
|
3495
|
+
ye.value ||= I();
|
|
3522
3496
|
});
|
|
3523
3497
|
let x = v({
|
|
3524
3498
|
get: () => ye.value,
|
|
3525
3499
|
set: (e) => {
|
|
3526
3500
|
ye.value = e;
|
|
3527
3501
|
}
|
|
3528
|
-
}), S = y(), C = y(!1),
|
|
3529
|
-
function
|
|
3502
|
+
}), S = y(), C = y(!1), be = v(() => S.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
3503
|
+
function xe(e) {
|
|
3530
3504
|
try {
|
|
3531
3505
|
let t = JSON.parse(e.message);
|
|
3532
3506
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -3534,25 +3508,25 @@ function Br(e) {
|
|
|
3534
3508
|
return !1;
|
|
3535
3509
|
}
|
|
3536
3510
|
}
|
|
3537
|
-
function
|
|
3538
|
-
if (
|
|
3539
|
-
let e =
|
|
3540
|
-
x.value =
|
|
3511
|
+
function Se(e) {
|
|
3512
|
+
if (xe(e)) {
|
|
3513
|
+
let e = T.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ae(t) : void 0;
|
|
3514
|
+
x.value = I(), T.value.clearError(), S.value = void 0, n && T.value.sendMessage({ text: n });
|
|
3541
3515
|
return;
|
|
3542
3516
|
}
|
|
3543
|
-
|
|
3517
|
+
ie.error(e), S.value = e, be.value && (C.value = !0);
|
|
3544
3518
|
}
|
|
3545
|
-
let
|
|
3519
|
+
let w = v(() => re({
|
|
3546
3520
|
baseUrl: i.value,
|
|
3547
3521
|
basePath: a.value,
|
|
3548
3522
|
headers: () => p.value
|
|
3549
|
-
})),
|
|
3550
|
-
...
|
|
3551
|
-
...
|
|
3552
|
-
}),
|
|
3523
|
+
})), Ce = y(null), we = () => ({
|
|
3524
|
+
...ge(),
|
|
3525
|
+
...Ce.value ?? {}
|
|
3526
|
+
}), T = v(() => new Er({
|
|
3553
3527
|
id: x.value,
|
|
3554
|
-
transport: new
|
|
3555
|
-
api:
|
|
3528
|
+
transport: new $n({
|
|
3529
|
+
api: w.value.getChatEndpoint(o.value, b.value ? "reasoning" : "chat"),
|
|
3556
3530
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
3557
3531
|
id: t,
|
|
3558
3532
|
messages: [e[e.length - 1]],
|
|
@@ -3567,8 +3541,8 @@ function Br(e) {
|
|
|
3567
3541
|
reasoning: d.value?.reasoning,
|
|
3568
3542
|
webSearch: f.value?.webSearch,
|
|
3569
3543
|
smoothStream: u.value?.smoothStream,
|
|
3570
|
-
deviceContext:
|
|
3571
|
-
externalContext:
|
|
3544
|
+
deviceContext: we(),
|
|
3545
|
+
externalContext: se.value,
|
|
3572
3546
|
disabledTools: f.value?.disabled,
|
|
3573
3547
|
fallbackModels: te.value,
|
|
3574
3548
|
gatewayOptions: ne.value
|
|
@@ -3576,23 +3550,23 @@ function Br(e) {
|
|
|
3576
3550
|
credentials: "include",
|
|
3577
3551
|
headers: () => p.value ?? {}
|
|
3578
3552
|
}),
|
|
3579
|
-
sendAutomaticallyWhen: (e) =>
|
|
3580
|
-
onError:
|
|
3553
|
+
sendAutomaticallyWhen: (e) => Nr(e) || tr(e),
|
|
3554
|
+
onError: Se,
|
|
3581
3555
|
onFinish: () => {
|
|
3582
3556
|
let e = x.value;
|
|
3583
|
-
!b.value && !
|
|
3557
|
+
!b.value && !E.value.some((t) => t.id === e) && Re(o.value);
|
|
3584
3558
|
}
|
|
3585
|
-
})),
|
|
3559
|
+
})), Te = v(() => {
|
|
3586
3560
|
let e = u.value?.initialMessage;
|
|
3587
3561
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
3588
|
-
}),
|
|
3589
|
-
id:
|
|
3562
|
+
}), Ee = I(), De = v(() => ({
|
|
3563
|
+
id: Ee,
|
|
3590
3564
|
role: "assistant",
|
|
3591
3565
|
parts: [{
|
|
3592
3566
|
type: "text",
|
|
3593
|
-
text:
|
|
3567
|
+
text: Te.value
|
|
3594
3568
|
}]
|
|
3595
|
-
})),
|
|
3569
|
+
})), Oe = v(() => {
|
|
3596
3570
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
3597
3571
|
...e,
|
|
3598
3572
|
parts: e.parts.map((e) => {
|
|
@@ -3602,169 +3576,169 @@ function Br(e) {
|
|
|
3602
3576
|
let e = t.url.slice(13);
|
|
3603
3577
|
return {
|
|
3604
3578
|
...t,
|
|
3605
|
-
url:
|
|
3579
|
+
url: w.value.getMediaUrl(o.value, x.value, e)
|
|
3606
3580
|
};
|
|
3607
3581
|
}
|
|
3608
3582
|
return t.url.startsWith("blob:") ? t : {
|
|
3609
3583
|
...t,
|
|
3610
|
-
url:
|
|
3584
|
+
url: w.value.appendAuthToken(t.url)
|
|
3611
3585
|
};
|
|
3612
3586
|
})
|
|
3613
3587
|
});
|
|
3614
|
-
return b.value ? e(
|
|
3615
|
-
}),
|
|
3588
|
+
return b.value ? e(T.value.messages) : !le.value && T.value.messages?.[0]?.role !== "assistant" ? [De.value, ...e(T.value.messages)] : e(T.value.messages);
|
|
3589
|
+
}), ke = v(() => {
|
|
3616
3590
|
let e = u.value?.messagePlaceholder;
|
|
3617
3591
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3618
|
-
}),
|
|
3619
|
-
async function
|
|
3592
|
+
}), E = y([]), Ae = y(!1), D = y([]), je = y(!1), Me = y("chat"), O = y([]), k = y(), Ne = y(!1), Pe = y(!1), Fe = y(), A = y(!1), j = y(!1), Ie = y(), M = y(""), N = y([]), P = y(""), Le = y(0);
|
|
3593
|
+
async function Re(e) {
|
|
3620
3594
|
if (b.value) {
|
|
3621
|
-
|
|
3595
|
+
E.value = [];
|
|
3622
3596
|
return;
|
|
3623
3597
|
}
|
|
3624
|
-
|
|
3598
|
+
Ae.value = !0;
|
|
3625
3599
|
try {
|
|
3626
|
-
|
|
3600
|
+
E.value = await w.value.getConversations(e, l.value);
|
|
3627
3601
|
} catch {
|
|
3628
|
-
|
|
3602
|
+
E.value = [];
|
|
3629
3603
|
} finally {
|
|
3630
|
-
|
|
3604
|
+
Ae.value = !1;
|
|
3631
3605
|
}
|
|
3632
3606
|
}
|
|
3633
|
-
async function
|
|
3607
|
+
async function ze() {
|
|
3634
3608
|
let e = x.value;
|
|
3635
3609
|
if (!e) {
|
|
3636
|
-
|
|
3610
|
+
D.value = [];
|
|
3637
3611
|
return;
|
|
3638
3612
|
}
|
|
3639
|
-
|
|
3613
|
+
je.value = !0;
|
|
3640
3614
|
try {
|
|
3641
|
-
|
|
3615
|
+
D.value = await w.value.getChatFiles(e);
|
|
3642
3616
|
} catch {
|
|
3643
|
-
|
|
3617
|
+
D.value = [];
|
|
3644
3618
|
} finally {
|
|
3645
|
-
|
|
3619
|
+
je.value = !1;
|
|
3646
3620
|
}
|
|
3647
3621
|
}
|
|
3648
|
-
function
|
|
3649
|
-
return
|
|
3622
|
+
function Be(e, t = !1) {
|
|
3623
|
+
return w.value.getChatFileDownloadUrl(e, t);
|
|
3650
3624
|
}
|
|
3651
|
-
function
|
|
3652
|
-
return
|
|
3625
|
+
function F(e) {
|
|
3626
|
+
return w.value.getChatFilePreviewUrl(e);
|
|
3653
3627
|
}
|
|
3654
|
-
async function
|
|
3655
|
-
await
|
|
3628
|
+
async function L(e) {
|
|
3629
|
+
await w.value.deleteChatFile(e), D.value = D.value.filter((t) => t.documentId !== e);
|
|
3656
3630
|
}
|
|
3657
|
-
async function
|
|
3631
|
+
async function Ve(e, t) {
|
|
3658
3632
|
if (!b.value) try {
|
|
3659
|
-
let n = await
|
|
3660
|
-
if (t !== x.value ||
|
|
3661
|
-
n && (
|
|
3633
|
+
let n = await w.value.getChat(e, t);
|
|
3634
|
+
if (t !== x.value || T.value.status !== "ready" || T.value.messages.length > 0) return;
|
|
3635
|
+
n && (T.value.messages = n.messages, C.value = n.blocked ?? !1);
|
|
3662
3636
|
} catch {}
|
|
3663
3637
|
}
|
|
3664
|
-
let
|
|
3665
|
-
let e =
|
|
3638
|
+
let He = () => {
|
|
3639
|
+
let e = T.value.status;
|
|
3666
3640
|
return e === "submitted" || e === "streaming";
|
|
3667
|
-
},
|
|
3641
|
+
}, Ue = 0, We = 0;
|
|
3668
3642
|
async function Ge() {
|
|
3669
|
-
if (b.value ||
|
|
3670
|
-
let e = x.value, t =
|
|
3643
|
+
if (b.value || He()) return "indeterminate";
|
|
3644
|
+
let e = x.value, t = Ue += 1;
|
|
3671
3645
|
try {
|
|
3672
|
-
let n = await
|
|
3673
|
-
if (!n || e !== x.value ||
|
|
3674
|
-
|
|
3675
|
-
let r = n.messages, i =
|
|
3676
|
-
return
|
|
3646
|
+
let n = await w.value.getChat(o.value, e);
|
|
3647
|
+
if (!n || e !== x.value || He() || t <= We) return "indeterminate";
|
|
3648
|
+
We = t;
|
|
3649
|
+
let r = n.messages, i = jr(r, T.value.messages);
|
|
3650
|
+
return T.value.messages = [...r, ...i], C.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
3677
3651
|
} catch {}
|
|
3678
3652
|
return "indeterminate";
|
|
3679
3653
|
}
|
|
3680
3654
|
function Ke(e) {
|
|
3681
|
-
|
|
3655
|
+
T.value.messages = [...T.value.messages, e];
|
|
3682
3656
|
}
|
|
3683
3657
|
async function qe(e) {
|
|
3684
3658
|
try {
|
|
3685
|
-
|
|
3659
|
+
O.value = await w.value.getMessageFeedbacks(e);
|
|
3686
3660
|
} catch {
|
|
3687
|
-
|
|
3661
|
+
O.value = [];
|
|
3688
3662
|
}
|
|
3689
3663
|
}
|
|
3690
|
-
function
|
|
3691
|
-
let t =
|
|
3692
|
-
t >= 0 ?
|
|
3664
|
+
function R(e) {
|
|
3665
|
+
let t = O.value.findIndex((t) => t.messageId === e.messageId);
|
|
3666
|
+
t >= 0 ? O.value[t] = e : O.value.push(e);
|
|
3693
3667
|
}
|
|
3694
3668
|
function Je(e) {
|
|
3695
|
-
let t =
|
|
3669
|
+
let t = Oe.value, n = t.findIndex((t) => t.id === e.id), r = ae(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
3696
3670
|
return {
|
|
3697
|
-
userQuestion:
|
|
3671
|
+
userQuestion: ae(i ?? e) ?? "",
|
|
3698
3672
|
assistantMessage: r
|
|
3699
3673
|
};
|
|
3700
3674
|
}
|
|
3701
3675
|
async function Ye(e, t) {
|
|
3702
3676
|
await Promise.all([
|
|
3703
|
-
|
|
3704
|
-
|
|
3677
|
+
Ve(e, t),
|
|
3678
|
+
Re(e),
|
|
3705
3679
|
qe(t)
|
|
3706
|
-
]),
|
|
3707
|
-
e && (
|
|
3680
|
+
]), Ce.value || _e((e, t) => w.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
3681
|
+
e && (Ce.value = e);
|
|
3708
3682
|
});
|
|
3709
3683
|
}
|
|
3710
3684
|
async function Xe() {
|
|
3711
|
-
let e =
|
|
3685
|
+
let e = M.value.trim(), t = N.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
3712
3686
|
type: "file",
|
|
3713
3687
|
mediaType: e.mediaSource.mimeType,
|
|
3714
3688
|
url: e.localUrl,
|
|
3715
3689
|
filename: e.mediaSource.name,
|
|
3716
3690
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
3717
3691
|
}));
|
|
3718
|
-
b.value &&
|
|
3719
|
-
let n =
|
|
3692
|
+
b.value && Oe.value.length > 0 && await $e(), P.value = e, Le.value = T.value.messages.length;
|
|
3693
|
+
let n = T.value.sendMessage;
|
|
3720
3694
|
n({
|
|
3721
3695
|
text: e,
|
|
3722
3696
|
files: t.length > 0 ? t : void 0
|
|
3723
|
-
}),
|
|
3697
|
+
}), M.value = "", Qe();
|
|
3724
3698
|
}
|
|
3725
|
-
function
|
|
3699
|
+
function z(e) {
|
|
3726
3700
|
let t = e.trim();
|
|
3727
3701
|
if (!t) return;
|
|
3728
|
-
if (
|
|
3729
|
-
|
|
3702
|
+
if (T.value.status !== "ready") {
|
|
3703
|
+
ie.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
3730
3704
|
return;
|
|
3731
3705
|
}
|
|
3732
|
-
let n =
|
|
3706
|
+
let n = T.value.sendMessage;
|
|
3733
3707
|
n({ text: t });
|
|
3734
3708
|
}
|
|
3735
3709
|
async function Ze() {
|
|
3736
|
-
let e =
|
|
3737
|
-
await
|
|
3710
|
+
let e = P.value.length > 0;
|
|
3711
|
+
await T.value.stop(), e && (M.value = P.value, T.value.messages = T.value.messages.slice(0, Le.value), P.value = "");
|
|
3738
3712
|
}
|
|
3739
|
-
fe(() =>
|
|
3740
|
-
e === "ready" &&
|
|
3713
|
+
fe(() => T.value.status, (e) => {
|
|
3714
|
+
e === "ready" && P.value.length > 0 && (P.value = "");
|
|
3741
3715
|
});
|
|
3742
3716
|
function Qe(e = !1) {
|
|
3743
|
-
for (let t of
|
|
3744
|
-
|
|
3717
|
+
for (let t of N.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
3718
|
+
N.value = [], ct.value = null;
|
|
3745
3719
|
}
|
|
3746
3720
|
async function $e() {
|
|
3747
|
-
return
|
|
3721
|
+
return P.value = "", await Ze(), x.value = I(), T.value.clearError(), S.value = void 0, C.value = !1, Qe(!0), gt("chat"), x.value;
|
|
3748
3722
|
}
|
|
3749
3723
|
async function et(e) {
|
|
3750
|
-
|
|
3724
|
+
T.value.status !== "ready" && (P.value = "", await Ze()), await T.value.regenerate(e);
|
|
3751
3725
|
}
|
|
3752
3726
|
function tt(e) {
|
|
3753
3727
|
if (e.tool === "requestGeolocation") {
|
|
3754
3728
|
let t = e.output;
|
|
3755
|
-
"latitude" in t && (
|
|
3729
|
+
"latitude" in t && (Ce.value = {
|
|
3756
3730
|
geolocationLatitude: t.latitude,
|
|
3757
3731
|
geolocationLongitude: t.longitude,
|
|
3758
3732
|
geolocationAccuracy: t.accuracy,
|
|
3759
3733
|
geolocationCity: t.city
|
|
3760
3734
|
});
|
|
3761
3735
|
}
|
|
3762
|
-
|
|
3736
|
+
T.value.addToolOutput(e);
|
|
3763
3737
|
}
|
|
3764
3738
|
function nt(e) {
|
|
3765
|
-
|
|
3739
|
+
T.value.addToolApprovalResponse(e);
|
|
3766
3740
|
}
|
|
3767
|
-
let rt = v(() =>
|
|
3741
|
+
let rt = v(() => T.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), it = v(() => _.value?.maxFilesPerMessage ?? 5), at = v(() => _.value?.maxFilesPerChat ?? 20), ot = v(() => Math.max(0, Math.min(it.value - N.value.length, at.value - rt.value - N.value.length))), st = v(() => ot.value <= 0), ct = y(null), lt = () => {
|
|
3768
3742
|
ct.value = null;
|
|
3769
3743
|
};
|
|
3770
3744
|
fe(st, (e) => {
|
|
@@ -3772,7 +3746,7 @@ function Br(e) {
|
|
|
3772
3746
|
});
|
|
3773
3747
|
async function ut(e) {
|
|
3774
3748
|
if (st.value) {
|
|
3775
|
-
ct.value = at.value - rt.value -
|
|
3749
|
+
ct.value = at.value - rt.value - N.value.length <= it.value - N.value.length ? {
|
|
3776
3750
|
reason: "per-chat",
|
|
3777
3751
|
max: at.value
|
|
3778
3752
|
} : {
|
|
@@ -3781,32 +3755,32 @@ function Br(e) {
|
|
|
3781
3755
|
};
|
|
3782
3756
|
return;
|
|
3783
3757
|
}
|
|
3784
|
-
let t =
|
|
3758
|
+
let t = I(), n = {
|
|
3785
3759
|
id: t,
|
|
3786
3760
|
file: e,
|
|
3787
3761
|
localUrl: URL.createObjectURL(e),
|
|
3788
3762
|
state: "uploading"
|
|
3789
3763
|
};
|
|
3790
|
-
|
|
3764
|
+
N.value = [...N.value, n];
|
|
3791
3765
|
try {
|
|
3792
|
-
let n = await
|
|
3793
|
-
|
|
3766
|
+
let n = await w.value.uploadMedia(o.value, x.value, e);
|
|
3767
|
+
N.value = N.value.map((e) => e.id === t ? {
|
|
3794
3768
|
...e,
|
|
3795
3769
|
state: "done",
|
|
3796
3770
|
mediaSource: n
|
|
3797
3771
|
} : e);
|
|
3798
3772
|
} catch (e) {
|
|
3799
3773
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
3800
|
-
|
|
3774
|
+
N.value = N.value.map((e) => e.id === t ? {
|
|
3801
3775
|
...e,
|
|
3802
3776
|
state: "error",
|
|
3803
3777
|
error: n
|
|
3804
3778
|
} : e);
|
|
3805
3779
|
}
|
|
3806
3780
|
}
|
|
3807
|
-
async function
|
|
3781
|
+
async function B(e, t) {
|
|
3808
3782
|
let { userQuestion: n, assistantMessage: r } = Je(e);
|
|
3809
|
-
|
|
3783
|
+
R(await w.value.submitMessageFeedback({
|
|
3810
3784
|
messageId: e.id,
|
|
3811
3785
|
chatId: x.value,
|
|
3812
3786
|
agentId: o.value,
|
|
@@ -3816,61 +3790,61 @@ function Br(e) {
|
|
|
3816
3790
|
}));
|
|
3817
3791
|
}
|
|
3818
3792
|
async function dt(e) {
|
|
3819
|
-
await
|
|
3793
|
+
await B(e, "upvote");
|
|
3820
3794
|
}
|
|
3821
3795
|
async function ft(e) {
|
|
3822
|
-
await
|
|
3796
|
+
await B(e, "downvote");
|
|
3823
3797
|
}
|
|
3824
3798
|
function pt(e) {
|
|
3825
|
-
|
|
3799
|
+
Pe.value = !1, Fe.value = void 0, k.value = e;
|
|
3826
3800
|
}
|
|
3827
3801
|
async function mt(e) {
|
|
3828
|
-
if (
|
|
3829
|
-
|
|
3830
|
-
let { userQuestion: t, assistantMessage: n } = Je(
|
|
3831
|
-
|
|
3832
|
-
messageId:
|
|
3802
|
+
if (k.value) try {
|
|
3803
|
+
Ne.value = !0, Pe.value = !1, Fe.value = void 0;
|
|
3804
|
+
let { userQuestion: t, assistantMessage: n } = Je(k.value);
|
|
3805
|
+
R(await w.value.submitMessageFeedback({
|
|
3806
|
+
messageId: k.value.id,
|
|
3833
3807
|
chatId: x.value,
|
|
3834
3808
|
agentId: o.value,
|
|
3835
3809
|
userQuestion: t,
|
|
3836
3810
|
assistantMessage: n,
|
|
3837
3811
|
comment: e
|
|
3838
|
-
})),
|
|
3812
|
+
})), Pe.value = !0, await qe(x.value);
|
|
3839
3813
|
} catch {
|
|
3840
|
-
|
|
3814
|
+
Fe.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
3841
3815
|
} finally {
|
|
3842
|
-
|
|
3816
|
+
Ne.value = !1;
|
|
3843
3817
|
}
|
|
3844
3818
|
}
|
|
3845
|
-
async function
|
|
3819
|
+
async function V(e) {
|
|
3846
3820
|
try {
|
|
3847
|
-
|
|
3821
|
+
j.value = !0, A.value = !1, Ie.value = void 0, await w.value.submitLead({
|
|
3848
3822
|
agentId: o.value,
|
|
3849
3823
|
chatId: x.value,
|
|
3850
3824
|
...e
|
|
3851
|
-
}),
|
|
3825
|
+
}), A.value = !0;
|
|
3852
3826
|
} catch {
|
|
3853
|
-
|
|
3827
|
+
Ie.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
3854
3828
|
} finally {
|
|
3855
|
-
|
|
3829
|
+
j.value = !1;
|
|
3856
3830
|
}
|
|
3857
3831
|
}
|
|
3858
|
-
async function
|
|
3859
|
-
let n = await
|
|
3860
|
-
|
|
3832
|
+
async function H(e, t) {
|
|
3833
|
+
let n = await w.value.updateChatTitle(o.value, e, t);
|
|
3834
|
+
E.value = E.value.map((t) => t.id === e ? {
|
|
3861
3835
|
...t,
|
|
3862
3836
|
title: n.title
|
|
3863
3837
|
} : t);
|
|
3864
3838
|
}
|
|
3865
3839
|
async function ht(e) {
|
|
3866
|
-
await
|
|
3840
|
+
await w.value.deleteChat(o.value, e), E.value = E.value.filter((t) => t.id !== e), x.value === e && await $e();
|
|
3867
3841
|
}
|
|
3868
3842
|
function gt(e) {
|
|
3869
|
-
|
|
3843
|
+
Me.value = e;
|
|
3870
3844
|
}
|
|
3871
3845
|
let _t;
|
|
3872
3846
|
function vt(e) {
|
|
3873
|
-
let t = () =>
|
|
3847
|
+
let t = () => w.value.getChat(o.value, e).then((e) => e !== null);
|
|
3874
3848
|
return t().catch(() => t().catch(() => !1));
|
|
3875
3849
|
}
|
|
3876
3850
|
return fe(l, async (e) => {
|
|
@@ -3880,13 +3854,13 @@ function Br(e) {
|
|
|
3880
3854
|
let n = x.value, r = !b.value && await vt(n);
|
|
3881
3855
|
if (l.value === e && x.value === n) {
|
|
3882
3856
|
if (r) {
|
|
3883
|
-
|
|
3857
|
+
Re(o.value);
|
|
3884
3858
|
return;
|
|
3885
3859
|
}
|
|
3886
|
-
|
|
3860
|
+
E.value = [], O.value = [], D.value = [], await $e(), M.value = "";
|
|
3887
3861
|
}
|
|
3888
3862
|
}), {
|
|
3889
|
-
apiClient:
|
|
3863
|
+
apiClient: w,
|
|
3890
3864
|
baseUrl: i,
|
|
3891
3865
|
basePath: a,
|
|
3892
3866
|
agentId: o,
|
|
@@ -3900,50 +3874,49 @@ function Br(e) {
|
|
|
3900
3874
|
revisedAnswers: m,
|
|
3901
3875
|
model: h,
|
|
3902
3876
|
actionsInput: g,
|
|
3903
|
-
actions:
|
|
3877
|
+
actions: ve,
|
|
3904
3878
|
agentFileUpload: _,
|
|
3905
3879
|
agentVoice: ee,
|
|
3906
3880
|
fallbackModels: te,
|
|
3907
3881
|
gatewayOptions: ne,
|
|
3908
|
-
externalContext:
|
|
3882
|
+
externalContext: se,
|
|
3909
3883
|
systemTheme: ce,
|
|
3910
3884
|
hideWelcomeMessage: le,
|
|
3911
3885
|
isDark: de,
|
|
3912
|
-
chat:
|
|
3913
|
-
messages:
|
|
3914
|
-
conversations:
|
|
3915
|
-
isLoadingConversations:
|
|
3916
|
-
chatFiles:
|
|
3917
|
-
isLoadingChatFiles:
|
|
3918
|
-
input:
|
|
3919
|
-
pendingAttachments:
|
|
3886
|
+
chat: T,
|
|
3887
|
+
messages: Oe,
|
|
3888
|
+
conversations: E,
|
|
3889
|
+
isLoadingConversations: Ae,
|
|
3890
|
+
chatFiles: D,
|
|
3891
|
+
isLoadingChatFiles: je,
|
|
3892
|
+
input: M,
|
|
3893
|
+
pendingAttachments: N,
|
|
3920
3894
|
isAttachmentLimitReached: st,
|
|
3921
3895
|
fileLimitError: ct,
|
|
3922
3896
|
localChatId: x,
|
|
3923
3897
|
isConversationBlocked: C,
|
|
3924
|
-
inputMessagePlaceholder:
|
|
3898
|
+
inputMessagePlaceholder: ke,
|
|
3925
3899
|
chatError: S,
|
|
3926
|
-
activeView:
|
|
3927
|
-
messageFeedbacks:
|
|
3928
|
-
feedbackDialogMessage:
|
|
3929
|
-
isFeedbackSubmitting:
|
|
3930
|
-
isFeedbackSubmitted:
|
|
3931
|
-
feedbackSubmitError:
|
|
3932
|
-
isLeadSubmitted:
|
|
3933
|
-
isLoadingSubmitLead:
|
|
3934
|
-
submitLeadError:
|
|
3935
|
-
buildDeviceContext:
|
|
3900
|
+
activeView: Me,
|
|
3901
|
+
messageFeedbacks: O,
|
|
3902
|
+
feedbackDialogMessage: k,
|
|
3903
|
+
isFeedbackSubmitting: Ne,
|
|
3904
|
+
isFeedbackSubmitted: Pe,
|
|
3905
|
+
feedbackSubmitError: Fe,
|
|
3906
|
+
isLeadSubmitted: A,
|
|
3907
|
+
isLoadingSubmitLead: j,
|
|
3908
|
+
submitLeadError: Ie,
|
|
3909
|
+
buildDeviceContext: we,
|
|
3936
3910
|
initialize: Ye,
|
|
3937
|
-
loadConversations:
|
|
3938
|
-
loadChatFiles:
|
|
3911
|
+
loadConversations: Re,
|
|
3912
|
+
loadChatFiles: ze,
|
|
3939
3913
|
refreshMessages: Ge,
|
|
3940
3914
|
appendMessage: Ke,
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
deleteChatFile: I,
|
|
3915
|
+
getChatFileUrl: Be,
|
|
3916
|
+
getChatFilePreviewUrl: F,
|
|
3917
|
+
deleteChatFile: L,
|
|
3945
3918
|
handleSubmit: Xe,
|
|
3946
|
-
sendMessage:
|
|
3919
|
+
sendMessage: z,
|
|
3947
3920
|
stopGeneration: Ze,
|
|
3948
3921
|
startNewChat: $e,
|
|
3949
3922
|
regenerate: et,
|
|
@@ -3956,14 +3929,14 @@ function Br(e) {
|
|
|
3956
3929
|
onDownvote: ft,
|
|
3957
3930
|
onFeedback: pt,
|
|
3958
3931
|
onFeedbackSubmit: mt,
|
|
3959
|
-
onLeadSubmit:
|
|
3932
|
+
onLeadSubmit: V,
|
|
3960
3933
|
navigate: gt,
|
|
3961
|
-
renameChatTitle:
|
|
3934
|
+
renameChatTitle: H,
|
|
3962
3935
|
deleteChat: ht
|
|
3963
3936
|
};
|
|
3964
3937
|
})();
|
|
3965
3938
|
}
|
|
3966
3939
|
//#endregion
|
|
3967
|
-
export {
|
|
3940
|
+
export { I as a, $n as i, Pr as n, Er as r, Dr as t };
|
|
3968
3941
|
|
|
3969
|
-
//# sourceMappingURL=useChatbotStore-
|
|
3942
|
+
//# sourceMappingURL=useChatbotStore-DhWHlZwO.js.map
|