@opentiny/tiny-robot 0.3.1-alpha.7 → 0.3.1-alpha.8
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/action-group/index.js +9 -9
- package/dist/attachments/index.js +1 -1
- package/dist/base-popper/index.js +1 -1
- package/dist/bubble/index.js +11 -6
- package/dist/container/index.js +7 -7
- package/dist/drag-overlay/index.js +7 -7
- package/dist/dropdown-menu/index.js +7 -7
- package/dist/feedback/index.js +1 -1
- package/dist/flow-layout-buttons/index.js +17 -17
- package/dist/history/index.js +1 -1
- package/dist/icon-button/index.js +1 -1
- package/dist/index.d.ts +2653 -1357
- package/dist/index.js +158 -123
- package/dist/index2.js +183 -4062
- package/dist/index3.js +266 -285
- package/dist/index4.js +380 -323
- package/dist/index5.js +510 -142
- package/dist/index6.js +301 -0
- package/dist/index7.js +161 -0
- package/dist/mcp-add-form/index.js +7 -7
- package/dist/mcp-server-picker/index.js +1 -1
- package/dist/prompts/index.js +3 -3
- package/dist/sender/index.js +3180 -1399
- package/dist/sender-actions/index.js +13 -0
- package/dist/sender-compat/index.js +229 -0
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +14 -14
- package/dist/suggestion-popover/index.js +181 -182
- package/dist/theme-provider/index.js +7 -7
- package/dist/utils.js +1 -1
- package/dist/welcome/index.js +4 -4
- package/package.json +18 -5
- package/dist/loading.js +0 -4
package/dist/index5.js
CHANGED
|
@@ -1,161 +1,529 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { defineComponent as k, openBlock as m, createElementBlock as y, renderSlot as g, unref as v, toDisplayString as be, createCommentVNode as X, markRaw as z, provide as S, inject as C, computed as _, toValue as B, reactive as fe, createBlock as E, resolveDynamicComponent as U, mergeProps as A, withCtx as R, normalizeProps as T, guardReactiveProps as $, withDirectives as me, createElementVNode as K, normalizeClass as pe, Fragment as N, renderList as G, createVNode as ge, vShow as _e, ref as q, watch as Y, onMounted as he, onUnmounted as Be, nextTick as J } from "vue";
|
|
2
|
+
import { _ as P } from "./_plugin-vue_export-helper.js";
|
|
3
|
+
import { i as Re, w as xe, g as ve, a as ye } from "./index4.js";
|
|
4
|
+
const Q = Symbol("bubble-message-group"), Z = Symbol("bubble-box-renderer-matches"), ee = Symbol("bubble-box-fallback-renderer"), te = Symbol(
|
|
5
|
+
"bubble-box-prop-fallback-renderer"
|
|
6
|
+
), ne = Symbol("bubble-content-renderer-matches"), se = Symbol(
|
|
7
|
+
"bubble-content-fallback-renderer"
|
|
8
|
+
), oe = Symbol(
|
|
9
|
+
"bubble-content-prop-fallback-renderer"
|
|
10
|
+
), j = Symbol("bubble-store"), re = Symbol("bubble-state-change-fn"), et = {
|
|
11
|
+
LOADING: -1,
|
|
12
|
+
NORMAL: 0,
|
|
13
|
+
CONTENT: 10,
|
|
14
|
+
ROLE: 20
|
|
15
|
+
}, Ee = {
|
|
16
|
+
class: "tr-bubble__box",
|
|
17
|
+
"data-box-type": "box"
|
|
18
|
+
}, Ce = /* @__PURE__ */ k({
|
|
19
|
+
__name: "Box",
|
|
20
|
+
props: {
|
|
21
|
+
placement: {},
|
|
22
|
+
shape: {}
|
|
23
|
+
},
|
|
24
|
+
setup(t) {
|
|
25
|
+
return (n, e) => (m(), y("div", Ee, [
|
|
26
|
+
g(n.$slots, "default", {}, void 0, !0)
|
|
27
|
+
]));
|
|
28
|
+
}
|
|
29
|
+
}), ae = /* @__PURE__ */ P(Ce, [["__scopeId", "data-v-98101726"]]), Se = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "tr-bubble__text",
|
|
32
|
+
"data-type": "text"
|
|
33
|
+
}, ke = /* @__PURE__ */ k({
|
|
34
|
+
__name: "Text",
|
|
35
|
+
props: {
|
|
36
|
+
message: {},
|
|
37
|
+
contentIndex: {}
|
|
38
|
+
},
|
|
39
|
+
setup(t) {
|
|
40
|
+
const n = t, e = Oe(() => n.message, n.contentIndex);
|
|
41
|
+
return (a, c) => {
|
|
42
|
+
var i;
|
|
43
|
+
return v(e) ? (m(), y("p", Se, be(typeof v(e) == "string" ? v(e) : (i = v(e)) == null ? void 0 : i.text), 1)) : X("", !0);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}), le = /* @__PURE__ */ P(ke, [["__scopeId", "data-v-53daeb22"]]), ce = [], ue = [], de = z(ae), ie = z(le);
|
|
47
|
+
function Ie(t) {
|
|
48
|
+
const { boxRendererMatches: n, fallbackBoxRenderer: e } = t;
|
|
49
|
+
n && S(Z, n), e && S(ee, e);
|
|
50
|
+
}
|
|
51
|
+
function Me(t) {
|
|
52
|
+
const { fallbackBoxRenderer: n } = t;
|
|
53
|
+
n && S(te, n);
|
|
54
|
+
}
|
|
55
|
+
function Ae(t, n) {
|
|
56
|
+
const e = C(Z, ce), a = C(ee, void 0), c = C(te, void 0);
|
|
57
|
+
return _(() => {
|
|
58
|
+
const i = B(t), s = B(e).find((b) => b.find(i, n));
|
|
59
|
+
return s ? {
|
|
60
|
+
renderer: s.renderer,
|
|
61
|
+
attributes: s.attributes
|
|
62
|
+
} : {
|
|
63
|
+
renderer: B(c) || B(a) || de
|
|
64
|
+
};
|
|
20
65
|
});
|
|
21
66
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
67
|
+
function Le(t) {
|
|
68
|
+
const { contentRendererMatches: n, fallbackContentRenderer: e } = t;
|
|
69
|
+
n && S(ne, n), e && S(se, e);
|
|
70
|
+
}
|
|
71
|
+
function Te(t) {
|
|
72
|
+
const { fallbackContentRenderer: n } = t;
|
|
73
|
+
n && S(oe, n);
|
|
74
|
+
}
|
|
75
|
+
function $e(t, n) {
|
|
76
|
+
const e = C(ne, ue), a = C(se, void 0), c = C(oe, void 0);
|
|
77
|
+
return _(() => {
|
|
78
|
+
const i = B(t), s = B(e).find((b) => b.find(i, n));
|
|
79
|
+
return s ? s.renderer : B(c) || B(a) || ie;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function Ne(t) {
|
|
83
|
+
S(re, t);
|
|
84
|
+
}
|
|
85
|
+
function tt() {
|
|
86
|
+
return C(re, (t, n) => {
|
|
87
|
+
console.warn(`[Bubble] State change function not found for key: ${t}`);
|
|
35
88
|
});
|
|
36
89
|
}
|
|
37
|
-
|
|
38
|
-
|
|
90
|
+
function H(t) {
|
|
91
|
+
const n = C(j, void 0);
|
|
92
|
+
if (n)
|
|
93
|
+
return n;
|
|
94
|
+
const e = fe(t || {});
|
|
95
|
+
return S(j, e), e;
|
|
96
|
+
}
|
|
97
|
+
const M = (t) => {
|
|
98
|
+
var n;
|
|
99
|
+
return ((n = t.state) == null ? void 0 : n.content) ?? t.content;
|
|
100
|
+
}, Oe = (t, n) => _(() => {
|
|
101
|
+
const e = M(B(t));
|
|
102
|
+
return Array.isArray(e) ? e.at(n ?? 0) : e;
|
|
103
|
+
});
|
|
104
|
+
function Fe(t) {
|
|
105
|
+
S(Q, t);
|
|
106
|
+
}
|
|
107
|
+
function Ge() {
|
|
108
|
+
return C(Q, void 0);
|
|
109
|
+
}
|
|
110
|
+
function nt(t, n) {
|
|
111
|
+
const e = _(() => {
|
|
112
|
+
const c = Object.entries(t.message).filter(([i]) => !n.includes(i));
|
|
113
|
+
return Object.fromEntries(c);
|
|
114
|
+
}), a = _(() => ({
|
|
115
|
+
...t,
|
|
116
|
+
message: e.value
|
|
117
|
+
}));
|
|
118
|
+
return {
|
|
119
|
+
restMessage: e,
|
|
120
|
+
restProps: a
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const W = /* @__PURE__ */ k({
|
|
124
|
+
__name: "BubbleBoxWrapper",
|
|
39
125
|
props: {
|
|
40
|
-
|
|
41
|
-
|
|
126
|
+
role: {},
|
|
127
|
+
placement: {},
|
|
128
|
+
shape: {},
|
|
129
|
+
messages: {},
|
|
130
|
+
contentIndex: {}
|
|
42
131
|
},
|
|
43
|
-
setup(
|
|
44
|
-
const e =
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
ref_key: "popperRef",
|
|
53
|
-
ref: e
|
|
54
|
-
}, [
|
|
55
|
-
K(t.$slots, "default", {}, void 0, !0)
|
|
56
|
-
], 512)) : J("", !0)
|
|
132
|
+
setup(t) {
|
|
133
|
+
const n = t, e = Ae(() => n.messages, n.contentIndex);
|
|
134
|
+
return (a, c) => (m(), E(U(v(e).renderer), A({
|
|
135
|
+
"data-role": n.role,
|
|
136
|
+
"data-placement": n.placement,
|
|
137
|
+
"data-shape": n.shape
|
|
138
|
+
}, v(e).attributes), {
|
|
139
|
+
default: R(() => [
|
|
140
|
+
g(a.$slots, "default")
|
|
57
141
|
]),
|
|
58
142
|
_: 3
|
|
59
|
-
}, 16));
|
|
143
|
+
}, 16, ["data-role", "data-placement", "data-shape"]));
|
|
60
144
|
}
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
__name: "index",
|
|
145
|
+
}), D = /* @__PURE__ */ k({
|
|
146
|
+
__name: "BubbleContentWrapper",
|
|
64
147
|
props: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
148
|
+
message: {},
|
|
149
|
+
contentIndex: {}
|
|
150
|
+
},
|
|
151
|
+
emits: ["state-change"],
|
|
152
|
+
setup(t, { emit: n }) {
|
|
153
|
+
const e = t, a = $e(() => e.message, e.contentIndex), c = n;
|
|
154
|
+
return Ne((s, b) => {
|
|
155
|
+
c("state-change", {
|
|
156
|
+
key: s,
|
|
157
|
+
value: b,
|
|
158
|
+
contentIndex: e.contentIndex
|
|
159
|
+
});
|
|
160
|
+
}), (s, b) => (m(), E(U(v(a)), T($(e)), null, 16));
|
|
161
|
+
}
|
|
162
|
+
}), Pe = ["data-role", "data-placement"], we = { class: "tr-bubble__body" }, Ke = { class: "tr-bubble__content" }, De = { class: "tr-bubble__after" }, Ue = /* @__PURE__ */ k({
|
|
163
|
+
__name: "Bubble",
|
|
164
|
+
props: {
|
|
165
|
+
content: {},
|
|
166
|
+
reasoning_content: {},
|
|
167
|
+
tool_calls: {},
|
|
168
|
+
tool_call_id: {},
|
|
169
|
+
name: {},
|
|
170
|
+
role: {},
|
|
171
|
+
id: {},
|
|
172
|
+
loading: { type: Boolean },
|
|
173
|
+
state: {},
|
|
174
|
+
hidden: { type: Boolean },
|
|
175
|
+
avatar: {},
|
|
176
|
+
placement: { default: "start" },
|
|
177
|
+
shape: { default: "corner" },
|
|
178
|
+
contentRenderMode: { default: "single" },
|
|
179
|
+
fallbackBoxRenderer: {},
|
|
180
|
+
fallbackContentRenderer: {}
|
|
181
|
+
},
|
|
182
|
+
emits: ["state-change"],
|
|
183
|
+
setup(t, { emit: n }) {
|
|
184
|
+
const e = t, a = n;
|
|
185
|
+
H();
|
|
186
|
+
const c = Ge(), i = _(() => B(c)), s = _(() => {
|
|
187
|
+
var w;
|
|
188
|
+
if ((w = i.value) != null && w.messages.length)
|
|
189
|
+
return i.value.messages;
|
|
190
|
+
const { role: h, content: f, reasoning_content: u, tool_calls: r, tool_call_id: l, name: d, id: o, loading: p, state: I } = e;
|
|
191
|
+
return [{ role: h, content: f, reasoning_content: u, tool_calls: r, tool_call_id: l, name: d, id: o, loading: p, state: I }];
|
|
192
|
+
});
|
|
193
|
+
Me({ fallbackBoxRenderer: () => e.fallbackBoxRenderer }), Te({ fallbackContentRenderer: () => e.fallbackContentRenderer });
|
|
194
|
+
const b = _(() => s.value.length === 0 ? !0 : e.hidden), x = _(() => e.contentRenderMode === "split" && s.value.length === 1 && Array.isArray(M(s.value[0])));
|
|
195
|
+
return (h, f) => me((m(), y("div", {
|
|
196
|
+
class: "tr-bubble",
|
|
197
|
+
"data-role": e.role,
|
|
198
|
+
"data-placement": e.placement
|
|
199
|
+
}, [
|
|
200
|
+
g(h.$slots, "prefix", {
|
|
201
|
+
messages: s.value,
|
|
202
|
+
role: t.role
|
|
203
|
+
}, void 0, !0),
|
|
204
|
+
K("div", we, [
|
|
205
|
+
e.avatar ? (m(), E(U(e.avatar), {
|
|
206
|
+
key: 0,
|
|
207
|
+
class: pe(["tr-bubble__avatar", h.$style["tr-bubble__avatar"]])
|
|
208
|
+
}, null, 8, ["class"])) : X("", !0),
|
|
209
|
+
K("div", Ke, [
|
|
210
|
+
x.value ? (m(!0), y(N, { key: 0 }, G(v(M)(s.value[0]), (u, r) => (m(), E(W, {
|
|
211
|
+
key: r,
|
|
212
|
+
class: "tr-bubble__box",
|
|
213
|
+
role: e.role,
|
|
214
|
+
placement: e.placement,
|
|
215
|
+
shape: e.shape,
|
|
216
|
+
messages: s.value,
|
|
217
|
+
"content-index": r
|
|
218
|
+
}, {
|
|
219
|
+
default: R(() => [
|
|
220
|
+
ge(D, {
|
|
221
|
+
message: s.value[0],
|
|
222
|
+
"content-index": r,
|
|
223
|
+
onStateChange: f[0] || (f[0] = (l) => a("state-change", { ...l, messageIndex: 0 }))
|
|
224
|
+
}, null, 8, ["message", "content-index"]),
|
|
225
|
+
g(h.$slots, "content-footer", {
|
|
226
|
+
messages: s.value,
|
|
227
|
+
role: e.role,
|
|
228
|
+
contentIndex: r
|
|
229
|
+
}, void 0, !0)
|
|
230
|
+
]),
|
|
231
|
+
_: 2
|
|
232
|
+
}, 1032, ["role", "placement", "shape", "messages", "content-index"]))), 128)) : (m(), E(W, {
|
|
233
|
+
key: 1,
|
|
234
|
+
role: e.role,
|
|
235
|
+
placement: e.placement,
|
|
236
|
+
shape: e.shape,
|
|
237
|
+
messages: s.value
|
|
238
|
+
}, {
|
|
239
|
+
default: R(() => [
|
|
240
|
+
(m(!0), y(N, null, G(s.value, (u, r) => (m(), y(N, {
|
|
241
|
+
key: `message-${r}`
|
|
242
|
+
}, [
|
|
243
|
+
Array.isArray(v(M)(u)) ? (m(!0), y(N, { key: 0 }, G(v(M)(u), (l, d) => (m(), E(D, {
|
|
244
|
+
key: `content-${d}`,
|
|
245
|
+
message: u,
|
|
246
|
+
"content-index": d,
|
|
247
|
+
onStateChange: (o) => a("state-change", { ...o, messageIndex: r })
|
|
248
|
+
}, null, 8, ["message", "content-index", "onStateChange"]))), 128)) : (m(), E(D, {
|
|
249
|
+
key: 1,
|
|
250
|
+
message: u,
|
|
251
|
+
onStateChange: (l) => a("state-change", { ...l, messageIndex: r })
|
|
252
|
+
}, null, 8, ["message", "onStateChange"]))
|
|
253
|
+
], 64))), 128)),
|
|
254
|
+
g(h.$slots, "content-footer", {
|
|
255
|
+
messages: s.value,
|
|
256
|
+
role: e.role
|
|
257
|
+
}, void 0, !0)
|
|
258
|
+
]),
|
|
259
|
+
_: 3
|
|
260
|
+
}, 8, ["role", "placement", "shape", "messages"]))
|
|
261
|
+
]),
|
|
262
|
+
K("div", De, [
|
|
263
|
+
g(h.$slots, "after", {
|
|
264
|
+
messages: s.value,
|
|
265
|
+
role: t.role
|
|
266
|
+
}, void 0, !0)
|
|
267
|
+
])
|
|
268
|
+
]),
|
|
269
|
+
g(h.$slots, "suffix", {
|
|
270
|
+
messages: s.value,
|
|
271
|
+
role: t.role
|
|
272
|
+
}, void 0, !0)
|
|
273
|
+
], 8, Pe)), [
|
|
274
|
+
[_e, !b.value]
|
|
275
|
+
]);
|
|
276
|
+
}
|
|
277
|
+
}), Ye = {
|
|
278
|
+
"tr-bubble__avatar": "_tr-bubble__avatar_1r87c_2"
|
|
279
|
+
}, He = {
|
|
280
|
+
$style: Ye
|
|
281
|
+
}, L = /* @__PURE__ */ P(Ue, [["__cssModules", He], ["__scopeId", "data-v-eb4c3985"]]);
|
|
282
|
+
function V(t, n) {
|
|
283
|
+
const e = Y(t, (a, c) => {
|
|
284
|
+
c === !0 && a === !1 && (n(), e());
|
|
285
|
+
});
|
|
286
|
+
return e;
|
|
287
|
+
}
|
|
288
|
+
function je(t, n, e) {
|
|
289
|
+
const { scrollOnMount: a = !0, bottomThreshold: c = 20, scrollThrottle: i = 0 } = e ?? {}, s = q(!0);
|
|
290
|
+
let b = !1;
|
|
291
|
+
const x = /* @__PURE__ */ new Set(), h = () => ye(t), { y: f, isScrolling: u } = Re(h, { throttle: i }), r = (o) => o.scrollHeight - o.scrollTop - o.clientHeight <= c, l = async (o = "auto") => {
|
|
292
|
+
const p = B(h);
|
|
293
|
+
if (p && (await J(), p.scrollTo({ top: p.scrollHeight, behavior: o }), o === "smooth" && !r(p))) {
|
|
294
|
+
const I = V(u, () => {
|
|
295
|
+
p.scrollTo({ top: p.scrollHeight, behavior: "auto" }), x.delete(I);
|
|
296
|
+
});
|
|
297
|
+
x.add(I);
|
|
298
|
+
}
|
|
299
|
+
}, d = () => {
|
|
300
|
+
b || !s.value || (b = !0, requestAnimationFrame(async () => {
|
|
301
|
+
b = !1, await l("auto");
|
|
302
|
+
}));
|
|
303
|
+
};
|
|
304
|
+
return Y(
|
|
305
|
+
f,
|
|
306
|
+
() => {
|
|
307
|
+
const o = B(h);
|
|
308
|
+
o && (s.value = r(o));
|
|
72
309
|
},
|
|
73
|
-
|
|
74
|
-
|
|
310
|
+
{ flush: "post" }
|
|
311
|
+
), xe(
|
|
312
|
+
n,
|
|
313
|
+
() => {
|
|
314
|
+
d();
|
|
75
315
|
},
|
|
76
|
-
|
|
77
|
-
|
|
316
|
+
{ flush: "post", throttle: 100 }
|
|
317
|
+
), he(() => {
|
|
318
|
+
a && l("smooth");
|
|
319
|
+
}), Be(() => {
|
|
320
|
+
x.forEach((o) => {
|
|
321
|
+
o();
|
|
322
|
+
}), x.clear();
|
|
323
|
+
}), ve("keydown", (o) => {
|
|
324
|
+
if (o.key === "End" && !s.value) {
|
|
325
|
+
const p = V(u, () => {
|
|
326
|
+
l("auto"), x.delete(p);
|
|
327
|
+
});
|
|
328
|
+
x.add(p);
|
|
329
|
+
}
|
|
330
|
+
}), {
|
|
331
|
+
scrollToBottom: l
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
const We = /* @__PURE__ */ k({
|
|
335
|
+
__name: "BubbleItem",
|
|
336
|
+
props: {
|
|
337
|
+
messageGroup: {},
|
|
338
|
+
roleConfig: {},
|
|
339
|
+
contentRenderMode: {}
|
|
78
340
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
} = se(t.trigger), v = (o = {}) => {
|
|
87
|
-
const p = {};
|
|
88
|
-
for (const [c, a] of Object.entries(o))
|
|
89
|
-
/^on[A-Z]/.test(c) && typeof a == "function" && (p[c] = a);
|
|
90
|
-
return p;
|
|
91
|
-
}, f = E(null), b = h(() => {
|
|
92
|
-
var o;
|
|
93
|
-
return ((o = f.value) == null ? void 0 : o.popperRef) || null;
|
|
94
|
-
}), m = h(() => {
|
|
95
|
-
var o, p;
|
|
96
|
-
return typeof e.offset == "number" ? {
|
|
97
|
-
mainAxis: e.offset,
|
|
98
|
-
crossAxis: 0
|
|
99
|
-
} : {
|
|
100
|
-
mainAxis: ((o = e.offset) == null ? void 0 : o.mainAxis) ?? 0,
|
|
101
|
-
crossAxis: ((p = e.offset) == null ? void 0 : p.crossAxis) ?? 0
|
|
102
|
-
};
|
|
341
|
+
emits: ["state-change"],
|
|
342
|
+
setup(t, { emit: n }) {
|
|
343
|
+
const e = t, a = n;
|
|
344
|
+
return Fe(() => e.messageGroup), (c, i) => (m(), E(L, A(t.roleConfig, {
|
|
345
|
+
role: t.messageGroup.role,
|
|
346
|
+
"content-render-mode": t.contentRenderMode,
|
|
347
|
+
onStateChange: i[0] || (i[0] = (s) => a("state-change", s))
|
|
103
348
|
}), {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
349
|
+
prefix: R((s) => [
|
|
350
|
+
g(c.$slots, "prefix", T($(s)))
|
|
351
|
+
]),
|
|
352
|
+
suffix: R((s) => [
|
|
353
|
+
g(c.$slots, "suffix", T($(s)))
|
|
354
|
+
]),
|
|
355
|
+
"content-footer": R((s) => [
|
|
356
|
+
g(c.$slots, "content-footer", T($(s)))
|
|
357
|
+
]),
|
|
358
|
+
after: R((s) => [
|
|
359
|
+
g(c.$slots, "after", T($(s)))
|
|
360
|
+
]),
|
|
361
|
+
_: 3
|
|
362
|
+
}, 16, ["role", "content-render-mode"]));
|
|
363
|
+
}
|
|
364
|
+
}), Ve = /* @__PURE__ */ k({
|
|
365
|
+
__name: "BubbleList",
|
|
366
|
+
props: {
|
|
367
|
+
messages: {},
|
|
368
|
+
groupStrategy: { type: [String, Function], default: "divider" },
|
|
369
|
+
dividerRole: { default: "user" },
|
|
370
|
+
fallbackRole: { default: "assistant" },
|
|
371
|
+
roleConfigs: {},
|
|
372
|
+
contentRenderMode: {},
|
|
373
|
+
autoScroll: { type: Boolean }
|
|
374
|
+
},
|
|
375
|
+
emits: ["state-change"],
|
|
376
|
+
setup(t, { expose: n, emit: e }) {
|
|
377
|
+
const a = t, c = e;
|
|
378
|
+
H();
|
|
379
|
+
const i = q(null);
|
|
380
|
+
let s = async () => {
|
|
381
|
+
};
|
|
382
|
+
if (a.autoScroll) {
|
|
383
|
+
const f = _(() => a.messages.at(-1)), { scrollToBottom: u } = je(i, () => {
|
|
384
|
+
var r, l;
|
|
385
|
+
return [
|
|
386
|
+
a.messages.length,
|
|
387
|
+
(r = f.value) == null ? void 0 : r.content,
|
|
388
|
+
(l = f.value) == null ? void 0 : l.reasoning_content
|
|
389
|
+
];
|
|
390
|
+
});
|
|
391
|
+
s = u, Y(
|
|
392
|
+
() => {
|
|
393
|
+
var r;
|
|
394
|
+
return (r = f.value) == null ? void 0 : r.role;
|
|
395
|
+
},
|
|
396
|
+
async (r) => {
|
|
397
|
+
r === "user" && (await J(), u("smooth"));
|
|
123
398
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
const b = (f) => {
|
|
402
|
+
const u = [];
|
|
403
|
+
let r = !1;
|
|
404
|
+
for (const [l, d] of f.entries()) {
|
|
405
|
+
const o = u[u.length - 1];
|
|
406
|
+
Array.isArray(M(d)) ? (u.push({
|
|
407
|
+
role: d.role || "",
|
|
408
|
+
messages: [d],
|
|
409
|
+
messageIndexes: [l],
|
|
410
|
+
startIndex: l
|
|
411
|
+
}), r = !0) : o && o.role === d.role && !r ? (o.messages.push(d), o.messageIndexes.push(l)) : (u.push({
|
|
412
|
+
role: d.role || "",
|
|
413
|
+
messages: [d],
|
|
414
|
+
messageIndexes: [l],
|
|
415
|
+
startIndex: l
|
|
416
|
+
}), r = !1);
|
|
417
|
+
}
|
|
418
|
+
return u;
|
|
419
|
+
}, x = (f, u) => {
|
|
420
|
+
const r = [];
|
|
421
|
+
let l = !1;
|
|
422
|
+
for (const [d, o] of f.entries()) {
|
|
423
|
+
const p = r[r.length - 1], I = o.role === u;
|
|
424
|
+
Array.isArray(M(o)) ? (r.push({
|
|
425
|
+
role: o.role || "",
|
|
426
|
+
messages: [o],
|
|
427
|
+
messageIndexes: [d],
|
|
428
|
+
startIndex: d
|
|
429
|
+
}), l = !0) : p && p.role === u === I && !l ? (p.messages.push(o), p.messageIndexes.push(d)) : (r.push({
|
|
430
|
+
role: I ? u : o.role || "",
|
|
431
|
+
messages: [o],
|
|
432
|
+
messageIndexes: [d],
|
|
433
|
+
startIndex: d
|
|
434
|
+
}), l = !1);
|
|
146
435
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}), (
|
|
152
|
-
|
|
153
|
-
|
|
436
|
+
return r;
|
|
437
|
+
}, h = _(() => a.messages.length === 0 ? [] : typeof a.groupStrategy == "function" ? a.groupStrategy(a.messages, a.dividerRole) : a.groupStrategy === "consecutive" ? b(a.messages) : x(a.messages, a.dividerRole));
|
|
438
|
+
return n({
|
|
439
|
+
scrollToBottom: s
|
|
440
|
+
}), (f, u) => (m(), y("div", {
|
|
441
|
+
class: "tr-bubble-list",
|
|
442
|
+
ref_key: "listRef",
|
|
443
|
+
ref: i
|
|
444
|
+
}, [
|
|
445
|
+
(m(!0), y(N, null, G(h.value, (r, l) => {
|
|
446
|
+
var d;
|
|
447
|
+
return m(), E(We, {
|
|
448
|
+
key: l,
|
|
449
|
+
role: r.role || a.fallbackRole,
|
|
450
|
+
"role-config": (d = a.roleConfigs) == null ? void 0 : d[r.role || a.fallbackRole],
|
|
451
|
+
"message-group": r,
|
|
452
|
+
"content-render-mode": a.contentRenderMode,
|
|
453
|
+
onStateChange: (o) => c("state-change", { ...o, messageIndex: r.startIndex + o.messageIndex })
|
|
454
|
+
}, {
|
|
455
|
+
prefix: R((o) => [
|
|
456
|
+
g(f.$slots, "prefix", A({ ref_for: !0 }, o, {
|
|
457
|
+
messageIndexes: r.messageIndexes
|
|
458
|
+
}), void 0, !0)
|
|
459
|
+
]),
|
|
460
|
+
suffix: R((o) => [
|
|
461
|
+
g(f.$slots, "suffix", A({ ref_for: !0 }, o, {
|
|
462
|
+
messageIndexes: r.messageIndexes
|
|
463
|
+
}), void 0, !0)
|
|
464
|
+
]),
|
|
465
|
+
"content-footer": R((o) => [
|
|
466
|
+
g(f.$slots, "content-footer", A({ ref_for: !0 }, o, {
|
|
467
|
+
messageIndexes: r.messageIndexes
|
|
468
|
+
}), void 0, !0)
|
|
469
|
+
]),
|
|
470
|
+
after: R((o) => [
|
|
471
|
+
g(f.$slots, "after", A({ ref_for: !0 }, o, {
|
|
472
|
+
messageIndexes: r.messageIndexes
|
|
473
|
+
}), void 0, !0)
|
|
474
|
+
]),
|
|
475
|
+
_: 2
|
|
476
|
+
}, 1032, ["role", "role-config", "message-group", "content-render-mode", "onStateChange"]);
|
|
477
|
+
}), 128))
|
|
478
|
+
], 512));
|
|
154
479
|
}
|
|
155
|
-
}),
|
|
156
|
-
|
|
480
|
+
}), O = /* @__PURE__ */ P(Ve, [["__scopeId", "data-v-5336988b"]]), F = /* @__PURE__ */ k({
|
|
481
|
+
__name: "BubbleProvider",
|
|
482
|
+
props: {
|
|
483
|
+
boxRendererMatches: {},
|
|
484
|
+
contentRendererMatches: {},
|
|
485
|
+
fallbackBoxRenderer: { type: [Object, Function] },
|
|
486
|
+
fallbackContentRenderer: { type: [Object, Function] },
|
|
487
|
+
store: {}
|
|
488
|
+
},
|
|
489
|
+
setup(t) {
|
|
490
|
+
const n = t;
|
|
491
|
+
H(n.store);
|
|
492
|
+
const e = _(() => (n.boxRendererMatches || []).concat(ce).sort((s, b) => (s.priority ?? 0) - (b.priority ?? 0))), a = _(() => (n.contentRendererMatches || []).concat(ue).sort((s, b) => (s.priority ?? 0) - (b.priority ?? 0))), c = _(() => n.fallbackBoxRenderer || de), i = _(() => n.fallbackContentRenderer || ie);
|
|
493
|
+
return Ie({ boxRendererMatches: e, fallbackBoxRenderer: c }), Le({ contentRendererMatches: a, fallbackContentRenderer: i }), (s, b) => g(s.$slots, "default");
|
|
494
|
+
}
|
|
495
|
+
}), st = {
|
|
496
|
+
Box: ae,
|
|
497
|
+
Text: le
|
|
498
|
+
};
|
|
499
|
+
L.name = "TrBubble";
|
|
500
|
+
const Xe = function(t) {
|
|
501
|
+
t.component(L.name, L);
|
|
502
|
+
};
|
|
503
|
+
L.install = Xe;
|
|
504
|
+
const ot = L;
|
|
505
|
+
O.name = "TrBubbleList";
|
|
506
|
+
const ze = function(t) {
|
|
507
|
+
t.component(O.name, O);
|
|
508
|
+
};
|
|
509
|
+
O.install = ze;
|
|
510
|
+
const rt = O;
|
|
511
|
+
F.name = "TrBubbleProvider";
|
|
512
|
+
const qe = function(t) {
|
|
513
|
+
t.component(F.name, F);
|
|
514
|
+
};
|
|
515
|
+
F.install = qe;
|
|
516
|
+
const at = F;
|
|
157
517
|
export {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
518
|
+
ot as B,
|
|
519
|
+
rt as a,
|
|
520
|
+
at as b,
|
|
521
|
+
et as c,
|
|
522
|
+
st as d,
|
|
523
|
+
Ae as e,
|
|
524
|
+
$e as f,
|
|
525
|
+
tt as g,
|
|
526
|
+
Oe as h,
|
|
527
|
+
nt as i,
|
|
528
|
+
je as u
|
|
161
529
|
};
|