langgraph-vue3-chatbot 0.1.12 → 0.1.13
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-lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as z, openBlock as o, createElementBlock as _, createElementVNode as
|
|
1
|
+
import { defineComponent as z, openBlock as o, createElementBlock as _, createElementVNode as b, toDisplayString as q, createBlock as $, unref as n, createVNode as S, createCommentVNode as N, ref as M, Fragment as le, renderList as de, withDirectives as we, normalizeClass as X, resolveDynamicComponent as ge, vShow as Te, mergeProps as oe, withCtx as I, renderSlot as R, computed as A, createTextVNode as Be, inject as Ee, provide as De, watch as Me, onMounted as Ye, onBeforeUnmount as Ze, Transition as Qe, nextTick as pt, isRef as mt, vModelText as gt, normalizeProps as xe, guardReactiveProps as ke, useModel as ft, mergeModels as Ve, createStaticVNode as vt, useSlots as ht, normalizeStyle as et } from "vue";
|
|
2
2
|
import { Client as yt } from "@langchain/langgraph-sdk";
|
|
3
3
|
import { Minimize2Icon as _t, Maximize2Icon as bt, XIcon as tt, ChevronDownIcon as st, PlayCircle as Ne, XCircle as xt, CheckCircle as kt, Loader as wt, BookOpenCheck as $t, ListTodoIcon as Ct, ZapIcon as It, FileSearch as zt, FolderSearch as St, SquarePen as At, FileEditIcon as Mt, EyeIcon as Tt, FolderSearchIcon as Bt, FileTextIcon as nt, GlobeIcon as at, BrainIcon as Ot, WrenchIcon as Pt, ArrowDownIcon as jt, PaperclipIcon as ot, Music2Icon as Et, VideoIcon as Dt, ImageIcon as Lt, Loader2Icon as Rt, CornerDownLeftIcon as Ut, CheckIcon as Wt, ArrowUpRight as Ft, ChevronsDown as Vt, ChevronsUp as Nt, Circle as Kt, LoaderCircle as Gt, Ban as Ht, CircleCheckBig as qt, BotMessageSquare as Jt, X as Xt } from "lucide-vue-next";
|
|
4
4
|
import { clsx as Yt } from "clsx";
|
|
@@ -47,18 +47,18 @@ async function ds(s, t, e, a) {
|
|
|
47
47
|
const l = [], k = u.messages;
|
|
48
48
|
let T = 0;
|
|
49
49
|
for (; T < k.length; ) {
|
|
50
|
-
const
|
|
50
|
+
const j = k[T], G = j.type, Y = j.content;
|
|
51
51
|
if (G === "human" || G === "user") {
|
|
52
|
-
const Q = typeof Y == "string" ? Y : Array.isArray(Y) ? Y.filter((
|
|
52
|
+
const Q = typeof Y == "string" ? Y : Array.isArray(Y) ? Y.filter((J) => J.type === "text").map((J) => J.text).join("") : "";
|
|
53
53
|
l.push({
|
|
54
|
-
key:
|
|
54
|
+
key: j.id || `human-${Date.now()}-${Math.random()}`,
|
|
55
55
|
type: "human",
|
|
56
56
|
content: Q
|
|
57
57
|
}), T++;
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
60
|
if (G === "ai") {
|
|
61
|
-
const Q = typeof Y == "string" ? Y : Array.isArray(Y) ? Y.filter((U) => U.type === "text").map((U) => U.text).join("") : "",
|
|
61
|
+
const Q = typeof Y == "string" ? Y : Array.isArray(Y) ? Y.filter((U) => U.type === "text").map((U) => U.text).join("") : "", J = ((i = j.tool_calls) == null ? void 0 : i.map((U) => ({
|
|
62
62
|
id: U.id,
|
|
63
63
|
name: U.name,
|
|
64
64
|
args: JSON.stringify(U.args, null, 2),
|
|
@@ -66,11 +66,11 @@ async function ds(s, t, e, a) {
|
|
|
66
66
|
result: ""
|
|
67
67
|
}))) || [];
|
|
68
68
|
if (l.push({
|
|
69
|
-
key:
|
|
69
|
+
key: j.id || `ai-${Date.now()}-${Math.random()}`,
|
|
70
70
|
type: "ai",
|
|
71
71
|
content: Q,
|
|
72
|
-
toolCalls:
|
|
73
|
-
}),
|
|
72
|
+
toolCalls: J.length > 0 ? J : void 0
|
|
73
|
+
}), J.length > 0) {
|
|
74
74
|
let U = T + 1;
|
|
75
75
|
for (; U < k.length; ) {
|
|
76
76
|
const ee = k[U];
|
|
@@ -84,7 +84,7 @@ async function ds(s, t, e, a) {
|
|
|
84
84
|
default:
|
|
85
85
|
return "completed";
|
|
86
86
|
}
|
|
87
|
-
})(D), g =
|
|
87
|
+
})(D), g = J.find((y) => y.id === se);
|
|
88
88
|
if (g) {
|
|
89
89
|
g.result = H, g.state = d;
|
|
90
90
|
const y = `tool-${se}-${Date.now()}`;
|
|
@@ -112,17 +112,17 @@ async function ds(s, t, e, a) {
|
|
|
112
112
|
}
|
|
113
113
|
T++;
|
|
114
114
|
}
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
115
|
+
const x = u.generated_files;
|
|
116
|
+
if (x && Array.isArray(x) && x.length > 0) {
|
|
117
|
+
const j = {
|
|
118
118
|
type: "generated_files",
|
|
119
|
-
content:
|
|
119
|
+
content: x
|
|
120
120
|
};
|
|
121
121
|
l.push({
|
|
122
122
|
key: `custom-generated_files-${Date.now()}-${Math.random()}`,
|
|
123
123
|
type: "custom",
|
|
124
124
|
content: "",
|
|
125
|
-
customContent:
|
|
125
|
+
customContent: j
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
const v = u.suggested_questions;
|
|
@@ -147,11 +147,11 @@ const ps = { class: "chat-header" }, ms = { class: "chat-title" }, gs = { class:
|
|
|
147
147
|
setup(s, { emit: t }) {
|
|
148
148
|
const e = s, a = t;
|
|
149
149
|
return (i, r) => (o(), _("div", ps, [
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
b("div", ms, [
|
|
151
|
+
b("span", gs, q(s.title), 1)
|
|
152
152
|
]),
|
|
153
153
|
e.showHeaderActions ? (o(), _("div", fs, [
|
|
154
|
-
|
|
154
|
+
b("button", {
|
|
155
155
|
class: "action-btn",
|
|
156
156
|
onClick: r[0] || (r[0] = (u) => a("toggleMaximize")),
|
|
157
157
|
type: "button",
|
|
@@ -165,7 +165,7 @@ const ps = { class: "chat-header" }, ms = { class: "chat-title" }, gs = { class:
|
|
|
165
165
|
class: "size-4"
|
|
166
166
|
}))
|
|
167
167
|
], 8, vs),
|
|
168
|
-
|
|
168
|
+
b("button", {
|
|
169
169
|
class: "action-btn",
|
|
170
170
|
onClick: r[1] || (r[1] = (u) => a("close")),
|
|
171
171
|
type: "button",
|
|
@@ -191,8 +191,8 @@ const _s = { class: "mb-3 text-xs max-w-full" }, bs = ["onClick"], xs = { class:
|
|
|
191
191
|
toolCalls: {}
|
|
192
192
|
},
|
|
193
193
|
setup(s) {
|
|
194
|
-
const t = (
|
|
195
|
-
switch (
|
|
194
|
+
const t = (x) => {
|
|
195
|
+
switch (x) {
|
|
196
196
|
case "start":
|
|
197
197
|
return { icon: Ne, color: "text-blue-500" };
|
|
198
198
|
case "running":
|
|
@@ -230,43 +230,43 @@ const _s = { class: "mb-3 text-xs max-w-full" }, bs = ["onClick"], xs = { class:
|
|
|
230
230
|
execute: It,
|
|
231
231
|
write_todos: Ct,
|
|
232
232
|
task: $t
|
|
233
|
-
}, i = (
|
|
234
|
-
k.value[
|
|
233
|
+
}, i = (x) => e[x] || x, r = (x) => a[x] || Pt, u = (x) => x === "write_todos" || x.includes("todo"), l = (x) => x ? x.length > 50 ? x.slice(0, 100) + "..." : x : "", k = M({}), T = (x) => {
|
|
234
|
+
k.value[x] = !k.value[x];
|
|
235
235
|
};
|
|
236
|
-
return (
|
|
236
|
+
return (x, v) => (o(), _("div", _s, [
|
|
237
237
|
(o(!0), _(le, null, de(s.toolCalls, (C) => we((o(), _("div", {
|
|
238
238
|
key: C.id,
|
|
239
239
|
class: "overflow-hidden"
|
|
240
240
|
}, [
|
|
241
|
-
|
|
241
|
+
b("div", {
|
|
242
242
|
class: "flex items-center gap-2 w-full text-left hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer",
|
|
243
|
-
onClick: (
|
|
243
|
+
onClick: (j) => T(C.id)
|
|
244
244
|
}, [
|
|
245
245
|
S(n(st), {
|
|
246
246
|
class: X(["h-4 w-4 shrink-0", k.value[C.id] ? "" : "-rotate-90"])
|
|
247
247
|
}, null, 8, ["class"]),
|
|
248
248
|
(o(), $(ge(r(C.name)), { class: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })),
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
b("span", xs, q(i(C.name)), 1),
|
|
250
|
+
b("span", ks, q(l(C.args)), 1),
|
|
251
251
|
(o(), $(ge(t(C.state).icon), {
|
|
252
252
|
class: X(n(V)("h-3 w-3 shrink-0 ml-auto", t(C.state).color))
|
|
253
253
|
}, null, 8, ["class"]))
|
|
254
254
|
], 8, bs),
|
|
255
|
-
we(
|
|
256
|
-
|
|
257
|
-
v[0] || (v[0] =
|
|
258
|
-
|
|
255
|
+
we(b("div", ws, [
|
|
256
|
+
b("div", null, [
|
|
257
|
+
v[0] || (v[0] = b("p", { class: "text-muted-foreground mb-1" }, "请求:", -1)),
|
|
258
|
+
b("pre", $s, q(C.args), 1)
|
|
259
259
|
]),
|
|
260
260
|
C.result || C.error ? (o(), _("div", Cs, [
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
b("p", Is, q(C.state === "error" ? "Error:" : "结果:"), 1),
|
|
262
|
+
b("pre", {
|
|
263
263
|
class: X(
|
|
264
264
|
n(V)(
|
|
265
265
|
"bg-muted p-2 rounded text-[10px] overflow-x-auto max-w-full",
|
|
266
266
|
C.state === "error" && "text-red-500"
|
|
267
267
|
)
|
|
268
268
|
)
|
|
269
|
-
},
|
|
269
|
+
}, q(C.error || C.result), 3)
|
|
270
270
|
])) : N("", !0)
|
|
271
271
|
], 512), [
|
|
272
272
|
[Te, k.value[C.id]]
|
|
@@ -478,7 +478,7 @@ const _s = { class: "mb-3 text-xs max-w-full" }, bs = ["onClick"], xs = { class:
|
|
|
478
478
|
"defer-nodes-until-visible": !0,
|
|
479
479
|
"viewport-priority": !0
|
|
480
480
|
}, null, 8, ["content"])) : (o(), _(le, { key: 1 }, [
|
|
481
|
-
Be(
|
|
481
|
+
Be(q(r.content), 1)
|
|
482
482
|
], 64))
|
|
483
483
|
]),
|
|
484
484
|
_: 2
|
|
@@ -491,10 +491,10 @@ const _s = { class: "mb-3 text-xs max-w-full" }, bs = ["onClick"], xs = { class:
|
|
|
491
491
|
from: "assistant"
|
|
492
492
|
}, {
|
|
493
493
|
default: I(() => [...i[0] || (i[0] = [
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
494
|
+
b("div", { class: "loading-indicator" }, [
|
|
495
|
+
b("span", { class: "dot" }),
|
|
496
|
+
b("span", { class: "dot" }),
|
|
497
|
+
b("span", { class: "dot" })
|
|
498
498
|
], -1)
|
|
499
499
|
])]),
|
|
500
500
|
_: 1
|
|
@@ -592,8 +592,8 @@ const Ds = /* @__PURE__ */ z({
|
|
|
592
592
|
key: 0,
|
|
593
593
|
class: n(V)("min-w-0 flex-1", t.class)
|
|
594
594
|
}, r.$attrs), [
|
|
595
|
-
|
|
596
|
-
t.showMediaType && n(e).mediaType ? (o(), _("span", Rs,
|
|
595
|
+
b("span", Ls, q(i.value), 1),
|
|
596
|
+
t.showMediaType && n(e).mediaType ? (o(), _("span", Rs, q(n(e).mediaType), 1)) : N("", !0)
|
|
597
597
|
], 16)) : N("", !0);
|
|
598
598
|
}
|
|
599
599
|
}), Ws = ["alt", "height", "src", "width"], Fs = ["src"], Vs = /* @__PURE__ */ z({
|
|
@@ -607,17 +607,17 @@ const Ds = /* @__PURE__ */ z({
|
|
|
607
607
|
() => a.value === "image" && e.value.type === "file" && !!l.value
|
|
608
608
|
), T = A(
|
|
609
609
|
() => a.value === "video" && e.value.type === "file" && !!l.value
|
|
610
|
-
),
|
|
610
|
+
), x = {
|
|
611
611
|
image: Lt,
|
|
612
612
|
video: Dt,
|
|
613
613
|
audio: Et,
|
|
614
614
|
source: at,
|
|
615
615
|
document: nt,
|
|
616
616
|
unknown: ot
|
|
617
|
-
}, v = A(() =>
|
|
617
|
+
}, v = A(() => x[a.value]), C = A(
|
|
618
618
|
() => (e.value.type === "file" ? e.value.filename : void 0) || "Image"
|
|
619
619
|
);
|
|
620
|
-
return (
|
|
620
|
+
return (j, G) => (o(), _("div", oe({
|
|
621
621
|
class: n(V)(
|
|
622
622
|
"flex shrink-0 items-center justify-center overflow-hidden",
|
|
623
623
|
n(i) === "grid" && "size-full bg-muted",
|
|
@@ -625,7 +625,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
625
625
|
n(i) === "list" && "size-12 rounded bg-muted",
|
|
626
626
|
t.class
|
|
627
627
|
)
|
|
628
|
-
},
|
|
628
|
+
}, j.$attrs), [
|
|
629
629
|
k.value ? (o(), _("img", {
|
|
630
630
|
key: 0,
|
|
631
631
|
alt: C.value,
|
|
@@ -681,7 +681,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
681
681
|
R(l.$slots, "default", {}, () => [
|
|
682
682
|
S(n(tt))
|
|
683
683
|
]),
|
|
684
|
-
|
|
684
|
+
b("span", Ns, q(t.label), 1)
|
|
685
685
|
]),
|
|
686
686
|
_: 3
|
|
687
687
|
}, 16, ["aria-label", "class"])) : N("", !0);
|
|
@@ -760,7 +760,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
760
760
|
}, r.$attrs, { onClick: i }), {
|
|
761
761
|
default: I(() => [
|
|
762
762
|
R(r.$slots, "default", {}, () => [
|
|
763
|
-
Be(
|
|
763
|
+
Be(q(e.suggestion), 1)
|
|
764
764
|
])
|
|
765
765
|
]),
|
|
766
766
|
_: 3
|
|
@@ -777,12 +777,12 @@ const Ds = /* @__PURE__ */ z({
|
|
|
777
777
|
emits: ["select"],
|
|
778
778
|
setup(s, { emit: t }) {
|
|
779
779
|
const e = s, a = t, i = M(null), r = M([]), u = M([]), l = M(0), k = M(!1);
|
|
780
|
-
let T = null,
|
|
780
|
+
let T = null, x = null;
|
|
781
781
|
const v = A(() => u.value.length > 1), C = A(() => {
|
|
782
782
|
const H = u.value[l.value];
|
|
783
783
|
return H ? e.suggestions.slice(H.start, H.end) : e.suggestions;
|
|
784
784
|
});
|
|
785
|
-
function
|
|
785
|
+
function j(H, se) {
|
|
786
786
|
r.value[se] = H;
|
|
787
787
|
}
|
|
788
788
|
function G() {
|
|
@@ -796,14 +796,14 @@ const Ds = /* @__PURE__ */ z({
|
|
|
796
796
|
function Q() {
|
|
797
797
|
k.value = !0, G();
|
|
798
798
|
}
|
|
799
|
-
function
|
|
799
|
+
function J() {
|
|
800
800
|
k.value = !1, Y();
|
|
801
801
|
}
|
|
802
802
|
function U() {
|
|
803
803
|
var g;
|
|
804
804
|
const H = ((g = i.value) == null ? void 0 : g.clientWidth) ?? 0, se = e.suggestions.map((y, f) => {
|
|
805
|
-
var
|
|
806
|
-
return ((
|
|
805
|
+
var O;
|
|
806
|
+
return ((O = r.value[f]) == null ? void 0 : O.offsetWidth) ?? 0;
|
|
807
807
|
});
|
|
808
808
|
if (!e.suggestions.length) {
|
|
809
809
|
u.value = [], l.value = 0, G();
|
|
@@ -816,9 +816,9 @@ const Ds = /* @__PURE__ */ z({
|
|
|
816
816
|
const D = [];
|
|
817
817
|
let te = 0, d = 0;
|
|
818
818
|
e.suggestions.forEach((y, f) => {
|
|
819
|
-
const
|
|
819
|
+
const O = se[f], E = te === f ? O : d + Ys + O;
|
|
820
820
|
if (te !== f && E > H) {
|
|
821
|
-
D.push({ start: te, end: f }), te = f, d =
|
|
821
|
+
D.push({ start: te, end: f }), te = f, d = O;
|
|
822
822
|
return;
|
|
823
823
|
}
|
|
824
824
|
d = E;
|
|
@@ -834,17 +834,17 @@ const Ds = /* @__PURE__ */ z({
|
|
|
834
834
|
},
|
|
835
835
|
{ immediate: !0 }
|
|
836
836
|
), Ye(() => {
|
|
837
|
-
|
|
837
|
+
x = new ResizeObserver(() => {
|
|
838
838
|
l.value = 0, ee();
|
|
839
|
-
}), i.value &&
|
|
839
|
+
}), i.value && x.observe(i.value);
|
|
840
840
|
}), Ze(() => {
|
|
841
|
-
G(),
|
|
841
|
+
G(), x == null || x.disconnect();
|
|
842
842
|
}), (H, se) => (o(), _("div", {
|
|
843
843
|
class: "suggestions-wrapper",
|
|
844
844
|
onMouseenter: Q,
|
|
845
|
-
onMouseleave:
|
|
845
|
+
onMouseleave: J
|
|
846
846
|
}, [
|
|
847
|
-
|
|
847
|
+
b("div", {
|
|
848
848
|
ref_key: "viewportRef",
|
|
849
849
|
ref: i,
|
|
850
850
|
class: X(["suggestions-viewport", { "has-fade": v.value }])
|
|
@@ -869,11 +869,11 @@ const Ds = /* @__PURE__ */ z({
|
|
|
869
869
|
_: 1
|
|
870
870
|
})
|
|
871
871
|
], 2),
|
|
872
|
-
|
|
872
|
+
b("div", Js, [
|
|
873
873
|
(o(!0), _(le, null, de(s.suggestions, (D, te) => (o(), $(n(Xe), {
|
|
874
874
|
key: `measure-${D}-${te}`,
|
|
875
875
|
ref_for: !0,
|
|
876
|
-
ref: (d) =>
|
|
876
|
+
ref: (d) => j((d == null ? void 0 : d.$el) || d, te),
|
|
877
877
|
suggestion: D,
|
|
878
878
|
class: "suggestion-chip",
|
|
879
879
|
tabindex: "-1"
|
|
@@ -1156,7 +1156,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1156
1156
|
c.url && c.url.startsWith("blob:") && URL.revokeObjectURL(c.url);
|
|
1157
1157
|
});
|
|
1158
1158
|
});
|
|
1159
|
-
const
|
|
1159
|
+
const x = (c) => {
|
|
1160
1160
|
r.value = c;
|
|
1161
1161
|
};
|
|
1162
1162
|
function v(c, h, m) {
|
|
@@ -1178,12 +1178,12 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1178
1178
|
mediaType: w.mediaType || "application/octet-stream",
|
|
1179
1179
|
filename: w.filename
|
|
1180
1180
|
} : (() => {
|
|
1181
|
-
const W = w.file,
|
|
1181
|
+
const W = w.file, P = w.url || (W ? URL.createObjectURL(W) : void 0), ce = v(w, W, P);
|
|
1182
1182
|
return {
|
|
1183
1183
|
...w,
|
|
1184
1184
|
id: w.id || Ke(),
|
|
1185
1185
|
type: ce,
|
|
1186
|
-
url:
|
|
1186
|
+
url: P,
|
|
1187
1187
|
mediaType: w.mediaType || (W == null ? void 0 : W.type) || "",
|
|
1188
1188
|
filename: w.filename || (W == null ? void 0 : W.name),
|
|
1189
1189
|
file: W
|
|
@@ -1192,7 +1192,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1192
1192
|
return ne && h.has(ne) ? ((re = B.url) != null && re.startsWith("blob:") && URL.revokeObjectURL(B.url), []) : (ne && h.add(ne), [B]);
|
|
1193
1193
|
});
|
|
1194
1194
|
l.value = [...l.value, ...m], u.value = l.value.length > 0;
|
|
1195
|
-
},
|
|
1195
|
+
}, j = (c) => {
|
|
1196
1196
|
const h = Array.from(c);
|
|
1197
1197
|
C(h.map((m) => ({
|
|
1198
1198
|
type: m.type.startsWith("image/") ? "image" : "file",
|
|
@@ -1207,7 +1207,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1207
1207
|
}), l.value = [], u.value = !1;
|
|
1208
1208
|
}, Q = () => {
|
|
1209
1209
|
r.value = "";
|
|
1210
|
-
},
|
|
1210
|
+
}, J = () => {
|
|
1211
1211
|
var c;
|
|
1212
1212
|
(c = k.value) == null || c.click();
|
|
1213
1213
|
}, U = async (c) => {
|
|
@@ -1245,13 +1245,13 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1245
1245
|
files: l,
|
|
1246
1246
|
fileInputRef: k,
|
|
1247
1247
|
isLoading: T,
|
|
1248
|
-
setTextInput:
|
|
1248
|
+
setTextInput: x,
|
|
1249
1249
|
addAttachments: C,
|
|
1250
|
-
addFiles:
|
|
1250
|
+
addFiles: j,
|
|
1251
1251
|
removeFile: G,
|
|
1252
1252
|
clearFiles: Y,
|
|
1253
1253
|
clearInput: Q,
|
|
1254
|
-
openFileDialog:
|
|
1254
|
+
openFileDialog: J,
|
|
1255
1255
|
sendMessage: ee
|
|
1256
1256
|
});
|
|
1257
1257
|
const se = A(() => !r.value.trim() && !u.value), D = A(() => e.currentModel || e.models.find((c) => c.is_default) || e.models[0]), te = A(() => {
|
|
@@ -1281,7 +1281,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1281
1281
|
h && G(h.id);
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function O(c) {
|
|
1285
1285
|
var w;
|
|
1286
1286
|
const h = (w = c.clipboardData) == null ? void 0 : w.items;
|
|
1287
1287
|
if (!h)
|
|
@@ -1292,7 +1292,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1292
1292
|
const ne = B.getAsFile();
|
|
1293
1293
|
ne && m.push(ne);
|
|
1294
1294
|
}
|
|
1295
|
-
m.length > 0 && (c.preventDefault(),
|
|
1295
|
+
m.length > 0 && (c.preventDefault(), j(m));
|
|
1296
1296
|
}
|
|
1297
1297
|
const E = A(() => e.status === "streaming" ? "destructive" : "submit"), he = A(() => e.status === "streaming" ? Rt : Ut), pe = A(() => e.status === "streaming" ? "size-4 animate-spin" : "size-4"), me = A(() => fe.value ? !1 : se.value), fe = A(() => e.status === "streaming");
|
|
1298
1298
|
function $e() {
|
|
@@ -1304,10 +1304,10 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1304
1304
|
}
|
|
1305
1305
|
function L(c) {
|
|
1306
1306
|
const h = c.target;
|
|
1307
|
-
h.files &&
|
|
1307
|
+
h.files && j(h.files), h.value = "";
|
|
1308
1308
|
}
|
|
1309
1309
|
return (c, h) => (o(), _("div", pn, [
|
|
1310
|
-
|
|
1310
|
+
b("input", {
|
|
1311
1311
|
ref_key: "fileInputRef",
|
|
1312
1312
|
ref: k,
|
|
1313
1313
|
type: "file",
|
|
@@ -1316,13 +1316,13 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1316
1316
|
accept: "image/*,.pdf,.doc,.docx,.txt",
|
|
1317
1317
|
onChange: L
|
|
1318
1318
|
}, null, 544),
|
|
1319
|
-
|
|
1319
|
+
b("div", mn, [
|
|
1320
1320
|
S(n(en), {
|
|
1321
1321
|
class: "input-group-shell overflow-hidden",
|
|
1322
1322
|
style: { "background-color": "white" }
|
|
1323
1323
|
}, {
|
|
1324
1324
|
default: I(() => [
|
|
1325
|
-
|
|
1325
|
+
b("div", gn, [
|
|
1326
1326
|
e.suggestions.length > 0 ? (o(), _("div", fn, [
|
|
1327
1327
|
S(Qs, {
|
|
1328
1328
|
suggestions: e.suggestions,
|
|
@@ -1330,12 +1330,12 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1330
1330
|
}, null, 8, ["suggestions"])
|
|
1331
1331
|
])) : N("", !0),
|
|
1332
1332
|
e.suggestions.length > 0 ? (o(), _("div", vn)) : N("", !0),
|
|
1333
|
-
|
|
1333
|
+
b("div", hn, [
|
|
1334
1334
|
S(qs)
|
|
1335
1335
|
]),
|
|
1336
1336
|
l.value.length > 0 ? (o(), _("div", yn)) : N("", !0)
|
|
1337
1337
|
]),
|
|
1338
|
-
|
|
1338
|
+
b("div", _n, [
|
|
1339
1339
|
S(n(an), {
|
|
1340
1340
|
modelValue: r.value,
|
|
1341
1341
|
"onUpdate:modelValue": h[1] || (h[1] = (m) => r.value = m),
|
|
@@ -1343,7 +1343,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1343
1343
|
name: "message",
|
|
1344
1344
|
class: "field-sizing-content max-h-48 min-h-16 pt-2 pb-3",
|
|
1345
1345
|
onKeydown: f,
|
|
1346
|
-
onPaste:
|
|
1346
|
+
onPaste: O,
|
|
1347
1347
|
onCompositionstart: h[2] || (h[2] = (m) => y.value = !0),
|
|
1348
1348
|
onCompositionend: h[3] || (h[3] = (m) => y.value = !1)
|
|
1349
1349
|
}, null, 8, ["modelValue"])
|
|
@@ -1353,11 +1353,11 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1353
1353
|
class: "justify-between gap-1"
|
|
1354
1354
|
}, {
|
|
1355
1355
|
default: I(() => [
|
|
1356
|
-
|
|
1356
|
+
b("div", bn, [
|
|
1357
1357
|
S(n(je), {
|
|
1358
1358
|
type: "button",
|
|
1359
1359
|
class: "attachment-button cursor-pointer text-muted-foreground",
|
|
1360
|
-
onClick:
|
|
1360
|
+
onClick: J
|
|
1361
1361
|
}, {
|
|
1362
1362
|
default: I(() => [
|
|
1363
1363
|
S(n(ot), { class: "size-4" })
|
|
@@ -1366,7 +1366,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1366
1366
|
}),
|
|
1367
1367
|
R(c.$slots, "attachment-trigger", { addAttachments: C }, void 0, !0)
|
|
1368
1368
|
]),
|
|
1369
|
-
|
|
1369
|
+
b("div", xn, [
|
|
1370
1370
|
S(n(ln), {
|
|
1371
1371
|
open: i.value,
|
|
1372
1372
|
"onUpdate:open": h[4] || (h[4] = (m) => i.value = m)
|
|
@@ -1386,7 +1386,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1386
1386
|
alt: D.value.name,
|
|
1387
1387
|
onError: ye
|
|
1388
1388
|
}, null, 40, kn)) : N("", !0),
|
|
1389
|
-
D.value ? (o(), _("span", wn,
|
|
1389
|
+
D.value ? (o(), _("span", wn, q(D.value.name), 1)) : (o(), _("span", $n, "选择模型")),
|
|
1390
1390
|
S(n(st), { class: "size-4 opacity-50 shrink-0" })
|
|
1391
1391
|
]),
|
|
1392
1392
|
_: 1
|
|
@@ -1397,7 +1397,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1397
1397
|
S(n(un), { align: "start" }, {
|
|
1398
1398
|
default: I(() => [
|
|
1399
1399
|
(o(!0), _(le, null, de(d.value, (m) => (o(), _(le, { key: m }, [
|
|
1400
|
-
h[5] || (h[5] =
|
|
1400
|
+
h[5] || (h[5] = b("div", { class: "px-2 py-1.5 text-sm font-semibold text-muted-foreground" }, " 请选择模型 ", -1)),
|
|
1401
1401
|
(o(!0), _(le, null, de(te.value[m], (w) => (o(), $(n(cn), {
|
|
1402
1402
|
key: w.name,
|
|
1403
1403
|
onSelect: () => g(w.name),
|
|
@@ -1406,14 +1406,14 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1406
1406
|
default: I(() => {
|
|
1407
1407
|
var B;
|
|
1408
1408
|
return [
|
|
1409
|
-
|
|
1409
|
+
b("img", {
|
|
1410
1410
|
src: `https://models.dev/logos/${n(He)(w.name)}.svg`,
|
|
1411
1411
|
class: "size-4 rounded-sm object-contain",
|
|
1412
1412
|
alt: w.name,
|
|
1413
1413
|
onError: ye
|
|
1414
1414
|
}, null, 40, Cn),
|
|
1415
|
-
|
|
1416
|
-
Be(
|
|
1415
|
+
b("span", In, [
|
|
1416
|
+
Be(q(w.name) + " ", 1),
|
|
1417
1417
|
w.is_default ? (o(), _("span", zn, " 默认 ")) : N("", !0)
|
|
1418
1418
|
]),
|
|
1419
1419
|
((B = D.value) == null ? void 0 : B.name) === w.name ? (o(), $(n(Wt), {
|
|
@@ -1513,7 +1513,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1513
1513
|
target: "_blank",
|
|
1514
1514
|
rel: "noopener noreferrer"
|
|
1515
1515
|
}, [
|
|
1516
|
-
|
|
1516
|
+
b("span", null, q(u), 1),
|
|
1517
1517
|
S(n(Ft), { class: "file-icon" })
|
|
1518
1518
|
], 8, Pn))), 128))
|
|
1519
1519
|
])) : N("", !0);
|
|
@@ -1530,7 +1530,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1530
1530
|
const t = s, e = ht(), a = A(() => {
|
|
1531
1531
|
var T;
|
|
1532
1532
|
const k = (T = e.default) == null ? void 0 : T.call(e);
|
|
1533
|
-
return !k || k.length === 0 ? "" : k.map((
|
|
1533
|
+
return !k || k.length === 0 ? "" : k.map((x) => typeof x.children == "string" ? x.children : "").join("");
|
|
1534
1534
|
}), i = A(() => {
|
|
1535
1535
|
var k;
|
|
1536
1536
|
return (((k = a.value) == null ? void 0 : k.length) ?? 0) * t.spread;
|
|
@@ -1573,7 +1573,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1573
1573
|
},
|
|
1574
1574
|
setup(s) {
|
|
1575
1575
|
const t = s, e = M([]), a = M(0), i = A(() => e.value.filter((d) => d.status === "completed").length), r = A(() => e.value.filter((d) => d.status === "in_progress").length), u = A(() => e.value.filter((d) => d.status === "interrupted").length), l = A(() => e.value.filter((d) => d.status === "pending").length), k = M(!1), T = M(!1);
|
|
1576
|
-
function
|
|
1576
|
+
function x() {
|
|
1577
1577
|
k.value = !k.value, T.value = !k.value;
|
|
1578
1578
|
}
|
|
1579
1579
|
function v(d) {
|
|
@@ -1586,12 +1586,12 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1586
1586
|
function C(d) {
|
|
1587
1587
|
return (d || "") === "write_todos";
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1589
|
+
function j(d, g) {
|
|
1590
1590
|
const y = String(d || "").toLowerCase();
|
|
1591
1591
|
return y === "completed" ? "completed" : y === "in_progress" ? "in_progress" : y === "pending" ? "pending" : y === "interrupted" ? "interrupted" : g;
|
|
1592
1592
|
}
|
|
1593
1593
|
function G(d) {
|
|
1594
|
-
const g =
|
|
1594
|
+
const g = j(d, "pending");
|
|
1595
1595
|
return g === "in_progress" ? "interrupted" : g;
|
|
1596
1596
|
}
|
|
1597
1597
|
function Y(d) {
|
|
@@ -1601,10 +1601,10 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1601
1601
|
return d.map((y, f) => ({
|
|
1602
1602
|
id: y.id || `todo-${f + 1}`,
|
|
1603
1603
|
title: y.title || y.task || y.content || y.text || y.name || "",
|
|
1604
|
-
status:
|
|
1604
|
+
status: j(y.status || y.state, g)
|
|
1605
1605
|
})).filter((y) => y.title);
|
|
1606
1606
|
}
|
|
1607
|
-
function
|
|
1607
|
+
function J(d) {
|
|
1608
1608
|
return d.map((g, y) => ({
|
|
1609
1609
|
id: g.id || `todo-${y + 1}`,
|
|
1610
1610
|
title: g.title || g.task || g.content || g.text || g.name || "",
|
|
@@ -1653,7 +1653,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1653
1653
|
return Me(
|
|
1654
1654
|
() => t.initialTodos,
|
|
1655
1655
|
(d) => {
|
|
1656
|
-
const g =
|
|
1656
|
+
const g = J(d || []);
|
|
1657
1657
|
e.value = g, v(g);
|
|
1658
1658
|
},
|
|
1659
1659
|
{ deep: !0, immediate: !0 }
|
|
@@ -1675,28 +1675,28 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1675
1675
|
g === "streaming" && d === "ready" && U();
|
|
1676
1676
|
}
|
|
1677
1677
|
), (d, g) => e.value.length ? (o(), _("div", Ln, [
|
|
1678
|
-
|
|
1679
|
-
|
|
1678
|
+
b("div", Rn, [
|
|
1679
|
+
b("div", {
|
|
1680
1680
|
class: "todo-divider",
|
|
1681
|
-
onClick:
|
|
1681
|
+
onClick: x
|
|
1682
1682
|
}, [
|
|
1683
|
-
|
|
1683
|
+
b("div", Un, [
|
|
1684
1684
|
(o(), $(ge(k.value ? n(Vt) : n(Nt)), {
|
|
1685
1685
|
size: 13,
|
|
1686
1686
|
class: "title-chevron"
|
|
1687
1687
|
})),
|
|
1688
|
-
g[0] || (g[0] =
|
|
1689
|
-
|
|
1690
|
-
|
|
1688
|
+
g[0] || (g[0] = b("span", { class: "title-label" }, "执行计划", -1)),
|
|
1689
|
+
b("span", Wn, q(i.value) + "/" + q(e.value.length), 1),
|
|
1690
|
+
b("span", Fn, q(r.value > 0 ? `进行中 ${r.value}` : u.value > 0 ? `中断 ${u.value}` : l.value > 0 ? `待处理 ${l.value}` : "已完成"), 1)
|
|
1691
1691
|
])
|
|
1692
1692
|
]),
|
|
1693
|
-
we(
|
|
1693
|
+
we(b("div", Vn, [
|
|
1694
1694
|
(o(!0), _(le, null, de(e.value, (y, f) => (o(), _("div", {
|
|
1695
1695
|
key: y.id,
|
|
1696
1696
|
class: "todo-item"
|
|
1697
1697
|
}, [
|
|
1698
|
-
|
|
1699
|
-
|
|
1698
|
+
b("div", Nn, [
|
|
1699
|
+
b("div", {
|
|
1700
1700
|
class: X(["todo-content", {
|
|
1701
1701
|
completed: y.status === "completed",
|
|
1702
1702
|
pending: y.status === "pending",
|
|
@@ -1704,8 +1704,8 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1704
1704
|
"in-progress": y.status === "in_progress"
|
|
1705
1705
|
}])
|
|
1706
1706
|
}, [
|
|
1707
|
-
|
|
1708
|
-
|
|
1707
|
+
b("span", Kn, q(f + 1) + ".", 1),
|
|
1708
|
+
b("span", Gn, [
|
|
1709
1709
|
y.status === "pending" ? (o(), $(n(Kt), {
|
|
1710
1710
|
key: 0,
|
|
1711
1711
|
size: 13,
|
|
@@ -1733,10 +1733,10 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1733
1733
|
class: "title-text-base title-text-shimmer"
|
|
1734
1734
|
}, {
|
|
1735
1735
|
default: I(() => [
|
|
1736
|
-
Be(
|
|
1736
|
+
Be(q(y.title), 1)
|
|
1737
1737
|
]),
|
|
1738
1738
|
_: 2
|
|
1739
|
-
}, 1024)) : (o(), _("div", Hn,
|
|
1739
|
+
}, 1024)) : (o(), _("div", Hn, q(y.title), 1))
|
|
1740
1740
|
], 2)
|
|
1741
1741
|
])
|
|
1742
1742
|
]))), 128))
|
|
@@ -1749,10 +1749,10 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1749
1749
|
}), Jn = /* @__PURE__ */ ue(qn, [["__scopeId", "data-v-35a3dec5"]]), Xn = { class: "chat-bot" }, Yn = {
|
|
1750
1750
|
key: 0,
|
|
1751
1751
|
class: "flex-1 overflow-y-hidden flex flex-col items-center justify-center"
|
|
1752
|
-
}, Zn = {
|
|
1752
|
+
}, Zn = { class: "default-empty-state" }, Qn = { class: "default-empty-title" }, ea = {
|
|
1753
1753
|
key: 2,
|
|
1754
1754
|
class: "loading-mask"
|
|
1755
|
-
},
|
|
1755
|
+
}, ta = /* @__PURE__ */ z({
|
|
1756
1756
|
__name: "ChatBot",
|
|
1757
1757
|
props: {
|
|
1758
1758
|
assistantId: { default: "research" },
|
|
@@ -1770,10 +1770,10 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1770
1770
|
const e = s, a = new yt({
|
|
1771
1771
|
apiUrl: e.apiUrl,
|
|
1772
1772
|
apiKey: e.apiKey || void 0
|
|
1773
|
-
}), i = M(!1), r = M(null), u = M("ready"), l = M(""), k = M(!1), T = M(!1),
|
|
1773
|
+
}), i = M(!1), r = M(null), u = M("ready"), l = M(""), k = M(!1), T = M(!1), x = M(!0), v = M([]), C = M([]), j = M([]), G = M([]);
|
|
1774
1774
|
function Y(f) {
|
|
1775
|
-
const
|
|
1776
|
-
return
|
|
1775
|
+
const O = f || "";
|
|
1776
|
+
return O.includes("todo") || O === "write_todos";
|
|
1777
1777
|
}
|
|
1778
1778
|
function Q(f) {
|
|
1779
1779
|
Y(f.name) && (G.value = [...G.value, {
|
|
@@ -1785,38 +1785,38 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1785
1785
|
state: f.state
|
|
1786
1786
|
}]);
|
|
1787
1787
|
}
|
|
1788
|
-
const
|
|
1788
|
+
const J = M([]), U = M(null);
|
|
1789
1789
|
Ye(async () => {
|
|
1790
|
-
|
|
1790
|
+
x.value = !0, C.value = [...e.suggestions], await Promise.all([
|
|
1791
1791
|
(async () => {
|
|
1792
1792
|
const f = await ls(e.apiUrl);
|
|
1793
|
-
|
|
1793
|
+
J.value = f, U.value = us(f) || null;
|
|
1794
1794
|
})(),
|
|
1795
1795
|
e.threadId ? (async () => {
|
|
1796
1796
|
const f = await cs(a, e.threadId, e.userId);
|
|
1797
1797
|
r.value = f, v.value = await ds(
|
|
1798
1798
|
a,
|
|
1799
1799
|
f,
|
|
1800
|
-
(
|
|
1801
|
-
C.value =
|
|
1800
|
+
(O) => {
|
|
1801
|
+
C.value = O;
|
|
1802
1802
|
},
|
|
1803
|
-
(
|
|
1804
|
-
|
|
1803
|
+
(O) => {
|
|
1804
|
+
j.value = O;
|
|
1805
1805
|
}
|
|
1806
1806
|
);
|
|
1807
1807
|
})() : Promise.resolve()
|
|
1808
|
-
]),
|
|
1808
|
+
]), x.value = !1;
|
|
1809
1809
|
});
|
|
1810
1810
|
function ee() {
|
|
1811
1811
|
i.value = !i.value, d("update:isMaximized", i.value);
|
|
1812
1812
|
}
|
|
1813
|
-
async function H(f,
|
|
1813
|
+
async function H(f, O = []) {
|
|
1814
1814
|
var pe, me, fe, $e, ye;
|
|
1815
1815
|
if (u.value === "streaming") return;
|
|
1816
1816
|
u.value = "streaming";
|
|
1817
1817
|
const E = [];
|
|
1818
1818
|
f.trim() && E.push({ type: "text", text: f });
|
|
1819
|
-
for (const L of
|
|
1819
|
+
for (const L of O) {
|
|
1820
1820
|
const c = L.mediaType || "application/octet-stream", h = L.filename || L.id || "unknown", m = L.data || L.url || "", w = m.startsWith("data:"), B = w && m.split(",")[1] || "", ne = L.type || (w ? c.startsWith("image/") ? "image" : "file" : "file_url");
|
|
1821
1821
|
if ((ne === "file" || ne === "image") && B) {
|
|
1822
1822
|
ne === "image" ? E.push({
|
|
@@ -1846,11 +1846,11 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1846
1846
|
key: he,
|
|
1847
1847
|
type: "human",
|
|
1848
1848
|
content: f,
|
|
1849
|
-
files:
|
|
1849
|
+
files: O.map((L) => ({ url: L.url, mediaType: L.mediaType, filename: L.filename }))
|
|
1850
1850
|
}
|
|
1851
1851
|
];
|
|
1852
1852
|
try {
|
|
1853
|
-
let L = function(re, W,
|
|
1853
|
+
let L = function(re, W, P, ce) {
|
|
1854
1854
|
return {
|
|
1855
1855
|
key: `tool-${re}-${Date.now()}`,
|
|
1856
1856
|
type: "tool",
|
|
@@ -1859,14 +1859,14 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1859
1859
|
toolCalls: [{
|
|
1860
1860
|
id: re,
|
|
1861
1861
|
name: W,
|
|
1862
|
-
args:
|
|
1862
|
+
args: P,
|
|
1863
1863
|
result: "",
|
|
1864
1864
|
state: ce
|
|
1865
1865
|
}]
|
|
1866
1866
|
};
|
|
1867
1867
|
}, c = function(re, W) {
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1868
|
+
const P = v.value[re];
|
|
1869
|
+
P && P.toolCalls && P.toolCalls.length > 0 && (W.args !== void 0 && (P.toolCalls[0].args = W.args), W.result !== void 0 && (P.toolCalls[0].result = W.result), W.state !== void 0 && (P.toolCalls[0].state = W.state));
|
|
1870
1870
|
};
|
|
1871
1871
|
if (!r.value) {
|
|
1872
1872
|
const re = await a.threads.create({
|
|
@@ -1923,13 +1923,13 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1923
1923
|
const B = /* @__PURE__ */ new Map();
|
|
1924
1924
|
let ne = !1;
|
|
1925
1925
|
for await (const re of h) {
|
|
1926
|
-
const W = re.event,
|
|
1927
|
-
if (W === "metadata" && (
|
|
1928
|
-
if (y(
|
|
1926
|
+
const W = re.event, P = re.data;
|
|
1927
|
+
if (W === "metadata" && (P != null && P.run_id) && (l.value = P.run_id), W === "custom") {
|
|
1928
|
+
if (y(P), (P == null ? void 0 : P.type) === "suggested_questions")
|
|
1929
1929
|
continue;
|
|
1930
1930
|
const ce = {
|
|
1931
|
-
type: (
|
|
1932
|
-
content:
|
|
1931
|
+
type: (P == null ? void 0 : P.type) || "unknown",
|
|
1932
|
+
content: P == null ? void 0 : P.content
|
|
1933
1933
|
}, F = `custom-${Date.now()}`;
|
|
1934
1934
|
v.value = [
|
|
1935
1935
|
...v.value,
|
|
@@ -1943,7 +1943,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
1943
1943
|
continue;
|
|
1944
1944
|
}
|
|
1945
1945
|
if (W === "messages" || W === "messages/partial") {
|
|
1946
|
-
const ce = Array.isArray(
|
|
1946
|
+
const ce = Array.isArray(P) ? P : [P], F = ce[0], Ce = ce[1];
|
|
1947
1947
|
if (Ce != null && Ce.run_id && (l.value = Ce.run_id), F) {
|
|
1948
1948
|
if (F.type === "tool") {
|
|
1949
1949
|
const p = F.tool_call_id, ae = F.name || "未知工具", ie = typeof F.content == "string" ? F.content : JSON.stringify(F.content), K = F.status;
|
|
@@ -2141,8 +2141,8 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2141
2141
|
}
|
|
2142
2142
|
function se(f) {
|
|
2143
2143
|
var pe, me;
|
|
2144
|
-
const
|
|
2145
|
-
if (!
|
|
2144
|
+
const O = !!f.text, E = ((pe = f.files) == null ? void 0 : pe.length) > 0;
|
|
2145
|
+
if (!O && !E)
|
|
2146
2146
|
return;
|
|
2147
2147
|
const he = ((me = f.text) == null ? void 0 : me.trim()) || "";
|
|
2148
2148
|
H(he || "仅发送了附件", f.files || []);
|
|
@@ -2171,8 +2171,8 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2171
2171
|
}
|
|
2172
2172
|
console.log("Custom event received:", f);
|
|
2173
2173
|
}
|
|
2174
|
-
return (f,
|
|
2175
|
-
|
|
2174
|
+
return (f, O) => (o(), _("div", Xn, [
|
|
2175
|
+
b("div", {
|
|
2176
2176
|
class: X(["chat-window", { maximized: i.value }])
|
|
2177
2177
|
}, [
|
|
2178
2178
|
S(ys, {
|
|
@@ -2182,8 +2182,14 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2182
2182
|
onClose: g,
|
|
2183
2183
|
onToggleMaximize: ee
|
|
2184
2184
|
}, null, 8, ["title", "is-maximized", "show-header-actions"]),
|
|
2185
|
-
!
|
|
2186
|
-
R(f.$slots, "empty", { sendMessage: H },
|
|
2185
|
+
!x.value && v.value.length === 0 ? (o(), _("div", Yn, [
|
|
2186
|
+
R(f.$slots, "empty", { sendMessage: H }, () => [
|
|
2187
|
+
b("div", Zn, [
|
|
2188
|
+
O[3] || (O[3] = b("div", { class: "default-empty-badge" }, "AI", -1)),
|
|
2189
|
+
b("h2", Qn, "欢迎使用 " + q(s.assistantName), 1),
|
|
2190
|
+
O[4] || (O[4] = b("p", { class: "default-empty-desc" }, "请输入你的问题,开始一段新的对话。", -1))
|
|
2191
|
+
])
|
|
2192
|
+
], !0)
|
|
2187
2193
|
])) : (o(), $(Os, {
|
|
2188
2194
|
key: 1,
|
|
2189
2195
|
messages: v.value,
|
|
@@ -2205,36 +2211,36 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2205
2211
|
_: 3
|
|
2206
2212
|
}, 8, ["messages", "is-streaming"])),
|
|
2207
2213
|
S(Jn, {
|
|
2208
|
-
"initial-todos":
|
|
2214
|
+
"initial-todos": j.value,
|
|
2209
2215
|
"tool-events": G.value,
|
|
2210
2216
|
"chat-status": u.value
|
|
2211
2217
|
}, null, 8, ["initial-todos", "tool-events", "chat-status"]),
|
|
2212
2218
|
S(An, {
|
|
2213
2219
|
status: u.value,
|
|
2214
2220
|
"current-model": U.value,
|
|
2215
|
-
models:
|
|
2221
|
+
models: J.value,
|
|
2216
2222
|
suggestions: C.value,
|
|
2217
2223
|
"use-web-search": k.value,
|
|
2218
2224
|
modelSelectorOpen: T.value,
|
|
2219
|
-
"onUpdate:modelSelectorOpen":
|
|
2225
|
+
"onUpdate:modelSelectorOpen": O[0] || (O[0] = (E) => T.value = E),
|
|
2220
2226
|
onSubmit: se,
|
|
2221
2227
|
onStop: D,
|
|
2222
2228
|
onSelectSuggestion: te,
|
|
2223
|
-
"onUpdate:currentModel":
|
|
2224
|
-
"onUpdate:useWebSearch":
|
|
2229
|
+
"onUpdate:currentModel": O[1] || (O[1] = (E) => U.value = E),
|
|
2230
|
+
"onUpdate:useWebSearch": O[2] || (O[2] = (E) => k.value = E)
|
|
2225
2231
|
}, {
|
|
2226
2232
|
"attachment-trigger": I((E) => [
|
|
2227
2233
|
R(f.$slots, "attachment-trigger", xe(ke(E)), void 0, !0)
|
|
2228
2234
|
]),
|
|
2229
2235
|
_: 3
|
|
2230
2236
|
}, 8, ["status", "current-model", "models", "suggestions", "use-web-search", "modelSelectorOpen"]),
|
|
2231
|
-
|
|
2237
|
+
x.value ? (o(), _("div", ea, [
|
|
2232
2238
|
S(n(Bn), { size: 24 })
|
|
2233
2239
|
])) : N("", !0)
|
|
2234
2240
|
], 2)
|
|
2235
2241
|
]));
|
|
2236
2242
|
}
|
|
2237
|
-
}),
|
|
2243
|
+
}), sa = /* @__PURE__ */ ue(ta, [["__scopeId", "data-v-55795ff5"]]), na = { class: "icon-wrapper" }, aa = /* @__PURE__ */ z({
|
|
2238
2244
|
__name: "FloatButton",
|
|
2239
2245
|
props: {
|
|
2240
2246
|
isExpanded: { type: Boolean }
|
|
@@ -2247,7 +2253,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2247
2253
|
onClick: i[0] || (i[0] = (r) => e("toggle")),
|
|
2248
2254
|
type: "button"
|
|
2249
2255
|
}, [
|
|
2250
|
-
|
|
2256
|
+
b("span", na, [
|
|
2251
2257
|
S(n(Jt), { class: "icon-svg" }),
|
|
2252
2258
|
S(n(Xt), {
|
|
2253
2259
|
size: 16,
|
|
@@ -2258,7 +2264,7 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2258
2264
|
])
|
|
2259
2265
|
], 2));
|
|
2260
2266
|
}
|
|
2261
|
-
}),
|
|
2267
|
+
}), oa = /* @__PURE__ */ ue(aa, [["__scopeId", "data-v-13898000"]]), ra = { class: "ask-ai-bot" }, ia = /* @__PURE__ */ z({
|
|
2262
2268
|
__name: "AskAiBot",
|
|
2263
2269
|
props: {
|
|
2264
2270
|
assistantId: { default: "research" },
|
|
@@ -2282,27 +2288,27 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2282
2288
|
a.value = v;
|
|
2283
2289
|
}
|
|
2284
2290
|
function k(v) {
|
|
2285
|
-
v.preventDefault(), r.value = !0, document.addEventListener("mousemove", T), document.addEventListener("mouseup",
|
|
2291
|
+
v.preventDefault(), r.value = !0, document.addEventListener("mousemove", T), document.addEventListener("mouseup", x);
|
|
2286
2292
|
}
|
|
2287
2293
|
function T(v) {
|
|
2288
2294
|
if (!r.value) return;
|
|
2289
2295
|
const C = window.innerWidth - v.clientX - 20;
|
|
2290
2296
|
i.value = Math.max(300, Math.min(1400, C));
|
|
2291
2297
|
}
|
|
2292
|
-
function
|
|
2293
|
-
r.value = !1, document.removeEventListener("mousemove", T), document.removeEventListener("mouseup",
|
|
2298
|
+
function x() {
|
|
2299
|
+
r.value = !1, document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", x);
|
|
2294
2300
|
}
|
|
2295
|
-
return (v, C) => (o(), _("div",
|
|
2301
|
+
return (v, C) => (o(), _("div", ra, [
|
|
2296
2302
|
S(Qe, { name: "slide-up" }, {
|
|
2297
2303
|
default: I(() => [
|
|
2298
|
-
we(
|
|
2304
|
+
we(b("div", {
|
|
2299
2305
|
class: X(["chat-window-container", { maximized: a.value }]),
|
|
2300
2306
|
style: et(a.value ? {} : {
|
|
2301
2307
|
width: typeof t.width == "number" ? `${i.value}px` : t.width,
|
|
2302
2308
|
height: typeof t.height == "number" ? `${t.height}px` : t.height
|
|
2303
2309
|
})
|
|
2304
2310
|
}, [
|
|
2305
|
-
S(
|
|
2311
|
+
S(sa, {
|
|
2306
2312
|
"api-url": s.apiUrl,
|
|
2307
2313
|
"api-key": s.apiKey,
|
|
2308
2314
|
"assistant-id": s.assistantId,
|
|
@@ -2314,14 +2320,14 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2314
2320
|
onClose: u,
|
|
2315
2321
|
"onUpdate:isMaximized": l
|
|
2316
2322
|
}, {
|
|
2317
|
-
empty: I((
|
|
2318
|
-
R(v.$slots, "empty", xe(ke(
|
|
2323
|
+
empty: I((j) => [
|
|
2324
|
+
R(v.$slots, "empty", xe(ke(j)), void 0, !0)
|
|
2319
2325
|
]),
|
|
2320
|
-
custom: I((
|
|
2321
|
-
R(v.$slots, "custom", xe(ke(
|
|
2326
|
+
custom: I((j) => [
|
|
2327
|
+
R(v.$slots, "custom", xe(ke(j)), void 0, !0)
|
|
2322
2328
|
]),
|
|
2323
|
-
"attachment-trigger": I((
|
|
2324
|
-
R(v.$slots, "attachment-trigger", xe(ke(
|
|
2329
|
+
"attachment-trigger": I((j) => [
|
|
2330
|
+
R(v.$slots, "attachment-trigger", xe(ke(j)), void 0, !0)
|
|
2325
2331
|
]),
|
|
2326
2332
|
_: 3
|
|
2327
2333
|
}, 8, ["api-url", "api-key", "assistant-id", "assistant-name", "system-prompt", "thread-id", "user-id", "suggestions"]),
|
|
@@ -2336,15 +2342,15 @@ const Ds = /* @__PURE__ */ z({
|
|
|
2336
2342
|
]),
|
|
2337
2343
|
_: 3
|
|
2338
2344
|
}),
|
|
2339
|
-
S(
|
|
2345
|
+
S(oa, {
|
|
2340
2346
|
"is-expanded": e.value,
|
|
2341
2347
|
onToggle: u
|
|
2342
2348
|
}, null, 8, ["is-expanded"])
|
|
2343
2349
|
]));
|
|
2344
2350
|
}
|
|
2345
|
-
}),
|
|
2351
|
+
}), xa = /* @__PURE__ */ ue(ia, [["__scopeId", "data-v-3d2a9c69"]]);
|
|
2346
2352
|
export {
|
|
2347
|
-
|
|
2348
|
-
|
|
2353
|
+
xa as AskAiBot,
|
|
2354
|
+
sa as ChatBot
|
|
2349
2355
|
};
|
|
2350
2356
|
//# sourceMappingURL=index.js.map
|