@opentiny/tiny-robot 0.5.2-alpha.16 → 0.5.2-alpha.17
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/anchor/index.js +32 -32
- package/dist/container/index.js +16 -15
- package/dist/dropdown-menu/index.js +141 -97
- package/dist/extension-manager/index.js +814 -292
- package/dist/index.d.ts +402 -228
- package/dist/index.js +64 -61
- package/dist/index3.js +92 -95
- package/dist/index6.js +641 -622
- package/dist/index7.js +296 -186
- package/dist/model-selector/index.js +517 -522
- package/dist/sender/index.js +111 -111
- package/dist/style.css +1 -1
- package/dist/useStableId.js +15 -0
- package/package.json +3 -3
package/dist/index6.js
CHANGED
|
@@ -1,193 +1,206 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { _ as
|
|
3
|
-
import { IconLoading as
|
|
4
|
-
import { l as
|
|
5
|
-
function
|
|
6
|
-
const n = U(
|
|
7
|
-
|
|
1
|
+
import { ref as $, watch as U, toValue as S, onMounted as ke, onUnmounted as Ze, nextTick as re, defineComponent as M, openBlock as y, createElementBlock as I, renderSlot as A, computed as R, unref as k, normalizeClass as z, createVNode as ee, onBeforeUnmount as Qe, Fragment as G, createElementVNode as B, mergeProps as P, toDisplayString as W, withDirectives as oe, vShow as se, createBlock as N, resolveDynamicComponent as X, normalizeProps as j, guardReactiveProps as Y, createCommentVNode as le, watchEffect as ae, useCssModule as et, renderList as Q, markRaw as K, inject as L, provide as O, reactive as tt, readonly as nt, withCtx as F } from "vue";
|
|
2
|
+
import { _ as H } from "./_plugin-vue_export-helper.js";
|
|
3
|
+
import { IconLoading as Ie, IconAtom as ot, IconArrowDown as Se, IconPlugin as ve, IconError as st, IconCancelled as rt, IconWarning as lt, IconClose as at } from "@opentiny/tiny-robot-svgs";
|
|
4
|
+
import { l as ct, j as he, w as ut, g as it, u as ye } from "./index4.js";
|
|
5
|
+
function xe(e, t) {
|
|
6
|
+
const n = U(e, (o, r) => {
|
|
7
|
+
r === !0 && o === !1 && (t(), n());
|
|
8
8
|
});
|
|
9
9
|
return n;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
function dt(e) {
|
|
12
|
+
if (typeof e != "object" || e === null) return !1;
|
|
13
|
+
const t = Object.getPrototypeOf(e);
|
|
14
|
+
return (t === Object.prototype || t === null) && "scrollRef" in e && "contentRef" in e;
|
|
15
|
+
}
|
|
16
|
+
function bt(e, t, n) {
|
|
17
|
+
let o, r, a, s;
|
|
18
|
+
arguments.length === 1 && dt(e) ? (o = e.scrollRef, r = e.contentRef, a = void 0, s = e) : (o = e, r = n == null ? void 0 : n.contentTarget, a = t, s = n);
|
|
19
|
+
const { scrollOnMount: l = !0, bottomThreshold: u = 20, scrollThrottle: b = 0, enabled: m = !0 } = s ?? {}, x = $(!0);
|
|
20
|
+
let v = null;
|
|
21
|
+
const d = /* @__PURE__ */ new Set(), f = () => ye(o), E = () => r ? ye(r) : null, i = () => S(m), { y: _, isScrolling: c, arrivedState: g } = ct(f, { throttle: b }), h = (C) => C.scrollHeight - C.scrollTop - C.clientHeight <= u, p = async (C = "auto") => {
|
|
22
|
+
x.value = !0;
|
|
23
|
+
const w = S(f);
|
|
24
|
+
if (w && (await re(), w.scrollTo({ top: w.scrollHeight, behavior: C }), C === "smooth" && !h(w))) {
|
|
25
|
+
const q = xe(c, () => {
|
|
26
|
+
w.scrollTo({ top: w.scrollHeight, behavior: "auto" }), d.delete(q);
|
|
19
27
|
});
|
|
20
|
-
|
|
28
|
+
d.add(q);
|
|
21
29
|
}
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
}, T = () => {
|
|
31
|
+
v !== null || !i() || !x.value || (v = requestAnimationFrame(async () => {
|
|
32
|
+
v = null, !(!i() || !x.value) && await p("auto");
|
|
25
33
|
}));
|
|
34
|
+
}, D = () => {
|
|
35
|
+
let C = !1;
|
|
36
|
+
return () => {
|
|
37
|
+
!C && (C = !0, !l) || T();
|
|
38
|
+
};
|
|
26
39
|
};
|
|
27
40
|
return U(
|
|
28
41
|
_,
|
|
29
|
-
() => {
|
|
30
|
-
const
|
|
31
|
-
|
|
42
|
+
(C, w) => {
|
|
43
|
+
const q = S(f);
|
|
44
|
+
q && (h(q) ? x.value = !0 : C < w && (x.value = !1));
|
|
32
45
|
},
|
|
33
46
|
{ flush: "post" }
|
|
34
|
-
),
|
|
35
|
-
|
|
36
|
-
() => {
|
|
37
|
-
|
|
47
|
+
), he(E, D()), he(f, D()), a !== void 0 && ut(a, T, { flush: "post", throttle: 100 }), U(
|
|
48
|
+
i,
|
|
49
|
+
(C) => {
|
|
50
|
+
C && x.value && T();
|
|
38
51
|
},
|
|
39
|
-
{ flush: "post"
|
|
40
|
-
),
|
|
41
|
-
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
}),
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
|
|
52
|
+
{ flush: "post" }
|
|
53
|
+
), ke(() => {
|
|
54
|
+
l && i() && p("smooth");
|
|
55
|
+
}), Ze(() => {
|
|
56
|
+
v !== null && (cancelAnimationFrame(v), v = null), d.forEach((C) => {
|
|
57
|
+
C();
|
|
58
|
+
}), d.clear();
|
|
59
|
+
}), it("keydown", (C) => {
|
|
60
|
+
if (C.key === "End" && !x.value) {
|
|
61
|
+
const w = xe(c, () => {
|
|
62
|
+
p("auto"), d.delete(w);
|
|
50
63
|
});
|
|
51
|
-
|
|
64
|
+
d.add(w);
|
|
52
65
|
}
|
|
53
66
|
}), {
|
|
54
|
-
scrollToBottom:
|
|
55
|
-
arrivedState:
|
|
67
|
+
scrollToBottom: p,
|
|
68
|
+
arrivedState: g
|
|
56
69
|
};
|
|
57
70
|
}
|
|
58
|
-
const
|
|
71
|
+
const Ae = Symbol("bubble-message-group"), Me = Symbol("bubble-box-renderer-matches"), Te = Symbol("bubble-box-fallback-renderer"), we = Symbol("bubble-box-attributes"), Le = Symbol(
|
|
59
72
|
"bubble-box-prop-fallback-renderer"
|
|
60
|
-
),
|
|
73
|
+
), $e = Symbol("bubble-content-renderer-matches"), Ne = Symbol(
|
|
61
74
|
"bubble-content-fallback-renderer"
|
|
62
|
-
),
|
|
75
|
+
), Oe = Symbol("bubble-content-attributes"), Fe = Symbol(
|
|
63
76
|
"bubble-content-prop-fallback-renderer"
|
|
64
|
-
),
|
|
77
|
+
), ie = Symbol("bubble-store"), Pe = Symbol("bubble-event-fn"), De = Symbol("bubble-list-context"), J = {
|
|
65
78
|
LOADING: -1,
|
|
66
79
|
NORMAL: 0,
|
|
67
80
|
CONTENT: 10,
|
|
68
81
|
ROLE: 20
|
|
69
|
-
},
|
|
82
|
+
}, ft = {
|
|
70
83
|
class: "tr-bubble__box",
|
|
71
84
|
"data-box-type": "box"
|
|
72
|
-
},
|
|
85
|
+
}, pt = /* @__PURE__ */ M({
|
|
73
86
|
__name: "Box",
|
|
74
87
|
props: {
|
|
75
88
|
placement: {},
|
|
76
89
|
shape: {}
|
|
77
90
|
},
|
|
78
|
-
setup(
|
|
79
|
-
return (
|
|
80
|
-
|
|
91
|
+
setup(e) {
|
|
92
|
+
return (t, n) => (y(), I("div", ft, [
|
|
93
|
+
A(t.$slots, "default", {}, void 0, !0)
|
|
81
94
|
]));
|
|
82
95
|
}
|
|
83
|
-
}),
|
|
96
|
+
}), de = /* @__PURE__ */ H(pt, [["__scopeId", "data-v-98101726"]]), mt = ["src", "alt"], _t = /* @__PURE__ */ M({
|
|
84
97
|
__name: "Image",
|
|
85
98
|
props: {
|
|
86
99
|
message: {},
|
|
87
100
|
contentIndex: {}
|
|
88
101
|
},
|
|
89
|
-
setup(
|
|
90
|
-
const
|
|
91
|
-
U(
|
|
102
|
+
setup(e) {
|
|
103
|
+
const t = e, n = $(!1), o = $(!1), { content: r } = ge(t), a = R(() => r.value ? typeof r.value.image_url == "string" ? r.value.image_url : r.value.image_url.url : null);
|
|
104
|
+
U(a, () => {
|
|
92
105
|
n.value = !1, o.value = !1;
|
|
93
106
|
});
|
|
94
|
-
const
|
|
107
|
+
const s = () => {
|
|
95
108
|
n.value = !0, o.value = !1;
|
|
96
|
-
},
|
|
109
|
+
}, l = () => {
|
|
97
110
|
o.value = !0, n.value = !0;
|
|
98
111
|
};
|
|
99
|
-
return (u,
|
|
100
|
-
var
|
|
101
|
-
return
|
|
102
|
-
class:
|
|
103
|
-
src:
|
|
104
|
-
alt: (
|
|
112
|
+
return (u, b) => {
|
|
113
|
+
var m;
|
|
114
|
+
return y(), I("img", {
|
|
115
|
+
class: z(["tr-bubble__image", { loading: !n.value }]),
|
|
116
|
+
src: a.value,
|
|
117
|
+
alt: (m = k(r)) == null ? void 0 : m.text,
|
|
105
118
|
loading: "lazy",
|
|
106
|
-
onLoad:
|
|
107
|
-
onError:
|
|
119
|
+
onLoad: s,
|
|
120
|
+
onError: l,
|
|
108
121
|
"data-type": "image"
|
|
109
|
-
}, null, 42,
|
|
122
|
+
}, null, 42, mt);
|
|
110
123
|
};
|
|
111
124
|
}
|
|
112
|
-
}),
|
|
125
|
+
}), Ue = /* @__PURE__ */ H(_t, [["__scopeId", "data-v-e59794cb"]]), gt = {
|
|
113
126
|
class: "tr-bubble__loading",
|
|
114
127
|
"data-type": "loading"
|
|
115
|
-
},
|
|
128
|
+
}, vt = /* @__PURE__ */ M({
|
|
116
129
|
__name: "Loading",
|
|
117
130
|
props: {
|
|
118
131
|
message: {},
|
|
119
132
|
contentIndex: {}
|
|
120
133
|
},
|
|
121
|
-
setup(
|
|
122
|
-
return (
|
|
123
|
-
|
|
134
|
+
setup(e) {
|
|
135
|
+
return (t, n) => (y(), I("div", gt, [
|
|
136
|
+
ee(k(Ie))
|
|
124
137
|
]));
|
|
125
138
|
}
|
|
126
|
-
}),
|
|
139
|
+
}), He = /* @__PURE__ */ H(vt, [["__scopeId", "data-v-bc1b5ff4"]]), ht = { class: "title" }, yt = { class: "detail" }, xt = /* @__PURE__ */ M({
|
|
127
140
|
inheritAttrs: !1,
|
|
128
141
|
__name: "Reasoning",
|
|
129
142
|
props: {
|
|
130
143
|
message: {},
|
|
131
144
|
contentIndex: {}
|
|
132
145
|
},
|
|
133
|
-
setup(
|
|
134
|
-
const
|
|
146
|
+
setup(e) {
|
|
147
|
+
const t = e, { restMessage: n, restProps: o } = qe(t, ["reasoning_content"]), r = fe(n, t.contentIndex), a = $(!0), s = $(t.message.reasoning_content ?? ""), l = $(null);
|
|
135
148
|
let u = null;
|
|
136
|
-
const
|
|
137
|
-
!
|
|
138
|
-
},
|
|
149
|
+
const b = () => {
|
|
150
|
+
!a.value || !l.value || (l.value.scrollTop = l.value.scrollHeight);
|
|
151
|
+
}, m = () => {
|
|
139
152
|
if (typeof window > "u" || typeof window.requestAnimationFrame != "function") {
|
|
140
|
-
|
|
153
|
+
s.value = t.message.reasoning_content ?? "";
|
|
141
154
|
return;
|
|
142
155
|
}
|
|
143
156
|
u === null && (u = window.requestAnimationFrame(() => {
|
|
144
|
-
u = null,
|
|
157
|
+
u = null, s.value = t.message.reasoning_content ?? "", re(b);
|
|
145
158
|
}));
|
|
146
159
|
};
|
|
147
160
|
U(
|
|
148
161
|
() => {
|
|
149
|
-
var
|
|
150
|
-
return (
|
|
162
|
+
var d;
|
|
163
|
+
return (d = t.message.state) == null ? void 0 : d.open;
|
|
151
164
|
},
|
|
152
|
-
(
|
|
153
|
-
|
|
165
|
+
(d) => {
|
|
166
|
+
a.value = d ?? !0, a.value && m();
|
|
154
167
|
},
|
|
155
168
|
{ immediate: !0 }
|
|
156
|
-
), U(() =>
|
|
157
|
-
const
|
|
158
|
-
|
|
169
|
+
), U(() => t.message.reasoning_content, m, { immediate: !0 });
|
|
170
|
+
const x = pe(), v = () => {
|
|
171
|
+
a.value = !a.value, a.value && m(), x({
|
|
159
172
|
name: "state:update",
|
|
160
173
|
payload: {
|
|
161
174
|
key: "open",
|
|
162
|
-
value:
|
|
175
|
+
value: a.value
|
|
163
176
|
}
|
|
164
177
|
});
|
|
165
178
|
};
|
|
166
|
-
return
|
|
179
|
+
return Qe(() => {
|
|
167
180
|
u !== null && typeof window < "u" && (window.cancelAnimationFrame(u), u = null);
|
|
168
|
-
}), (
|
|
169
|
-
var
|
|
170
|
-
return
|
|
171
|
-
B("div",
|
|
181
|
+
}), (d, f) => {
|
|
182
|
+
var E, i;
|
|
183
|
+
return y(), I(G, null, [
|
|
184
|
+
B("div", P({
|
|
172
185
|
class: "tr-bubble__reasoning",
|
|
173
186
|
"data-type": "reasoning"
|
|
174
|
-
},
|
|
187
|
+
}, d.$attrs), [
|
|
175
188
|
B("div", {
|
|
176
189
|
class: "header",
|
|
177
|
-
onClick:
|
|
190
|
+
onClick: v
|
|
178
191
|
}, [
|
|
179
192
|
B("div", {
|
|
180
|
-
class:
|
|
193
|
+
class: z(["icon-and-text", { thinking: (E = t.message.state) == null ? void 0 : E.thinking }])
|
|
181
194
|
}, [
|
|
182
|
-
|
|
183
|
-
B("span",
|
|
195
|
+
ee(k(ot)),
|
|
196
|
+
B("span", ht, W((i = t.message.state) != null && i.thinking ? "正在思考" : "已思考"), 1)
|
|
184
197
|
], 2),
|
|
185
|
-
|
|
186
|
-
class:
|
|
198
|
+
ee(k(Se), {
|
|
199
|
+
class: z(["expand-icon", { "-rotate-90": !a.value }])
|
|
187
200
|
}, null, 8, ["class"])
|
|
188
201
|
]),
|
|
189
|
-
|
|
190
|
-
|
|
202
|
+
oe(B("div", yt, [
|
|
203
|
+
f[0] || (f[0] = B("div", { class: "side-border" }, [
|
|
191
204
|
B("div", { class: "dot-wrapper" }, [
|
|
192
205
|
B("div", { class: "dot" })
|
|
193
206
|
]),
|
|
@@ -196,342 +209,351 @@ const Ee = Symbol("bubble-message-group"), Ce = Symbol("bubble-box-renderer-matc
|
|
|
196
209
|
B("p", {
|
|
197
210
|
class: "detail-content",
|
|
198
211
|
ref_key: "detailRef",
|
|
199
|
-
ref:
|
|
200
|
-
},
|
|
212
|
+
ref: l
|
|
213
|
+
}, W(s.value), 513)
|
|
201
214
|
], 512), [
|
|
202
|
-
[
|
|
215
|
+
[se, a.value]
|
|
203
216
|
])
|
|
204
217
|
], 16),
|
|
205
|
-
(
|
|
218
|
+
(y(), N(X(k(r).renderer), j(Y({ ...k(r).attributes, ...k(o) })), null, 16))
|
|
206
219
|
], 64);
|
|
207
220
|
};
|
|
208
221
|
}
|
|
209
|
-
}),
|
|
222
|
+
}), Ke = /* @__PURE__ */ H(xt, [["__scopeId", "data-v-4e9abfba"]]), Rt = {
|
|
210
223
|
key: 0,
|
|
211
224
|
class: "tr-bubble__text",
|
|
212
225
|
"data-type": "text"
|
|
213
|
-
},
|
|
226
|
+
}, Bt = /* @__PURE__ */ M({
|
|
214
227
|
__name: "Text",
|
|
215
228
|
props: {
|
|
216
229
|
message: {},
|
|
217
230
|
contentIndex: {}
|
|
218
231
|
},
|
|
219
|
-
setup(
|
|
220
|
-
const
|
|
221
|
-
return (o,
|
|
232
|
+
setup(e) {
|
|
233
|
+
const t = e, { contentText: n } = ge(t);
|
|
234
|
+
return (o, r) => k(n) ? (y(), I("p", Rt, W(k(n)), 1)) : le("", !0);
|
|
222
235
|
}
|
|
223
|
-
}),
|
|
236
|
+
}), be = /* @__PURE__ */ H(Bt, [["__scopeId", "data-v-93592ecb"]]), Ge = /* @__PURE__ */ M({
|
|
224
237
|
__name: "ToolRole",
|
|
225
238
|
props: {
|
|
226
239
|
message: {},
|
|
227
240
|
contentIndex: {}
|
|
228
241
|
},
|
|
229
|
-
setup(
|
|
230
|
-
const
|
|
231
|
-
return
|
|
232
|
-
|
|
233
|
-
}), (o,
|
|
242
|
+
setup(e) {
|
|
243
|
+
const t = e, n = _e();
|
|
244
|
+
return ae(() => {
|
|
245
|
+
t.message.tool_call_id && (n.toolCallResults || (n.toolCallResults = {}), n.toolCallResults[t.message.tool_call_id] = t.message.content ?? "");
|
|
246
|
+
}), (o, r) => le("", !0);
|
|
234
247
|
}
|
|
235
|
-
}),
|
|
248
|
+
}), Et = {
|
|
236
249
|
class: "tr-bubble__tool-call",
|
|
237
250
|
"data-type": "tool-call"
|
|
238
|
-
},
|
|
251
|
+
}, Ct = { class: "header" }, kt = { class: "header-left" }, It = { class: "tool-info" }, St = { class: "title" }, At = {
|
|
252
|
+
key: 0,
|
|
253
|
+
class: "description"
|
|
254
|
+
}, Mt = { class: "header-right" }, Tt = { class: "divider" }, wt = ["innerHTML"], Lt = /* @__PURE__ */ M({
|
|
239
255
|
__name: "Tool",
|
|
240
256
|
props: {
|
|
241
257
|
message: {},
|
|
242
258
|
contentIndex: {},
|
|
243
259
|
toolCallIndex: {}
|
|
244
260
|
},
|
|
245
|
-
setup(
|
|
246
|
-
const
|
|
247
|
-
["running", { text: "正在调用", icon:
|
|
248
|
-
["success", { text: "已调用", icon:
|
|
249
|
-
["failed", { text: "调用失败", icon:
|
|
250
|
-
["cancelled", { text: "已取消", icon:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
261
|
+
setup(e) {
|
|
262
|
+
const t = e, { toolCall: n, toolCallWithResult: o, state: r } = Xt(t), a = /* @__PURE__ */ new Map([
|
|
263
|
+
["running", { text: "正在调用", icon: Ie }],
|
|
264
|
+
["success", { text: "已调用", icon: ve }],
|
|
265
|
+
["failed", { text: "调用失败", icon: st }],
|
|
266
|
+
["cancelled", { text: "已取消", icon: rt }],
|
|
267
|
+
["awaiting-approval", { text: "等待确认", icon: lt }],
|
|
268
|
+
["denied", { text: "已拒绝", icon: at }]
|
|
269
|
+
]), s = R(() => {
|
|
270
|
+
var g;
|
|
271
|
+
const c = ((g = r.value) == null ? void 0 : g.status) || "";
|
|
272
|
+
return a.get(c) || { text: "", icon: ve };
|
|
273
|
+
}), l = R(() => typeof r.value.description == "string" ? r.value.description : ""), u = (c, g = 2) => {
|
|
274
|
+
let h = "";
|
|
256
275
|
try {
|
|
257
|
-
typeof
|
|
276
|
+
typeof c == "string" ? h = JSON.stringify(JSON.parse(c), null, g) : h = JSON.stringify(c, null, g);
|
|
258
277
|
} catch {
|
|
259
278
|
}
|
|
260
|
-
return
|
|
261
|
-
},
|
|
262
|
-
if (!
|
|
279
|
+
return h;
|
|
280
|
+
}, b = et(), m = (c) => c.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), x = (c) => {
|
|
281
|
+
if (!c)
|
|
263
282
|
return "";
|
|
264
|
-
let g =
|
|
283
|
+
let g = m(c);
|
|
265
284
|
return g = g.replace(
|
|
266
285
|
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,
|
|
267
|
-
(
|
|
268
|
-
let
|
|
269
|
-
return /^"/.test(
|
|
286
|
+
(h) => {
|
|
287
|
+
let p = "number";
|
|
288
|
+
return /^"/.test(h) ? p = /:$/.test(h) ? "key" : "string" : /true|false/.test(h) ? p = "boolean" : /null/.test(h) && (p = "null"), `<span class="${b[p]}">${h}</span>`;
|
|
270
289
|
}
|
|
271
290
|
), g;
|
|
272
|
-
},
|
|
273
|
-
U(
|
|
274
|
-
g === "" || g === "{}" ||
|
|
275
|
-
|
|
276
|
-
top:
|
|
291
|
+
}, v = R(() => u(o.value, 2)), d = R(() => x(v.value)), f = $(null);
|
|
292
|
+
U(v, (c, g) => {
|
|
293
|
+
g === "" || g === "{}" || re(() => {
|
|
294
|
+
f.value && f.value.scrollTo({
|
|
295
|
+
top: f.value.scrollHeight,
|
|
277
296
|
behavior: "smooth"
|
|
278
297
|
});
|
|
279
298
|
});
|
|
280
299
|
});
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
300
|
+
const E = $(!1);
|
|
301
|
+
ae(() => {
|
|
302
|
+
E.value = r.value.open ?? !1;
|
|
284
303
|
});
|
|
285
|
-
const
|
|
286
|
-
var g,
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
|
|
304
|
+
const i = pe(), _ = () => {
|
|
305
|
+
var g, h;
|
|
306
|
+
E.value = !E.value;
|
|
307
|
+
const c = (g = n.value) == null ? void 0 : g.id;
|
|
308
|
+
c && i({
|
|
290
309
|
name: "state:update",
|
|
291
310
|
payload: {
|
|
292
311
|
key: "toolCall",
|
|
293
312
|
value: {
|
|
294
|
-
...(
|
|
295
|
-
[
|
|
313
|
+
...(h = t.message.state) == null ? void 0 : h.toolCall,
|
|
314
|
+
[c]: { ...r.value, open: E.value }
|
|
296
315
|
}
|
|
297
316
|
}
|
|
298
317
|
});
|
|
299
318
|
};
|
|
300
|
-
return (
|
|
301
|
-
var
|
|
302
|
-
return
|
|
303
|
-
B("div",
|
|
304
|
-
B("div",
|
|
305
|
-
(
|
|
306
|
-
class:
|
|
319
|
+
return (c, g) => {
|
|
320
|
+
var h;
|
|
321
|
+
return y(), I("div", Et, [
|
|
322
|
+
B("div", Ct, [
|
|
323
|
+
B("div", kt, [
|
|
324
|
+
(y(), N(X(s.value.icon), {
|
|
325
|
+
class: z(["header-icon", `icon-${k(r).status}`])
|
|
307
326
|
}, null, 8, ["class"])),
|
|
308
|
-
B("
|
|
309
|
-
B("
|
|
310
|
-
|
|
327
|
+
B("div", It, [
|
|
328
|
+
B("div", null, [
|
|
329
|
+
B("span", null, W(s.value.text) + " ", 1),
|
|
330
|
+
B("span", St, W(((h = k(n)) == null ? void 0 : h.function.name) || "Untitled"), 1)
|
|
331
|
+
]),
|
|
332
|
+
l.value ? (y(), I("div", At, W(l.value), 1)) : le("", !0)
|
|
311
333
|
])
|
|
312
334
|
]),
|
|
313
|
-
B("div",
|
|
314
|
-
|
|
315
|
-
class:
|
|
316
|
-
onClick:
|
|
335
|
+
B("div", Mt, [
|
|
336
|
+
ee(k(Se), {
|
|
337
|
+
class: z(["expand-icon", { "-rotate-90": !E.value }]),
|
|
338
|
+
onClick: _
|
|
317
339
|
}, null, 8, ["class"])
|
|
318
340
|
])
|
|
319
341
|
]),
|
|
320
|
-
|
|
321
|
-
[
|
|
342
|
+
oe(B("div", Tt, null, 512), [
|
|
343
|
+
[se, E.value]
|
|
322
344
|
]),
|
|
323
|
-
|
|
345
|
+
oe(B("div", {
|
|
324
346
|
class: "detail",
|
|
325
|
-
innerHTML:
|
|
347
|
+
innerHTML: d.value,
|
|
326
348
|
ref_key: "detailRef",
|
|
327
|
-
ref:
|
|
328
|
-
}, null, 8,
|
|
329
|
-
[
|
|
349
|
+
ref: f
|
|
350
|
+
}, null, 8, wt), [
|
|
351
|
+
[se, E.value]
|
|
330
352
|
])
|
|
331
353
|
]);
|
|
332
354
|
};
|
|
333
355
|
}
|
|
334
|
-
}),
|
|
335
|
-
key:
|
|
336
|
-
number:
|
|
337
|
-
string:
|
|
338
|
-
boolean:
|
|
356
|
+
}), $t = "_key_1b448_2", Nt = "_number_1b448_6", Ot = "_string_1b448_10", Ft = "_boolean_1b448_14", Pt = {
|
|
357
|
+
key: $t,
|
|
358
|
+
number: Nt,
|
|
359
|
+
string: Ot,
|
|
360
|
+
boolean: Ft,
|
|
339
361
|
null: "_null_1b448_18"
|
|
340
|
-
},
|
|
341
|
-
$style:
|
|
342
|
-
},
|
|
362
|
+
}, Dt = {
|
|
363
|
+
$style: Pt
|
|
364
|
+
}, je = /* @__PURE__ */ H(Lt, [["__cssModules", Dt], ["__scopeId", "data-v-f33174de"]]), Ye = /* @__PURE__ */ M({
|
|
343
365
|
inheritAttrs: !1,
|
|
344
366
|
__name: "Tools",
|
|
345
367
|
props: {
|
|
346
368
|
message: {},
|
|
347
369
|
contentIndex: {}
|
|
348
370
|
},
|
|
349
|
-
setup(
|
|
350
|
-
const
|
|
351
|
-
return (
|
|
352
|
-
(
|
|
353
|
-
B("div",
|
|
354
|
-
(
|
|
355
|
-
key:
|
|
356
|
-
}, { ref_for: !0 },
|
|
371
|
+
setup(e) {
|
|
372
|
+
const t = e, { restMessage: n, restProps: o } = qe(t, ["tool_calls"]), r = fe(n, t.contentIndex);
|
|
373
|
+
return (a, s) => (y(), I(G, null, [
|
|
374
|
+
(y(), N(X(k(r).renderer), j(Y({ ...k(r).attributes, ...k(o) })), null, 16)),
|
|
375
|
+
B("div", P({ class: "tr-bubble__tools" }, a.$attrs), [
|
|
376
|
+
(y(!0), I(G, null, Q(t.message.tool_calls, (l, u) => (y(), N(je, P({
|
|
377
|
+
key: l.id
|
|
378
|
+
}, { ref_for: !0 }, t, { "tool-call-index": u }), null, 16, ["tool-call-index"]))), 128))
|
|
357
379
|
], 16)
|
|
358
380
|
], 64));
|
|
359
381
|
}
|
|
360
|
-
}),
|
|
382
|
+
}), Je = [
|
|
361
383
|
{
|
|
362
|
-
find: (
|
|
363
|
-
renderer:
|
|
364
|
-
priority:
|
|
384
|
+
find: (e, t) => (t == null ? void 0 : t.type) === "image_url",
|
|
385
|
+
renderer: K(de),
|
|
386
|
+
priority: J.NORMAL,
|
|
365
387
|
attributes: { "data-box-type": "image" }
|
|
366
388
|
}
|
|
367
|
-
],
|
|
389
|
+
], We = [
|
|
368
390
|
{
|
|
369
|
-
find: (
|
|
370
|
-
renderer:
|
|
371
|
-
priority:
|
|
391
|
+
find: (e) => !!e.loading,
|
|
392
|
+
renderer: K(He),
|
|
393
|
+
priority: J.LOADING
|
|
372
394
|
},
|
|
373
395
|
{
|
|
374
|
-
find: (
|
|
375
|
-
renderer:
|
|
376
|
-
priority:
|
|
396
|
+
find: (e) => typeof e.reasoning_content == "string" && e.reasoning_content.trim() !== "",
|
|
397
|
+
renderer: K(Ke),
|
|
398
|
+
priority: J.NORMAL
|
|
377
399
|
},
|
|
378
400
|
{
|
|
379
|
-
find: (
|
|
380
|
-
renderer:
|
|
381
|
-
priority:
|
|
401
|
+
find: (e) => Array.isArray(e.tool_calls) && e.tool_calls.length > 0,
|
|
402
|
+
renderer: K(Ye),
|
|
403
|
+
priority: J.NORMAL
|
|
382
404
|
},
|
|
383
405
|
{
|
|
384
|
-
find: (
|
|
385
|
-
renderer:
|
|
386
|
-
priority:
|
|
406
|
+
find: (e, t) => t.type === "image_url",
|
|
407
|
+
renderer: K(Ue),
|
|
408
|
+
priority: J.CONTENT
|
|
387
409
|
},
|
|
388
410
|
{
|
|
389
|
-
find: (
|
|
390
|
-
renderer:
|
|
391
|
-
priority:
|
|
411
|
+
find: (e) => e.role === "tool",
|
|
412
|
+
renderer: K(Ge),
|
|
413
|
+
priority: J.ROLE
|
|
392
414
|
}
|
|
393
|
-
],
|
|
394
|
-
const
|
|
395
|
-
return !
|
|
396
|
-
const
|
|
397
|
-
return
|
|
398
|
-
} : (
|
|
415
|
+
], ze = K(de), Ve = K(be), Re = Symbol("BUBBLE_CONTENT_RESOLVER_KEY"), ce = (e) => {
|
|
416
|
+
const t = L(Re, void 0), n = t ?? e;
|
|
417
|
+
return !t && e && O(Re, e), n ? (r) => {
|
|
418
|
+
const a = S(n);
|
|
419
|
+
return a == null ? void 0 : a(r);
|
|
420
|
+
} : (r) => r.content;
|
|
399
421
|
};
|
|
400
|
-
function
|
|
401
|
-
const { boxRendererMatches:
|
|
402
|
-
|
|
422
|
+
function Ut(e) {
|
|
423
|
+
const { boxRendererMatches: t, boxAttributes: n, fallbackBoxRenderer: o } = e;
|
|
424
|
+
t && O(Me, t), n && O(we, n), o && O(Te, o);
|
|
403
425
|
}
|
|
404
|
-
function
|
|
405
|
-
const { fallbackBoxRenderer:
|
|
406
|
-
|
|
426
|
+
function Ht(e) {
|
|
427
|
+
const { fallbackBoxRenderer: t } = e;
|
|
428
|
+
t && O(Le, t);
|
|
407
429
|
}
|
|
408
|
-
function
|
|
409
|
-
const n =
|
|
410
|
-
if (typeof
|
|
430
|
+
function Kt(e, t) {
|
|
431
|
+
const n = L(Me, Je), o = L(we, void 0), r = L(Te, void 0), a = L(Le, void 0), s = ce();
|
|
432
|
+
if (typeof t == "number" && S(e).length !== 1)
|
|
411
433
|
throw new Error("[BubbleBoxRenderer] When contentIndex is a number, messages array length must be 1");
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
434
|
+
const l = (b) => {
|
|
435
|
+
if (b.length !== 1)
|
|
414
436
|
return { content: void 0, index: void 0 };
|
|
415
|
-
const
|
|
437
|
+
const m = s(b.at(0));
|
|
416
438
|
return {
|
|
417
|
-
content: Array.isArray(
|
|
418
|
-
index:
|
|
439
|
+
content: Array.isArray(m) ? m.at(t ?? 0) : { type: "text", text: m || "" },
|
|
440
|
+
index: t ?? 0
|
|
419
441
|
};
|
|
420
|
-
}, u = (
|
|
421
|
-
return
|
|
422
|
-
const
|
|
423
|
-
const
|
|
424
|
-
if (
|
|
425
|
-
return typeof
|
|
426
|
-
})(),
|
|
427
|
-
return
|
|
428
|
-
renderer:
|
|
442
|
+
}, u = (b, m, x, v) => typeof b.attributes == "function" ? b.attributes(m, x, v) : b.attributes;
|
|
443
|
+
return R(() => {
|
|
444
|
+
const b = S(e), { content: m, index: x } = l(b), v = (() => {
|
|
445
|
+
const f = S(o);
|
|
446
|
+
if (f)
|
|
447
|
+
return typeof f == "function" ? f(b, m, x) : f;
|
|
448
|
+
})(), d = S(n).find((f) => f.find(b, m, x));
|
|
449
|
+
return d ? {
|
|
450
|
+
renderer: d.renderer,
|
|
429
451
|
attributes: {
|
|
430
|
-
...
|
|
431
|
-
...u(
|
|
452
|
+
...v,
|
|
453
|
+
...u(d, b, m, x)
|
|
432
454
|
}
|
|
433
455
|
} : {
|
|
434
|
-
renderer:
|
|
435
|
-
attributes:
|
|
456
|
+
renderer: S(a) || S(r) || ze,
|
|
457
|
+
attributes: v
|
|
436
458
|
};
|
|
437
459
|
});
|
|
438
460
|
}
|
|
439
|
-
function
|
|
440
|
-
const { contentRendererMatches:
|
|
441
|
-
|
|
461
|
+
function Gt(e) {
|
|
462
|
+
const { contentRendererMatches: t, contentAttributes: n, fallbackContentRenderer: o } = e;
|
|
463
|
+
t && O($e, t), n && O(Oe, n), o && O(Ne, o);
|
|
442
464
|
}
|
|
443
|
-
function
|
|
444
|
-
const { fallbackContentRenderer:
|
|
445
|
-
|
|
465
|
+
function jt(e) {
|
|
466
|
+
const { fallbackContentRenderer: t } = e;
|
|
467
|
+
t && O(Fe, t);
|
|
446
468
|
}
|
|
447
|
-
function
|
|
448
|
-
const n =
|
|
449
|
-
return
|
|
450
|
-
const
|
|
451
|
-
const
|
|
452
|
-
if (
|
|
453
|
-
return typeof
|
|
454
|
-
})(),
|
|
455
|
-
return
|
|
456
|
-
renderer:
|
|
469
|
+
function fe(e, t) {
|
|
470
|
+
const n = L($e, We), o = L(Oe, void 0), r = L(Ne, void 0), a = L(Fe, void 0), s = ce();
|
|
471
|
+
return R(() => {
|
|
472
|
+
const l = S(e), u = s(l), b = Array.isArray(u) ? u.at(t ?? 0) : { type: "text", text: u || "" }, m = (() => {
|
|
473
|
+
const v = S(o);
|
|
474
|
+
if (v)
|
|
475
|
+
return typeof v == "function" ? v(l, b, t) : v;
|
|
476
|
+
})(), x = S(n).find((v) => v.find(l, b, t));
|
|
477
|
+
return x ? {
|
|
478
|
+
renderer: x.renderer,
|
|
457
479
|
attributes: {
|
|
458
|
-
...
|
|
459
|
-
...
|
|
480
|
+
...m,
|
|
481
|
+
...x.attributes
|
|
460
482
|
}
|
|
461
483
|
} : {
|
|
462
|
-
renderer:
|
|
463
|
-
attributes:
|
|
484
|
+
renderer: S(a) || S(r) || Ve,
|
|
485
|
+
attributes: m
|
|
464
486
|
};
|
|
465
487
|
});
|
|
466
488
|
}
|
|
467
|
-
function
|
|
468
|
-
|
|
489
|
+
function Yt(e) {
|
|
490
|
+
O(Pe, e);
|
|
469
491
|
}
|
|
470
|
-
function
|
|
471
|
-
return
|
|
472
|
-
console.warn(`[Bubble] Event function not found for event: ${
|
|
492
|
+
function pe() {
|
|
493
|
+
return L(Pe, (e) => {
|
|
494
|
+
console.warn(`[Bubble] Event function not found for event: ${e.name}`);
|
|
473
495
|
});
|
|
474
496
|
}
|
|
475
|
-
function
|
|
476
|
-
const
|
|
477
|
-
return (
|
|
478
|
-
|
|
497
|
+
function gn() {
|
|
498
|
+
const e = pe();
|
|
499
|
+
return (t, n) => {
|
|
500
|
+
e({
|
|
479
501
|
name: "state:update",
|
|
480
|
-
payload: { key:
|
|
502
|
+
payload: { key: t, value: n }
|
|
481
503
|
});
|
|
482
504
|
};
|
|
483
505
|
}
|
|
484
|
-
function
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
487
|
-
return
|
|
488
|
-
const n =
|
|
489
|
-
return
|
|
506
|
+
function me(e) {
|
|
507
|
+
const t = L(ie, void 0);
|
|
508
|
+
if (t)
|
|
509
|
+
return t;
|
|
510
|
+
const n = tt(e || {});
|
|
511
|
+
return O(ie, n), n;
|
|
490
512
|
}
|
|
491
|
-
function
|
|
492
|
-
return
|
|
513
|
+
function _e() {
|
|
514
|
+
return L(ie, {});
|
|
493
515
|
}
|
|
494
|
-
function
|
|
516
|
+
function Xe(e) {
|
|
495
517
|
U(
|
|
496
|
-
|
|
497
|
-
(
|
|
498
|
-
if (!
|
|
499
|
-
const
|
|
518
|
+
e,
|
|
519
|
+
(t, n, o) => {
|
|
520
|
+
if (!t) return;
|
|
521
|
+
const r = (a) => {
|
|
500
522
|
var u;
|
|
501
|
-
const
|
|
502
|
-
if (!
|
|
503
|
-
|
|
504
|
-
const
|
|
523
|
+
const s = window.getSelection();
|
|
524
|
+
if (!t.contains((s == null ? void 0 : s.anchorNode) || null)) return;
|
|
525
|
+
a.preventDefault();
|
|
526
|
+
const l = (s == null ? void 0 : s.toString().replace(/\n{2,}/g, `
|
|
505
527
|
`)) || "";
|
|
506
|
-
(u =
|
|
528
|
+
(u = a.clipboardData) == null || u.setData("text/plain", l);
|
|
507
529
|
};
|
|
508
|
-
|
|
530
|
+
t.addEventListener("copy", r), o(() => t.removeEventListener("copy", r));
|
|
509
531
|
},
|
|
510
532
|
{ immediate: !0, flush: "post" }
|
|
511
533
|
);
|
|
512
534
|
}
|
|
513
|
-
const
|
|
514
|
-
const
|
|
515
|
-
const
|
|
516
|
-
return Array.isArray(
|
|
517
|
-
}), o =
|
|
535
|
+
const ge = (e) => {
|
|
536
|
+
const t = ce(), n = R(() => {
|
|
537
|
+
const r = t(e.message);
|
|
538
|
+
return Array.isArray(r) ? r.at(e.contentIndex) : { type: "text", text: r || "" };
|
|
539
|
+
}), o = R(() => n.value.type === "text" ? String(n.value.text) : "");
|
|
518
540
|
return {
|
|
519
541
|
content: n,
|
|
520
542
|
contentText: o
|
|
521
543
|
};
|
|
522
544
|
};
|
|
523
|
-
function
|
|
524
|
-
|
|
545
|
+
function Jt(e) {
|
|
546
|
+
O(Ae, e);
|
|
525
547
|
}
|
|
526
|
-
function
|
|
527
|
-
return
|
|
548
|
+
function Wt() {
|
|
549
|
+
return L(Ae, void 0);
|
|
528
550
|
}
|
|
529
|
-
function
|
|
530
|
-
const n =
|
|
531
|
-
const
|
|
532
|
-
return Object.fromEntries(
|
|
533
|
-
}), o =
|
|
534
|
-
...
|
|
551
|
+
function qe(e, t) {
|
|
552
|
+
const n = R(() => {
|
|
553
|
+
const r = Object.entries(e.message).filter(([a]) => !t.includes(a));
|
|
554
|
+
return Object.fromEntries(r);
|
|
555
|
+
}), o = R(() => ({
|
|
556
|
+
...e,
|
|
535
557
|
message: n.value
|
|
536
558
|
}));
|
|
537
559
|
return {
|
|
@@ -539,64 +561,64 @@ function je(t, e) {
|
|
|
539
561
|
restProps: o
|
|
540
562
|
};
|
|
541
563
|
}
|
|
542
|
-
let
|
|
543
|
-
const
|
|
544
|
-
let
|
|
545
|
-
const
|
|
546
|
-
if (
|
|
547
|
-
return
|
|
564
|
+
let ue = null;
|
|
565
|
+
const zt = () => (ue || (ue = import("./index5.js")), ue);
|
|
566
|
+
let Z = null;
|
|
567
|
+
const Vt = async () => {
|
|
568
|
+
if (Z)
|
|
569
|
+
return Z;
|
|
548
570
|
try {
|
|
549
|
-
const [
|
|
550
|
-
return
|
|
571
|
+
const [e, t] = await Promise.all([import("markdown-it"), import("dompurify")]);
|
|
572
|
+
return Z = { markdown: e.default, dompurify: t.default }, Z;
|
|
551
573
|
} catch {
|
|
552
|
-
return console.warn("[BubbleMarkdownRenderer] install markdown-it and dompurify to use markdown renderer"),
|
|
574
|
+
return console.warn("[BubbleMarkdownRenderer] install markdown-it and dompurify to use markdown renderer"), Z = null, null;
|
|
553
575
|
}
|
|
554
|
-
},
|
|
555
|
-
const
|
|
556
|
-
var
|
|
557
|
-
return (
|
|
558
|
-
}), n =
|
|
559
|
-
var
|
|
560
|
-
let
|
|
561
|
-
|
|
562
|
-
const
|
|
576
|
+
}, Be = ["running", "success", "failed", "cancelled", "awaiting-approval", "denied"], Xt = (e) => {
|
|
577
|
+
const t = R(() => {
|
|
578
|
+
var s, l;
|
|
579
|
+
return (l = (s = e.message) == null ? void 0 : s.tool_calls) == null ? void 0 : l[e.toolCallIndex];
|
|
580
|
+
}), n = _e(), o = R(() => {
|
|
581
|
+
var m, x, v;
|
|
582
|
+
let s = n.toolCallDefaultStatus;
|
|
583
|
+
s && !Be.includes(s) && (s = void 0);
|
|
584
|
+
const l = n.toolCallDefaultOpen;
|
|
563
585
|
let u = {
|
|
564
|
-
status:
|
|
565
|
-
open:
|
|
586
|
+
status: s,
|
|
587
|
+
open: l
|
|
566
588
|
};
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
571
|
-
const { status:
|
|
572
|
-
|
|
589
|
+
const b = (m = t.value) == null ? void 0 : m.id;
|
|
590
|
+
if (b) {
|
|
591
|
+
const d = (v = (x = e.message.state) == null ? void 0 : x.toolCall) == null ? void 0 : v[b];
|
|
592
|
+
if (d) {
|
|
593
|
+
const { status: f, open: E, ...i } = d;
|
|
594
|
+
f && Be.includes(f) && (u.status = f), E !== void 0 && (u.open = E), u = { ...u, ...i };
|
|
573
595
|
}
|
|
574
596
|
}
|
|
575
597
|
return u;
|
|
576
|
-
}),
|
|
577
|
-
var
|
|
578
|
-
const
|
|
579
|
-
if (
|
|
580
|
-
return (u = n.toolCallResults) == null ? void 0 : u[
|
|
581
|
-
}),
|
|
582
|
-
return
|
|
598
|
+
}), r = R(() => {
|
|
599
|
+
var l, u;
|
|
600
|
+
const s = (l = t.value) == null ? void 0 : l.id;
|
|
601
|
+
if (s)
|
|
602
|
+
return (u = n.toolCallResults) == null ? void 0 : u[s];
|
|
603
|
+
}), a = $({});
|
|
604
|
+
return ae(() => {
|
|
583
605
|
var u;
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
arguments: JSON.parse(
|
|
589
|
-
result:
|
|
606
|
+
const s = (u = t.value) == null ? void 0 : u.function.arguments, l = r.value;
|
|
607
|
+
zt().then(({ jsonrepair: b }) => {
|
|
608
|
+
const m = b(typeof s == "string" ? s || "{}" : JSON.stringify(s));
|
|
609
|
+
a.value = {
|
|
610
|
+
arguments: JSON.parse(m),
|
|
611
|
+
result: l ? JSON.parse(b(l || "{}")) : void 0
|
|
590
612
|
};
|
|
591
|
-
}).catch((
|
|
592
|
-
console.warn(
|
|
613
|
+
}).catch((b) => {
|
|
614
|
+
console.warn(b);
|
|
593
615
|
});
|
|
594
616
|
}), {
|
|
595
|
-
toolCall:
|
|
596
|
-
toolCallWithResult:
|
|
617
|
+
toolCall: t,
|
|
618
|
+
toolCallWithResult: nt(a),
|
|
597
619
|
state: o
|
|
598
620
|
};
|
|
599
|
-
},
|
|
621
|
+
}, Ee = /* @__PURE__ */ M({
|
|
600
622
|
__name: "BubbleBoxWrapper",
|
|
601
623
|
props: {
|
|
602
624
|
role: {},
|
|
@@ -605,49 +627,49 @@ const Ut = async () => {
|
|
|
605
627
|
messages: {},
|
|
606
628
|
contentIndex: {}
|
|
607
629
|
},
|
|
608
|
-
setup(
|
|
609
|
-
const
|
|
610
|
-
return (o,
|
|
611
|
-
"data-role":
|
|
612
|
-
"data-placement":
|
|
613
|
-
"data-shape":
|
|
630
|
+
setup(e) {
|
|
631
|
+
const t = e, n = Kt(() => t.messages, t.contentIndex);
|
|
632
|
+
return (o, r) => (y(), N(X(k(n).renderer), P(k(n).attributes, {
|
|
633
|
+
"data-role": t.role,
|
|
634
|
+
"data-placement": t.placement,
|
|
635
|
+
"data-shape": t.shape
|
|
614
636
|
}), {
|
|
615
|
-
default:
|
|
616
|
-
|
|
637
|
+
default: F(() => [
|
|
638
|
+
A(o.$slots, "default")
|
|
617
639
|
]),
|
|
618
640
|
_: 3
|
|
619
641
|
}, 16, ["data-role", "data-placement", "data-shape"]));
|
|
620
642
|
}
|
|
621
|
-
}),
|
|
643
|
+
}), Ce = /* @__PURE__ */ M({
|
|
622
644
|
__name: "BubbleContentWrapper",
|
|
623
645
|
props: {
|
|
624
646
|
message: {},
|
|
625
647
|
contentIndex: {}
|
|
626
648
|
},
|
|
627
649
|
emits: ["state-change", "bubble-event"],
|
|
628
|
-
setup(
|
|
629
|
-
const n =
|
|
650
|
+
setup(e, { emit: t }) {
|
|
651
|
+
const n = e, o = fe(() => n.message, n.contentIndex), r = R(() => ({
|
|
630
652
|
...o.value.attributes,
|
|
631
653
|
message: n.message,
|
|
632
654
|
contentIndex: n.contentIndex
|
|
633
|
-
})),
|
|
634
|
-
return
|
|
635
|
-
if (
|
|
636
|
-
...
|
|
655
|
+
})), a = t;
|
|
656
|
+
return Yt((l) => {
|
|
657
|
+
if (a("bubble-event", {
|
|
658
|
+
...l,
|
|
637
659
|
contentIndex: n.contentIndex
|
|
638
|
-
}),
|
|
639
|
-
const u =
|
|
660
|
+
}), l.name === "state:update") {
|
|
661
|
+
const u = l.payload;
|
|
640
662
|
if (!u || typeof u != "object" || !("key" in u) || typeof u.key != "string" || !("value" in u))
|
|
641
663
|
return;
|
|
642
|
-
|
|
664
|
+
a("state-change", {
|
|
643
665
|
key: u.key,
|
|
644
666
|
value: u.value,
|
|
645
667
|
contentIndex: n.contentIndex
|
|
646
668
|
});
|
|
647
669
|
}
|
|
648
|
-
}), (
|
|
670
|
+
}), (l, u) => (y(), N(X(k(o).renderer), j(Y(r.value)), null, 16));
|
|
649
671
|
}
|
|
650
|
-
}),
|
|
672
|
+
}), qt = ["data-role", "data-placement"], Zt = { class: "tr-bubble__body" }, Qt = { class: "tr-bubble__content" }, en = { class: "tr-bubble__after" }, tn = /* @__PURE__ */ M({
|
|
651
673
|
__name: "Bubble",
|
|
652
674
|
props: {
|
|
653
675
|
content: {},
|
|
@@ -664,120 +686,120 @@ const Ut = async () => {
|
|
|
664
686
|
placement: { default: "start" },
|
|
665
687
|
shape: { default: "corner" },
|
|
666
688
|
contentRenderMode: { default: "single" },
|
|
667
|
-
contentResolver: { type: Function, default: (
|
|
689
|
+
contentResolver: { type: Function, default: (e) => e.content },
|
|
668
690
|
fallbackBoxRenderer: {},
|
|
669
691
|
fallbackContentRenderer: {}
|
|
670
692
|
},
|
|
671
693
|
emits: ["state-change", "bubble-event"],
|
|
672
|
-
setup(
|
|
673
|
-
const n =
|
|
674
|
-
|
|
675
|
-
const
|
|
676
|
-
var
|
|
677
|
-
if ((
|
|
678
|
-
return
|
|
679
|
-
const { role:
|
|
680
|
-
return [{ role:
|
|
681
|
-
}), u = (
|
|
682
|
-
const
|
|
683
|
-
return Array.isArray(
|
|
694
|
+
setup(e, { emit: t }) {
|
|
695
|
+
const n = e, o = ce(() => n.contentResolver), r = t;
|
|
696
|
+
me();
|
|
697
|
+
const a = Wt(), s = R(() => S(a)), l = R(() => {
|
|
698
|
+
var T;
|
|
699
|
+
if ((T = s.value) != null && T.messages.length)
|
|
700
|
+
return s.value.messages;
|
|
701
|
+
const { role: d, content: f, reasoning_content: E, tool_calls: i, tool_call_id: _, name: c, id: g, loading: h, state: p } = n;
|
|
702
|
+
return [{ role: d, content: f, reasoning_content: E, tool_calls: i, tool_call_id: _, name: c, id: g, loading: h, state: p }];
|
|
703
|
+
}), u = (d) => {
|
|
704
|
+
const f = o(d);
|
|
705
|
+
return Array.isArray(f) ? f : [{ type: "text", text: f || "" }];
|
|
684
706
|
};
|
|
685
|
-
|
|
686
|
-
const
|
|
687
|
-
if (n.contentRenderMode === "split" &&
|
|
688
|
-
const
|
|
689
|
-
if (Array.isArray(
|
|
690
|
-
return
|
|
707
|
+
Ht({ fallbackBoxRenderer: () => n.fallbackBoxRenderer }), jt({ fallbackContentRenderer: () => n.fallbackContentRenderer });
|
|
708
|
+
const b = R(() => l.value.length === 0 ? !0 : n.hidden), m = R(() => {
|
|
709
|
+
if (n.contentRenderMode === "split" && l.value.length === 1) {
|
|
710
|
+
const d = o(l.value.at(0));
|
|
711
|
+
if (Array.isArray(d))
|
|
712
|
+
return d;
|
|
691
713
|
}
|
|
692
714
|
return null;
|
|
693
|
-
}),
|
|
694
|
-
return
|
|
715
|
+
}), x = L(De, !1), v = $(null);
|
|
716
|
+
return x || Xe(v), (d, f) => oe((y(), I("div", {
|
|
695
717
|
class: "tr-bubble",
|
|
696
718
|
ref_key: "bubbleRef",
|
|
697
|
-
ref:
|
|
719
|
+
ref: v,
|
|
698
720
|
"data-role": n.role,
|
|
699
721
|
"data-placement": n.placement
|
|
700
722
|
}, [
|
|
701
|
-
|
|
702
|
-
messages:
|
|
703
|
-
role:
|
|
723
|
+
A(d.$slots, "prefix", {
|
|
724
|
+
messages: l.value,
|
|
725
|
+
role: e.role
|
|
704
726
|
}, void 0, !0),
|
|
705
|
-
B("div",
|
|
706
|
-
n.avatar ? (
|
|
727
|
+
B("div", Zt, [
|
|
728
|
+
n.avatar ? (y(), N(X(n.avatar), {
|
|
707
729
|
key: 0,
|
|
708
|
-
class:
|
|
709
|
-
}, null, 8, ["class"])) :
|
|
710
|
-
B("div",
|
|
711
|
-
|
|
712
|
-
key:
|
|
730
|
+
class: z(["tr-bubble__avatar", d.$style["tr-bubble__avatar"]])
|
|
731
|
+
}, null, 8, ["class"])) : le("", !0),
|
|
732
|
+
B("div", Qt, [
|
|
733
|
+
m.value ? (y(!0), I(G, { key: 0 }, Q(m.value, (E, i) => (y(), N(Ee, {
|
|
734
|
+
key: i,
|
|
713
735
|
class: "tr-bubble__box",
|
|
714
736
|
role: n.role,
|
|
715
737
|
placement: n.placement,
|
|
716
738
|
shape: n.shape,
|
|
717
|
-
messages:
|
|
718
|
-
"content-index":
|
|
739
|
+
messages: l.value,
|
|
740
|
+
"content-index": i
|
|
719
741
|
}, {
|
|
720
|
-
default:
|
|
721
|
-
|
|
722
|
-
message:
|
|
723
|
-
"content-index":
|
|
724
|
-
onStateChange:
|
|
725
|
-
onBubbleEvent:
|
|
742
|
+
default: F(() => [
|
|
743
|
+
ee(Ce, {
|
|
744
|
+
message: l.value.at(0),
|
|
745
|
+
"content-index": i,
|
|
746
|
+
onStateChange: f[0] || (f[0] = (_) => r("state-change", { ..._, messageIndex: 0 })),
|
|
747
|
+
onBubbleEvent: f[1] || (f[1] = (_) => r("bubble-event", { ..._, messageIndex: 0 }))
|
|
726
748
|
}, null, 8, ["message", "content-index"]),
|
|
727
|
-
|
|
728
|
-
messages:
|
|
749
|
+
A(d.$slots, "content-footer", {
|
|
750
|
+
messages: l.value,
|
|
729
751
|
role: n.role,
|
|
730
|
-
contentIndex:
|
|
752
|
+
contentIndex: i
|
|
731
753
|
}, void 0, !0)
|
|
732
754
|
]),
|
|
733
755
|
_: 2
|
|
734
|
-
}, 1032, ["role", "placement", "shape", "messages", "content-index"]))), 128)) : (
|
|
756
|
+
}, 1032, ["role", "placement", "shape", "messages", "content-index"]))), 128)) : (y(), N(Ee, {
|
|
735
757
|
key: 1,
|
|
736
758
|
role: n.role,
|
|
737
759
|
placement: n.placement,
|
|
738
760
|
shape: n.shape,
|
|
739
|
-
messages:
|
|
761
|
+
messages: l.value
|
|
740
762
|
}, {
|
|
741
|
-
default:
|
|
742
|
-
(
|
|
743
|
-
key: `message-${
|
|
763
|
+
default: F(() => [
|
|
764
|
+
(y(!0), I(G, null, Q(l.value, (E, i) => (y(), I(G, {
|
|
765
|
+
key: `message-${i}`
|
|
744
766
|
}, [
|
|
745
|
-
(
|
|
746
|
-
key: `content-${
|
|
747
|
-
message:
|
|
748
|
-
"content-index":
|
|
749
|
-
onStateChange: (
|
|
750
|
-
onBubbleEvent: (
|
|
767
|
+
(y(!0), I(G, null, Q(u(E), (_, c) => (y(), N(Ce, {
|
|
768
|
+
key: `content-${c}`,
|
|
769
|
+
message: E,
|
|
770
|
+
"content-index": c,
|
|
771
|
+
onStateChange: (g) => r("state-change", { ...g, messageIndex: i }),
|
|
772
|
+
onBubbleEvent: (g) => r("bubble-event", { ...g, messageIndex: i })
|
|
751
773
|
}, null, 8, ["message", "content-index", "onStateChange", "onBubbleEvent"]))), 128))
|
|
752
774
|
], 64))), 128)),
|
|
753
|
-
|
|
754
|
-
messages:
|
|
775
|
+
A(d.$slots, "content-footer", {
|
|
776
|
+
messages: l.value,
|
|
755
777
|
role: n.role
|
|
756
778
|
}, void 0, !0)
|
|
757
779
|
]),
|
|
758
780
|
_: 3
|
|
759
781
|
}, 8, ["role", "placement", "shape", "messages"]))
|
|
760
782
|
]),
|
|
761
|
-
B("div",
|
|
762
|
-
|
|
763
|
-
messages:
|
|
764
|
-
role:
|
|
783
|
+
B("div", en, [
|
|
784
|
+
A(d.$slots, "after", {
|
|
785
|
+
messages: l.value,
|
|
786
|
+
role: e.role
|
|
765
787
|
}, void 0, !0)
|
|
766
788
|
])
|
|
767
789
|
]),
|
|
768
|
-
|
|
769
|
-
messages:
|
|
770
|
-
role:
|
|
790
|
+
A(d.$slots, "suffix", {
|
|
791
|
+
messages: l.value,
|
|
792
|
+
role: e.role
|
|
771
793
|
}, void 0, !0)
|
|
772
|
-
], 8,
|
|
773
|
-
[
|
|
794
|
+
], 8, qt)), [
|
|
795
|
+
[se, !b.value]
|
|
774
796
|
]);
|
|
775
797
|
}
|
|
776
|
-
}),
|
|
798
|
+
}), nn = {
|
|
777
799
|
"tr-bubble__avatar": "_tr-bubble__avatar_1r87c_2"
|
|
778
|
-
},
|
|
779
|
-
$style:
|
|
780
|
-
},
|
|
800
|
+
}, on = {
|
|
801
|
+
$style: nn
|
|
802
|
+
}, V = /* @__PURE__ */ H(tn, [["__cssModules", on], ["__scopeId", "data-v-d68ceaad"]]), sn = /* @__PURE__ */ M({
|
|
781
803
|
__name: "BubbleItem",
|
|
782
804
|
props: {
|
|
783
805
|
messageGroup: {},
|
|
@@ -786,31 +808,31 @@ const Ut = async () => {
|
|
|
786
808
|
contentResolver: { type: Function }
|
|
787
809
|
},
|
|
788
810
|
emits: ["state-change", "bubble-event"],
|
|
789
|
-
setup(
|
|
790
|
-
const n =
|
|
791
|
-
return
|
|
792
|
-
role:
|
|
793
|
-
"content-render-mode":
|
|
794
|
-
"content-resolver":
|
|
795
|
-
onStateChange:
|
|
796
|
-
onBubbleEvent:
|
|
811
|
+
setup(e, { emit: t }) {
|
|
812
|
+
const n = e, o = t;
|
|
813
|
+
return Jt(() => n.messageGroup), (r, a) => (y(), N(V, P(e.roleConfig, {
|
|
814
|
+
role: e.messageGroup.role,
|
|
815
|
+
"content-render-mode": e.contentRenderMode,
|
|
816
|
+
"content-resolver": e.contentResolver,
|
|
817
|
+
onStateChange: a[0] || (a[0] = (s) => o("state-change", s)),
|
|
818
|
+
onBubbleEvent: a[1] || (a[1] = (s) => o("bubble-event", s))
|
|
797
819
|
}), {
|
|
798
|
-
prefix:
|
|
799
|
-
|
|
820
|
+
prefix: F((s) => [
|
|
821
|
+
A(r.$slots, "prefix", j(Y(s)))
|
|
800
822
|
]),
|
|
801
|
-
suffix:
|
|
802
|
-
|
|
823
|
+
suffix: F((s) => [
|
|
824
|
+
A(r.$slots, "suffix", j(Y(s)))
|
|
803
825
|
]),
|
|
804
|
-
"content-footer":
|
|
805
|
-
|
|
826
|
+
"content-footer": F((s) => [
|
|
827
|
+
A(r.$slots, "content-footer", j(Y(s)))
|
|
806
828
|
]),
|
|
807
|
-
after:
|
|
808
|
-
|
|
829
|
+
after: F((s) => [
|
|
830
|
+
A(r.$slots, "after", j(Y(s)))
|
|
809
831
|
]),
|
|
810
832
|
_: 3
|
|
811
833
|
}, 16, ["role", "content-render-mode", "content-resolver"]));
|
|
812
834
|
}
|
|
813
|
-
}),
|
|
835
|
+
}), rn = /* @__PURE__ */ M({
|
|
814
836
|
__name: "BubbleList",
|
|
815
837
|
props: {
|
|
816
838
|
messages: {},
|
|
@@ -819,131 +841,128 @@ const Ut = async () => {
|
|
|
819
841
|
fallbackRole: { default: "assistant" },
|
|
820
842
|
roleConfigs: {},
|
|
821
843
|
contentRenderMode: {},
|
|
822
|
-
contentResolver: { type: Function, default: (
|
|
844
|
+
contentResolver: { type: Function, default: (e) => e.content },
|
|
823
845
|
autoScroll: { type: Boolean }
|
|
824
846
|
},
|
|
825
847
|
emits: ["state-change", "bubble-event"],
|
|
826
|
-
setup(
|
|
827
|
-
const o =
|
|
828
|
-
|
|
829
|
-
const
|
|
830
|
-
var
|
|
831
|
-
return
|
|
832
|
-
},
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
a = f, U(
|
|
845
|
-
() => {
|
|
846
|
-
var s;
|
|
847
|
-
return (s = c.value) == null ? void 0 : s.role;
|
|
848
|
-
},
|
|
849
|
-
async (s) => {
|
|
850
|
-
s === "user" && (await te(), f("smooth"));
|
|
851
|
-
}
|
|
852
|
-
);
|
|
853
|
-
}
|
|
854
|
-
Je(r);
|
|
855
|
-
const u = (c) => {
|
|
856
|
-
const f = [];
|
|
857
|
-
let s = !1;
|
|
858
|
-
for (const [d, g] of c.entries()) {
|
|
859
|
-
const b = f[f.length - 1], S = g.role || "", N = i(g.role);
|
|
860
|
-
b && (s && N || b.role === S && s === N) ? (b.messages.push(g), b.messageIndexes.push(d)) : f.push({
|
|
861
|
-
role: S,
|
|
862
|
-
messages: [g],
|
|
863
|
-
messageIndexes: [d]
|
|
864
|
-
}), s = N;
|
|
848
|
+
setup(e, { expose: t, emit: n }) {
|
|
849
|
+
const o = e, r = n;
|
|
850
|
+
me(), O(De, !0);
|
|
851
|
+
const a = (i) => {
|
|
852
|
+
var _, c;
|
|
853
|
+
return i ? !!((c = (_ = o.roleConfigs) == null ? void 0 : _[i]) != null && c.hidden) : !1;
|
|
854
|
+
}, s = $(null), l = $(null), u = R(() => o.messages.at(-1)), { scrollToBottom: b } = bt({
|
|
855
|
+
scrollRef: s,
|
|
856
|
+
contentRef: l,
|
|
857
|
+
enabled: () => o.autoScroll
|
|
858
|
+
});
|
|
859
|
+
U(
|
|
860
|
+
() => {
|
|
861
|
+
var i;
|
|
862
|
+
return (i = u.value) == null ? void 0 : i.role;
|
|
863
|
+
},
|
|
864
|
+
async (i) => {
|
|
865
|
+
o.autoScroll && i === "user" && (await re(), b("smooth"));
|
|
865
866
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
const
|
|
869
|
-
let
|
|
870
|
-
for (const [g,
|
|
871
|
-
const
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
d === pe ? (S.messages.push(b), S.messageIndexes.push(g)) : s.push({
|
|
876
|
-
role: N ? f : Z,
|
|
877
|
-
messages: [b],
|
|
867
|
+
), Xe(s);
|
|
868
|
+
const m = (i) => {
|
|
869
|
+
const _ = [];
|
|
870
|
+
let c = !1;
|
|
871
|
+
for (const [g, h] of i.entries()) {
|
|
872
|
+
const p = _[_.length - 1], T = h.role || "", D = a(h.role);
|
|
873
|
+
p && (c && D || p.role === T && c === D) ? (p.messages.push(h), p.messageIndexes.push(g)) : _.push({
|
|
874
|
+
role: T,
|
|
875
|
+
messages: [h],
|
|
878
876
|
messageIndexes: [g]
|
|
879
|
-
}),
|
|
877
|
+
}), c = D;
|
|
880
878
|
}
|
|
881
|
-
return
|
|
882
|
-
},
|
|
883
|
-
const
|
|
884
|
-
|
|
879
|
+
return _;
|
|
880
|
+
}, x = (i, _) => {
|
|
881
|
+
const c = [];
|
|
882
|
+
let g = !1;
|
|
883
|
+
for (const [h, p] of i.entries()) {
|
|
884
|
+
const T = c[c.length - 1], D = p.role === _, C = p.role || "", w = a(p.role);
|
|
885
|
+
T && // divider 消息(分割角色)永远不与任何组进行合并
|
|
886
|
+
!D && // divider 组(分割角色)不允许被追加消息,确保 divider 组永远只有 1 条 message
|
|
887
|
+
T.role !== _ && // hidden / 非 hidden 分组隔离
|
|
888
|
+
g === w ? (T.messages.push(p), T.messageIndexes.push(h)) : c.push({
|
|
889
|
+
role: D ? _ : C,
|
|
890
|
+
messages: [p],
|
|
891
|
+
messageIndexes: [h]
|
|
892
|
+
}), g = w;
|
|
893
|
+
}
|
|
894
|
+
return c;
|
|
895
|
+
}, v = R(() => o.messages.length === 0 ? [] : typeof o.groupStrategy == "function" ? o.groupStrategy(o.messages, o.dividerRole) : o.groupStrategy === "consecutive" ? m(o.messages) : x(o.messages, o.dividerRole)), d = (i, _) => {
|
|
896
|
+
const c = i.messageIndexes[_];
|
|
897
|
+
if (c === void 0) {
|
|
885
898
|
console.warn(
|
|
886
899
|
"[BubbleList] Missing messageIndexes mapping; event was not emitted. Ensure custom groupStrategy returns messageIndexes aligned with messages.",
|
|
887
900
|
{
|
|
888
|
-
messageIndex:
|
|
889
|
-
messageIndexes:
|
|
901
|
+
messageIndex: _,
|
|
902
|
+
messageIndexes: i.messageIndexes
|
|
890
903
|
}
|
|
891
904
|
);
|
|
892
905
|
return;
|
|
893
906
|
}
|
|
894
|
-
return
|
|
895
|
-
},
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
},
|
|
899
|
-
const
|
|
900
|
-
|
|
907
|
+
return c;
|
|
908
|
+
}, f = (i, _) => {
|
|
909
|
+
const c = d(i, _.messageIndex);
|
|
910
|
+
c !== void 0 && r("state-change", { ..._, messageIndex: c });
|
|
911
|
+
}, E = (i, _) => {
|
|
912
|
+
const c = d(i, _.messageIndex);
|
|
913
|
+
c !== void 0 && r("bubble-event", { ..._, messageIndex: c });
|
|
901
914
|
};
|
|
902
|
-
return
|
|
903
|
-
scrollToBottom:
|
|
904
|
-
}), (
|
|
915
|
+
return t({
|
|
916
|
+
scrollToBottom: b
|
|
917
|
+
}), (i, _) => (y(), I("div", {
|
|
905
918
|
class: "tr-bubble-list",
|
|
906
|
-
ref_key: "
|
|
907
|
-
ref:
|
|
919
|
+
ref_key: "scrollContainerRef",
|
|
920
|
+
ref: s
|
|
908
921
|
}, [
|
|
909
|
-
(
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
922
|
+
B("div", {
|
|
923
|
+
class: "tr-bubble-list__content",
|
|
924
|
+
ref_key: "contentRef",
|
|
925
|
+
ref: l
|
|
926
|
+
}, [
|
|
927
|
+
(y(!0), I(G, null, Q(v.value, (c, g) => {
|
|
928
|
+
var h;
|
|
929
|
+
return y(), N(sn, {
|
|
930
|
+
key: g,
|
|
931
|
+
role: c.role || o.fallbackRole,
|
|
932
|
+
"role-config": (h = o.roleConfigs) == null ? void 0 : h[c.role || o.fallbackRole],
|
|
933
|
+
"message-group": c,
|
|
934
|
+
"content-render-mode": o.contentRenderMode,
|
|
935
|
+
"content-resolver": o.contentResolver,
|
|
936
|
+
onStateChange: (p) => f(c, p),
|
|
937
|
+
onBubbleEvent: (p) => E(c, p)
|
|
938
|
+
}, {
|
|
939
|
+
prefix: F((p) => [
|
|
940
|
+
A(i.$slots, "prefix", P({ ref_for: !0 }, p, {
|
|
941
|
+
messageIndexes: c.messageIndexes
|
|
942
|
+
}), void 0, !0)
|
|
943
|
+
]),
|
|
944
|
+
suffix: F((p) => [
|
|
945
|
+
A(i.$slots, "suffix", P({ ref_for: !0 }, p, {
|
|
946
|
+
messageIndexes: c.messageIndexes
|
|
947
|
+
}), void 0, !0)
|
|
948
|
+
]),
|
|
949
|
+
"content-footer": F((p) => [
|
|
950
|
+
A(i.$slots, "content-footer", P({ ref_for: !0 }, p, {
|
|
951
|
+
messageIndexes: c.messageIndexes
|
|
952
|
+
}), void 0, !0)
|
|
953
|
+
]),
|
|
954
|
+
after: F((p) => [
|
|
955
|
+
A(i.$slots, "after", P({ ref_for: !0 }, p, {
|
|
956
|
+
messageIndexes: c.messageIndexes
|
|
957
|
+
}), void 0, !0)
|
|
958
|
+
]),
|
|
959
|
+
_: 2
|
|
960
|
+
}, 1032, ["role", "role-config", "message-group", "content-render-mode", "content-resolver", "onStateChange", "onBubbleEvent"]);
|
|
961
|
+
}), 128))
|
|
962
|
+
], 512)
|
|
944
963
|
], 512));
|
|
945
964
|
}
|
|
946
|
-
}),
|
|
965
|
+
}), te = /* @__PURE__ */ H(rn, [["__scopeId", "data-v-d51c5aeb"]]), ne = /* @__PURE__ */ M({
|
|
947
966
|
__name: "BubbleProvider",
|
|
948
967
|
props: {
|
|
949
968
|
boxRendererMatches: {},
|
|
@@ -954,85 +973,85 @@ const Ut = async () => {
|
|
|
954
973
|
fallbackContentRenderer: { type: [Object, Function] },
|
|
955
974
|
store: {}
|
|
956
975
|
},
|
|
957
|
-
setup(
|
|
958
|
-
const
|
|
959
|
-
|
|
960
|
-
const n =
|
|
961
|
-
return
|
|
976
|
+
setup(e) {
|
|
977
|
+
const t = e;
|
|
978
|
+
me(t.store);
|
|
979
|
+
const n = R(() => (t.boxRendererMatches || []).concat(Je).sort((s, l) => (s.priority ?? 0) - (l.priority ?? 0))), o = R(() => (t.contentRendererMatches || []).concat(We).sort((s, l) => (s.priority ?? 0) - (l.priority ?? 0))), r = R(() => t.fallbackBoxRenderer || ze), a = R(() => t.fallbackContentRenderer || Ve);
|
|
980
|
+
return Ut({
|
|
962
981
|
boxRendererMatches: n,
|
|
963
|
-
boxAttributes: () =>
|
|
964
|
-
fallbackBoxRenderer:
|
|
965
|
-
}),
|
|
982
|
+
boxAttributes: () => t.boxAttributes,
|
|
983
|
+
fallbackBoxRenderer: r
|
|
984
|
+
}), Gt({
|
|
966
985
|
contentRendererMatches: o,
|
|
967
|
-
contentAttributes: () =>
|
|
968
|
-
fallbackContentRenderer:
|
|
969
|
-
}), (
|
|
986
|
+
contentAttributes: () => t.contentAttributes,
|
|
987
|
+
fallbackContentRenderer: a
|
|
988
|
+
}), (s, l) => A(s.$slots, "default");
|
|
970
989
|
}
|
|
971
|
-
}),
|
|
990
|
+
}), ln = ["innerHTML"], an = /* @__PURE__ */ M({
|
|
972
991
|
__name: "Markdown",
|
|
973
992
|
props: {
|
|
974
993
|
message: {},
|
|
975
994
|
contentIndex: {}
|
|
976
995
|
},
|
|
977
|
-
setup(
|
|
978
|
-
const
|
|
979
|
-
|
|
980
|
-
o.value = await
|
|
996
|
+
setup(e) {
|
|
997
|
+
const t = e, { contentText: n } = ge(t), o = $(null);
|
|
998
|
+
ke(async () => {
|
|
999
|
+
o.value = await Vt();
|
|
981
1000
|
});
|
|
982
|
-
const { mdConfig:
|
|
983
|
-
return
|
|
1001
|
+
const { mdConfig: r, dompurifyConfig: a } = _e(), s = $("");
|
|
1002
|
+
return ae(() => {
|
|
984
1003
|
if (o.value) {
|
|
985
|
-
const { markdown:
|
|
986
|
-
|
|
1004
|
+
const { markdown: l, dompurify: u } = o.value, b = l(r || {}).render(n.value);
|
|
1005
|
+
s.value = u.sanitize(b, a);
|
|
987
1006
|
}
|
|
988
|
-
}), (
|
|
1007
|
+
}), (l, u) => s.value ? (y(), I("div", {
|
|
989
1008
|
key: 0,
|
|
990
1009
|
class: "tr-bubble__markdown markdown-body",
|
|
991
1010
|
"data-type": "markdown",
|
|
992
|
-
innerHTML:
|
|
993
|
-
}, null, 8,
|
|
1011
|
+
innerHTML: s.value
|
|
1012
|
+
}, null, 8, ln)) : (y(), N(be, j(P({ key: 1 }, t)), null, 16));
|
|
994
1013
|
}
|
|
995
|
-
}),
|
|
996
|
-
Box:
|
|
997
|
-
Image:
|
|
998
|
-
Loading:
|
|
999
|
-
Markdown:
|
|
1000
|
-
Reasoning:
|
|
1001
|
-
Text:
|
|
1002
|
-
Tool:
|
|
1003
|
-
ToolRole:
|
|
1004
|
-
Tools:
|
|
1014
|
+
}), cn = /* @__PURE__ */ H(an, [["__scopeId", "data-v-eb1c196f"]]), vn = {
|
|
1015
|
+
Box: de,
|
|
1016
|
+
Image: Ue,
|
|
1017
|
+
Loading: He,
|
|
1018
|
+
Markdown: cn,
|
|
1019
|
+
Reasoning: Ke,
|
|
1020
|
+
Text: be,
|
|
1021
|
+
Tool: je,
|
|
1022
|
+
ToolRole: Ge,
|
|
1023
|
+
Tools: Ye
|
|
1005
1024
|
};
|
|
1006
|
-
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1025
|
+
V.name = "TrBubble";
|
|
1026
|
+
const un = function(e) {
|
|
1027
|
+
e.component(V.name, V);
|
|
1009
1028
|
};
|
|
1010
|
-
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1029
|
+
V.install = un;
|
|
1030
|
+
const hn = V;
|
|
1031
|
+
te.name = "TrBubbleList";
|
|
1032
|
+
const dn = function(e) {
|
|
1033
|
+
e.component(te.name, te);
|
|
1015
1034
|
};
|
|
1016
|
-
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1035
|
+
te.install = dn;
|
|
1036
|
+
const yn = te;
|
|
1037
|
+
ne.name = "TrBubbleProvider";
|
|
1038
|
+
const bn = function(e) {
|
|
1039
|
+
e.component(ne.name, ne);
|
|
1021
1040
|
};
|
|
1022
|
-
|
|
1023
|
-
const
|
|
1041
|
+
ne.install = bn;
|
|
1042
|
+
const xn = ne;
|
|
1024
1043
|
export {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1044
|
+
hn as B,
|
|
1045
|
+
yn as a,
|
|
1046
|
+
xn as b,
|
|
1047
|
+
J as c,
|
|
1048
|
+
vn as d,
|
|
1049
|
+
Kt as e,
|
|
1050
|
+
fe as f,
|
|
1051
|
+
pe as g,
|
|
1052
|
+
gn as h,
|
|
1053
|
+
ge as i,
|
|
1054
|
+
qe as j,
|
|
1055
|
+
Xt as k,
|
|
1056
|
+
bt as u
|
|
1038
1057
|
};
|