rt-chat-messages 1.0.5 → 1.0.6
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/chat-messages.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useMessageProcessor as ct, A2UISurface as ut, useA2UIConfig as dt,
|
|
1
|
+
import { defineComponent as Me, ref as C, onMounted as Ve, computed as Y, createBlock as de, createCommentVNode as B, openBlock as d, Teleport as at, createElementBlock as p, withModifiers as he, normalizeClass as le, createElementVNode as l, normalizeStyle as be, renderSlot as Fe, h as Oe, watch as ye, nextTick as oe, onUnmounted as He, createVNode as M, withCtx as W, unref as U, createTextVNode as We, toDisplayString as N, Fragment as ze, renderList as Ee, resolveDynamicComponent as Ke, withDirectives as nt, vShow as ot, createStaticVNode as lt, Transition as rt, getCurrentInstance as it } from "vue";
|
|
2
|
+
import { useMessageProcessor as ct, A2UISurface as ut, useA2UIConfig as dt, DEFAULT_CATALOG as mt, provideA2UI as vt, defaultTheme as ft } from "a2ui-vue";
|
|
3
3
|
import gt from "markdown-it";
|
|
4
|
-
import
|
|
4
|
+
import pt from "@vscode/markdown-it-katex";
|
|
5
5
|
import je from "mermaid";
|
|
6
|
-
const
|
|
6
|
+
const ht = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ Me({
|
|
7
7
|
__name: "Dialog",
|
|
8
8
|
props: {
|
|
9
9
|
visible: { type: Boolean, default: !1 },
|
|
@@ -14,63 +14,63 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
14
14
|
appendToBody: { type: Boolean, default: !0 }
|
|
15
15
|
},
|
|
16
16
|
emits: ["update:visible", "close"],
|
|
17
|
-
setup(r, { emit:
|
|
18
|
-
const b = r,
|
|
17
|
+
setup(r, { emit: y }) {
|
|
18
|
+
const b = r, w = y, m = C(!1);
|
|
19
19
|
Ve(() => {
|
|
20
|
-
|
|
20
|
+
m.value = !0;
|
|
21
21
|
});
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
b.closeOnClickModal &&
|
|
22
|
+
const A = Y(() => b.fullscreen ? { width: "100%", height: "100%", margin: 0 } : { width: b.width }), $ = () => {
|
|
23
|
+
w("update:visible", !1), w("close");
|
|
24
|
+
}, x = () => {
|
|
25
|
+
b.closeOnClickModal && $();
|
|
26
26
|
};
|
|
27
|
-
return (
|
|
27
|
+
return (H, D) => m.value ? (d(), de(at, {
|
|
28
28
|
key: 0,
|
|
29
29
|
to: "body"
|
|
30
30
|
}, [
|
|
31
|
-
r.visible ? (
|
|
31
|
+
r.visible ? (d(), p("div", {
|
|
32
32
|
key: 0,
|
|
33
|
-
class:
|
|
34
|
-
onClick:
|
|
33
|
+
class: le(["cm-dialog-overlay", { "is-fullscreen": r.fullscreen }]),
|
|
34
|
+
onClick: he(x, ["self"])
|
|
35
35
|
}, [
|
|
36
|
-
|
|
36
|
+
l("div", {
|
|
37
37
|
class: "cm-dialog",
|
|
38
|
-
style:
|
|
38
|
+
style: be(A.value),
|
|
39
39
|
role: "dialog",
|
|
40
40
|
"aria-modal": "true"
|
|
41
41
|
}, [
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
l("div", ht, [
|
|
43
|
+
Fe(H.$slots, "default", {}, void 0, !0)
|
|
44
44
|
]),
|
|
45
|
-
r.showClose ? (
|
|
45
|
+
r.showClose ? (d(), p("button", {
|
|
46
46
|
key: 0,
|
|
47
47
|
class: "cm-dialog__close",
|
|
48
|
-
onClick:
|
|
49
|
-
}, [...
|
|
50
|
-
|
|
48
|
+
onClick: $
|
|
49
|
+
}, [...D[0] || (D[0] = [
|
|
50
|
+
l("svg", {
|
|
51
51
|
viewBox: "0 0 1024 1024",
|
|
52
52
|
width: "16",
|
|
53
53
|
height: "16"
|
|
54
54
|
}, [
|
|
55
|
-
|
|
55
|
+
l("path", {
|
|
56
56
|
fill: "currentColor",
|
|
57
57
|
d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
|
|
58
58
|
})
|
|
59
59
|
], -1)
|
|
60
|
-
])])) :
|
|
60
|
+
])])) : B("", !0)
|
|
61
61
|
], 4)
|
|
62
|
-
], 2)) :
|
|
63
|
-
])) :
|
|
62
|
+
], 2)) : B("", !0)
|
|
63
|
+
])) : B("", !0);
|
|
64
64
|
}
|
|
65
|
-
}),
|
|
65
|
+
}), Ce = (r, y) => {
|
|
66
66
|
const b = r.__vccOpts || r;
|
|
67
|
-
for (const [
|
|
68
|
-
b[
|
|
67
|
+
for (const [w, m] of y)
|
|
68
|
+
b[w] = m;
|
|
69
69
|
return b;
|
|
70
|
-
}, Pe = /* @__PURE__ */
|
|
70
|
+
}, Pe = /* @__PURE__ */ Ce(yt, [["__scopeId", "data-v-efdf0259"]]), wt = ["disabled"], kt = {
|
|
71
71
|
key: 0,
|
|
72
72
|
class: "cm-icon-loading"
|
|
73
|
-
}, bt = /* @__PURE__ */
|
|
73
|
+
}, bt = /* @__PURE__ */ Me({
|
|
74
74
|
__name: "Button",
|
|
75
75
|
props: {
|
|
76
76
|
type: { default: "default" },
|
|
@@ -80,37 +80,37 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
80
80
|
loading: { type: Boolean, default: !1 }
|
|
81
81
|
},
|
|
82
82
|
emits: ["click"],
|
|
83
|
-
setup(r, { emit:
|
|
84
|
-
const b = r,
|
|
85
|
-
b.disabled || b.loading ||
|
|
83
|
+
setup(r, { emit: y }) {
|
|
84
|
+
const b = r, w = y, m = (A) => {
|
|
85
|
+
b.disabled || b.loading || w("click", A);
|
|
86
86
|
};
|
|
87
|
-
return (
|
|
88
|
-
class:
|
|
87
|
+
return (A, $) => (d(), p("button", {
|
|
88
|
+
class: le(["cm-button", [
|
|
89
89
|
`cm-button--${r.type}`,
|
|
90
90
|
`cm-button--${r.size}`,
|
|
91
91
|
{ "is-circle": r.circle, "is-disabled": r.disabled, "is-loading": r.loading }
|
|
92
92
|
]]),
|
|
93
93
|
disabled: r.disabled || r.loading,
|
|
94
|
-
onClick:
|
|
94
|
+
onClick: m
|
|
95
95
|
}, [
|
|
96
|
-
r.loading ? (
|
|
97
|
-
|
|
96
|
+
r.loading ? (d(), p("span", kt, [...$[0] || ($[0] = [
|
|
97
|
+
l("svg", {
|
|
98
98
|
viewBox: "0 0 1024 1024",
|
|
99
99
|
width: "1em",
|
|
100
100
|
height: "1em"
|
|
101
101
|
}, [
|
|
102
|
-
|
|
102
|
+
l("path", {
|
|
103
103
|
fill: "currentColor",
|
|
104
104
|
d: "M512 64a448 448 0 0 1 448 448 32 32 0 1 1-64 0 416 416 0 0 0-416-416 416 416 0 0 0-416 416 32 32 0 1 1-64 0 448 448 0 0 1 448-448z"
|
|
105
105
|
})
|
|
106
106
|
], -1)
|
|
107
|
-
])])) :
|
|
107
|
+
])])) : Fe(A.$slots, "default", { key: 1 }, void 0, !0)
|
|
108
108
|
], 10, wt));
|
|
109
109
|
}
|
|
110
|
-
}),
|
|
110
|
+
}), K = /* @__PURE__ */ Ce(bt, [["__scopeId", "data-v-bab126c7"]]), J = (r, y) => Me({
|
|
111
111
|
name: r,
|
|
112
112
|
render() {
|
|
113
|
-
return
|
|
113
|
+
return Oe(
|
|
114
114
|
"svg",
|
|
115
115
|
{
|
|
116
116
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -120,76 +120,76 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
120
120
|
fill: "currentColor",
|
|
121
121
|
style: "vertical-align: middle"
|
|
122
122
|
},
|
|
123
|
-
[
|
|
123
|
+
[Oe("path", { d: y })]
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
|
-
}),
|
|
126
|
+
}), Ue = J(
|
|
127
127
|
"Close",
|
|
128
128
|
"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
|
|
129
|
-
), Ye =
|
|
129
|
+
), Ye = J(
|
|
130
130
|
"ZoomIn",
|
|
131
131
|
"M637.696 587.392a316.032 316.032 0 1 0-45.44 49.344l191.232 191.296a32 32 0 0 0 45.312-45.184L637.696 587.392zM73.152 357.696a284.48 284.48 0 1 1 284.48 284.48A284.672 284.672 0 0 1 73.152 357.568zm268.48-154.56a32 32 0 0 0-32 32v90.496h-90.56a32 32 0 0 0 0 64h90.56v90.56a32 32 0 0 0 64 0v-90.496h90.496a32 32 0 0 0 0-64H373.632v-90.56a32 32 0 0 0-32-32z"
|
|
132
|
-
), Ne =
|
|
132
|
+
), Ne = J(
|
|
133
133
|
"ZoomOut",
|
|
134
134
|
"M637.696 587.392a316.032 316.032 0 1 0-45.44 49.344l191.232 191.296a32 32 0 0 0 45.312-45.184L637.696 587.392zM73.152 357.696a284.48 284.48 0 1 1 284.48 284.48A284.672 284.672 0 0 1 73.152 357.568zm145.92-58.56a32 32 0 0 0 0 64h245.12a32 32 0 0 0 0-64H219.072z"
|
|
135
|
-
), Mt =
|
|
135
|
+
), Mt = J(
|
|
136
136
|
"Document",
|
|
137
137
|
"M854.6 288.7c0.4 0 0.7 0 1 0v431.5c0 17.6-14.4 32-32 32H200.4c-17.6 0-32-14.4-32-32l0-575.2c0-17.6 14.4-32 32-32h391.5c0 0.3 0 0.7 0 1l0 142.1c0 17.6 14.4 32.1 32 32.1h142.6c0-0.4 0-0.7 0-1.1L854.6 288.7zM790.2 220.2L668 97.9v122.3h122.2zM240 448h544a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64zm0 128h544a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64zm0 128h384a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64z"
|
|
138
|
-
), Xe =
|
|
138
|
+
), Xe = J(
|
|
139
139
|
"Download",
|
|
140
140
|
"M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2 0.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
|
|
141
|
-
), St =
|
|
141
|
+
), St = J(
|
|
142
142
|
"VideoPlay",
|
|
143
143
|
"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm-48-247.616L668.608 512 464 375.616v272.768zm10.656-340.32a32 32 0 0 1 32 32V673.92a32 32 0 0 1-50.208 26.24l-236.8-161.92a32 32 0 0 1 0-52.48l236.8-161.92a32 32 0 0 1 18.208-5.632z"
|
|
144
|
-
), Ct =
|
|
144
|
+
), Ct = J(
|
|
145
145
|
"VideoPause",
|
|
146
146
|
"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm-96-544a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32zm192 0a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32z"
|
|
147
|
-
),
|
|
147
|
+
), _t = J(
|
|
148
148
|
"ArrowLeft",
|
|
149
149
|
"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
|
|
150
|
-
),
|
|
150
|
+
), At = J(
|
|
151
151
|
"ArrowRight",
|
|
152
152
|
"M340.864 149.312a29.12 29.12 0 0 0-41.728 0 30.592 30.592 0 0 0 0 42.752L611.072 511.936 299.136 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L672.448 534.272a32 32 0 0 0 0-44.672L340.864 149.312z"
|
|
153
|
-
), qe =
|
|
153
|
+
), qe = J(
|
|
154
154
|
"Spinner",
|
|
155
155
|
"M512 64a448 448 0 0 1 448 448 32 32 0 1 1-64 0 416 416 0 0 0-416-416 416 416 0 0 0-416 416 32 32 0 1 1-64 0 448 448 0 0 1 448-448z"
|
|
156
|
-
), Ze =
|
|
156
|
+
), Ze = J(
|
|
157
157
|
"Check",
|
|
158
158
|
"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"
|
|
159
|
-
),
|
|
159
|
+
), $t = J(
|
|
160
160
|
"ChevronUp",
|
|
161
161
|
"M854.6 642.5l-320-320c-12.5-12.5-32.8-12.5-45.3 0l-320 320c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L512 390.6l297.4 297.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3z"
|
|
162
|
-
),
|
|
162
|
+
), xt = J(
|
|
163
163
|
"ChevronDown",
|
|
164
164
|
"M854.6 381.5l-320 320c-12.5 12.5-32.8 12.5-45.3 0l-320-320c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L512 633.4l297.4-297.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3z"
|
|
165
|
-
),
|
|
165
|
+
), It = ["src", "alt"], Lt = { class: "preview-controls" }, zt = { class: "cm-button-group" }, Et = {
|
|
166
166
|
key: 0,
|
|
167
167
|
class: "mobile-close-hint"
|
|
168
|
-
},
|
|
168
|
+
}, Ut = ["innerHTML"], Tt = { class: "preview-controls" }, Bt = { class: "cm-button-group" }, Ht = {
|
|
169
169
|
key: 0,
|
|
170
170
|
class: "mobile-close-hint"
|
|
171
|
-
}, Dt = /* @__PURE__ */
|
|
171
|
+
}, Dt = /* @__PURE__ */ Me({
|
|
172
172
|
__name: "MarkdownMessage",
|
|
173
173
|
props: {
|
|
174
174
|
content: {},
|
|
175
175
|
isStreaming: { type: Boolean, default: !1 }
|
|
176
176
|
},
|
|
177
177
|
setup(r) {
|
|
178
|
-
const
|
|
179
|
-
let
|
|
178
|
+
const y = r, b = C(), w = C(), m = C(!1), A = C(""), $ = C(""), x = C(!1), H = C(""), D = C(!1), k = C(1), V = C({ x: 0, y: 0 }), L = C(!1), R = C({ x: 0, y: 0 }), S = C(1), O = C({ x: 0, y: 0 }), _ = C(!1), we = C({ x: 0, y: 0 }), z = C(""), re = C(/* @__PURE__ */ new Map()), me = C(!1);
|
|
179
|
+
let ke = 0;
|
|
180
180
|
je.initialize({
|
|
181
181
|
startOnLoad: !1,
|
|
182
182
|
theme: "default",
|
|
183
183
|
securityLevel: "loose",
|
|
184
184
|
fontFamily: "inherit"
|
|
185
185
|
});
|
|
186
|
-
const
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
return (
|
|
186
|
+
const _e = (a) => {
|
|
187
|
+
const o = a.renderer.rules.fence;
|
|
188
|
+
a.renderer.rules.fence = (c, g, u, e, t) => {
|
|
189
|
+
const s = c[g], n = s.content.trim();
|
|
190
|
+
return (s.info ? s.info.trim() : "") === "mermaid" ? (ke++, `<div class="mermaid-container"><pre class="mermaid" data-mermaid-id="${`mermaid-${Date.now()}-${ke}`}">${n}</pre></div>`) : o(c, g, u, e, t);
|
|
191
191
|
};
|
|
192
|
-
},
|
|
192
|
+
}, X = new gt({
|
|
193
193
|
html: !0,
|
|
194
194
|
// 允许HTML标签,以便markdown渲染的标签能正常显示
|
|
195
195
|
xhtmlOut: !1,
|
|
@@ -203,437 +203,437 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
203
203
|
// 启用一些语言中性的替换 + 引号美化
|
|
204
204
|
quotes: `""''`,
|
|
205
205
|
// 双引号和单引号的替换对,中文环境
|
|
206
|
-
highlight: function(
|
|
207
|
-
return
|
|
206
|
+
highlight: function(a, o) {
|
|
207
|
+
return o && o.trim() ? `<pre class="hljs language-${o}"><code>${((g) => g.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"))(a)}</code></pre>` : `<pre class="hljs"><code>${a}</code></pre>`;
|
|
208
208
|
}
|
|
209
|
-
}),
|
|
210
|
-
return
|
|
209
|
+
}), ee = X.renderer.rules.image || function(a, o, c, g, u) {
|
|
210
|
+
return u.renderToken(a, o, c);
|
|
211
211
|
};
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
if (
|
|
215
|
-
const
|
|
216
|
-
let
|
|
217
|
-
for (let
|
|
218
|
-
const
|
|
219
|
-
|
|
212
|
+
X.renderer.rules.image = function(a, o, c, g, u) {
|
|
213
|
+
const e = a[o], t = e.attrIndex("src");
|
|
214
|
+
if (t >= 0) {
|
|
215
|
+
const s = e.attrs[t][1], v = "img-" + ((E) => {
|
|
216
|
+
let P = 0;
|
|
217
|
+
for (let j = 0; j < E.length; j++) {
|
|
218
|
+
const pe = E.charCodeAt(j);
|
|
219
|
+
P = (P << 5) - P + pe, P = P & P;
|
|
220
220
|
}
|
|
221
|
-
return Math.abs(
|
|
222
|
-
})(
|
|
223
|
-
|
|
221
|
+
return Math.abs(P).toString(36);
|
|
222
|
+
})(s);
|
|
223
|
+
e.attrSet("id", v), e.attrSet("data-image-id", v), e.attrSet("key", v), e.attrSet("loading", "eager"), e.attrSet("decoding", "async"), e.attrSet("fetchpriority", "high"), e.attrSet("data-src", s), e.attrSet("data-cached", "true");
|
|
224
224
|
}
|
|
225
|
-
return
|
|
226
|
-
},
|
|
225
|
+
return ee(a, o, c, g, u);
|
|
226
|
+
}, X.use(pt, {
|
|
227
227
|
throwOnError: !1,
|
|
228
228
|
errorColor: "#cc0000"
|
|
229
|
-
}),
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
return
|
|
233
|
-
},
|
|
234
|
-
if (!
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
|
|
229
|
+
}), X.use(_e);
|
|
230
|
+
const q = (a) => {
|
|
231
|
+
const o = a.match(/```[\w]*\n/g), c = a.match(/\n```/g), g = (o == null ? void 0 : o.length) || 0, u = (c == null ? void 0 : c.length) || 0;
|
|
232
|
+
return g > u && (a += "\n```"), a;
|
|
233
|
+
}, T = (a) => {
|
|
234
|
+
if (!a) return "";
|
|
235
|
+
a = a.replace(/;;\s*$/g, ""), a = a.replace(/;;\s*$/g, "");
|
|
236
|
+
const o = /^```(?:markdown|md)\s*\n([\s\S]*?)\n```$/, c = a.match(o);
|
|
237
|
+
if (c)
|
|
238
|
+
a = c[1];
|
|
239
239
|
else {
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
const
|
|
243
|
-
(/^#{1,6}\s/.test(
|
|
240
|
+
const g = /^```\s*\n([\s\S]*?)\n```$/, u = a.match(g);
|
|
241
|
+
if (u) {
|
|
242
|
+
const e = u[1];
|
|
243
|
+
(/^#{1,6}\s/.test(e) || /^\*{1,2}[^*]+\*{1,2}/.test(e) || /^[-*+]\s/.test(e) || /^\d+\.\s/.test(e) || /!\[.*?\]\(.*?\)/.test(e) || /\[.*?\]\(.*?\)/.test(e) || /^\|.+\|/.test(e) || /^\|[\s-:]+\|/m.test(e)) && (a = e);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
if (
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
249
|
-
const
|
|
250
|
-
(/^#{1,6}\s/.test(
|
|
246
|
+
if (y.isStreaming) {
|
|
247
|
+
const g = /^```(?:markdown|md)?\s*\n/;
|
|
248
|
+
if (g.test(a)) {
|
|
249
|
+
const e = a.replace(g, "");
|
|
250
|
+
(/^#{1,6}\s/.test(e) || /^\|.+\|/.test(e) || /^\|[\s-:]+\|/m.test(e) || /!\[.*?\]\(.*?\)/.test(e) || /\[.*?\]\(.*?\)/.test(e)) && (a = a.replace(g, ""));
|
|
251
251
|
}
|
|
252
|
-
if (/^```(?:markdown|md)?\s*\n/.test(
|
|
253
|
-
const
|
|
254
|
-
|
|
252
|
+
if (/^```(?:markdown|md)?\s*\n/.test(y.content)) {
|
|
253
|
+
const e = /\n```\s*$/;
|
|
254
|
+
e.test(a) && (a = a.replace(e, ""));
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
return
|
|
257
|
+
return a = a.replace(
|
|
258
258
|
/```(?:markdown|md)\s*\n([\s\S]*?)\n```/g,
|
|
259
|
-
(
|
|
260
|
-
),
|
|
261
|
-
},
|
|
262
|
-
if (!
|
|
263
|
-
return
|
|
264
|
-
const
|
|
265
|
-
let
|
|
266
|
-
const
|
|
267
|
-
for (; (
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
270
|
-
const
|
|
271
|
-
|
|
259
|
+
(g, u) => u
|
|
260
|
+
), y.isStreaming && (a = q(a)), a;
|
|
261
|
+
}, te = (a) => {
|
|
262
|
+
if (!a.includes("<img"))
|
|
263
|
+
return a;
|
|
264
|
+
const o = /<img[^>]*?src="([^"]*)"[^>]*?>/g;
|
|
265
|
+
let c, g = a;
|
|
266
|
+
const u = [];
|
|
267
|
+
for (; (c = o.exec(a)) !== null; ) {
|
|
268
|
+
const e = c[0], t = c[1];
|
|
269
|
+
if (re.value.has(t)) {
|
|
270
|
+
const s = re.value.get(t);
|
|
271
|
+
e !== s && u.push({ original: e, cached: s });
|
|
272
272
|
} else
|
|
273
|
-
|
|
273
|
+
re.value.set(t, e);
|
|
274
274
|
}
|
|
275
|
-
for (const { original:
|
|
276
|
-
|
|
277
|
-
return
|
|
278
|
-
},
|
|
279
|
-
if (!
|
|
275
|
+
for (const { original: e, cached: t } of u)
|
|
276
|
+
g = g.replace(e, t);
|
|
277
|
+
return g;
|
|
278
|
+
}, Ae = (a) => {
|
|
279
|
+
if (!w.value)
|
|
280
280
|
return;
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
}),
|
|
286
|
-
|
|
287
|
-
|
|
281
|
+
const o = w.value, c = /* @__PURE__ */ new Map();
|
|
282
|
+
if (y.isStreaming && o.children.length > 0 && o.querySelectorAll("img[data-image-id]").forEach((g) => {
|
|
283
|
+
const u = g.getAttribute("data-image-id");
|
|
284
|
+
u && c.set(u, g);
|
|
285
|
+
}), o.innerHTML = a, !y.isStreaming) {
|
|
286
|
+
oe(() => {
|
|
287
|
+
Be(), h();
|
|
288
288
|
});
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
|
|
291
|
+
c.size > 0 && o.querySelectorAll("img[data-image-id]").forEach((g) => {
|
|
292
|
+
const u = g.getAttribute("data-image-id");
|
|
293
|
+
if (u && c.has(u)) {
|
|
294
|
+
const e = c.get(u);
|
|
295
|
+
g.parentNode && e !== g && g.parentNode.replaceChild(e, g);
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
|
-
},
|
|
298
|
+
}, G = () => {
|
|
299
299
|
try {
|
|
300
|
-
if (!
|
|
301
|
-
|
|
300
|
+
if (!y.content) {
|
|
301
|
+
z.value = "", w.value && (w.value.innerHTML = ""), y.isStreaming || re.value.clear();
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
|
-
if (document.hidden &&
|
|
305
|
-
|
|
304
|
+
if (document.hidden && y.isStreaming) {
|
|
305
|
+
me.value = !0;
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
const
|
|
309
|
-
let
|
|
310
|
-
|
|
311
|
-
} catch (
|
|
312
|
-
console.error("Markdown rendering error:",
|
|
308
|
+
const a = T(y.content);
|
|
309
|
+
let o = X.render(a);
|
|
310
|
+
y.isStreaming && o.includes("<img") && (o = te(o)), o !== z.value && (z.value = o, Ae(o)), y.isStreaming || re.value.clear();
|
|
311
|
+
} catch (a) {
|
|
312
|
+
console.error("Markdown rendering error:", a), w.value && (w.value.innerHTML = `<pre style="white-space: pre-wrap; word-wrap: break-word;">${y.content}</pre>`);
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
|
-
|
|
316
|
-
() =>
|
|
317
|
-
(
|
|
318
|
-
|
|
319
|
-
|
|
315
|
+
ye(() => y.content, G), ye(
|
|
316
|
+
() => y.isStreaming,
|
|
317
|
+
(a, o) => {
|
|
318
|
+
o && !a && oe(() => {
|
|
319
|
+
G();
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
322
|
);
|
|
323
|
-
const
|
|
324
|
-
!document.hidden &&
|
|
325
|
-
|
|
323
|
+
const Q = () => {
|
|
324
|
+
!document.hidden && me.value && (me.value = !1, oe(() => {
|
|
325
|
+
G();
|
|
326
326
|
}));
|
|
327
327
|
};
|
|
328
|
-
document.addEventListener("visibilitychange",
|
|
329
|
-
document.removeEventListener("visibilitychange",
|
|
328
|
+
document.addEventListener("visibilitychange", Q), He(() => {
|
|
329
|
+
document.removeEventListener("visibilitychange", Q);
|
|
330
330
|
});
|
|
331
331
|
const i = () => {
|
|
332
|
-
|
|
333
|
-
},
|
|
334
|
-
let
|
|
335
|
-
return
|
|
332
|
+
D.value = window.innerWidth < 768;
|
|
333
|
+
}, f = (a) => {
|
|
334
|
+
let o = a;
|
|
335
|
+
return o = o.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1"), [
|
|
336
336
|
/([A-Za-z0-9_]+)\[([^\]]*[\u4e00-\u9fa5]+[^\]]*)\]/g,
|
|
337
337
|
/([A-Za-z0-9_]+)\(([^)]*[\u4e00-\u9fa5]+[^)]*)\)/g,
|
|
338
338
|
/([A-Za-z0-9_]+)\{([^}]*[\u4e00-\u9fa5]+[^}]*)\}/g
|
|
339
|
-
].forEach((
|
|
340
|
-
|
|
341
|
-
if (
|
|
342
|
-
return
|
|
343
|
-
let
|
|
344
|
-
return
|
|
339
|
+
].forEach((g) => {
|
|
340
|
+
o = o.replace(g, (u, e, t) => {
|
|
341
|
+
if (t.startsWith('"') && t.endsWith('"'))
|
|
342
|
+
return u;
|
|
343
|
+
let s = t.replace(/^["']+|["']+$/g, "").replace(/["]/g, '\\"');
|
|
344
|
+
return u.includes("[") ? `${e}["${s}"]` : u.includes("(") ? `${e}("${s}")` : u.includes("{") ? `${e}{"${s}"}` : u;
|
|
345
345
|
});
|
|
346
|
-
}),
|
|
347
|
-
},
|
|
348
|
-
var
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
if (
|
|
352
|
-
for (const
|
|
353
|
-
const
|
|
354
|
-
let
|
|
355
|
-
if (
|
|
346
|
+
}), o;
|
|
347
|
+
}, h = async () => {
|
|
348
|
+
var o, c;
|
|
349
|
+
if (y.isStreaming || (await oe(), !b.value)) return;
|
|
350
|
+
const a = b.value.querySelectorAll(".mermaid");
|
|
351
|
+
if (a.length !== 0)
|
|
352
|
+
for (const g of Array.from(a)) {
|
|
353
|
+
const u = g;
|
|
354
|
+
let e = (o = u.textContent) == null ? void 0 : o.trim();
|
|
355
|
+
if (e && u.getAttribute("data-processed") !== "true")
|
|
356
356
|
try {
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}),
|
|
357
|
+
u.setAttribute("data-processed", "true"), e = f(e);
|
|
358
|
+
const t = u.getAttribute("data-mermaid-id") || `mermaid-${Date.now()}-${Math.random()}`, { svg: s } = await je.render(t, e), n = u.parentElement;
|
|
359
|
+
if (n) {
|
|
360
|
+
const v = document.createElement("div");
|
|
361
|
+
v.className = "mermaid-svg", v.innerHTML = s, v.setAttribute("data-mermaid-svg", "true"), v.style.cursor = "pointer", v.title = "Click to zoom", v.addEventListener("click", (E) => {
|
|
362
|
+
E.preventDefault(), E.stopPropagation(), H.value = s, S.value = 1, O.value = { x: 0, y: 0 }, x.value = !0;
|
|
363
|
+
}), n.replaceChild(v, u);
|
|
364
364
|
}
|
|
365
|
-
} catch (
|
|
366
|
-
console.error("Mermaid render failure:",
|
|
367
|
-
const
|
|
368
|
-
|
|
365
|
+
} catch (t) {
|
|
366
|
+
console.error("Mermaid render failure:", t);
|
|
367
|
+
const s = document.createElement("div");
|
|
368
|
+
s.className = "mermaid-error", s.textContent = `Mermaid render error: ${t}`, (c = u.parentElement) == null || c.replaceChild(s, u);
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
},
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
},
|
|
382
|
-
|
|
383
|
-
},
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
},
|
|
390
|
-
var
|
|
391
|
-
if (
|
|
392
|
-
|
|
393
|
-
x:
|
|
394
|
-
y:
|
|
371
|
+
}, I = (a) => {
|
|
372
|
+
a.preventDefault(), a.stopPropagation();
|
|
373
|
+
const o = a.target;
|
|
374
|
+
A.value = o.src, $.value = o.alt || "Image Preview", k.value = 1, V.value = { x: 0, y: 0 }, m.value = !0;
|
|
375
|
+
}, F = () => {
|
|
376
|
+
k.value <= 1 && (V.value = { x: 0, y: 0 });
|
|
377
|
+
}, ve = () => {
|
|
378
|
+
k.value = Math.min(k.value + 1, 10), F();
|
|
379
|
+
}, fe = () => {
|
|
380
|
+
k.value = Math.max(k.value - 1, 0.5), F();
|
|
381
|
+
}, ie = () => {
|
|
382
|
+
k.value = 1, V.value = { x: 0, y: 0 };
|
|
383
|
+
}, $e = () => {
|
|
384
|
+
k.value <= 1 && (m.value = !1);
|
|
385
|
+
}, se = (a) => {
|
|
386
|
+
a.preventDefault();
|
|
387
|
+
const o = a.deltaY > 0 ? -0.5 : 0.5, c = Math.max(0.5, Math.min(10, k.value + o));
|
|
388
|
+
k.value = c, F();
|
|
389
|
+
}, ae = (a) => {
|
|
390
|
+
var e;
|
|
391
|
+
if (k.value <= 1) return;
|
|
392
|
+
a.preventDefault(), L.value = !0, R.value = {
|
|
393
|
+
x: a.clientX - V.value.x,
|
|
394
|
+
y: a.clientY - V.value.y
|
|
395
395
|
};
|
|
396
|
-
const
|
|
397
|
-
if (!L.value || !
|
|
398
|
-
let
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
},
|
|
402
|
-
L.value = !1, document.removeEventListener("mousemove",
|
|
396
|
+
const o = a.target, c = (e = o.parentElement) == null ? void 0 : e.getBoundingClientRect(), g = (t) => {
|
|
397
|
+
if (!L.value || !c) return;
|
|
398
|
+
let s = t.clientX - R.value.x, n = t.clientY - R.value.y;
|
|
399
|
+
const v = o.offsetWidth, E = o.offsetHeight, P = v * k.value, j = E * k.value, pe = 0.3, De = c.width * (1 - pe - 0.5) - P / 2, Ie = P / 2 - c.width * (1 - pe - 0.5), Le = c.height * (1 - pe - 0.5) - j / 2, Se = j / 2 - c.height * (1 - pe - 0.5);
|
|
400
|
+
P > c.width ? s = Math.max(De, Math.min(Ie, s)) : s = 0, j > c.height ? n = Math.max(Le, Math.min(Se, n)) : n = 0, V.value = { x: s, y: n };
|
|
401
|
+
}, u = () => {
|
|
402
|
+
L.value = !1, document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", u);
|
|
403
403
|
};
|
|
404
|
-
document.addEventListener("mousemove",
|
|
405
|
-
},
|
|
406
|
-
var
|
|
407
|
-
if (
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
410
|
-
L.value = !0,
|
|
411
|
-
x:
|
|
412
|
-
y:
|
|
404
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", u);
|
|
405
|
+
}, ne = (a) => {
|
|
406
|
+
var n;
|
|
407
|
+
if (a.touches.length !== 1) return;
|
|
408
|
+
const o = a.touches[0], c = o.clientX, g = o.clientY;
|
|
409
|
+
if (k.value <= 1) return;
|
|
410
|
+
L.value = !0, R.value = {
|
|
411
|
+
x: c - V.value.x,
|
|
412
|
+
y: g - V.value.y
|
|
413
413
|
};
|
|
414
|
-
const
|
|
415
|
-
if (!L.value ||
|
|
414
|
+
const u = a.target, e = (n = u.parentElement) == null ? void 0 : n.getBoundingClientRect(), t = (v) => {
|
|
415
|
+
if (!L.value || v.touches.length !== 1 || !e)
|
|
416
416
|
return;
|
|
417
|
-
const
|
|
418
|
-
let
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
},
|
|
422
|
-
L.value = !1, document.removeEventListener("touchmove",
|
|
417
|
+
const E = v.touches[0];
|
|
418
|
+
let P = E.clientX - R.value.x, j = E.clientY - R.value.y;
|
|
419
|
+
const pe = u.offsetWidth, De = u.offsetHeight, Ie = pe * k.value, Le = De * k.value, Se = 0.3, Qe = e.width * (1 - Se - 0.5) - Ie / 2, et = Ie / 2 - e.width * (1 - Se - 0.5), tt = e.height * (1 - Se - 0.5) - Le / 2, st = Le / 2 - e.height * (1 - Se - 0.5);
|
|
420
|
+
Ie > e.width ? P = Math.max(Qe, Math.min(et, P)) : P = 0, Le > e.height ? j = Math.max(tt, Math.min(st, j)) : j = 0, V.value = { x: P, y: j };
|
|
421
|
+
}, s = () => {
|
|
422
|
+
L.value = !1, document.removeEventListener("touchmove", t), document.removeEventListener("touchend", s);
|
|
423
423
|
};
|
|
424
|
-
document.addEventListener("touchmove",
|
|
425
|
-
},
|
|
426
|
-
|
|
427
|
-
},
|
|
428
|
-
|
|
429
|
-
},
|
|
430
|
-
|
|
431
|
-
},
|
|
432
|
-
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
},
|
|
436
|
-
var
|
|
437
|
-
if (
|
|
438
|
-
|
|
439
|
-
x:
|
|
440
|
-
y:
|
|
424
|
+
document.addEventListener("touchmove", t, { passive: !1 }), document.addEventListener("touchend", s);
|
|
425
|
+
}, Z = () => {
|
|
426
|
+
S.value = Math.min(S.value + 1, 10);
|
|
427
|
+
}, xe = () => {
|
|
428
|
+
S.value = Math.max(S.value - 1, 0.5);
|
|
429
|
+
}, ce = () => {
|
|
430
|
+
S.value = 1, O.value = { x: 0, y: 0 };
|
|
431
|
+
}, ge = (a) => {
|
|
432
|
+
a.preventDefault();
|
|
433
|
+
const o = a.deltaY > 0 ? -0.5 : 0.5;
|
|
434
|
+
S.value = Math.max(0.5, Math.min(10, S.value + o));
|
|
435
|
+
}, Te = (a) => {
|
|
436
|
+
var e, t;
|
|
437
|
+
if (S.value <= 1) return;
|
|
438
|
+
a.preventDefault(), _.value = !0, we.value = {
|
|
439
|
+
x: a.clientX - O.value.x,
|
|
440
|
+
y: a.clientY - O.value.y
|
|
441
441
|
};
|
|
442
|
-
const
|
|
443
|
-
if (!
|
|
444
|
-
let
|
|
445
|
-
|
|
446
|
-
},
|
|
447
|
-
|
|
442
|
+
const c = (t = (e = a.target.closest(".mermaid-preview-content")) == null ? void 0 : e.parentElement) == null ? void 0 : t.getBoundingClientRect(), g = (s) => {
|
|
443
|
+
if (!_.value || !c) return;
|
|
444
|
+
let n = s.clientX - we.value.x, v = s.clientY - we.value.y;
|
|
445
|
+
O.value = { x: n, y: v };
|
|
446
|
+
}, u = () => {
|
|
447
|
+
_.value = !1, document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", u);
|
|
448
448
|
};
|
|
449
|
-
document.addEventListener("mousemove",
|
|
450
|
-
},
|
|
451
|
-
},
|
|
452
|
-
|
|
449
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", u);
|
|
450
|
+
}, ue = (a) => {
|
|
451
|
+
}, Be = () => {
|
|
452
|
+
y.isStreaming || oe(() => {
|
|
453
453
|
if (!b.value) return;
|
|
454
454
|
b.value.querySelectorAll(
|
|
455
455
|
".markdown-content img"
|
|
456
|
-
).forEach((
|
|
457
|
-
const
|
|
458
|
-
|
|
456
|
+
).forEach((o) => {
|
|
457
|
+
const c = o;
|
|
458
|
+
c.getAttribute("data-processed") !== "true" && (c.setAttribute("data-processed", "true"), c.style.cursor = "pointer", c.addEventListener("click", I));
|
|
459
459
|
});
|
|
460
460
|
});
|
|
461
461
|
};
|
|
462
462
|
return Ve(() => {
|
|
463
|
-
i(), window.addEventListener("resize", i),
|
|
464
|
-
}),
|
|
463
|
+
i(), window.addEventListener("resize", i), G(), Be(), h();
|
|
464
|
+
}), He(() => {
|
|
465
465
|
b.value && b.value.querySelectorAll(
|
|
466
466
|
".markdown-content img"
|
|
467
|
-
).forEach((
|
|
468
|
-
|
|
467
|
+
).forEach((o) => {
|
|
468
|
+
o.removeEventListener("click", I);
|
|
469
469
|
});
|
|
470
|
-
}), (
|
|
470
|
+
}), (a, o) => (d(), p("div", {
|
|
471
471
|
class: "markdown-message",
|
|
472
472
|
ref_key: "markdownContainer",
|
|
473
473
|
ref: b
|
|
474
474
|
}, [
|
|
475
|
-
|
|
475
|
+
l("div", {
|
|
476
476
|
ref_key: "markdownContent",
|
|
477
|
-
ref:
|
|
477
|
+
ref: w,
|
|
478
478
|
class: "markdown-content"
|
|
479
479
|
}, null, 512),
|
|
480
|
-
|
|
481
|
-
visible:
|
|
482
|
-
"onUpdate:visible":
|
|
483
|
-
width:
|
|
484
|
-
fullscreen:
|
|
480
|
+
M(Pe, {
|
|
481
|
+
visible: m.value,
|
|
482
|
+
"onUpdate:visible": o[2] || (o[2] = (c) => m.value = c),
|
|
483
|
+
width: D.value ? "95vw" : "80vw",
|
|
484
|
+
fullscreen: D.value,
|
|
485
485
|
class: "image-preview-dialog",
|
|
486
486
|
"close-on-click-modal": !1,
|
|
487
487
|
"append-to-body": ""
|
|
488
488
|
}, {
|
|
489
|
-
default:
|
|
490
|
-
|
|
489
|
+
default: W(() => [
|
|
490
|
+
l("div", {
|
|
491
491
|
class: "image-preview-container",
|
|
492
|
-
onClick:
|
|
492
|
+
onClick: o[1] || (o[1] = he((c) => m.value = !1, ["self"]))
|
|
493
493
|
}, [
|
|
494
|
-
|
|
495
|
-
src:
|
|
496
|
-
alt:
|
|
494
|
+
l("img", {
|
|
495
|
+
src: A.value,
|
|
496
|
+
alt: $.value,
|
|
497
497
|
class: "preview-image",
|
|
498
|
-
style:
|
|
499
|
-
transform: `translate(${V.value.x}px, ${V.value.y}px) scale(${
|
|
498
|
+
style: be({
|
|
499
|
+
transform: `translate(${V.value.x}px, ${V.value.y}px) scale(${k.value})`
|
|
500
500
|
}),
|
|
501
|
-
onWheel:
|
|
502
|
-
onDblclick:
|
|
503
|
-
onMousedown:
|
|
504
|
-
onTouchstart:
|
|
505
|
-
onClick:
|
|
506
|
-
}, null, 44,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
501
|
+
onWheel: he(se, ["prevent"]),
|
|
502
|
+
onDblclick: ie,
|
|
503
|
+
onMousedown: ae,
|
|
504
|
+
onTouchstart: he(ne, ["prevent"]),
|
|
505
|
+
onClick: $e
|
|
506
|
+
}, null, 44, It),
|
|
507
|
+
l("div", Lt, [
|
|
508
|
+
l("div", zt, [
|
|
509
|
+
M(K, {
|
|
510
510
|
size: "small",
|
|
511
|
-
onClick:
|
|
512
|
-
disabled:
|
|
511
|
+
onClick: fe,
|
|
512
|
+
disabled: k.value <= 0.5
|
|
513
513
|
}, {
|
|
514
|
-
default:
|
|
515
|
-
|
|
514
|
+
default: W(() => [
|
|
515
|
+
M(U(Ne))
|
|
516
516
|
]),
|
|
517
517
|
_: 1
|
|
518
518
|
}, 8, ["disabled"]),
|
|
519
|
-
|
|
519
|
+
M(K, {
|
|
520
520
|
size: "small",
|
|
521
|
-
onClick:
|
|
521
|
+
onClick: ie
|
|
522
522
|
}, {
|
|
523
|
-
default:
|
|
524
|
-
We(
|
|
523
|
+
default: W(() => [
|
|
524
|
+
We(N(Math.round(k.value * 100)) + "% ", 1)
|
|
525
525
|
]),
|
|
526
526
|
_: 1
|
|
527
527
|
}),
|
|
528
|
-
|
|
528
|
+
M(K, {
|
|
529
529
|
size: "small",
|
|
530
|
-
onClick:
|
|
531
|
-
disabled:
|
|
530
|
+
onClick: ve,
|
|
531
|
+
disabled: k.value >= 10
|
|
532
532
|
}, {
|
|
533
|
-
default:
|
|
534
|
-
|
|
533
|
+
default: W(() => [
|
|
534
|
+
M(U(Ye))
|
|
535
535
|
]),
|
|
536
536
|
_: 1
|
|
537
537
|
}, 8, ["disabled"])
|
|
538
538
|
]),
|
|
539
|
-
|
|
539
|
+
M(K, {
|
|
540
540
|
size: "small",
|
|
541
|
-
onClick:
|
|
541
|
+
onClick: o[0] || (o[0] = (c) => m.value = !1),
|
|
542
542
|
type: "danger"
|
|
543
543
|
}, {
|
|
544
|
-
default:
|
|
545
|
-
|
|
544
|
+
default: W(() => [
|
|
545
|
+
M(U(Ue))
|
|
546
546
|
]),
|
|
547
547
|
_: 1
|
|
548
548
|
})
|
|
549
549
|
]),
|
|
550
|
-
|
|
550
|
+
D.value ? (d(), p("div", Et, "双击重置 · 轻触关闭")) : B("", !0)
|
|
551
551
|
])
|
|
552
552
|
]),
|
|
553
553
|
_: 1
|
|
554
554
|
}, 8, ["visible", "width", "fullscreen"]),
|
|
555
|
-
|
|
556
|
-
visible:
|
|
557
|
-
"onUpdate:visible":
|
|
558
|
-
width:
|
|
559
|
-
fullscreen:
|
|
555
|
+
M(Pe, {
|
|
556
|
+
visible: x.value,
|
|
557
|
+
"onUpdate:visible": o[5] || (o[5] = (c) => x.value = c),
|
|
558
|
+
width: D.value ? "95vw" : "90vw",
|
|
559
|
+
fullscreen: D.value,
|
|
560
560
|
class: "mermaid-preview-dialog",
|
|
561
561
|
"close-on-click-modal": !1,
|
|
562
562
|
"append-to-body": ""
|
|
563
563
|
}, {
|
|
564
|
-
default:
|
|
565
|
-
|
|
564
|
+
default: W(() => [
|
|
565
|
+
l("div", {
|
|
566
566
|
class: "mermaid-preview-container",
|
|
567
|
-
onClick:
|
|
567
|
+
onClick: o[4] || (o[4] = he((c) => x.value = !1, ["self"]))
|
|
568
568
|
}, [
|
|
569
|
-
|
|
569
|
+
l("div", {
|
|
570
570
|
class: "mermaid-preview-content",
|
|
571
|
-
innerHTML:
|
|
572
|
-
style:
|
|
573
|
-
transform: `translate(${
|
|
571
|
+
innerHTML: H.value,
|
|
572
|
+
style: be({
|
|
573
|
+
transform: `translate(${O.value.x}px, ${O.value.y}px) scale(${S.value})`
|
|
574
574
|
}),
|
|
575
|
-
onWheel:
|
|
576
|
-
onDblclick:
|
|
577
|
-
onMousedown:
|
|
578
|
-
onTouchstart:
|
|
579
|
-
}, null, 44,
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
575
|
+
onWheel: he(ge, ["prevent"]),
|
|
576
|
+
onDblclick: ce,
|
|
577
|
+
onMousedown: Te,
|
|
578
|
+
onTouchstart: he(ue, ["prevent"])
|
|
579
|
+
}, null, 44, Ut),
|
|
580
|
+
l("div", Tt, [
|
|
581
|
+
l("div", Bt, [
|
|
582
|
+
M(K, {
|
|
583
583
|
size: "small",
|
|
584
|
-
onClick:
|
|
585
|
-
disabled:
|
|
584
|
+
onClick: xe,
|
|
585
|
+
disabled: S.value <= 0.5
|
|
586
586
|
}, {
|
|
587
|
-
default:
|
|
588
|
-
|
|
587
|
+
default: W(() => [
|
|
588
|
+
M(U(Ne))
|
|
589
589
|
]),
|
|
590
590
|
_: 1
|
|
591
591
|
}, 8, ["disabled"]),
|
|
592
|
-
|
|
592
|
+
M(K, {
|
|
593
593
|
size: "small",
|
|
594
|
-
onClick:
|
|
594
|
+
onClick: ce
|
|
595
595
|
}, {
|
|
596
|
-
default:
|
|
597
|
-
We(
|
|
596
|
+
default: W(() => [
|
|
597
|
+
We(N(Math.round(S.value * 100)) + "% ", 1)
|
|
598
598
|
]),
|
|
599
599
|
_: 1
|
|
600
600
|
}),
|
|
601
|
-
|
|
601
|
+
M(K, {
|
|
602
602
|
size: "small",
|
|
603
|
-
onClick:
|
|
604
|
-
disabled:
|
|
603
|
+
onClick: Z,
|
|
604
|
+
disabled: S.value >= 10
|
|
605
605
|
}, {
|
|
606
|
-
default:
|
|
607
|
-
|
|
606
|
+
default: W(() => [
|
|
607
|
+
M(U(Ye))
|
|
608
608
|
]),
|
|
609
609
|
_: 1
|
|
610
610
|
}, 8, ["disabled"])
|
|
611
611
|
]),
|
|
612
|
-
|
|
612
|
+
M(K, {
|
|
613
613
|
size: "small",
|
|
614
|
-
onClick:
|
|
614
|
+
onClick: o[3] || (o[3] = (c) => x.value = !1),
|
|
615
615
|
type: "danger"
|
|
616
616
|
}, {
|
|
617
|
-
default:
|
|
618
|
-
|
|
617
|
+
default: W(() => [
|
|
618
|
+
M(U(Ue))
|
|
619
619
|
]),
|
|
620
620
|
_: 1
|
|
621
621
|
})
|
|
622
622
|
]),
|
|
623
|
-
|
|
623
|
+
D.value ? (d(), p("div", Ht, "双击重置 · 轻触关闭")) : B("", !0)
|
|
624
624
|
])
|
|
625
625
|
]),
|
|
626
626
|
_: 1
|
|
627
627
|
}, 8, ["visible", "width", "fullscreen"])
|
|
628
628
|
], 512));
|
|
629
629
|
}
|
|
630
|
-
}), Je = /* @__PURE__ */
|
|
630
|
+
}), Je = /* @__PURE__ */ Ce(Dt, [["__scopeId", "data-v-c6385dde"]]), Pt = {
|
|
631
631
|
key: 0,
|
|
632
632
|
class: "text-content"
|
|
633
633
|
}, Rt = {
|
|
634
634
|
key: 1,
|
|
635
635
|
class: "images-content"
|
|
636
|
-
}, Vt = ["onClick"],
|
|
636
|
+
}, Vt = ["onClick"], Ft = ["src", "alt", "onError"], Ot = {
|
|
637
637
|
key: 0,
|
|
638
638
|
class: "more-images"
|
|
639
639
|
}, Wt = {
|
|
@@ -642,10 +642,10 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
642
642
|
}, jt = ["onClick"], Yt = { class: "file-icon-wrapper-small" }, Nt = ["title"], Xt = { class: "file-name" }, qt = { class: "file-type" }, Zt = { class: "file-actions" }, Kt = {
|
|
643
643
|
key: 3,
|
|
644
644
|
class: "audio-content"
|
|
645
|
-
}, Jt = { class: "audio-player" }, Gt = { class: "audio-info" }, Qt = { class: "audio-progress" },
|
|
645
|
+
}, Jt = { class: "audio-player" }, Gt = { class: "audio-info" }, Qt = { class: "audio-progress" }, es = { class: "progress-bar" }, ts = { class: "audio-time" }, ss = { class: "image-preview-container" }, as = ["src"], ns = {
|
|
646
646
|
key: 0,
|
|
647
647
|
class: "image-nav"
|
|
648
|
-
},
|
|
648
|
+
}, os = { class: "image-counter" }, ls = /* @__PURE__ */ Me({
|
|
649
649
|
__name: "MultimodalMessage",
|
|
650
650
|
props: {
|
|
651
651
|
message: {},
|
|
@@ -655,285 +655,285 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
655
655
|
onDownload: {}
|
|
656
656
|
},
|
|
657
657
|
setup(r) {
|
|
658
|
-
const
|
|
658
|
+
const y = r, b = Y(() => {
|
|
659
659
|
try {
|
|
660
|
-
return
|
|
660
|
+
return y.message.metadata ? JSON.parse(y.message.metadata) : {};
|
|
661
661
|
} catch {
|
|
662
662
|
return {};
|
|
663
663
|
}
|
|
664
|
-
}),
|
|
664
|
+
}), w = Y(
|
|
665
665
|
() => b.value.imageUrls || []
|
|
666
|
-
),
|
|
666
|
+
), m = Y(() => b.value.audioUrl), A = C(/* @__PURE__ */ new Set()), $ = Y(
|
|
667
667
|
() => b.value.fileUrls || []
|
|
668
|
-
),
|
|
668
|
+
), x = Y(() => $.value), H = Y(() => y.message.attachments && y.message.attachments.length > 0 ? y.message.attachments : b.value.attachments && Array.isArray(b.value.attachments) ? b.value.attachments : []), D = Y(() => {
|
|
669
669
|
const i = [];
|
|
670
|
-
return
|
|
671
|
-
var
|
|
672
|
-
((
|
|
673
|
-
url:
|
|
674
|
-
name:
|
|
675
|
-
type:
|
|
670
|
+
return H.value && H.value.length > 0 ? H.value.forEach((f) => {
|
|
671
|
+
var I, F;
|
|
672
|
+
((I = f.type) == null ? void 0 : I.startsWith("image/")) || ((F = f.name) == null ? void 0 : F.match(/\.(jpg|jpeg|png|gif|webp|svg|bmp|ico)$/i)) || i.push({
|
|
673
|
+
url: f.url || f.download_url || f.file_url || "",
|
|
674
|
+
name: f.original_name || f.name || "Unknown File",
|
|
675
|
+
type: ee(f.original_name || f.name || "Unknown File")
|
|
676
676
|
});
|
|
677
|
-
}) :
|
|
677
|
+
}) : x.value && x.value.length > 0 && x.value.forEach((f) => {
|
|
678
678
|
i.push({
|
|
679
|
-
url:
|
|
680
|
-
name:
|
|
681
|
-
type:
|
|
679
|
+
url: f,
|
|
680
|
+
name: X(f),
|
|
681
|
+
type: ee(f)
|
|
682
682
|
});
|
|
683
683
|
}), i;
|
|
684
|
-
}),
|
|
685
|
-
let
|
|
686
|
-
const
|
|
687
|
-
V.value = i, L.value =
|
|
688
|
-
},
|
|
689
|
-
L.value > 0 && (L.value--, V.value =
|
|
690
|
-
},
|
|
691
|
-
L.value <
|
|
692
|
-
},
|
|
693
|
-
console.error("Image load failed:",
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
},
|
|
684
|
+
}), k = C(!1), V = C(""), L = C(0), R = C(!1), S = C(!1), O = C(0), _ = C(0), we = Y(() => _.value > 0 ? O.value / _.value * 100 : 0);
|
|
685
|
+
let z = null;
|
|
686
|
+
const re = (i, f) => {
|
|
687
|
+
V.value = i, L.value = f, k.value = !0;
|
|
688
|
+
}, me = () => {
|
|
689
|
+
L.value > 0 && (L.value--, V.value = w.value[L.value]);
|
|
690
|
+
}, ke = () => {
|
|
691
|
+
L.value < w.value.length - 1 && (L.value++, V.value = w.value[L.value]);
|
|
692
|
+
}, _e = (i, f) => {
|
|
693
|
+
console.error("Image load failed:", f);
|
|
694
|
+
const h = i.target;
|
|
695
|
+
h.style.display = "none";
|
|
696
|
+
}, X = (i) => {
|
|
697
697
|
if (!i) return "Unknown File";
|
|
698
698
|
if (!i.includes("/"))
|
|
699
699
|
return decodeURIComponent(i) || "Unknown File";
|
|
700
700
|
try {
|
|
701
|
-
const
|
|
702
|
-
return decodeURIComponent(
|
|
701
|
+
const f = i.lastIndexOf("/"), h = f >= 0 ? i.substring(f + 1) : i;
|
|
702
|
+
return decodeURIComponent(h) || "Unknown File";
|
|
703
703
|
} catch {
|
|
704
704
|
return "Unknown File";
|
|
705
705
|
}
|
|
706
|
-
},
|
|
707
|
-
var
|
|
708
|
-
return ((
|
|
709
|
-
},
|
|
710
|
-
|
|
711
|
-
},
|
|
706
|
+
}, ee = (i) => {
|
|
707
|
+
var I;
|
|
708
|
+
return ((I = X(i).split(".").pop()) == null ? void 0 : I.toUpperCase()) || "FILE";
|
|
709
|
+
}, q = (i, f) => {
|
|
710
|
+
te(i, f);
|
|
711
|
+
}, T = (i) => !i || i.startsWith("http://") || i.startsWith("https://") || i.startsWith("blob:") ? i : (y.apiBaseUrl ? y.apiBaseUrl.replace(/\/$/, "") : "") + (i.startsWith("/") ? i : "/" + i), te = async (i, f) => {
|
|
712
712
|
try {
|
|
713
|
-
const
|
|
714
|
-
if (console.log("正在下载文件...",
|
|
715
|
-
const
|
|
716
|
-
|
|
713
|
+
const h = T(i);
|
|
714
|
+
if (console.log("正在下载文件...", h), y.onDownload && (A.value = /* @__PURE__ */ new Set([...A.value, i]), await y.onDownload(i, f) !== !1)) {
|
|
715
|
+
const Z = new Set(A.value);
|
|
716
|
+
Z.delete(i), A.value = Z;
|
|
717
717
|
return;
|
|
718
718
|
}
|
|
719
|
-
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
722
|
-
const
|
|
723
|
-
|
|
719
|
+
A.value = /* @__PURE__ */ new Set([...A.value, i]);
|
|
720
|
+
const I = localStorage.getItem("token"), F = {};
|
|
721
|
+
if (I && (F.Authorization = I.startsWith("Bearer ") ? I : `Bearer ${I}`), typeof window < "u" && typeof window.plus < "u") {
|
|
722
|
+
const ne = window.plus, Z = ne.downloader.createDownload(
|
|
723
|
+
h,
|
|
724
724
|
{
|
|
725
725
|
method: "GET",
|
|
726
|
-
filename: "_downloads/" + (
|
|
726
|
+
filename: "_downloads/" + (f || X(i))
|
|
727
727
|
},
|
|
728
|
-
(
|
|
729
|
-
const
|
|
730
|
-
|
|
728
|
+
(xe, ce) => {
|
|
729
|
+
const ge = new Set(A.value);
|
|
730
|
+
ge.delete(i), A.value = ge, ce === 200 || ce === 206 ? ne.runtime.openFile(xe.filename) : console.error("App 环境原生下载失败, status:", ce);
|
|
731
731
|
}
|
|
732
732
|
);
|
|
733
|
-
|
|
733
|
+
F.Authorization && Z.setRequestHeader(
|
|
734
734
|
"Authorization",
|
|
735
|
-
|
|
736
|
-
),
|
|
735
|
+
F.Authorization
|
|
736
|
+
), Z.start();
|
|
737
737
|
return;
|
|
738
738
|
}
|
|
739
|
-
const
|
|
740
|
-
if (!
|
|
741
|
-
throw new Error(`下载失败: ${
|
|
742
|
-
let
|
|
743
|
-
const
|
|
744
|
-
if (
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
747
|
-
|
|
739
|
+
const ve = await fetch(h, { headers: F });
|
|
740
|
+
if (!ve.ok)
|
|
741
|
+
throw new Error(`下载失败: ${ve.status}`);
|
|
742
|
+
let fe = f;
|
|
743
|
+
const ie = ve.headers.get("Content-Disposition");
|
|
744
|
+
if (ie) {
|
|
745
|
+
const ne = ie.match(/filename\*=UTF-8''(.+)/i);
|
|
746
|
+
if (ne)
|
|
747
|
+
fe = decodeURIComponent(ne[1]);
|
|
748
748
|
else {
|
|
749
|
-
const
|
|
750
|
-
|
|
749
|
+
const Z = ie.match(/filename="?([^";\n]+)"?/i);
|
|
750
|
+
Z && (fe = Z[1]);
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
} catch (
|
|
756
|
-
console.error("下载文件失败:",
|
|
753
|
+
const $e = await ve.blob(), se = URL.createObjectURL($e), ae = document.createElement("a");
|
|
754
|
+
ae.href = se, ae.download = fe || f || X(i), document.body.appendChild(ae), ae.click(), document.body.removeChild(ae), URL.revokeObjectURL(se);
|
|
755
|
+
} catch (h) {
|
|
756
|
+
console.error("下载文件失败:", h);
|
|
757
757
|
} finally {
|
|
758
|
-
const
|
|
759
|
-
|
|
758
|
+
const h = new Set(A.value);
|
|
759
|
+
h.delete(i), A.value = h;
|
|
760
760
|
}
|
|
761
|
-
},
|
|
762
|
-
if (
|
|
761
|
+
}, Ae = async () => {
|
|
762
|
+
if (m.value)
|
|
763
763
|
try {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
}),
|
|
767
|
-
|
|
768
|
-
}),
|
|
769
|
-
|
|
770
|
-
}),
|
|
771
|
-
console.error("Audio playback error:", i),
|
|
772
|
-
})),
|
|
764
|
+
z || (z = new Audio(), z.src = T(m.value), z.addEventListener("loadedmetadata", () => {
|
|
765
|
+
_.value = (z == null ? void 0 : z.duration) || 0;
|
|
766
|
+
}), z.addEventListener("timeupdate", () => {
|
|
767
|
+
O.value = (z == null ? void 0 : z.currentTime) || 0;
|
|
768
|
+
}), z.addEventListener("ended", () => {
|
|
769
|
+
R.value = !1, O.value = 0;
|
|
770
|
+
}), z.addEventListener("error", (i) => {
|
|
771
|
+
console.error("Audio playback error:", i), S.value = !1, R.value = !1;
|
|
772
|
+
})), R.value ? (z.pause(), R.value = !1) : (S.value = !0, await z.play(), R.value = !0, S.value = !1);
|
|
773
773
|
} catch (i) {
|
|
774
|
-
console.error("Audio playback failed:", i),
|
|
774
|
+
console.error("Audio playback failed:", i), S.value = !1, R.value = !1;
|
|
775
775
|
}
|
|
776
|
-
},
|
|
777
|
-
const
|
|
778
|
-
return `${
|
|
779
|
-
},
|
|
780
|
-
|
|
776
|
+
}, G = (i) => {
|
|
777
|
+
const f = Math.floor(i / 60), h = Math.floor(i % 60);
|
|
778
|
+
return `${f}:${h.toString().padStart(2, "0")}`;
|
|
779
|
+
}, Q = (i) => {
|
|
780
|
+
k.value && (i.key === "ArrowLeft" ? me() : i.key === "ArrowRight" ? ke() : i.key === "Escape" && (k.value = !1));
|
|
781
781
|
};
|
|
782
|
-
return
|
|
783
|
-
i ? document.addEventListener("keydown",
|
|
784
|
-
}),
|
|
785
|
-
|
|
786
|
-
}), (i,
|
|
787
|
-
class:
|
|
782
|
+
return ye(k, (i) => {
|
|
783
|
+
i ? document.addEventListener("keydown", Q) : document.removeEventListener("keydown", Q);
|
|
784
|
+
}), He(() => {
|
|
785
|
+
z && (z.pause(), z = null), document.removeEventListener("keydown", Q);
|
|
786
|
+
}), (i, f) => (d(), p("div", {
|
|
787
|
+
class: le(["multimodal-message", { "is-user": r.isUser, "is-assistant": !r.isUser }])
|
|
788
788
|
}, [
|
|
789
|
-
r.message.content ? (
|
|
790
|
-
|
|
789
|
+
r.message.content ? (d(), p("div", Pt, [
|
|
790
|
+
M(Je, {
|
|
791
791
|
content: r.message.content,
|
|
792
792
|
"is-streaming": r.isStreaming
|
|
793
793
|
}, null, 8, ["content", "is-streaming"])
|
|
794
|
-
])) :
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
class:
|
|
794
|
+
])) : B("", !0),
|
|
795
|
+
w.value && w.value.length > 0 ? (d(), p("div", Rt, [
|
|
796
|
+
l("div", {
|
|
797
|
+
class: le(["images-grid", `grid-${Math.min(w.value.length, 4)}`])
|
|
798
798
|
}, [
|
|
799
|
-
(
|
|
800
|
-
key:
|
|
799
|
+
(d(!0), p(ze, null, Ee(w.value.slice(0, 4), (h, I) => (d(), p("div", {
|
|
800
|
+
key: I,
|
|
801
801
|
class: "image-item",
|
|
802
|
-
onClick: (
|
|
802
|
+
onClick: (F) => re(h, I)
|
|
803
803
|
}, [
|
|
804
|
-
|
|
805
|
-
src:
|
|
806
|
-
alt: `图片 ${
|
|
807
|
-
onError: (
|
|
804
|
+
l("img", {
|
|
805
|
+
src: h,
|
|
806
|
+
alt: `图片 ${I + 1}`,
|
|
807
|
+
onError: (F) => _e(F, h),
|
|
808
808
|
loading: "lazy"
|
|
809
|
-
}, null, 40,
|
|
810
|
-
|
|
809
|
+
}, null, 40, Ft),
|
|
810
|
+
I === 3 && w.value.length > 4 ? (d(), p("div", Ot, " +" + N(w.value.length - 4), 1)) : B("", !0)
|
|
811
811
|
], 8, Vt))), 128))
|
|
812
812
|
], 2)
|
|
813
|
-
])) :
|
|
814
|
-
|
|
815
|
-
(
|
|
816
|
-
key:
|
|
813
|
+
])) : B("", !0),
|
|
814
|
+
D.value && D.value.length > 0 ? (d(), p("div", Wt, [
|
|
815
|
+
(d(!0), p(ze, null, Ee(D.value, (h, I) => (d(), p("div", {
|
|
816
|
+
key: I,
|
|
817
817
|
class: "file-item",
|
|
818
|
-
onClick: (
|
|
818
|
+
onClick: (F) => q(h.url, h.name)
|
|
819
819
|
}, [
|
|
820
|
-
|
|
821
|
-
|
|
820
|
+
l("div", Yt, [
|
|
821
|
+
M(U(Mt), { class: "file-icon" })
|
|
822
822
|
]),
|
|
823
|
-
|
|
823
|
+
l("div", {
|
|
824
824
|
class: "file-info",
|
|
825
|
-
title:
|
|
825
|
+
title: h.name
|
|
826
826
|
}, [
|
|
827
|
-
|
|
828
|
-
|
|
827
|
+
l("span", Xt, N(h.name), 1),
|
|
828
|
+
l("span", qt, N(h.type), 1)
|
|
829
829
|
], 8, Nt),
|
|
830
|
-
|
|
831
|
-
|
|
830
|
+
l("div", Zt, [
|
|
831
|
+
M(K, {
|
|
832
832
|
size: "small",
|
|
833
833
|
type: "text",
|
|
834
|
-
disabled:
|
|
835
|
-
onClick:
|
|
834
|
+
disabled: A.value.has(h.url),
|
|
835
|
+
onClick: he((F) => te(h.url, h.name), ["stop"])
|
|
836
836
|
}, {
|
|
837
|
-
default:
|
|
838
|
-
|
|
839
|
-
class:
|
|
837
|
+
default: W(() => [
|
|
838
|
+
M(U(Xe), {
|
|
839
|
+
class: le({ "icon-spin": A.value.has(h.url) })
|
|
840
840
|
}, null, 8, ["class"])
|
|
841
841
|
]),
|
|
842
842
|
_: 2
|
|
843
843
|
}, 1032, ["disabled", "onClick"])
|
|
844
844
|
])
|
|
845
845
|
], 8, jt))), 128))
|
|
846
|
-
])) :
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
onClick:
|
|
851
|
-
loading:
|
|
846
|
+
])) : B("", !0),
|
|
847
|
+
m.value ? (d(), p("div", Kt, [
|
|
848
|
+
l("div", Jt, [
|
|
849
|
+
M(K, {
|
|
850
|
+
onClick: Ae,
|
|
851
|
+
loading: S.value,
|
|
852
852
|
circle: "",
|
|
853
853
|
size: "small",
|
|
854
854
|
class: "play-btn"
|
|
855
855
|
}, {
|
|
856
|
-
default:
|
|
857
|
-
(
|
|
856
|
+
default: W(() => [
|
|
857
|
+
(d(), de(Ke(R.value ? U(Ct) : U(St))))
|
|
858
858
|
]),
|
|
859
859
|
_: 1
|
|
860
860
|
}, 8, ["loading"]),
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
861
|
+
l("div", Gt, [
|
|
862
|
+
l("div", Qt, [
|
|
863
|
+
l("div", es, [
|
|
864
|
+
l("div", {
|
|
865
865
|
class: "progress-fill",
|
|
866
|
-
style:
|
|
866
|
+
style: be({ width: we.value + "%" })
|
|
867
867
|
}, null, 4)
|
|
868
868
|
])
|
|
869
869
|
]),
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
870
|
+
l("div", ts, [
|
|
871
|
+
l("span", null, N(G(O.value)), 1),
|
|
872
|
+
f[4] || (f[4] = l("span", null, "/", -1)),
|
|
873
|
+
l("span", null, N(G(_.value)), 1)
|
|
874
874
|
])
|
|
875
875
|
]),
|
|
876
|
-
|
|
877
|
-
onClick:
|
|
876
|
+
M(K, {
|
|
877
|
+
onClick: f[0] || (f[0] = (h) => te(m.value)),
|
|
878
878
|
size: "small",
|
|
879
879
|
type: "text",
|
|
880
880
|
class: "download-btn"
|
|
881
881
|
}, {
|
|
882
|
-
default:
|
|
883
|
-
|
|
882
|
+
default: W(() => [
|
|
883
|
+
M(U(Xe))
|
|
884
884
|
]),
|
|
885
885
|
_: 1
|
|
886
886
|
})
|
|
887
887
|
])
|
|
888
|
-
])) :
|
|
889
|
-
|
|
890
|
-
visible:
|
|
891
|
-
"onUpdate:visible":
|
|
888
|
+
])) : B("", !0),
|
|
889
|
+
M(Pe, {
|
|
890
|
+
visible: k.value,
|
|
891
|
+
"onUpdate:visible": f[3] || (f[3] = (h) => k.value = h),
|
|
892
892
|
width: "90%",
|
|
893
893
|
"show-close": !1,
|
|
894
894
|
"append-to-body": "",
|
|
895
895
|
class: "image-preview-dialog-wrapper"
|
|
896
896
|
}, {
|
|
897
|
-
default:
|
|
898
|
-
|
|
899
|
-
|
|
897
|
+
default: W(() => [
|
|
898
|
+
l("div", ss, [
|
|
899
|
+
l("img", {
|
|
900
900
|
src: V.value,
|
|
901
901
|
alt: "预览图片",
|
|
902
902
|
class: "preview-image",
|
|
903
|
-
onClick:
|
|
904
|
-
}, null, 8,
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
onClick:
|
|
903
|
+
onClick: f[1] || (f[1] = (h) => k.value = !1)
|
|
904
|
+
}, null, 8, as),
|
|
905
|
+
w.value && w.value.length > 1 ? (d(), p("div", ns, [
|
|
906
|
+
M(K, {
|
|
907
|
+
onClick: me,
|
|
908
908
|
disabled: L.value === 0,
|
|
909
909
|
circle: "",
|
|
910
910
|
class: "nav-btn"
|
|
911
911
|
}, {
|
|
912
|
-
default:
|
|
913
|
-
|
|
912
|
+
default: W(() => [
|
|
913
|
+
M(U(_t))
|
|
914
914
|
]),
|
|
915
915
|
_: 1
|
|
916
916
|
}, 8, ["disabled"]),
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
onClick:
|
|
920
|
-
disabled: L.value ===
|
|
917
|
+
l("span", os, N(L.value + 1) + " / " + N(w.value.length), 1),
|
|
918
|
+
M(K, {
|
|
919
|
+
onClick: ke,
|
|
920
|
+
disabled: L.value === w.value.length - 1,
|
|
921
921
|
circle: "",
|
|
922
922
|
class: "nav-btn"
|
|
923
923
|
}, {
|
|
924
|
-
default:
|
|
925
|
-
|
|
924
|
+
default: W(() => [
|
|
925
|
+
M(U(At))
|
|
926
926
|
]),
|
|
927
927
|
_: 1
|
|
928
928
|
}, 8, ["disabled"])
|
|
929
|
-
])) :
|
|
930
|
-
|
|
931
|
-
onClick:
|
|
929
|
+
])) : B("", !0),
|
|
930
|
+
M(K, {
|
|
931
|
+
onClick: f[2] || (f[2] = (h) => k.value = !1),
|
|
932
932
|
class: "close-btn",
|
|
933
933
|
circle: ""
|
|
934
934
|
}, {
|
|
935
|
-
default:
|
|
936
|
-
|
|
935
|
+
default: W(() => [
|
|
936
|
+
M(U(Ue))
|
|
937
937
|
]),
|
|
938
938
|
_: 1
|
|
939
939
|
})
|
|
@@ -943,115 +943,143 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
943
943
|
}, 8, ["visible"])
|
|
944
944
|
], 2));
|
|
945
945
|
}
|
|
946
|
-
}), Re = /* @__PURE__ */
|
|
947
|
-
key: 0,
|
|
948
|
-
class: "agent-steps"
|
|
949
|
-
}, ia = { class: "steps-indicator" }, ca = {
|
|
946
|
+
}), Re = /* @__PURE__ */ Ce(ls, [["__scopeId", "data-v-96cd8b34"]]), rs = ["aria-expanded"], is = { class: "steps-indicator" }, cs = {
|
|
950
947
|
key: 0,
|
|
951
948
|
class: "icon-running"
|
|
952
|
-
},
|
|
949
|
+
}, us = {
|
|
953
950
|
key: 1,
|
|
951
|
+
class: "icon-error"
|
|
952
|
+
}, ds = {
|
|
953
|
+
key: 2,
|
|
954
954
|
class: "icon-completed"
|
|
955
|
-
},
|
|
955
|
+
}, ms = { class: "steps-copy" }, vs = { class: "steps-summary" }, fs = { class: "steps-meta" }, gs = { class: "steps-count" }, ps = { class: "icon-chevron" }, hs = {
|
|
956
|
+
class: "steps-progress",
|
|
957
|
+
"aria-hidden": "true"
|
|
958
|
+
}, ys = { class: "steps-list" }, ws = {
|
|
959
|
+
class: "step-rail",
|
|
960
|
+
"aria-hidden": "true"
|
|
961
|
+
}, ks = { class: "step-icon" }, bs = {
|
|
956
962
|
key: 3,
|
|
957
963
|
class: "icon-dot"
|
|
958
|
-
},
|
|
964
|
+
}, Ms = { class: "step-name" }, Ss = { class: "step-status" }, Cs = /* @__PURE__ */ Me({
|
|
959
965
|
__name: "AgentSteps",
|
|
960
966
|
props: {
|
|
961
967
|
steps: {}
|
|
962
968
|
},
|
|
963
969
|
emits: ["resize"],
|
|
964
|
-
setup(r, { emit:
|
|
965
|
-
const b = r,
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
}
|
|
969
|
-
},
|
|
970
|
-
() => b.steps.some((
|
|
971
|
-
),
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
970
|
+
setup(r, { emit: y }) {
|
|
971
|
+
const b = r, w = C(!0), m = y, A = () => {
|
|
972
|
+
w.value = !w.value, oe(() => {
|
|
973
|
+
requestAnimationFrame(() => m("resize"));
|
|
974
|
+
});
|
|
975
|
+
}, $ = Y(
|
|
976
|
+
() => b.steps.some((S) => S.status === "running")
|
|
977
|
+
), x = Y(() => b.steps.some((S) => S.status === "error")), H = Y(
|
|
978
|
+
() => b.steps.filter((S) => S.status === "completed").length
|
|
979
|
+
), D = Y(() => b.steps.length === 0 ? 0 : Math.round(H.value / b.steps.length * 100)), k = Y(() => ({
|
|
980
|
+
width: `${D.value}%`
|
|
981
|
+
})), V = Y(() => $.value ? "智能处理流程" : x.value ? "需要关注" : "全部步骤已同步"), L = Y(() => {
|
|
982
|
+
const S = b.steps.find((O) => O.status === "running");
|
|
983
|
+
return S ? `正在处理 ${S.displayName}` : x.value ? "处理遇到问题" : H.value === b.steps.length ? "处理完成" : `已完成 ${H.value}/${b.steps.length} 个步骤`;
|
|
984
|
+
}), R = (S) => S === "running" ? "进行中" : S === "error" ? "异常" : "完成";
|
|
985
|
+
return (S, O) => r.steps.length > 0 ? (d(), p("div", {
|
|
986
|
+
key: 0,
|
|
987
|
+
class: le(["agent-steps", {
|
|
988
|
+
"is-running": $.value,
|
|
989
|
+
"is-error": x.value,
|
|
990
|
+
"is-collapsed": !w.value
|
|
991
|
+
}])
|
|
992
|
+
}, [
|
|
993
|
+
l("button", {
|
|
994
|
+
type: "button",
|
|
982
995
|
class: "steps-header",
|
|
983
|
-
|
|
996
|
+
"aria-expanded": w.value,
|
|
997
|
+
onClick: A
|
|
984
998
|
}, [
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
])) : (
|
|
989
|
-
|
|
999
|
+
l("span", is, [
|
|
1000
|
+
$.value ? (d(), p("span", cs, [
|
|
1001
|
+
M(U(qe))
|
|
1002
|
+
])) : x.value ? (d(), p("span", us, [
|
|
1003
|
+
M(U(Ue))
|
|
1004
|
+
])) : (d(), p("span", ds, [
|
|
1005
|
+
M(U(Ze))
|
|
990
1006
|
]))
|
|
991
1007
|
]),
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
(
|
|
1008
|
+
l("span", ms, [
|
|
1009
|
+
l("span", vs, N(L.value), 1),
|
|
1010
|
+
l("span", fs, N(V.value), 1)
|
|
1011
|
+
]),
|
|
1012
|
+
l("span", gs, N(H.value) + "/" + N(r.steps.length), 1),
|
|
1013
|
+
l("span", ps, [
|
|
1014
|
+
(d(), de(Ke(w.value ? U($t) : U(xt))))
|
|
995
1015
|
])
|
|
1016
|
+
], 8, rs),
|
|
1017
|
+
l("div", hs, [
|
|
1018
|
+
l("span", {
|
|
1019
|
+
style: be(k.value)
|
|
1020
|
+
}, null, 4)
|
|
996
1021
|
]),
|
|
997
|
-
nt(
|
|
998
|
-
(
|
|
999
|
-
key:
|
|
1000
|
-
class:
|
|
1001
|
-
"is-running":
|
|
1002
|
-
"is-completed":
|
|
1003
|
-
"is-error":
|
|
1022
|
+
nt(l("div", ys, [
|
|
1023
|
+
(d(!0), p(ze, null, Ee(r.steps, (_) => (d(), p("div", {
|
|
1024
|
+
key: _.name,
|
|
1025
|
+
class: le(["step-item", {
|
|
1026
|
+
"is-running": _.status === "running",
|
|
1027
|
+
"is-completed": _.status === "completed",
|
|
1028
|
+
"is-error": _.status === "error"
|
|
1004
1029
|
}])
|
|
1005
1030
|
}, [
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1031
|
+
l("span", ws, [
|
|
1032
|
+
l("span", ks, [
|
|
1033
|
+
_.status === "running" ? (d(), de(U(qe), {
|
|
1034
|
+
key: 0,
|
|
1035
|
+
class: "icon-spin"
|
|
1036
|
+
})) : _.status === "completed" ? (d(), de(U(Ze), { key: 1 })) : _.status === "error" ? (d(), de(U(Ue), { key: 2 })) : (d(), p("span", bs))
|
|
1037
|
+
])
|
|
1011
1038
|
]),
|
|
1012
|
-
|
|
1039
|
+
l("span", Ms, N(_.displayName), 1),
|
|
1040
|
+
l("span", Ss, N(R(_.status)), 1)
|
|
1013
1041
|
], 2))), 128))
|
|
1014
1042
|
], 512), [
|
|
1015
|
-
[ot,
|
|
1043
|
+
[ot, w.value]
|
|
1016
1044
|
])
|
|
1017
|
-
])) :
|
|
1045
|
+
], 2)) : B("", !0);
|
|
1018
1046
|
}
|
|
1019
|
-
}), Ge = /* @__PURE__ */
|
|
1047
|
+
}), Ge = /* @__PURE__ */ Ce(Cs, [["__scopeId", "data-v-5030f19a"]]), _s = { class: "chat-message-list-root" }, As = {
|
|
1020
1048
|
key: 0,
|
|
1021
1049
|
class: "bg-grid"
|
|
1022
|
-
},
|
|
1050
|
+
}, $s = {
|
|
1023
1051
|
key: 0,
|
|
1024
1052
|
class: "welcome-screen"
|
|
1025
|
-
},
|
|
1053
|
+
}, xs = { class: "welcome-content" }, Is = { class: "welcome-logo" }, Ls = ["src"], zs = {
|
|
1026
1054
|
key: 1,
|
|
1027
1055
|
class: "default-logo"
|
|
1028
|
-
},
|
|
1056
|
+
}, Es = { class: "welcome-title" }, Us = {
|
|
1029
1057
|
key: 1,
|
|
1030
1058
|
class: "messages-container"
|
|
1031
|
-
},
|
|
1059
|
+
}, Ts = {
|
|
1032
1060
|
key: 0,
|
|
1033
1061
|
class: "user-message-wrapper"
|
|
1034
|
-
},
|
|
1062
|
+
}, Bs = { class: "message-bubble user-bubble" }, Hs = {
|
|
1035
1063
|
key: 0,
|
|
1036
1064
|
class: "message-actions user-actions"
|
|
1037
|
-
},
|
|
1065
|
+
}, Ds = ["onClick"], Ps = {
|
|
1038
1066
|
key: 1,
|
|
1039
1067
|
class: "message-content assistant-content"
|
|
1040
|
-
},
|
|
1041
|
-
key:
|
|
1068
|
+
}, Rs = {
|
|
1069
|
+
key: 2,
|
|
1042
1070
|
class: "a2ui-card-skeleton",
|
|
1043
1071
|
"aria-hidden": "true"
|
|
1044
|
-
},
|
|
1072
|
+
}, Vs = {
|
|
1045
1073
|
key: 1,
|
|
1046
1074
|
class: "message-actions"
|
|
1047
|
-
},
|
|
1075
|
+
}, Fs = ["onClick"], Os = {
|
|
1048
1076
|
key: 0,
|
|
1049
1077
|
class: "message-row message-assistant"
|
|
1050
|
-
},
|
|
1078
|
+
}, Ws = {
|
|
1051
1079
|
key: 0,
|
|
1052
1080
|
class: "loading-ring",
|
|
1053
1081
|
viewBox: "0 0 36 36"
|
|
1054
|
-
},
|
|
1082
|
+
}, js = /* @__PURE__ */ Me({
|
|
1055
1083
|
__name: "ChatMessageList",
|
|
1056
1084
|
props: {
|
|
1057
1085
|
messages: { default: () => [] },
|
|
@@ -1069,6 +1097,7 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
1069
1097
|
apiBaseUrl: { default: "" },
|
|
1070
1098
|
enableA2UI: { type: Boolean, default: !0 },
|
|
1071
1099
|
autoProvideA2UI: { type: Boolean, default: !0 },
|
|
1100
|
+
a2uiCatalog: {},
|
|
1072
1101
|
hideA2UIRawContent: { type: Boolean, default: !0 },
|
|
1073
1102
|
showA2UISkeleton: { type: Boolean, default: !0 },
|
|
1074
1103
|
a2uiActionHandler: {}
|
|
@@ -1080,396 +1109,468 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
1080
1109
|
"a2ui-action",
|
|
1081
1110
|
"a2ui-error"
|
|
1082
1111
|
],
|
|
1083
|
-
setup(r, { expose:
|
|
1084
|
-
const
|
|
1112
|
+
setup(r, { expose: y, emit: b }) {
|
|
1113
|
+
const w = /* @__PURE__ */ new WeakMap(), m = r, A = b, $ = C(null), x = C(!1), H = C(!0), D = C({}), k = C({});
|
|
1085
1114
|
(() => {
|
|
1086
|
-
var
|
|
1087
|
-
if (!
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1115
|
+
var s;
|
|
1116
|
+
if (!m.autoProvideA2UI) return;
|
|
1117
|
+
if (!m.a2uiCatalog)
|
|
1118
|
+
try {
|
|
1119
|
+
dt();
|
|
1120
|
+
return;
|
|
1121
|
+
} catch {
|
|
1122
|
+
}
|
|
1123
|
+
const e = (s = it()) == null ? void 0 : s.appContext.app, t = m.a2uiCatalog || mt;
|
|
1124
|
+
!e || w.get(e) === t || (vt({
|
|
1125
|
+
app: e,
|
|
1126
|
+
catalog: t,
|
|
1127
|
+
theme: ft
|
|
1128
|
+
}), w.set(e, t));
|
|
1099
1129
|
})();
|
|
1100
|
-
const L = ct(),
|
|
1101
|
-
if (
|
|
1102
|
-
const { scrollTop:
|
|
1103
|
-
return
|
|
1104
|
-
},
|
|
1105
|
-
|
|
1106
|
-
},
|
|
1107
|
-
var
|
|
1108
|
-
return !
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
].filter(Boolean).length !== 1 ? !1 :
|
|
1114
|
-
},
|
|
1115
|
-
const
|
|
1116
|
-
if (!
|
|
1117
|
-
const
|
|
1118
|
-
return typeof
|
|
1119
|
-
},
|
|
1120
|
-
const
|
|
1121
|
-
return !!(
|
|
1122
|
-
}) : !1,
|
|
1123
|
-
const
|
|
1124
|
-
return !!(
|
|
1125
|
-
}) : !1,
|
|
1126
|
-
const
|
|
1127
|
-
return !(!
|
|
1128
|
-
(
|
|
1130
|
+
const L = ct(), R = () => {
|
|
1131
|
+
if (!$.value) return !0;
|
|
1132
|
+
const { scrollTop: e, scrollHeight: t, clientHeight: s } = $.value;
|
|
1133
|
+
return t - e - s < 50;
|
|
1134
|
+
}, S = () => {
|
|
1135
|
+
H.value = R();
|
|
1136
|
+
}, O = (e) => {
|
|
1137
|
+
var s, n;
|
|
1138
|
+
return !e || typeof e != "object" || e.version !== "v0.9" || [
|
|
1139
|
+
e.createSurface,
|
|
1140
|
+
e.updateComponents,
|
|
1141
|
+
e.updateDataModel,
|
|
1142
|
+
e.deleteSurface
|
|
1143
|
+
].filter(Boolean).length !== 1 ? !1 : e.createSurface ? we(e.createSurface) : e.updateComponents ? _e(e.updateComponents) : e.updateDataModel ? typeof ((s = _(e.updateDataModel)) == null ? void 0 : s.surfaceId) == "string" : e.deleteSurface ? typeof ((n = _(e.deleteSurface)) == null ? void 0 : n.surfaceId) == "string" : !1;
|
|
1144
|
+
}, _ = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : null, we = (e) => {
|
|
1145
|
+
const t = _(e);
|
|
1146
|
+
if (!t) return !1;
|
|
1147
|
+
const s = Object.keys(t);
|
|
1148
|
+
return typeof t.surfaceId == "string" && typeof t.catalogId == "string" && s.every((n) => n === "surfaceId" || n === "catalogId");
|
|
1149
|
+
}, z = (e) => Array.isArray(e) ? e.every((t) => {
|
|
1150
|
+
const s = _(t);
|
|
1151
|
+
return !!(s && typeof s.label == "string" && typeof s.value == "string");
|
|
1152
|
+
}) : !1, re = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), me = (e) => Array.isArray(e) ? e.every((t) => {
|
|
1153
|
+
const s = _(t);
|
|
1154
|
+
return !!(s && typeof s.label == "string" && typeof s.value == "string");
|
|
1155
|
+
}) : !1, ke = (e) => {
|
|
1156
|
+
const t = _(e);
|
|
1157
|
+
return !(!t || typeof t.id != "string" || typeof t.component != "string" || Object.prototype.hasOwnProperty.call(t, "props") || Object.prototype.hasOwnProperty.call(t, "componentType") || Object.prototype.hasOwnProperty.call(t, "component_type") || t.facts !== void 0 && !z(t.facts) || t.tags !== void 0 && !re(t.tags) || ["policyOptions", "audienceOptions", "detailOptions"].some(
|
|
1158
|
+
(n) => t[n] !== void 0 && !me(t[n])
|
|
1129
1159
|
));
|
|
1130
|
-
},
|
|
1131
|
-
const
|
|
1132
|
-
return !
|
|
1133
|
-
},
|
|
1134
|
-
const
|
|
1135
|
-
if (!
|
|
1136
|
-
const
|
|
1137
|
-
if (!
|
|
1160
|
+
}, _e = (e) => {
|
|
1161
|
+
const t = _(e);
|
|
1162
|
+
return !t || typeof t.surfaceId != "string" || !Array.isArray(t.components) || t.components.length === 0 ? !1 : t.components.every(ke);
|
|
1163
|
+
}, X = (e) => {
|
|
1164
|
+
const t = e.trim();
|
|
1165
|
+
if (!t) return null;
|
|
1166
|
+
const s = t.match(/^```(?:json|a2ui|agui|ag-ui)?\s*([\s\S]*?)\s*```$/i), n = s ? s[1].trim() : t;
|
|
1167
|
+
if (!n.startsWith("{") && !n.startsWith("[")) return null;
|
|
1138
1168
|
try {
|
|
1139
|
-
return JSON.parse(
|
|
1169
|
+
return JSON.parse(n);
|
|
1140
1170
|
} catch {
|
|
1141
1171
|
return null;
|
|
1142
1172
|
}
|
|
1143
|
-
},
|
|
1144
|
-
if (
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1173
|
+
}, ee = (e) => {
|
|
1174
|
+
if (typeof e != "string") return null;
|
|
1175
|
+
const t = e.trim().toLowerCase();
|
|
1176
|
+
return t === "text_only" || t === "text-only" || t === "text" ? "text_only" : t === "ui_only" || t === "ui-only" || t === "ui" ? "ui_only" : t === "text_and_ui" || t === "text-and-ui" || t === "text+ui" || t === "both" ? "text_and_ui" : null;
|
|
1177
|
+
}, q = (e) => {
|
|
1178
|
+
const t = ee(e);
|
|
1179
|
+
if (t) return t;
|
|
1180
|
+
if (typeof e == "string") {
|
|
1181
|
+
const n = X(e);
|
|
1182
|
+
return n ? q(n) : null;
|
|
1183
|
+
}
|
|
1184
|
+
if (Array.isArray(e)) {
|
|
1185
|
+
for (const n of e) {
|
|
1186
|
+
const v = q(n);
|
|
1187
|
+
if (v) return v;
|
|
1188
|
+
}
|
|
1189
|
+
return null;
|
|
1190
|
+
}
|
|
1191
|
+
const s = _(e);
|
|
1192
|
+
return s && (ee(s.displayMode) || ee(s.display_mode) || ee(s.a2uiDisplayMode) || ee(s.a2ui_display_mode) || q(s.metadata) || q(s.payload) || q(s.data)) || null;
|
|
1193
|
+
}, T = (e) => {
|
|
1194
|
+
if (!e) return [];
|
|
1195
|
+
if (typeof e == "string") {
|
|
1196
|
+
const v = X(e);
|
|
1197
|
+
return v ? T(v) : Array.from(
|
|
1198
|
+
e.matchAll(/```(?:agui|ag-ui|a2ui|json)\s*\n([\s\S]*?)\n```/gi)
|
|
1199
|
+
).flatMap((E) => {
|
|
1200
|
+
const P = X(E[1]);
|
|
1201
|
+
return P ? T(P) : [];
|
|
1152
1202
|
});
|
|
1153
1203
|
}
|
|
1154
|
-
if (Array.isArray(
|
|
1155
|
-
const
|
|
1156
|
-
return
|
|
1204
|
+
if (Array.isArray(e)) {
|
|
1205
|
+
const v = e.map((E) => _(E)).filter((E) => !!E);
|
|
1206
|
+
return v.length === e.length && v.every(O) ? v : te(e);
|
|
1157
1207
|
}
|
|
1158
|
-
if (typeof
|
|
1159
|
-
const
|
|
1160
|
-
if (
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1208
|
+
if (typeof e != "object") return [];
|
|
1209
|
+
const t = e;
|
|
1210
|
+
if (O(t)) return [t];
|
|
1211
|
+
const s = te(t);
|
|
1212
|
+
if (s.length > 0) return s;
|
|
1213
|
+
const n = h(t);
|
|
1214
|
+
return n.length > 0 ? n : [];
|
|
1215
|
+
}, te = (e) => {
|
|
1216
|
+
if (!e) return [];
|
|
1217
|
+
if (typeof e == "string") {
|
|
1218
|
+
const s = X(e);
|
|
1219
|
+
return s ? te(s) : [];
|
|
1168
1220
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
const
|
|
1173
|
-
return
|
|
1174
|
-
},
|
|
1175
|
-
const
|
|
1176
|
-
return
|
|
1177
|
-
},
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
...U(t.a2uiMessage),
|
|
1183
|
-
...U(t.a2uiMessages),
|
|
1184
|
-
...U(t.a2ui_message),
|
|
1185
|
-
...U(t.a2ui_messages),
|
|
1186
|
-
...U(t.agui),
|
|
1187
|
-
...U(t.aguiEvents),
|
|
1188
|
-
...U(t.agui_events),
|
|
1189
|
-
...U(t.metadata),
|
|
1190
|
-
...U(t.content)
|
|
1191
|
-
], ce = (t) => {
|
|
1192
|
-
var e, a, s, n;
|
|
1193
|
-
return ((e = t == null ? void 0 : t.createSurface) == null ? void 0 : e.surfaceId) || ((a = t == null ? void 0 : t.updateComponents) == null ? void 0 : a.surfaceId) || ((s = t == null ? void 0 : t.updateDataModel) == null ? void 0 : s.surfaceId) || ((n = t == null ? void 0 : t.deleteSurface) == null ? void 0 : n.surfaceId) || null;
|
|
1194
|
-
}, i = (t, e) => String(t.id || `index-${e}`), v = (t, e, a = !1) => {
|
|
1195
|
-
const s = { ...m.value }, n = { ..._.value }, c = a ? new Set(n[t] || []) : /* @__PURE__ */ new Set();
|
|
1196
|
-
for (const l of e) {
|
|
1197
|
-
const y = ce(l);
|
|
1198
|
-
y && (s[y] = t, c.add(y));
|
|
1221
|
+
if (typeof e != "object") return [];
|
|
1222
|
+
if (Array.isArray(e))
|
|
1223
|
+
return e.map((n) => _(n)).filter((n) => !!n).flatMap(G);
|
|
1224
|
+
const t = e;
|
|
1225
|
+
return t.protocol === "ag-ui" ? te(t.aguiEvents || t.agui_events) : Ae(t) ? G(t) : [];
|
|
1226
|
+
}, Ae = (e) => {
|
|
1227
|
+
const t = String(e.type || "").toUpperCase();
|
|
1228
|
+
return t ? t === "STATE_SNAPSHOT" ? Q(e.state).length > 0 : t === "STATE_DELTA" ? Q(e.delta).length > 0 : !0 : !1;
|
|
1229
|
+
}, G = (e) => {
|
|
1230
|
+
const t = String(e.type || "").toUpperCase();
|
|
1231
|
+
if (t === "STATE_SNAPSHOT") {
|
|
1232
|
+
const s = Q(e.state);
|
|
1233
|
+
return s.length > 0 ? s : f(e);
|
|
1199
1234
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1235
|
+
if (t === "STATE_DELTA") {
|
|
1236
|
+
const s = Q(e.delta);
|
|
1237
|
+
return s.length > 0 ? s : f(e);
|
|
1238
|
+
}
|
|
1239
|
+
return [];
|
|
1240
|
+
}, Q = (e) => {
|
|
1241
|
+
const t = _(e);
|
|
1242
|
+
return t ? [
|
|
1243
|
+
...T(t.a2uiMessages),
|
|
1244
|
+
...T(t.a2ui_messages),
|
|
1245
|
+
...T(t.a2ui)
|
|
1246
|
+
] : [];
|
|
1247
|
+
}, i = (e) => {
|
|
1248
|
+
const t = _(e);
|
|
1249
|
+
return t ? G(t) : [];
|
|
1250
|
+
}, f = (e) => [
|
|
1251
|
+
...i(e.rawEvent),
|
|
1252
|
+
...i(e.raw_event)
|
|
1253
|
+
], h = (e) => {
|
|
1254
|
+
const t = [
|
|
1255
|
+
e.value,
|
|
1256
|
+
e.metadata,
|
|
1257
|
+
e.payload,
|
|
1258
|
+
e.data,
|
|
1259
|
+
e.a2uiMessages,
|
|
1260
|
+
e.a2ui_messages,
|
|
1261
|
+
e.a2ui,
|
|
1262
|
+
e.aguiEvents,
|
|
1263
|
+
e.agui_events,
|
|
1264
|
+
e.agui
|
|
1265
|
+
];
|
|
1266
|
+
for (const s of t) {
|
|
1267
|
+
if (s === void 0 || s === e) continue;
|
|
1268
|
+
const n = T(s);
|
|
1269
|
+
if (n.length > 0) return n;
|
|
1270
|
+
}
|
|
1271
|
+
return [];
|
|
1272
|
+
}, I = (e) => [
|
|
1273
|
+
...T(e.a2ui),
|
|
1274
|
+
...T(e.a2uiMessage),
|
|
1275
|
+
...T(e.a2uiMessages),
|
|
1276
|
+
...T(e.a2ui_message),
|
|
1277
|
+
...T(e.a2ui_messages),
|
|
1278
|
+
...T(e.agui),
|
|
1279
|
+
...T(e.aguiEvents),
|
|
1280
|
+
...T(e.agui_events),
|
|
1281
|
+
...T(e.metadata),
|
|
1282
|
+
...T(e.content)
|
|
1283
|
+
], F = (e) => q(e.displayMode) || q(e.display_mode) || q(e.a2uiDisplayMode) || q(e.a2ui_display_mode) || q(e.metadata) || null, ve = (e) => {
|
|
1284
|
+
var t, s, n, v;
|
|
1285
|
+
return ((t = e == null ? void 0 : e.createSurface) == null ? void 0 : t.surfaceId) || ((s = e == null ? void 0 : e.updateComponents) == null ? void 0 : s.surfaceId) || ((n = e == null ? void 0 : e.updateDataModel) == null ? void 0 : n.surfaceId) || ((v = e == null ? void 0 : e.deleteSurface) == null ? void 0 : v.surfaceId) || null;
|
|
1286
|
+
}, fe = (e, t) => String(e.id || `index-${t}`), ie = (e, t, s = !1) => {
|
|
1287
|
+
const n = { ...k.value }, v = { ...D.value }, E = s ? new Set(v[e] || []) : /* @__PURE__ */ new Set();
|
|
1288
|
+
for (const P of t) {
|
|
1289
|
+
const j = ve(P);
|
|
1290
|
+
j && (n[j] = e, E.add(j));
|
|
1291
|
+
}
|
|
1292
|
+
v[e] = Array.from(E), k.value = n, D.value = v;
|
|
1293
|
+
}, $e = () => {
|
|
1294
|
+
if (L.clearSurfaces(), D.value = {}, k.value = {}, !m.enableA2UI) return;
|
|
1295
|
+
const e = [];
|
|
1296
|
+
if (m.messages.forEach((t, s) => {
|
|
1297
|
+
const n = I(t);
|
|
1298
|
+
if (n.length === 0) return;
|
|
1299
|
+
const v = fe(t, s);
|
|
1300
|
+
ie(v, n), e.push(...n);
|
|
1301
|
+
}), e.length !== 0)
|
|
1210
1302
|
try {
|
|
1211
|
-
L.processMessages(
|
|
1212
|
-
} catch (
|
|
1213
|
-
console.warn("[rt-chat-messages] A2UI payload render failed",
|
|
1303
|
+
L.processMessages(e);
|
|
1304
|
+
} catch (t) {
|
|
1305
|
+
console.warn("[rt-chat-messages] A2UI payload render failed", t), A("a2ui-error", t);
|
|
1214
1306
|
}
|
|
1215
|
-
},
|
|
1216
|
-
if (!
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1307
|
+
}, se = (e, t) => {
|
|
1308
|
+
if (!m.enableA2UI) return [];
|
|
1309
|
+
if (F(e) === "text_only") return [];
|
|
1310
|
+
const n = fe(e, t);
|
|
1311
|
+
return (D.value[n] || []).filter(
|
|
1312
|
+
(v) => k.value[v] === n
|
|
1220
1313
|
);
|
|
1221
|
-
},
|
|
1222
|
-
const
|
|
1223
|
-
if (!
|
|
1224
|
-
const
|
|
1225
|
-
if (!
|
|
1226
|
-
const
|
|
1227
|
-
return
|
|
1228
|
-
},
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1314
|
+
}, ae = (e) => {
|
|
1315
|
+
const t = typeof e.content == "string" ? e.content.trimStart() : "";
|
|
1316
|
+
if (!t || I(e).length > 0) return !1;
|
|
1317
|
+
const s = t.match(/^```([^\s\n`]*)?/);
|
|
1318
|
+
if (!s) return !1;
|
|
1319
|
+
const n = (s[1] || "").toLowerCase();
|
|
1320
|
+
return n ? ["a", "ag", "agu", "agui", "ag-", "ag-u", "ag-ui", "a2", "a2u", "a2ui"].includes(n) : !1;
|
|
1321
|
+
}, ne = (e, t) => !!(m.enableA2UI && m.showA2UISkeleton && m.isStreaming && t === m.messages.length - 1 && se(e, t).length === 0 && ae(e)), Z = (e, t) => {
|
|
1322
|
+
if (!m.hideA2UIRawContent || e.attachments && e.attachments.length > 0) return !0;
|
|
1323
|
+
if (ae(e) || !e.content) return !1;
|
|
1324
|
+
if (I(e).length === 0) return !0;
|
|
1325
|
+
const n = F(e);
|
|
1326
|
+
return n === "text_only" || n === "text_and_ui" ? !0 : n === "ui_only" ? !1 : se(e, t).length === 0;
|
|
1327
|
+
}, xe = async (e) => {
|
|
1328
|
+
var s;
|
|
1329
|
+
const t = (s = e == null ? void 0 : e.message) == null ? void 0 : s.action;
|
|
1330
|
+
A("a2ui-action", t, e);
|
|
1232
1331
|
try {
|
|
1233
|
-
const
|
|
1234
|
-
if (
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1332
|
+
const n = m.a2uiActionHandler ? await m.a2uiActionHandler(e) : [], v = T(n);
|
|
1333
|
+
if (v.length > 0) {
|
|
1334
|
+
const E = k.value[t == null ? void 0 : t.surfaceId];
|
|
1335
|
+
E && ie(E, v, !0), L.processMessages(v), m.autoScroll && !x.value && (await oe(), ue("smooth"));
|
|
1237
1336
|
}
|
|
1238
|
-
|
|
1239
|
-
} catch (
|
|
1240
|
-
|
|
1337
|
+
e.resolve(v);
|
|
1338
|
+
} catch (n) {
|
|
1339
|
+
A("a2ui-error", n), e.reject(n instanceof Error ? n : new Error(String(n)));
|
|
1241
1340
|
}
|
|
1242
1341
|
};
|
|
1243
|
-
let
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
},
|
|
1247
|
-
if (await
|
|
1248
|
-
if (
|
|
1249
|
-
|
|
1250
|
-
top:
|
|
1251
|
-
behavior:
|
|
1342
|
+
let ce = 0, ge = !1;
|
|
1343
|
+
const Te = () => {
|
|
1344
|
+
R() || (H.value = !1, x.value = !0);
|
|
1345
|
+
}, ue = async (e = "smooth", t = !1) => {
|
|
1346
|
+
if (await oe(), $.value) {
|
|
1347
|
+
if (t && (x.value = !1), x.value) return;
|
|
1348
|
+
H.value = !0, ge = !0, $.value.scrollTo({
|
|
1349
|
+
top: $.value.scrollHeight,
|
|
1350
|
+
behavior: e
|
|
1252
1351
|
}), setTimeout(() => {
|
|
1253
|
-
|
|
1352
|
+
ge = !1;
|
|
1254
1353
|
}, 50);
|
|
1255
1354
|
}
|
|
1256
|
-
},
|
|
1257
|
-
if (
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1355
|
+
}, Be = (e) => {
|
|
1356
|
+
if (A("scroll", e), !$.value) return;
|
|
1357
|
+
const t = $.value.scrollTop, s = t < ce;
|
|
1358
|
+
ce = t, !ge && s && (x.value = !0, H.value = !1), R() && (H.value = !0, x.value = !1, A("scroll-bottom"));
|
|
1260
1359
|
};
|
|
1261
|
-
|
|
1262
|
-
() =>
|
|
1263
|
-
async (
|
|
1264
|
-
|
|
1360
|
+
ye(
|
|
1361
|
+
() => m.messages.length,
|
|
1362
|
+
async (e, t) => {
|
|
1363
|
+
e > (t || 0) && (x.value = !1, m.autoScroll && ue("instant"));
|
|
1265
1364
|
}
|
|
1266
|
-
),
|
|
1267
|
-
() => [
|
|
1268
|
-
|
|
1365
|
+
), ye(
|
|
1366
|
+
() => [m.messages, m.enableA2UI],
|
|
1367
|
+
$e,
|
|
1269
1368
|
{ deep: !0, immediate: !0 }
|
|
1270
1369
|
);
|
|
1271
|
-
let
|
|
1272
|
-
|
|
1273
|
-
() =>
|
|
1370
|
+
let a = null;
|
|
1371
|
+
ye(
|
|
1372
|
+
() => m.messages,
|
|
1274
1373
|
async () => {
|
|
1275
|
-
if (!
|
|
1374
|
+
if (!m.isStreaming || !m.autoScroll || x.value || document.hidden)
|
|
1276
1375
|
return;
|
|
1277
|
-
const
|
|
1278
|
-
!
|
|
1279
|
-
await
|
|
1280
|
-
top:
|
|
1376
|
+
const e = m.messages[m.messages.length - 1];
|
|
1377
|
+
!e || e.role !== "assistant" || (a && cancelAnimationFrame(a), a = requestAnimationFrame(async () => {
|
|
1378
|
+
await oe(), $.value && !x.value && $.value.scrollTo({
|
|
1379
|
+
top: $.value.scrollHeight,
|
|
1281
1380
|
behavior: "instant"
|
|
1282
1381
|
});
|
|
1283
1382
|
}));
|
|
1284
1383
|
},
|
|
1285
1384
|
{ deep: !0 }
|
|
1286
|
-
),
|
|
1287
|
-
() =>
|
|
1288
|
-
(
|
|
1289
|
-
|
|
1385
|
+
), ye(
|
|
1386
|
+
() => m.isTyping,
|
|
1387
|
+
(e) => {
|
|
1388
|
+
e && m.autoScroll && ue("instant");
|
|
1290
1389
|
}
|
|
1291
1390
|
);
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1391
|
+
const o = (e) => {
|
|
1392
|
+
A("copy", e), navigator.clipboard && e.content && navigator.clipboard.writeText(e.content);
|
|
1294
1393
|
};
|
|
1295
|
-
|
|
1296
|
-
() =>
|
|
1394
|
+
ye(
|
|
1395
|
+
() => m.agentSteps,
|
|
1297
1396
|
() => {
|
|
1298
|
-
|
|
1397
|
+
m.autoScroll && !x.value && ue();
|
|
1299
1398
|
},
|
|
1300
1399
|
{ deep: !0 }
|
|
1301
1400
|
);
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1304
|
-
},
|
|
1305
|
-
!document.hidden &&
|
|
1306
|
-
|
|
1307
|
-
top:
|
|
1401
|
+
const c = () => {
|
|
1402
|
+
m.autoScroll && !x.value && ue();
|
|
1403
|
+
}, g = () => {
|
|
1404
|
+
!document.hidden && m.isStreaming && m.autoScroll && !x.value && oe(() => {
|
|
1405
|
+
$.value && ($.value.scrollTo({
|
|
1406
|
+
top: $.value.scrollHeight,
|
|
1308
1407
|
behavior: "instant"
|
|
1309
|
-
}),
|
|
1408
|
+
}), H.value = !0);
|
|
1310
1409
|
});
|
|
1311
1410
|
};
|
|
1312
|
-
let
|
|
1411
|
+
let u;
|
|
1313
1412
|
return Ve(() => {
|
|
1314
|
-
|
|
1315
|
-
}),
|
|
1316
|
-
|
|
1317
|
-
}),
|
|
1318
|
-
scrollToBottom:
|
|
1319
|
-
containerRef:
|
|
1320
|
-
}), (
|
|
1321
|
-
r.showBackground ? (
|
|
1322
|
-
|
|
1413
|
+
S(), u = L.onEvent(xe), document.addEventListener("visibilitychange", g);
|
|
1414
|
+
}), He(() => {
|
|
1415
|
+
u == null || u(), document.removeEventListener("visibilitychange", g);
|
|
1416
|
+
}), y({
|
|
1417
|
+
scrollToBottom: ue,
|
|
1418
|
+
containerRef: $
|
|
1419
|
+
}), (e, t) => (d(), p("div", _s, [
|
|
1420
|
+
r.showBackground ? (d(), p("div", As)) : B("", !0),
|
|
1421
|
+
l("div", {
|
|
1323
1422
|
class: "chat-message-list",
|
|
1324
1423
|
ref_key: "containerRef",
|
|
1325
|
-
ref:
|
|
1326
|
-
onScroll:
|
|
1327
|
-
onWheel:
|
|
1328
|
-
onTouchmove:
|
|
1329
|
-
style:
|
|
1424
|
+
ref: $,
|
|
1425
|
+
onScroll: Be,
|
|
1426
|
+
onWheel: Te,
|
|
1427
|
+
onTouchmove: Te,
|
|
1428
|
+
style: be({
|
|
1330
1429
|
paddingTop: r.contentPaddingTop,
|
|
1331
1430
|
paddingBottom: r.contentPaddingBottom
|
|
1332
1431
|
})
|
|
1333
1432
|
}, [
|
|
1334
|
-
r.showWelcome && r.messages.length === 0 ? (
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
r.appLogo ? (
|
|
1433
|
+
r.showWelcome && r.messages.length === 0 ? (d(), p("div", $s, [
|
|
1434
|
+
Fe(e.$slots, "welcome", {}, () => [
|
|
1435
|
+
l("div", xs, [
|
|
1436
|
+
l("div", Is, [
|
|
1437
|
+
r.appLogo ? (d(), p("img", {
|
|
1339
1438
|
key: 0,
|
|
1340
1439
|
src: r.appLogo,
|
|
1341
1440
|
alt: "Logo"
|
|
1342
|
-
}, null, 8,
|
|
1343
|
-
|
|
1441
|
+
}, null, 8, Ls)) : (d(), p("div", zs, [...t[1] || (t[1] = [
|
|
1442
|
+
l("svg", {
|
|
1344
1443
|
viewBox: "0 0 1024 1024",
|
|
1345
1444
|
width: "32",
|
|
1346
1445
|
height: "32"
|
|
1347
1446
|
}, [
|
|
1348
|
-
|
|
1447
|
+
l("path", {
|
|
1349
1448
|
fill: "currentColor",
|
|
1350
1449
|
d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"
|
|
1351
1450
|
})
|
|
1352
1451
|
], -1)
|
|
1353
1452
|
])]))
|
|
1354
1453
|
]),
|
|
1355
|
-
|
|
1356
|
-
|
|
1454
|
+
l("h2", Es, N(r.appName), 1),
|
|
1455
|
+
t[2] || (t[2] = l("p", { class: "welcome-desc" }, "今天有什么可以帮您?", -1))
|
|
1357
1456
|
])
|
|
1358
1457
|
], !0)
|
|
1359
|
-
])) : (
|
|
1360
|
-
(
|
|
1361
|
-
key:
|
|
1362
|
-
class:
|
|
1458
|
+
])) : (d(), p("div", Us, [
|
|
1459
|
+
(d(!0), p(ze, null, Ee(r.messages, (s, n) => (d(), p("div", {
|
|
1460
|
+
key: s.id || n,
|
|
1461
|
+
class: le([
|
|
1363
1462
|
"message-row",
|
|
1364
|
-
|
|
1463
|
+
s.role === "user" ? "message-user" : "message-assistant"
|
|
1365
1464
|
])
|
|
1366
1465
|
}, [
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
message:
|
|
1466
|
+
s.role === "user" ? (d(), p("div", Ts, [
|
|
1467
|
+
l("div", Bs, [
|
|
1468
|
+
M(Re, {
|
|
1469
|
+
message: s,
|
|
1371
1470
|
"is-user": !0,
|
|
1372
1471
|
"api-base-url": r.apiBaseUrl
|
|
1373
1472
|
}, null, 8, ["message", "api-base-url"])
|
|
1374
1473
|
]),
|
|
1375
|
-
|
|
1376
|
-
|
|
1474
|
+
s.content ? (d(), p("div", Hs, [
|
|
1475
|
+
l("button", {
|
|
1377
1476
|
class: "action-btn",
|
|
1378
|
-
onClick: (
|
|
1477
|
+
onClick: (v) => o(s),
|
|
1379
1478
|
title: "复制"
|
|
1380
|
-
}, [...
|
|
1381
|
-
|
|
1479
|
+
}, [...t[3] || (t[3] = [
|
|
1480
|
+
l("svg", {
|
|
1382
1481
|
viewBox: "0 0 1024 1024",
|
|
1383
1482
|
width: "12",
|
|
1384
1483
|
height: "12"
|
|
1385
1484
|
}, [
|
|
1386
|
-
|
|
1485
|
+
l("path", {
|
|
1387
1486
|
fill: "currentColor",
|
|
1388
1487
|
d: "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c6 6 14.1 9.4 22.6 9.4H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM352 853.3V704h149.3l-149.3 149.3zM224 256h448v640H416V672c0-17.7-14.3-32-32-32H224V256z"
|
|
1389
1488
|
})
|
|
1390
1489
|
], -1),
|
|
1391
|
-
|
|
1392
|
-
])], 8,
|
|
1393
|
-
])) :
|
|
1394
|
-
])) : (
|
|
1395
|
-
r.showAgentSteps &&
|
|
1490
|
+
l("span", null, "复制", -1)
|
|
1491
|
+
])], 8, Ds)
|
|
1492
|
+
])) : B("", !0)
|
|
1493
|
+
])) : (d(), p("div", Ps, [
|
|
1494
|
+
r.showAgentSteps && n === r.messages.length - 1 && r.agentSteps && r.agentSteps.length > 0 ? (d(), de(Ge, {
|
|
1396
1495
|
key: 0,
|
|
1397
1496
|
steps: r.agentSteps,
|
|
1398
|
-
onResize:
|
|
1399
|
-
}, null, 8, ["steps"])) :
|
|
1400
|
-
|
|
1401
|
-
|
|
1497
|
+
onResize: c
|
|
1498
|
+
}, null, 8, ["steps"])) : B("", !0),
|
|
1499
|
+
l("div", {
|
|
1500
|
+
class: le(["message-bubble assistant-bubble", { "assistant-bubble-a2ui": se(s, n).length > 0 }])
|
|
1501
|
+
}, [
|
|
1502
|
+
Z(s, n) ? (d(), de(Re, {
|
|
1402
1503
|
key: 0,
|
|
1403
|
-
|
|
1404
|
-
}, [
|
|
1405
|
-
(u(!0), f(Ee, null, Te($(a, s), (n) => (u(), oe(E(ut), {
|
|
1406
|
-
key: n,
|
|
1407
|
-
"surface-id": n
|
|
1408
|
-
}, null, 8, ["surface-id"]))), 128))
|
|
1409
|
-
], 2)) : z("", !0),
|
|
1410
|
-
ue(a, s) ? (u(), f("div", Ta, [...e[4] || (e[4] = [
|
|
1411
|
-
lt('<div class="skeleton-header" data-v-a459a823><div class="skeleton-avatar skeleton-shimmer" data-v-a459a823></div><div class="skeleton-title-group" data-v-a459a823><div class="skeleton-line skeleton-title skeleton-shimmer" data-v-a459a823></div><div class="skeleton-line skeleton-subtitle skeleton-shimmer" data-v-a459a823></div></div></div><div class="skeleton-line skeleton-summary skeleton-shimmer" data-v-a459a823></div><div class="skeleton-line skeleton-summary short skeleton-shimmer" data-v-a459a823></div><div class="skeleton-facts" data-v-a459a823><div class="skeleton-fact skeleton-shimmer" data-v-a459a823></div><div class="skeleton-fact skeleton-shimmer" data-v-a459a823></div><div class="skeleton-fact skeleton-shimmer" data-v-a459a823></div></div>', 4)
|
|
1412
|
-
])])) : z("", !0),
|
|
1413
|
-
ae(a) ? (u(), oe(Re, {
|
|
1414
|
-
key: 2,
|
|
1415
|
-
message: a,
|
|
1504
|
+
message: s,
|
|
1416
1505
|
"is-user": !1,
|
|
1417
1506
|
"api-base-url": r.apiBaseUrl,
|
|
1418
|
-
"is-streaming": r.isStreaming &&
|
|
1419
|
-
}, null, 8, ["message", "api-base-url", "is-streaming"])) :
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1507
|
+
"is-streaming": r.isStreaming && n === r.messages.length - 1
|
|
1508
|
+
}, null, 8, ["message", "api-base-url", "is-streaming"])) : B("", !0),
|
|
1509
|
+
se(s, n).length > 0 ? (d(), p("div", {
|
|
1510
|
+
key: 1,
|
|
1511
|
+
class: le(["a2ui-surfaces", { "a2ui-surfaces-with-content": Z(s, n) }])
|
|
1512
|
+
}, [
|
|
1513
|
+
(d(!0), p(ze, null, Ee(se(s, n), (v) => (d(), de(U(ut), {
|
|
1514
|
+
key: v,
|
|
1515
|
+
"surface-id": v
|
|
1516
|
+
}, null, 8, ["surface-id"]))), 128))
|
|
1517
|
+
], 2)) : B("", !0),
|
|
1518
|
+
ne(s, n) ? (d(), p("div", Rs, [...t[4] || (t[4] = [
|
|
1519
|
+
lt('<div class="skeleton-header" data-v-eac8b914><div class="skeleton-avatar skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-title-group" data-v-eac8b914><div class="skeleton-line skeleton-title skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-line skeleton-subtitle skeleton-shimmer" data-v-eac8b914></div></div></div><div class="skeleton-line skeleton-summary skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-line skeleton-summary short skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-facts" data-v-eac8b914><div class="skeleton-fact skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-fact skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-fact skeleton-shimmer" data-v-eac8b914></div></div>', 4)
|
|
1520
|
+
])])) : B("", !0)
|
|
1521
|
+
], 2),
|
|
1522
|
+
Z(s, n) && s.content && !(r.isStreaming && n === r.messages.length - 1) ? (d(), p("div", Vs, [
|
|
1523
|
+
l("button", {
|
|
1423
1524
|
class: "action-btn",
|
|
1424
|
-
onClick: (
|
|
1525
|
+
onClick: (v) => o(s),
|
|
1425
1526
|
title: "复制"
|
|
1426
|
-
}, [...
|
|
1427
|
-
|
|
1527
|
+
}, [...t[5] || (t[5] = [
|
|
1528
|
+
l("svg", {
|
|
1428
1529
|
viewBox: "0 0 1024 1024",
|
|
1429
1530
|
width: "12",
|
|
1430
1531
|
height: "12"
|
|
1431
1532
|
}, [
|
|
1432
|
-
|
|
1533
|
+
l("path", {
|
|
1433
1534
|
fill: "currentColor",
|
|
1434
1535
|
d: "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c6 6 14.1 9.4 22.6 9.4H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM352 853.3V704h149.3l-149.3 149.3zM224 256h448v640H416V672c0-17.7-14.3-32-32-32H224V256z"
|
|
1435
1536
|
})
|
|
1436
1537
|
], -1),
|
|
1437
|
-
|
|
1438
|
-
])], 8,
|
|
1439
|
-
])) :
|
|
1538
|
+
l("span", null, "复制", -1)
|
|
1539
|
+
])], 8, Fs)
|
|
1540
|
+
])) : B("", !0)
|
|
1440
1541
|
]))
|
|
1441
1542
|
], 2))), 128)),
|
|
1442
|
-
r.isTyping ? (
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1543
|
+
r.isTyping ? (d(), p("div", Os, [...t[6] || (t[6] = [
|
|
1544
|
+
l("div", { class: "typing-indicator" }, [
|
|
1545
|
+
l("div", { class: "typing-dot" }),
|
|
1546
|
+
l("div", {
|
|
1446
1547
|
class: "typing-dot",
|
|
1447
1548
|
style: { "animation-delay": "0.2s" }
|
|
1448
1549
|
}),
|
|
1449
|
-
|
|
1550
|
+
l("div", {
|
|
1450
1551
|
class: "typing-dot",
|
|
1451
1552
|
style: { "animation-delay": "0.4s" }
|
|
1452
1553
|
})
|
|
1453
1554
|
], -1)
|
|
1454
|
-
])])) :
|
|
1555
|
+
])])) : B("", !0)
|
|
1455
1556
|
]))
|
|
1456
1557
|
], 36),
|
|
1457
|
-
|
|
1458
|
-
default:
|
|
1459
|
-
|
|
1558
|
+
M(rt, { name: "fade-slide" }, {
|
|
1559
|
+
default: W(() => [
|
|
1560
|
+
H.value ? B("", !0) : (d(), p("button", {
|
|
1460
1561
|
key: 0,
|
|
1461
1562
|
class: "scroll-to-bottom-btn",
|
|
1462
|
-
style:
|
|
1463
|
-
onClick:
|
|
1563
|
+
style: be({ bottom: `calc(${r.contentPaddingBottom || "140px"} + 20px)` }),
|
|
1564
|
+
onClick: t[0] || (t[0] = (s) => ue("smooth", !0))
|
|
1464
1565
|
}, [
|
|
1465
|
-
|
|
1466
|
-
|
|
1566
|
+
t[8] || (t[8] = l("div", { class: "btn-inner" }, [
|
|
1567
|
+
l("svg", {
|
|
1467
1568
|
class: "arrow-icon",
|
|
1468
1569
|
viewBox: "0 0 24 24",
|
|
1469
1570
|
fill: "none",
|
|
1470
1571
|
stroke: "currentColor"
|
|
1471
1572
|
}, [
|
|
1472
|
-
|
|
1573
|
+
l("path", {
|
|
1473
1574
|
"stroke-linecap": "round",
|
|
1474
1575
|
"stroke-linejoin": "round",
|
|
1475
1576
|
"stroke-width": "2.5",
|
|
@@ -1477,29 +1578,29 @@ const pt = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ be({
|
|
|
1477
1578
|
})
|
|
1478
1579
|
])
|
|
1479
1580
|
], -1)),
|
|
1480
|
-
r.isStreaming ? (
|
|
1481
|
-
|
|
1581
|
+
r.isStreaming ? (d(), p("svg", Ws, [...t[7] || (t[7] = [
|
|
1582
|
+
l("circle", {
|
|
1482
1583
|
class: "loading-circle",
|
|
1483
1584
|
cx: "18",
|
|
1484
1585
|
cy: "18",
|
|
1485
1586
|
r: "16"
|
|
1486
1587
|
}, null, -1)
|
|
1487
|
-
])])) :
|
|
1588
|
+
])])) : B("", !0)
|
|
1488
1589
|
], 4))
|
|
1489
1590
|
]),
|
|
1490
1591
|
_: 1
|
|
1491
1592
|
})
|
|
1492
1593
|
]));
|
|
1493
1594
|
}
|
|
1494
|
-
}),
|
|
1595
|
+
}), Ys = /* @__PURE__ */ Ce(js, [["__scopeId", "data-v-eac8b914"]]), Js = {
|
|
1495
1596
|
install(r) {
|
|
1496
|
-
r.component("ChatMessageList",
|
|
1597
|
+
r.component("ChatMessageList", Ys), r.component("MultimodalMessage", Re), r.component("MarkdownMessage", Je), r.component("AgentSteps", Ge);
|
|
1497
1598
|
}
|
|
1498
1599
|
};
|
|
1499
1600
|
export {
|
|
1500
1601
|
Ge as AgentSteps,
|
|
1501
|
-
|
|
1602
|
+
Ys as ChatMessageList,
|
|
1502
1603
|
Je as MarkdownMessage,
|
|
1503
1604
|
Re as MultimodalMessage,
|
|
1504
|
-
|
|
1605
|
+
Js as default
|
|
1505
1606
|
};
|