rt-chat-messages 1.0.4 → 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/README.md +79 -22
- package/dist/chat-messages.es.js +1126 -693
- package/dist/chat-messages.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/ChatMessageList.vue.d.ts +24 -1
- package/dist/types/components/MultimodalMessage.vue.d.ts +10 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +9 -0
- package/package.json +4 -2
package/dist/chat-messages.es.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
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
|
+
import gt from "markdown-it";
|
|
4
|
+
import pt from "@vscode/markdown-it-katex";
|
|
5
|
+
import je from "mermaid";
|
|
6
|
+
const ht = { class: "cm-dialog__body" }, yt = /* @__PURE__ */ Me({
|
|
6
7
|
__name: "Dialog",
|
|
7
8
|
props: {
|
|
8
9
|
visible: { type: Boolean, default: !1 },
|
|
@@ -13,63 +14,63 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ Q({
|
|
|
13
14
|
appendToBody: { type: Boolean, default: !0 }
|
|
14
15
|
},
|
|
15
16
|
emits: ["update:visible", "close"],
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
setup(r, { emit: y }) {
|
|
18
|
+
const b = r, w = y, m = C(!1);
|
|
19
|
+
Ve(() => {
|
|
20
|
+
m.value = !0;
|
|
20
21
|
});
|
|
21
|
-
const
|
|
22
|
-
|
|
22
|
+
const A = Y(() => b.fullscreen ? { width: "100%", height: "100%", margin: 0 } : { width: b.width }), $ = () => {
|
|
23
|
+
w("update:visible", !1), w("close");
|
|
23
24
|
}, x = () => {
|
|
24
|
-
|
|
25
|
+
b.closeOnClickModal && $();
|
|
25
26
|
};
|
|
26
|
-
return (
|
|
27
|
+
return (H, D) => m.value ? (d(), de(at, {
|
|
27
28
|
key: 0,
|
|
28
29
|
to: "body"
|
|
29
30
|
}, [
|
|
30
|
-
|
|
31
|
+
r.visible ? (d(), p("div", {
|
|
31
32
|
key: 0,
|
|
32
|
-
class: le(["cm-dialog-overlay", { "is-fullscreen":
|
|
33
|
-
onClick:
|
|
33
|
+
class: le(["cm-dialog-overlay", { "is-fullscreen": r.fullscreen }]),
|
|
34
|
+
onClick: he(x, ["self"])
|
|
34
35
|
}, [
|
|
35
|
-
|
|
36
|
+
l("div", {
|
|
36
37
|
class: "cm-dialog",
|
|
37
|
-
style:
|
|
38
|
+
style: be(A.value),
|
|
38
39
|
role: "dialog",
|
|
39
40
|
"aria-modal": "true"
|
|
40
41
|
}, [
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
l("div", ht, [
|
|
43
|
+
Fe(H.$slots, "default", {}, void 0, !0)
|
|
43
44
|
]),
|
|
44
|
-
|
|
45
|
+
r.showClose ? (d(), p("button", {
|
|
45
46
|
key: 0,
|
|
46
47
|
class: "cm-dialog__close",
|
|
47
|
-
onClick:
|
|
48
|
-
}, [...
|
|
49
|
-
|
|
48
|
+
onClick: $
|
|
49
|
+
}, [...D[0] || (D[0] = [
|
|
50
|
+
l("svg", {
|
|
50
51
|
viewBox: "0 0 1024 1024",
|
|
51
52
|
width: "16",
|
|
52
53
|
height: "16"
|
|
53
54
|
}, [
|
|
54
|
-
|
|
55
|
+
l("path", {
|
|
55
56
|
fill: "currentColor",
|
|
56
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"
|
|
57
58
|
})
|
|
58
59
|
], -1)
|
|
59
|
-
])])) :
|
|
60
|
+
])])) : B("", !0)
|
|
60
61
|
], 4)
|
|
61
|
-
], 2)) :
|
|
62
|
-
])) :
|
|
62
|
+
], 2)) : B("", !0)
|
|
63
|
+
])) : B("", !0);
|
|
63
64
|
}
|
|
64
|
-
}),
|
|
65
|
-
const
|
|
66
|
-
for (const [
|
|
67
|
-
|
|
68
|
-
return
|
|
69
|
-
},
|
|
65
|
+
}), Ce = (r, y) => {
|
|
66
|
+
const b = r.__vccOpts || r;
|
|
67
|
+
for (const [w, m] of y)
|
|
68
|
+
b[w] = m;
|
|
69
|
+
return b;
|
|
70
|
+
}, Pe = /* @__PURE__ */ Ce(yt, [["__scopeId", "data-v-efdf0259"]]), wt = ["disabled"], kt = {
|
|
70
71
|
key: 0,
|
|
71
72
|
class: "cm-icon-loading"
|
|
72
|
-
},
|
|
73
|
+
}, bt = /* @__PURE__ */ Me({
|
|
73
74
|
__name: "Button",
|
|
74
75
|
props: {
|
|
75
76
|
type: { default: "default" },
|
|
@@ -79,37 +80,37 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ Q({
|
|
|
79
80
|
loading: { type: Boolean, default: !1 }
|
|
80
81
|
},
|
|
81
82
|
emits: ["click"],
|
|
82
|
-
setup(
|
|
83
|
-
const
|
|
84
|
-
|
|
83
|
+
setup(r, { emit: y }) {
|
|
84
|
+
const b = r, w = y, m = (A) => {
|
|
85
|
+
b.disabled || b.loading || w("click", A);
|
|
85
86
|
};
|
|
86
|
-
return (
|
|
87
|
+
return (A, $) => (d(), p("button", {
|
|
87
88
|
class: le(["cm-button", [
|
|
88
|
-
`cm-button--${
|
|
89
|
-
`cm-button--${
|
|
90
|
-
{ "is-circle":
|
|
89
|
+
`cm-button--${r.type}`,
|
|
90
|
+
`cm-button--${r.size}`,
|
|
91
|
+
{ "is-circle": r.circle, "is-disabled": r.disabled, "is-loading": r.loading }
|
|
91
92
|
]]),
|
|
92
|
-
disabled:
|
|
93
|
-
onClick:
|
|
93
|
+
disabled: r.disabled || r.loading,
|
|
94
|
+
onClick: m
|
|
94
95
|
}, [
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
r.loading ? (d(), p("span", kt, [...$[0] || ($[0] = [
|
|
97
|
+
l("svg", {
|
|
97
98
|
viewBox: "0 0 1024 1024",
|
|
98
99
|
width: "1em",
|
|
99
100
|
height: "1em"
|
|
100
101
|
}, [
|
|
101
|
-
|
|
102
|
+
l("path", {
|
|
102
103
|
fill: "currentColor",
|
|
103
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"
|
|
104
105
|
})
|
|
105
106
|
], -1)
|
|
106
|
-
])])) :
|
|
107
|
-
], 10,
|
|
107
|
+
])])) : Fe(A.$slots, "default", { key: 1 }, void 0, !0)
|
|
108
|
+
], 10, wt));
|
|
108
109
|
}
|
|
109
|
-
}),
|
|
110
|
-
name:
|
|
110
|
+
}), K = /* @__PURE__ */ Ce(bt, [["__scopeId", "data-v-bab126c7"]]), J = (r, y) => Me({
|
|
111
|
+
name: r,
|
|
111
112
|
render() {
|
|
112
|
-
return
|
|
113
|
+
return Oe(
|
|
113
114
|
"svg",
|
|
114
115
|
{
|
|
115
116
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -119,76 +120,76 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ Q({
|
|
|
119
120
|
fill: "currentColor",
|
|
120
121
|
style: "vertical-align: middle"
|
|
121
122
|
},
|
|
122
|
-
[
|
|
123
|
+
[Oe("path", { d: y })]
|
|
123
124
|
);
|
|
124
125
|
}
|
|
125
|
-
}),
|
|
126
|
+
}), Ue = J(
|
|
126
127
|
"Close",
|
|
127
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"
|
|
128
|
-
),
|
|
129
|
+
), Ye = J(
|
|
129
130
|
"ZoomIn",
|
|
130
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"
|
|
131
|
-
),
|
|
132
|
+
), Ne = J(
|
|
132
133
|
"ZoomOut",
|
|
133
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"
|
|
134
|
-
),
|
|
135
|
+
), Mt = J(
|
|
135
136
|
"Document",
|
|
136
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"
|
|
137
|
-
),
|
|
138
|
+
), Xe = J(
|
|
138
139
|
"Download",
|
|
139
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"
|
|
140
|
-
),
|
|
141
|
+
), St = J(
|
|
141
142
|
"VideoPlay",
|
|
142
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"
|
|
143
|
-
),
|
|
144
|
+
), Ct = J(
|
|
144
145
|
"VideoPause",
|
|
145
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"
|
|
146
|
-
),
|
|
147
|
+
), _t = J(
|
|
147
148
|
"ArrowLeft",
|
|
148
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"
|
|
149
|
-
),
|
|
150
|
+
), At = J(
|
|
150
151
|
"ArrowRight",
|
|
151
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"
|
|
152
|
-
),
|
|
153
|
+
), qe = J(
|
|
153
154
|
"Spinner",
|
|
154
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"
|
|
155
|
-
),
|
|
156
|
+
), Ze = J(
|
|
156
157
|
"Check",
|
|
157
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"
|
|
158
|
-
),
|
|
159
|
+
), $t = J(
|
|
159
160
|
"ChevronUp",
|
|
160
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"
|
|
161
|
-
),
|
|
162
|
+
), xt = J(
|
|
162
163
|
"ChevronDown",
|
|
163
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"
|
|
164
|
-
),
|
|
165
|
+
), It = ["src", "alt"], Lt = { class: "preview-controls" }, zt = { class: "cm-button-group" }, Et = {
|
|
165
166
|
key: 0,
|
|
166
167
|
class: "mobile-close-hint"
|
|
167
|
-
},
|
|
168
|
+
}, Ut = ["innerHTML"], Tt = { class: "preview-controls" }, Bt = { class: "cm-button-group" }, Ht = {
|
|
168
169
|
key: 0,
|
|
169
170
|
class: "mobile-close-hint"
|
|
170
|
-
},
|
|
171
|
+
}, Dt = /* @__PURE__ */ Me({
|
|
171
172
|
__name: "MarkdownMessage",
|
|
172
173
|
props: {
|
|
173
174
|
content: {},
|
|
174
175
|
isStreaming: { type: Boolean, default: !1 }
|
|
175
176
|
},
|
|
176
|
-
setup(
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
|
|
177
|
+
setup(r) {
|
|
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
|
+
je.initialize({
|
|
180
181
|
startOnLoad: !1,
|
|
181
182
|
theme: "default",
|
|
182
183
|
securityLevel: "loose",
|
|
183
184
|
fontFamily: "inherit"
|
|
184
185
|
});
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
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);
|
|
190
191
|
};
|
|
191
|
-
},
|
|
192
|
+
}, X = new gt({
|
|
192
193
|
html: !0,
|
|
193
194
|
// 允许HTML标签,以便markdown渲染的标签能正常显示
|
|
194
195
|
xhtmlOut: !1,
|
|
@@ -202,685 +203,737 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ Q({
|
|
|
202
203
|
// 启用一些语言中性的替换 + 引号美化
|
|
203
204
|
quotes: `""''`,
|
|
204
205
|
// 双引号和单引号的替换对,中文环境
|
|
205
|
-
highlight: function(
|
|
206
|
-
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>`;
|
|
207
208
|
}
|
|
208
|
-
}),
|
|
209
|
-
return
|
|
209
|
+
}), ee = X.renderer.rules.image || function(a, o, c, g, u) {
|
|
210
|
+
return u.renderToken(a, o, c);
|
|
210
211
|
};
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
214
|
-
const
|
|
215
|
-
let
|
|
216
|
-
for (let
|
|
217
|
-
const
|
|
218
|
-
|
|
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;
|
|
219
220
|
}
|
|
220
|
-
return Math.abs(
|
|
221
|
-
})(
|
|
222
|
-
|
|
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");
|
|
223
224
|
}
|
|
224
|
-
return
|
|
225
|
-
},
|
|
225
|
+
return ee(a, o, c, g, u);
|
|
226
|
+
}, X.use(pt, {
|
|
226
227
|
throwOnError: !1,
|
|
227
228
|
errorColor: "#cc0000"
|
|
228
|
-
}),
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
return g >
|
|
232
|
-
},
|
|
233
|
-
if (!
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
|
|
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];
|
|
238
239
|
else {
|
|
239
|
-
const g = /^```\s*\n([\s\S]*?)\n```$/,
|
|
240
|
-
if (
|
|
241
|
-
const
|
|
242
|
-
(/^#{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);
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
|
-
if (
|
|
246
|
+
if (y.isStreaming) {
|
|
246
247
|
const g = /^```(?:markdown|md)?\s*\n/;
|
|
247
|
-
if (g.test(
|
|
248
|
-
const
|
|
249
|
-
(/^#{1,6}\s/.test(
|
|
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, ""));
|
|
250
251
|
}
|
|
251
|
-
if (/^```(?:markdown|md)?\s*\n/.test(
|
|
252
|
-
const
|
|
253
|
-
|
|
252
|
+
if (/^```(?:markdown|md)?\s*\n/.test(y.content)) {
|
|
253
|
+
const e = /\n```\s*$/;
|
|
254
|
+
e.test(a) && (a = a.replace(e, ""));
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
return
|
|
257
|
+
return a = a.replace(
|
|
257
258
|
/```(?:markdown|md)\s*\n([\s\S]*?)\n```/g,
|
|
258
|
-
(g,
|
|
259
|
-
),
|
|
260
|
-
},
|
|
261
|
-
if (!
|
|
262
|
-
return
|
|
263
|
-
const
|
|
264
|
-
let
|
|
265
|
-
const
|
|
266
|
-
for (; (
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
const
|
|
270
|
-
|
|
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 });
|
|
271
272
|
} else
|
|
272
|
-
|
|
273
|
+
re.value.set(t, e);
|
|
273
274
|
}
|
|
274
|
-
for (const { original:
|
|
275
|
-
g = g.replace(
|
|
275
|
+
for (const { original: e, cached: t } of u)
|
|
276
|
+
g = g.replace(e, t);
|
|
276
277
|
return g;
|
|
277
|
-
},
|
|
278
|
-
if (!
|
|
278
|
+
}, Ae = (a) => {
|
|
279
|
+
if (!w.value)
|
|
279
280
|
return;
|
|
280
|
-
const
|
|
281
|
-
if (
|
|
282
|
-
|
|
283
|
-
|
|
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();
|
|
284
288
|
});
|
|
285
289
|
return;
|
|
286
290
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
v && g.set(v, s);
|
|
293
|
-
}), l.querySelectorAll("img[data-image-id]").forEach((s) => {
|
|
294
|
-
const v = s.getAttribute("data-image-id");
|
|
295
|
-
if (v && g.has(v)) {
|
|
296
|
-
const w = g.get(v);
|
|
297
|
-
s.parentNode && s.parentNode.replaceChild(w, s);
|
|
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);
|
|
298
296
|
}
|
|
299
297
|
});
|
|
300
|
-
|
|
301
|
-
for (; l.firstChild; )
|
|
302
|
-
r.appendChild(l.firstChild);
|
|
303
|
-
t.innerHTML = "", t.appendChild(r);
|
|
304
|
-
}, K = () => {
|
|
298
|
+
}, G = () => {
|
|
305
299
|
try {
|
|
306
|
-
if (!
|
|
307
|
-
|
|
300
|
+
if (!y.content) {
|
|
301
|
+
z.value = "", w.value && (w.value.innerHTML = ""), y.isStreaming || re.value.clear();
|
|
308
302
|
return;
|
|
309
303
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
304
|
+
if (document.hidden && y.isStreaming) {
|
|
305
|
+
me.value = !0;
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
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>`);
|
|
315
313
|
}
|
|
316
314
|
};
|
|
317
|
-
|
|
318
|
-
() =>
|
|
319
|
-
(
|
|
320
|
-
|
|
321
|
-
|
|
315
|
+
ye(() => y.content, G), ye(
|
|
316
|
+
() => y.isStreaming,
|
|
317
|
+
(a, o) => {
|
|
318
|
+
o && !a && oe(() => {
|
|
319
|
+
G();
|
|
322
320
|
});
|
|
323
321
|
}
|
|
324
322
|
);
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
323
|
+
const Q = () => {
|
|
324
|
+
!document.hidden && me.value && (me.value = !1, oe(() => {
|
|
325
|
+
G();
|
|
326
|
+
}));
|
|
327
|
+
};
|
|
328
|
+
document.addEventListener("visibilitychange", Q), He(() => {
|
|
329
|
+
document.removeEventListener("visibilitychange", Q);
|
|
330
|
+
});
|
|
331
|
+
const i = () => {
|
|
332
|
+
D.value = window.innerWidth < 768;
|
|
333
|
+
}, f = (a) => {
|
|
334
|
+
let o = a;
|
|
335
|
+
return o = o.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1"), [
|
|
330
336
|
/([A-Za-z0-9_]+)\[([^\]]*[\u4e00-\u9fa5]+[^\]]*)\]/g,
|
|
331
337
|
/([A-Za-z0-9_]+)\(([^)]*[\u4e00-\u9fa5]+[^)]*)\)/g,
|
|
332
338
|
/([A-Za-z0-9_]+)\{([^}]*[\u4e00-\u9fa5]+[^}]*)\}/g
|
|
333
339
|
].forEach((g) => {
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
return
|
|
337
|
-
let
|
|
338
|
-
return
|
|
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;
|
|
339
345
|
});
|
|
340
|
-
}),
|
|
341
|
-
},
|
|
342
|
-
var
|
|
343
|
-
if (
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
for (const g of Array.from(
|
|
347
|
-
const
|
|
348
|
-
let
|
|
349
|
-
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")
|
|
350
356
|
try {
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}),
|
|
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);
|
|
358
364
|
}
|
|
359
|
-
} catch (
|
|
360
|
-
console.error("Mermaid render failure:",
|
|
361
|
-
const
|
|
362
|
-
|
|
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);
|
|
363
369
|
}
|
|
364
370
|
}
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
},
|
|
370
|
-
|
|
371
|
-
},
|
|
372
|
-
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
},
|
|
384
|
-
var
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
x:
|
|
388
|
-
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
|
|
389
395
|
};
|
|
390
|
-
const
|
|
391
|
-
if (!
|
|
392
|
-
let
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
},
|
|
396
|
-
|
|
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);
|
|
397
403
|
};
|
|
398
|
-
document.addEventListener("mousemove", g), document.addEventListener("mouseup",
|
|
399
|
-
},
|
|
400
|
-
var
|
|
401
|
-
if (
|
|
402
|
-
const
|
|
403
|
-
if (
|
|
404
|
-
|
|
405
|
-
x:
|
|
406
|
-
y: g -
|
|
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
|
|
407
413
|
};
|
|
408
|
-
const
|
|
409
|
-
if (!
|
|
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)
|
|
410
416
|
return;
|
|
411
|
-
const
|
|
412
|
-
let
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
},
|
|
416
|
-
|
|
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);
|
|
417
423
|
};
|
|
418
|
-
document.addEventListener("touchmove",
|
|
419
|
-
},
|
|
424
|
+
document.addEventListener("touchmove", t, { passive: !1 }), document.addEventListener("touchend", s);
|
|
425
|
+
}, Z = () => {
|
|
420
426
|
S.value = Math.min(S.value + 1, 10);
|
|
421
|
-
},
|
|
427
|
+
}, xe = () => {
|
|
422
428
|
S.value = Math.max(S.value - 1, 0.5);
|
|
423
|
-
},
|
|
424
|
-
S.value = 1,
|
|
425
|
-
},
|
|
426
|
-
|
|
427
|
-
const
|
|
428
|
-
S.value = Math.max(0.5, Math.min(10, S.value +
|
|
429
|
-
},
|
|
430
|
-
var
|
|
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;
|
|
431
437
|
if (S.value <= 1) return;
|
|
432
|
-
|
|
433
|
-
x:
|
|
434
|
-
y:
|
|
438
|
+
a.preventDefault(), _.value = !0, we.value = {
|
|
439
|
+
x: a.clientX - O.value.x,
|
|
440
|
+
y: a.clientY - O.value.y
|
|
435
441
|
};
|
|
436
|
-
const
|
|
437
|
-
if (!
|
|
438
|
-
let
|
|
439
|
-
|
|
440
|
-
},
|
|
441
|
-
|
|
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);
|
|
442
448
|
};
|
|
443
|
-
document.addEventListener("mousemove", g), document.addEventListener("mouseup",
|
|
444
|
-
},
|
|
445
|
-
},
|
|
446
|
-
|
|
447
|
-
if (!
|
|
448
|
-
|
|
449
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", u);
|
|
450
|
+
}, ue = (a) => {
|
|
451
|
+
}, Be = () => {
|
|
452
|
+
y.isStreaming || oe(() => {
|
|
453
|
+
if (!b.value) return;
|
|
454
|
+
b.value.querySelectorAll(
|
|
449
455
|
".markdown-content img"
|
|
450
|
-
).forEach((
|
|
451
|
-
const
|
|
452
|
-
|
|
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));
|
|
453
459
|
});
|
|
454
460
|
});
|
|
455
461
|
};
|
|
456
|
-
return
|
|
457
|
-
|
|
458
|
-
}),
|
|
459
|
-
|
|
462
|
+
return Ve(() => {
|
|
463
|
+
i(), window.addEventListener("resize", i), G(), Be(), h();
|
|
464
|
+
}), He(() => {
|
|
465
|
+
b.value && b.value.querySelectorAll(
|
|
460
466
|
".markdown-content img"
|
|
461
|
-
).forEach((
|
|
462
|
-
|
|
467
|
+
).forEach((o) => {
|
|
468
|
+
o.removeEventListener("click", I);
|
|
463
469
|
});
|
|
464
|
-
}), (
|
|
470
|
+
}), (a, o) => (d(), p("div", {
|
|
465
471
|
class: "markdown-message",
|
|
466
472
|
ref_key: "markdownContainer",
|
|
467
|
-
ref:
|
|
473
|
+
ref: b
|
|
468
474
|
}, [
|
|
469
|
-
|
|
475
|
+
l("div", {
|
|
470
476
|
ref_key: "markdownContent",
|
|
471
|
-
ref:
|
|
477
|
+
ref: w,
|
|
472
478
|
class: "markdown-content"
|
|
473
479
|
}, null, 512),
|
|
474
|
-
|
|
475
|
-
visible:
|
|
476
|
-
"onUpdate:visible":
|
|
477
|
-
width:
|
|
478
|
-
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,
|
|
479
485
|
class: "image-preview-dialog",
|
|
480
486
|
"close-on-click-modal": !1,
|
|
481
487
|
"append-to-body": ""
|
|
482
488
|
}, {
|
|
483
|
-
default:
|
|
484
|
-
|
|
489
|
+
default: W(() => [
|
|
490
|
+
l("div", {
|
|
485
491
|
class: "image-preview-container",
|
|
486
|
-
onClick:
|
|
492
|
+
onClick: o[1] || (o[1] = he((c) => m.value = !1, ["self"]))
|
|
487
493
|
}, [
|
|
488
|
-
|
|
489
|
-
src:
|
|
490
|
-
alt:
|
|
494
|
+
l("img", {
|
|
495
|
+
src: A.value,
|
|
496
|
+
alt: $.value,
|
|
491
497
|
class: "preview-image",
|
|
492
|
-
style:
|
|
493
|
-
transform: `translate(${
|
|
498
|
+
style: be({
|
|
499
|
+
transform: `translate(${V.value.x}px, ${V.value.y}px) scale(${k.value})`
|
|
494
500
|
}),
|
|
495
|
-
onWheel:
|
|
496
|
-
onDblclick:
|
|
497
|
-
onMousedown:
|
|
498
|
-
onTouchstart:
|
|
499
|
-
onClick:
|
|
500
|
-
}, null, 44,
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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, {
|
|
504
510
|
size: "small",
|
|
505
|
-
onClick:
|
|
506
|
-
disabled:
|
|
511
|
+
onClick: fe,
|
|
512
|
+
disabled: k.value <= 0.5
|
|
507
513
|
}, {
|
|
508
|
-
default:
|
|
509
|
-
|
|
514
|
+
default: W(() => [
|
|
515
|
+
M(U(Ne))
|
|
510
516
|
]),
|
|
511
517
|
_: 1
|
|
512
518
|
}, 8, ["disabled"]),
|
|
513
|
-
|
|
519
|
+
M(K, {
|
|
514
520
|
size: "small",
|
|
515
|
-
onClick:
|
|
521
|
+
onClick: ie
|
|
516
522
|
}, {
|
|
517
|
-
default:
|
|
518
|
-
|
|
523
|
+
default: W(() => [
|
|
524
|
+
We(N(Math.round(k.value * 100)) + "% ", 1)
|
|
519
525
|
]),
|
|
520
526
|
_: 1
|
|
521
527
|
}),
|
|
522
|
-
|
|
528
|
+
M(K, {
|
|
523
529
|
size: "small",
|
|
524
|
-
onClick:
|
|
525
|
-
disabled:
|
|
530
|
+
onClick: ve,
|
|
531
|
+
disabled: k.value >= 10
|
|
526
532
|
}, {
|
|
527
|
-
default:
|
|
528
|
-
|
|
533
|
+
default: W(() => [
|
|
534
|
+
M(U(Ye))
|
|
529
535
|
]),
|
|
530
536
|
_: 1
|
|
531
537
|
}, 8, ["disabled"])
|
|
532
538
|
]),
|
|
533
|
-
|
|
539
|
+
M(K, {
|
|
534
540
|
size: "small",
|
|
535
|
-
onClick:
|
|
541
|
+
onClick: o[0] || (o[0] = (c) => m.value = !1),
|
|
536
542
|
type: "danger"
|
|
537
543
|
}, {
|
|
538
|
-
default:
|
|
539
|
-
|
|
544
|
+
default: W(() => [
|
|
545
|
+
M(U(Ue))
|
|
540
546
|
]),
|
|
541
547
|
_: 1
|
|
542
548
|
})
|
|
543
549
|
]),
|
|
544
|
-
|
|
550
|
+
D.value ? (d(), p("div", Et, "双击重置 · 轻触关闭")) : B("", !0)
|
|
545
551
|
])
|
|
546
552
|
]),
|
|
547
553
|
_: 1
|
|
548
554
|
}, 8, ["visible", "width", "fullscreen"]),
|
|
549
|
-
|
|
555
|
+
M(Pe, {
|
|
550
556
|
visible: x.value,
|
|
551
|
-
"onUpdate:visible":
|
|
552
|
-
width:
|
|
553
|
-
fullscreen:
|
|
557
|
+
"onUpdate:visible": o[5] || (o[5] = (c) => x.value = c),
|
|
558
|
+
width: D.value ? "95vw" : "90vw",
|
|
559
|
+
fullscreen: D.value,
|
|
554
560
|
class: "mermaid-preview-dialog",
|
|
555
561
|
"close-on-click-modal": !1,
|
|
556
562
|
"append-to-body": ""
|
|
557
563
|
}, {
|
|
558
|
-
default:
|
|
559
|
-
|
|
564
|
+
default: W(() => [
|
|
565
|
+
l("div", {
|
|
560
566
|
class: "mermaid-preview-container",
|
|
561
|
-
onClick:
|
|
567
|
+
onClick: o[4] || (o[4] = he((c) => x.value = !1, ["self"]))
|
|
562
568
|
}, [
|
|
563
|
-
|
|
569
|
+
l("div", {
|
|
564
570
|
class: "mermaid-preview-content",
|
|
565
|
-
innerHTML:
|
|
566
|
-
style:
|
|
567
|
-
transform: `translate(${
|
|
571
|
+
innerHTML: H.value,
|
|
572
|
+
style: be({
|
|
573
|
+
transform: `translate(${O.value.x}px, ${O.value.y}px) scale(${S.value})`
|
|
568
574
|
}),
|
|
569
|
-
onWheel:
|
|
570
|
-
onDblclick:
|
|
571
|
-
onMousedown:
|
|
572
|
-
onTouchstart:
|
|
573
|
-
}, null, 44,
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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, {
|
|
577
583
|
size: "small",
|
|
578
|
-
onClick:
|
|
584
|
+
onClick: xe,
|
|
579
585
|
disabled: S.value <= 0.5
|
|
580
586
|
}, {
|
|
581
|
-
default:
|
|
582
|
-
|
|
587
|
+
default: W(() => [
|
|
588
|
+
M(U(Ne))
|
|
583
589
|
]),
|
|
584
590
|
_: 1
|
|
585
591
|
}, 8, ["disabled"]),
|
|
586
|
-
|
|
592
|
+
M(K, {
|
|
587
593
|
size: "small",
|
|
588
|
-
onClick:
|
|
594
|
+
onClick: ce
|
|
589
595
|
}, {
|
|
590
|
-
default:
|
|
591
|
-
|
|
596
|
+
default: W(() => [
|
|
597
|
+
We(N(Math.round(S.value * 100)) + "% ", 1)
|
|
592
598
|
]),
|
|
593
599
|
_: 1
|
|
594
600
|
}),
|
|
595
|
-
|
|
601
|
+
M(K, {
|
|
596
602
|
size: "small",
|
|
597
|
-
onClick:
|
|
603
|
+
onClick: Z,
|
|
598
604
|
disabled: S.value >= 10
|
|
599
605
|
}, {
|
|
600
|
-
default:
|
|
601
|
-
|
|
606
|
+
default: W(() => [
|
|
607
|
+
M(U(Ye))
|
|
602
608
|
]),
|
|
603
609
|
_: 1
|
|
604
610
|
}, 8, ["disabled"])
|
|
605
611
|
]),
|
|
606
|
-
|
|
612
|
+
M(K, {
|
|
607
613
|
size: "small",
|
|
608
|
-
onClick:
|
|
614
|
+
onClick: o[3] || (o[3] = (c) => x.value = !1),
|
|
609
615
|
type: "danger"
|
|
610
616
|
}, {
|
|
611
|
-
default:
|
|
612
|
-
|
|
617
|
+
default: W(() => [
|
|
618
|
+
M(U(Ue))
|
|
613
619
|
]),
|
|
614
620
|
_: 1
|
|
615
621
|
})
|
|
616
622
|
]),
|
|
617
|
-
|
|
623
|
+
D.value ? (d(), p("div", Ht, "双击重置 · 轻触关闭")) : B("", !0)
|
|
618
624
|
])
|
|
619
625
|
]),
|
|
620
626
|
_: 1
|
|
621
627
|
}, 8, ["visible", "width", "fullscreen"])
|
|
622
628
|
], 512));
|
|
623
629
|
}
|
|
624
|
-
}),
|
|
630
|
+
}), Je = /* @__PURE__ */ Ce(Dt, [["__scopeId", "data-v-c6385dde"]]), Pt = {
|
|
625
631
|
key: 0,
|
|
626
632
|
class: "text-content"
|
|
627
|
-
},
|
|
633
|
+
}, Rt = {
|
|
628
634
|
key: 1,
|
|
629
635
|
class: "images-content"
|
|
630
|
-
},
|
|
636
|
+
}, Vt = ["onClick"], Ft = ["src", "alt", "onError"], Ot = {
|
|
631
637
|
key: 0,
|
|
632
638
|
class: "more-images"
|
|
633
|
-
},
|
|
639
|
+
}, Wt = {
|
|
634
640
|
key: 2,
|
|
635
|
-
class: "attachments-content"
|
|
636
|
-
}, At = { class: "file-icon-wrapper" }, Tt = { class: "attachment-info" }, Ht = { class: "attachment-name" }, Dt = { class: "attachment-size" }, Rt = {
|
|
637
|
-
key: 3,
|
|
638
641
|
class: "files-content"
|
|
639
|
-
},
|
|
640
|
-
key:
|
|
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
|
+
key: 3,
|
|
641
644
|
class: "audio-content"
|
|
642
|
-
},
|
|
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 = {
|
|
643
646
|
key: 0,
|
|
644
647
|
class: "image-nav"
|
|
645
|
-
},
|
|
648
|
+
}, os = { class: "image-counter" }, ls = /* @__PURE__ */ Me({
|
|
646
649
|
__name: "MultimodalMessage",
|
|
647
650
|
props: {
|
|
648
651
|
message: {},
|
|
649
652
|
isUser: { type: Boolean, default: !1 },
|
|
650
|
-
isStreaming: { type: Boolean, default: !1 }
|
|
653
|
+
isStreaming: { type: Boolean, default: !1 },
|
|
654
|
+
apiBaseUrl: { default: "" },
|
|
655
|
+
onDownload: {}
|
|
651
656
|
},
|
|
652
|
-
setup(
|
|
653
|
-
const
|
|
657
|
+
setup(r) {
|
|
658
|
+
const y = r, b = Y(() => {
|
|
654
659
|
try {
|
|
655
|
-
return
|
|
660
|
+
return y.message.metadata ? JSON.parse(y.message.metadata) : {};
|
|
656
661
|
} catch {
|
|
657
662
|
return {};
|
|
658
663
|
}
|
|
659
|
-
}),
|
|
660
|
-
() =>
|
|
661
|
-
),
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
664
|
+
}), w = Y(
|
|
665
|
+
() => b.value.imageUrls || []
|
|
666
|
+
), m = Y(() => b.value.audioUrl), A = C(/* @__PURE__ */ new Set()), $ = Y(
|
|
667
|
+
() => b.value.fileUrls || []
|
|
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
|
+
const i = [];
|
|
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
|
+
});
|
|
677
|
+
}) : x.value && x.value.length > 0 && x.value.forEach((f) => {
|
|
678
|
+
i.push({
|
|
679
|
+
url: f,
|
|
680
|
+
name: X(f),
|
|
681
|
+
type: ee(f)
|
|
682
|
+
});
|
|
683
|
+
}), i;
|
|
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
|
+
if (!i) return "Unknown File";
|
|
698
|
+
if (!i.includes("/"))
|
|
699
|
+
return decodeURIComponent(i) || "Unknown File";
|
|
674
700
|
try {
|
|
675
|
-
const
|
|
676
|
-
return decodeURIComponent(
|
|
701
|
+
const f = i.lastIndexOf("/"), h = f >= 0 ? i.substring(f + 1) : i;
|
|
702
|
+
return decodeURIComponent(h) || "Unknown File";
|
|
677
703
|
} catch {
|
|
678
704
|
return "Unknown File";
|
|
679
705
|
}
|
|
680
|
-
},
|
|
681
|
-
var
|
|
682
|
-
return ((
|
|
683
|
-
},
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}, ie = (m) => {
|
|
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) => {
|
|
687
712
|
try {
|
|
688
|
-
const h =
|
|
689
|
-
|
|
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
|
+
return;
|
|
718
|
+
}
|
|
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
|
+
{
|
|
725
|
+
method: "GET",
|
|
726
|
+
filename: "_downloads/" + (f || X(i))
|
|
727
|
+
},
|
|
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
|
+
}
|
|
732
|
+
);
|
|
733
|
+
F.Authorization && Z.setRequestHeader(
|
|
734
|
+
"Authorization",
|
|
735
|
+
F.Authorization
|
|
736
|
+
), Z.start();
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
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
|
+
else {
|
|
749
|
+
const Z = ie.match(/filename="?([^";\n]+)"?/i);
|
|
750
|
+
Z && (fe = Z[1]);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
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);
|
|
690
755
|
} catch (h) {
|
|
691
|
-
console.error("
|
|
756
|
+
console.error("下载文件失败:", h);
|
|
757
|
+
} finally {
|
|
758
|
+
const h = new Set(A.value);
|
|
759
|
+
h.delete(i), A.value = h;
|
|
692
760
|
}
|
|
693
|
-
},
|
|
694
|
-
if (
|
|
761
|
+
}, Ae = async () => {
|
|
762
|
+
if (m.value)
|
|
695
763
|
try {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}),
|
|
699
|
-
|
|
700
|
-
}),
|
|
701
|
-
|
|
702
|
-
}),
|
|
703
|
-
console.error("Audio playback error:",
|
|
704
|
-
})),
|
|
705
|
-
} catch (
|
|
706
|
-
console.error("Audio playback failed:",
|
|
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
|
+
} catch (i) {
|
|
774
|
+
console.error("Audio playback failed:", i), S.value = !1, R.value = !1;
|
|
707
775
|
}
|
|
708
|
-
},
|
|
709
|
-
const
|
|
710
|
-
return `${
|
|
711
|
-
},
|
|
712
|
-
|
|
713
|
-
const h = 1024, y = ["B", "KB", "MB", "GB"], B = Math.floor(Math.log(m) / Math.log(h));
|
|
714
|
-
return (m / Math.pow(h, B)).toFixed(2) + y[B];
|
|
715
|
-
}, we = (m) => {
|
|
716
|
-
var y;
|
|
717
|
-
return ((y = m.split(".").pop()) == null ? void 0 : y.toUpperCase()) || "FILE";
|
|
718
|
-
}, K = (m) => {
|
|
719
|
-
x.value && (m.key === "ArrowLeft" ? te() : m.key === "ArrowRight" ? se() : m.key === "Escape" && (x.value = !1));
|
|
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));
|
|
720
781
|
};
|
|
721
|
-
return
|
|
722
|
-
|
|
723
|
-
}),
|
|
724
|
-
|
|
725
|
-
}), (
|
|
726
|
-
class: le(["multimodal-message", { "is-user":
|
|
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 }])
|
|
727
788
|
}, [
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
content:
|
|
731
|
-
"is-streaming":
|
|
789
|
+
r.message.content ? (d(), p("div", Pt, [
|
|
790
|
+
M(Je, {
|
|
791
|
+
content: r.message.content,
|
|
792
|
+
"is-streaming": r.isStreaming
|
|
732
793
|
}, null, 8, ["content", "is-streaming"])
|
|
733
|
-
])) :
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
class: le(["images-grid", `grid-${Math.min(
|
|
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)}`])
|
|
737
798
|
}, [
|
|
738
|
-
(
|
|
739
|
-
key:
|
|
799
|
+
(d(!0), p(ze, null, Ee(w.value.slice(0, 4), (h, I) => (d(), p("div", {
|
|
800
|
+
key: I,
|
|
740
801
|
class: "image-item",
|
|
741
|
-
onClick: (
|
|
802
|
+
onClick: (F) => re(h, I)
|
|
742
803
|
}, [
|
|
743
|
-
|
|
744
|
-
src:
|
|
745
|
-
alt: `图片 ${
|
|
746
|
-
onError: (
|
|
804
|
+
l("img", {
|
|
805
|
+
src: h,
|
|
806
|
+
alt: `图片 ${I + 1}`,
|
|
807
|
+
onError: (F) => _e(F, h),
|
|
747
808
|
loading: "lazy"
|
|
748
|
-
}, null, 40,
|
|
749
|
-
|
|
750
|
-
], 8,
|
|
809
|
+
}, null, 40, Ft),
|
|
810
|
+
I === 3 && w.value.length > 4 ? (d(), p("div", Ot, " +" + N(w.value.length - 4), 1)) : B("", !0)
|
|
811
|
+
], 8, Vt))), 128))
|
|
751
812
|
], 2)
|
|
752
|
-
])) :
|
|
753
|
-
|
|
754
|
-
(
|
|
755
|
-
key:
|
|
756
|
-
class: "attachment-item"
|
|
757
|
-
}, [
|
|
758
|
-
a("div", At, [
|
|
759
|
-
f(I(Be), { class: "file-icon" })
|
|
760
|
-
]),
|
|
761
|
-
a("div", Tt, [
|
|
762
|
-
a("span", Ht, F(y.name), 1),
|
|
763
|
-
a("span", Dt, F(we(y.name)) + " " + F(ye(y.size)), 1)
|
|
764
|
-
])
|
|
765
|
-
]))), 128))
|
|
766
|
-
])) : D("", !0),
|
|
767
|
-
z.value && z.value.length > 0 ? (o(), u("div", Rt, [
|
|
768
|
-
(o(!0), u(ue, null, me(z.value, (y, B) => (o(), u("div", {
|
|
769
|
-
key: B,
|
|
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,
|
|
770
817
|
class: "file-item",
|
|
771
|
-
onClick: (
|
|
818
|
+
onClick: (F) => q(h.url, h.name)
|
|
772
819
|
}, [
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
]),
|
|
776
|
-
a("div", Nt, [
|
|
777
|
-
a("span", Ut, F(ae(y)), 1),
|
|
778
|
-
a("span", Yt, F(ge(y)), 1)
|
|
820
|
+
l("div", Yt, [
|
|
821
|
+
M(U(Mt), { class: "file-icon" })
|
|
779
822
|
]),
|
|
780
|
-
|
|
781
|
-
|
|
823
|
+
l("div", {
|
|
824
|
+
class: "file-info",
|
|
825
|
+
title: h.name
|
|
826
|
+
}, [
|
|
827
|
+
l("span", Xt, N(h.name), 1),
|
|
828
|
+
l("span", qt, N(h.type), 1)
|
|
829
|
+
], 8, Nt),
|
|
830
|
+
l("div", Zt, [
|
|
831
|
+
M(K, {
|
|
782
832
|
size: "small",
|
|
783
833
|
type: "text",
|
|
784
|
-
|
|
834
|
+
disabled: A.value.has(h.url),
|
|
835
|
+
onClick: he((F) => te(h.url, h.name), ["stop"])
|
|
785
836
|
}, {
|
|
786
|
-
default:
|
|
787
|
-
|
|
837
|
+
default: W(() => [
|
|
838
|
+
M(U(Xe), {
|
|
839
|
+
class: le({ "icon-spin": A.value.has(h.url) })
|
|
840
|
+
}, null, 8, ["class"])
|
|
788
841
|
]),
|
|
789
|
-
_:
|
|
790
|
-
},
|
|
842
|
+
_: 2
|
|
843
|
+
}, 1032, ["disabled", "onClick"])
|
|
791
844
|
])
|
|
792
|
-
], 8,
|
|
793
|
-
])) :
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
onClick:
|
|
798
|
-
loading:
|
|
845
|
+
], 8, jt))), 128))
|
|
846
|
+
])) : B("", !0),
|
|
847
|
+
m.value ? (d(), p("div", Kt, [
|
|
848
|
+
l("div", Jt, [
|
|
849
|
+
M(K, {
|
|
850
|
+
onClick: Ae,
|
|
851
|
+
loading: S.value,
|
|
799
852
|
circle: "",
|
|
800
853
|
size: "small",
|
|
801
854
|
class: "play-btn"
|
|
802
855
|
}, {
|
|
803
|
-
default:
|
|
804
|
-
(
|
|
856
|
+
default: W(() => [
|
|
857
|
+
(d(), de(Ke(R.value ? U(Ct) : U(St))))
|
|
805
858
|
]),
|
|
806
859
|
_: 1
|
|
807
860
|
}, 8, ["loading"]),
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
861
|
+
l("div", Gt, [
|
|
862
|
+
l("div", Qt, [
|
|
863
|
+
l("div", es, [
|
|
864
|
+
l("div", {
|
|
812
865
|
class: "progress-fill",
|
|
813
|
-
style:
|
|
866
|
+
style: be({ width: we.value + "%" })
|
|
814
867
|
}, null, 4)
|
|
815
868
|
])
|
|
816
869
|
]),
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
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)
|
|
821
874
|
])
|
|
822
875
|
]),
|
|
823
|
-
|
|
824
|
-
onClick:
|
|
876
|
+
M(K, {
|
|
877
|
+
onClick: f[0] || (f[0] = (h) => te(m.value)),
|
|
825
878
|
size: "small",
|
|
826
879
|
type: "text",
|
|
827
880
|
class: "download-btn"
|
|
828
881
|
}, {
|
|
829
|
-
default:
|
|
830
|
-
|
|
882
|
+
default: W(() => [
|
|
883
|
+
M(U(Xe))
|
|
831
884
|
]),
|
|
832
885
|
_: 1
|
|
833
886
|
})
|
|
834
887
|
])
|
|
835
|
-
])) :
|
|
836
|
-
|
|
837
|
-
visible:
|
|
838
|
-
"onUpdate:visible":
|
|
888
|
+
])) : B("", !0),
|
|
889
|
+
M(Pe, {
|
|
890
|
+
visible: k.value,
|
|
891
|
+
"onUpdate:visible": f[3] || (f[3] = (h) => k.value = h),
|
|
839
892
|
width: "90%",
|
|
840
893
|
"show-close": !1,
|
|
841
894
|
"append-to-body": "",
|
|
842
895
|
class: "image-preview-dialog-wrapper"
|
|
843
896
|
}, {
|
|
844
|
-
default:
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
src:
|
|
897
|
+
default: W(() => [
|
|
898
|
+
l("div", ss, [
|
|
899
|
+
l("img", {
|
|
900
|
+
src: V.value,
|
|
848
901
|
alt: "预览图片",
|
|
849
902
|
class: "preview-image",
|
|
850
|
-
onClick:
|
|
851
|
-
}, null, 8,
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
onClick:
|
|
855
|
-
disabled:
|
|
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
|
+
disabled: L.value === 0,
|
|
856
909
|
circle: "",
|
|
857
910
|
class: "nav-btn"
|
|
858
911
|
}, {
|
|
859
|
-
default:
|
|
860
|
-
|
|
912
|
+
default: W(() => [
|
|
913
|
+
M(U(_t))
|
|
861
914
|
]),
|
|
862
915
|
_: 1
|
|
863
916
|
}, 8, ["disabled"]),
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
onClick:
|
|
867
|
-
disabled:
|
|
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,
|
|
868
921
|
circle: "",
|
|
869
922
|
class: "nav-btn"
|
|
870
923
|
}, {
|
|
871
|
-
default:
|
|
872
|
-
|
|
924
|
+
default: W(() => [
|
|
925
|
+
M(U(At))
|
|
873
926
|
]),
|
|
874
927
|
_: 1
|
|
875
928
|
}, 8, ["disabled"])
|
|
876
|
-
])) :
|
|
877
|
-
|
|
878
|
-
onClick:
|
|
929
|
+
])) : B("", !0),
|
|
930
|
+
M(K, {
|
|
931
|
+
onClick: f[2] || (f[2] = (h) => k.value = !1),
|
|
879
932
|
class: "close-btn",
|
|
880
933
|
circle: ""
|
|
881
934
|
}, {
|
|
882
|
-
default:
|
|
883
|
-
|
|
935
|
+
default: W(() => [
|
|
936
|
+
M(U(Ue))
|
|
884
937
|
]),
|
|
885
938
|
_: 1
|
|
886
939
|
})
|
|
@@ -890,104 +943,143 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ Q({
|
|
|
890
943
|
}, 8, ["visible"])
|
|
891
944
|
], 2));
|
|
892
945
|
}
|
|
893
|
-
}),
|
|
894
|
-
key: 0,
|
|
895
|
-
class: "agent-steps"
|
|
896
|
-
}, ss = { class: "steps-indicator" }, as = {
|
|
946
|
+
}), Re = /* @__PURE__ */ Ce(ls, [["__scopeId", "data-v-96cd8b34"]]), rs = ["aria-expanded"], is = { class: "steps-indicator" }, cs = {
|
|
897
947
|
key: 0,
|
|
898
948
|
class: "icon-running"
|
|
899
|
-
},
|
|
949
|
+
}, us = {
|
|
900
950
|
key: 1,
|
|
951
|
+
class: "icon-error"
|
|
952
|
+
}, ds = {
|
|
953
|
+
key: 2,
|
|
901
954
|
class: "icon-completed"
|
|
902
|
-
},
|
|
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 = {
|
|
903
962
|
key: 3,
|
|
904
963
|
class: "icon-dot"
|
|
905
|
-
},
|
|
964
|
+
}, Ms = { class: "step-name" }, Ss = { class: "step-status" }, Cs = /* @__PURE__ */ Me({
|
|
906
965
|
__name: "AgentSteps",
|
|
907
966
|
props: {
|
|
908
967
|
steps: {}
|
|
909
968
|
},
|
|
910
969
|
emits: ["resize"],
|
|
911
|
-
setup(
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
}
|
|
916
|
-
},
|
|
917
|
-
() =>
|
|
918
|
-
), x =
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
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",
|
|
929
995
|
class: "steps-header",
|
|
930
|
-
|
|
996
|
+
"aria-expanded": w.value,
|
|
997
|
+
onClick: A
|
|
931
998
|
}, [
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
])) : (
|
|
936
|
-
|
|
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))
|
|
937
1006
|
]))
|
|
938
1007
|
]),
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
(
|
|
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))))
|
|
942
1015
|
])
|
|
1016
|
+
], 8, rs),
|
|
1017
|
+
l("div", hs, [
|
|
1018
|
+
l("span", {
|
|
1019
|
+
style: be(k.value)
|
|
1020
|
+
}, null, 4)
|
|
943
1021
|
]),
|
|
944
|
-
|
|
945
|
-
(
|
|
946
|
-
key:
|
|
1022
|
+
nt(l("div", ys, [
|
|
1023
|
+
(d(!0), p(ze, null, Ee(r.steps, (_) => (d(), p("div", {
|
|
1024
|
+
key: _.name,
|
|
947
1025
|
class: le(["step-item", {
|
|
948
|
-
"is-running":
|
|
949
|
-
"is-completed":
|
|
950
|
-
"is-error":
|
|
1026
|
+
"is-running": _.status === "running",
|
|
1027
|
+
"is-completed": _.status === "completed",
|
|
1028
|
+
"is-error": _.status === "error"
|
|
951
1029
|
}])
|
|
952
1030
|
}, [
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
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
|
+
])
|
|
958
1038
|
]),
|
|
959
|
-
|
|
1039
|
+
l("span", Ms, N(_.displayName), 1),
|
|
1040
|
+
l("span", Ss, N(R(_.status)), 1)
|
|
960
1041
|
], 2))), 128))
|
|
961
1042
|
], 512), [
|
|
962
|
-
[
|
|
1043
|
+
[ot, w.value]
|
|
963
1044
|
])
|
|
964
|
-
])) :
|
|
1045
|
+
], 2)) : B("", !0);
|
|
965
1046
|
}
|
|
966
|
-
}),
|
|
1047
|
+
}), Ge = /* @__PURE__ */ Ce(Cs, [["__scopeId", "data-v-5030f19a"]]), _s = { class: "chat-message-list-root" }, As = {
|
|
967
1048
|
key: 0,
|
|
968
1049
|
class: "bg-grid"
|
|
969
|
-
},
|
|
1050
|
+
}, $s = {
|
|
970
1051
|
key: 0,
|
|
971
1052
|
class: "welcome-screen"
|
|
972
|
-
},
|
|
1053
|
+
}, xs = { class: "welcome-content" }, Is = { class: "welcome-logo" }, Ls = ["src"], zs = {
|
|
973
1054
|
key: 1,
|
|
974
1055
|
class: "default-logo"
|
|
975
|
-
},
|
|
1056
|
+
}, Es = { class: "welcome-title" }, Us = {
|
|
976
1057
|
key: 1,
|
|
977
1058
|
class: "messages-container"
|
|
978
|
-
},
|
|
1059
|
+
}, Ts = {
|
|
1060
|
+
key: 0,
|
|
1061
|
+
class: "user-message-wrapper"
|
|
1062
|
+
}, Bs = { class: "message-bubble user-bubble" }, Hs = {
|
|
979
1063
|
key: 0,
|
|
980
|
-
class: "message-
|
|
981
|
-
},
|
|
1064
|
+
class: "message-actions user-actions"
|
|
1065
|
+
}, Ds = ["onClick"], Ps = {
|
|
982
1066
|
key: 1,
|
|
983
1067
|
class: "message-content assistant-content"
|
|
984
|
-
},
|
|
1068
|
+
}, Rs = {
|
|
1069
|
+
key: 2,
|
|
1070
|
+
class: "a2ui-card-skeleton",
|
|
1071
|
+
"aria-hidden": "true"
|
|
1072
|
+
}, Vs = {
|
|
985
1073
|
key: 1,
|
|
986
1074
|
class: "message-actions"
|
|
987
|
-
},
|
|
1075
|
+
}, Fs = ["onClick"], Os = {
|
|
988
1076
|
key: 0,
|
|
989
1077
|
class: "message-row message-assistant"
|
|
990
|
-
},
|
|
1078
|
+
}, Ws = {
|
|
1079
|
+
key: 0,
|
|
1080
|
+
class: "loading-ring",
|
|
1081
|
+
viewBox: "0 0 36 36"
|
|
1082
|
+
}, js = /* @__PURE__ */ Me({
|
|
991
1083
|
__name: "ChatMessageList",
|
|
992
1084
|
props: {
|
|
993
1085
|
messages: { default: () => [] },
|
|
@@ -1001,173 +1093,514 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ Q({
|
|
|
1001
1093
|
autoScroll: { type: Boolean, default: !0 },
|
|
1002
1094
|
contentPaddingTop: { default: "80px" },
|
|
1003
1095
|
contentPaddingBottom: { default: "140px" },
|
|
1004
|
-
showBackground: { type: Boolean, default: !0 }
|
|
1096
|
+
showBackground: { type: Boolean, default: !0 },
|
|
1097
|
+
apiBaseUrl: { default: "" },
|
|
1098
|
+
enableA2UI: { type: Boolean, default: !0 },
|
|
1099
|
+
autoProvideA2UI: { type: Boolean, default: !0 },
|
|
1100
|
+
a2uiCatalog: {},
|
|
1101
|
+
hideA2UIRawContent: { type: Boolean, default: !0 },
|
|
1102
|
+
showA2UISkeleton: { type: Boolean, default: !0 },
|
|
1103
|
+
a2uiActionHandler: {}
|
|
1005
1104
|
},
|
|
1006
|
-
emits: [
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1105
|
+
emits: [
|
|
1106
|
+
"copy",
|
|
1107
|
+
"scroll",
|
|
1108
|
+
"scroll-bottom",
|
|
1109
|
+
"a2ui-action",
|
|
1110
|
+
"a2ui-error"
|
|
1111
|
+
],
|
|
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({});
|
|
1114
|
+
(() => {
|
|
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));
|
|
1129
|
+
})();
|
|
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])
|
|
1159
|
+
));
|
|
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;
|
|
1168
|
+
try {
|
|
1169
|
+
return JSON.parse(n);
|
|
1170
|
+
} catch {
|
|
1171
|
+
return null;
|
|
1172
|
+
}
|
|
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) : [];
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
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);
|
|
1207
|
+
}
|
|
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) : [];
|
|
1220
|
+
}
|
|
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);
|
|
1234
|
+
}
|
|
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)
|
|
1302
|
+
try {
|
|
1303
|
+
L.processMessages(e);
|
|
1304
|
+
} catch (t) {
|
|
1305
|
+
console.warn("[rt-chat-messages] A2UI payload render failed", t), A("a2ui-error", t);
|
|
1306
|
+
}
|
|
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
|
|
1313
|
+
);
|
|
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);
|
|
1331
|
+
try {
|
|
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"));
|
|
1336
|
+
}
|
|
1337
|
+
e.resolve(v);
|
|
1338
|
+
} catch (n) {
|
|
1339
|
+
A("a2ui-error", n), e.reject(n instanceof Error ? n : new Error(String(n)));
|
|
1340
|
+
}
|
|
1019
1341
|
};
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
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
|
|
1351
|
+
}), setTimeout(() => {
|
|
1352
|
+
ge = !1;
|
|
1353
|
+
}, 50);
|
|
1024
1354
|
}
|
|
1025
|
-
|
|
1026
|
-
()
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
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"));
|
|
1359
|
+
};
|
|
1360
|
+
ye(
|
|
1361
|
+
() => m.messages.length,
|
|
1362
|
+
async (e, t) => {
|
|
1363
|
+
e > (t || 0) && (x.value = !1, m.autoScroll && ue("instant"));
|
|
1364
|
+
}
|
|
1365
|
+
), ye(
|
|
1366
|
+
() => [m.messages, m.enableA2UI],
|
|
1367
|
+
$e,
|
|
1368
|
+
{ deep: !0, immediate: !0 }
|
|
1369
|
+
);
|
|
1370
|
+
let a = null;
|
|
1371
|
+
ye(
|
|
1372
|
+
() => m.messages,
|
|
1373
|
+
async () => {
|
|
1374
|
+
if (!m.isStreaming || !m.autoScroll || x.value || document.hidden)
|
|
1375
|
+
return;
|
|
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({
|
|
1034
1379
|
top: $.value.scrollHeight,
|
|
1035
1380
|
behavior: "instant"
|
|
1036
1381
|
});
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
(
|
|
1042
|
-
|
|
1382
|
+
}));
|
|
1383
|
+
},
|
|
1384
|
+
{ deep: !0 }
|
|
1385
|
+
), ye(
|
|
1386
|
+
() => m.isTyping,
|
|
1387
|
+
(e) => {
|
|
1388
|
+
e && m.autoScroll && ue("instant");
|
|
1043
1389
|
}
|
|
1044
1390
|
);
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1391
|
+
const o = (e) => {
|
|
1392
|
+
A("copy", e), navigator.clipboard && e.content && navigator.clipboard.writeText(e.content);
|
|
1047
1393
|
};
|
|
1048
|
-
|
|
1049
|
-
() =>
|
|
1394
|
+
ye(
|
|
1395
|
+
() => m.agentSteps,
|
|
1050
1396
|
() => {
|
|
1051
|
-
|
|
1397
|
+
m.autoScroll && !x.value && ue();
|
|
1052
1398
|
},
|
|
1053
1399
|
{ deep: !0 }
|
|
1054
1400
|
);
|
|
1055
1401
|
const c = () => {
|
|
1056
|
-
|
|
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,
|
|
1407
|
+
behavior: "instant"
|
|
1408
|
+
}), H.value = !0);
|
|
1409
|
+
});
|
|
1057
1410
|
};
|
|
1058
|
-
|
|
1059
|
-
|
|
1411
|
+
let u;
|
|
1412
|
+
return Ve(() => {
|
|
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,
|
|
1060
1418
|
containerRef: $
|
|
1061
|
-
}), (
|
|
1062
|
-
|
|
1063
|
-
|
|
1419
|
+
}), (e, t) => (d(), p("div", _s, [
|
|
1420
|
+
r.showBackground ? (d(), p("div", As)) : B("", !0),
|
|
1421
|
+
l("div", {
|
|
1064
1422
|
class: "chat-message-list",
|
|
1065
1423
|
ref_key: "containerRef",
|
|
1066
1424
|
ref: $,
|
|
1067
|
-
onScroll:
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1425
|
+
onScroll: Be,
|
|
1426
|
+
onWheel: Te,
|
|
1427
|
+
onTouchmove: Te,
|
|
1428
|
+
style: be({
|
|
1429
|
+
paddingTop: r.contentPaddingTop,
|
|
1430
|
+
paddingBottom: r.contentPaddingBottom
|
|
1071
1431
|
})
|
|
1072
1432
|
}, [
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
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", {
|
|
1078
1438
|
key: 0,
|
|
1079
|
-
src:
|
|
1439
|
+
src: r.appLogo,
|
|
1080
1440
|
alt: "Logo"
|
|
1081
|
-
}, null, 8,
|
|
1082
|
-
|
|
1441
|
+
}, null, 8, Ls)) : (d(), p("div", zs, [...t[1] || (t[1] = [
|
|
1442
|
+
l("svg", {
|
|
1083
1443
|
viewBox: "0 0 1024 1024",
|
|
1084
1444
|
width: "32",
|
|
1085
1445
|
height: "32"
|
|
1086
1446
|
}, [
|
|
1087
|
-
|
|
1447
|
+
l("path", {
|
|
1088
1448
|
fill: "currentColor",
|
|
1089
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"
|
|
1090
1450
|
})
|
|
1091
1451
|
], -1)
|
|
1092
1452
|
])]))
|
|
1093
1453
|
]),
|
|
1094
|
-
|
|
1095
|
-
|
|
1454
|
+
l("h2", Es, N(r.appName), 1),
|
|
1455
|
+
t[2] || (t[2] = l("p", { class: "welcome-desc" }, "今天有什么可以帮您?", -1))
|
|
1096
1456
|
])
|
|
1097
1457
|
], !0)
|
|
1098
|
-
])) : (
|
|
1099
|
-
(
|
|
1100
|
-
key:
|
|
1458
|
+
])) : (d(), p("div", Us, [
|
|
1459
|
+
(d(!0), p(ze, null, Ee(r.messages, (s, n) => (d(), p("div", {
|
|
1460
|
+
key: s.id || n,
|
|
1101
1461
|
class: le([
|
|
1102
1462
|
"message-row",
|
|
1103
|
-
|
|
1463
|
+
s.role === "user" ? "message-user" : "message-assistant"
|
|
1104
1464
|
])
|
|
1105
1465
|
}, [
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1466
|
+
s.role === "user" ? (d(), p("div", Ts, [
|
|
1467
|
+
l("div", Bs, [
|
|
1468
|
+
M(Re, {
|
|
1469
|
+
message: s,
|
|
1470
|
+
"is-user": !0,
|
|
1471
|
+
"api-base-url": r.apiBaseUrl
|
|
1472
|
+
}, null, 8, ["message", "api-base-url"])
|
|
1473
|
+
]),
|
|
1474
|
+
s.content ? (d(), p("div", Hs, [
|
|
1475
|
+
l("button", {
|
|
1476
|
+
class: "action-btn",
|
|
1477
|
+
onClick: (v) => o(s),
|
|
1478
|
+
title: "复制"
|
|
1479
|
+
}, [...t[3] || (t[3] = [
|
|
1480
|
+
l("svg", {
|
|
1481
|
+
viewBox: "0 0 1024 1024",
|
|
1482
|
+
width: "12",
|
|
1483
|
+
height: "12"
|
|
1484
|
+
}, [
|
|
1485
|
+
l("path", {
|
|
1486
|
+
fill: "currentColor",
|
|
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"
|
|
1488
|
+
})
|
|
1489
|
+
], -1),
|
|
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, {
|
|
1113
1495
|
key: 0,
|
|
1114
|
-
steps:
|
|
1496
|
+
steps: r.agentSteps,
|
|
1115
1497
|
onResize: c
|
|
1116
|
-
}, null, 8, ["steps"])) :
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
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, {
|
|
1503
|
+
key: 0,
|
|
1504
|
+
message: s,
|
|
1120
1505
|
"is-user": !1,
|
|
1121
|
-
"
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1506
|
+
"api-base-url": r.apiBaseUrl,
|
|
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", {
|
|
1126
1524
|
class: "action-btn",
|
|
1127
|
-
onClick: (
|
|
1525
|
+
onClick: (v) => o(s),
|
|
1128
1526
|
title: "复制"
|
|
1129
|
-
}, [...
|
|
1130
|
-
|
|
1527
|
+
}, [...t[5] || (t[5] = [
|
|
1528
|
+
l("svg", {
|
|
1131
1529
|
viewBox: "0 0 1024 1024",
|
|
1132
1530
|
width: "12",
|
|
1133
1531
|
height: "12"
|
|
1134
1532
|
}, [
|
|
1135
|
-
|
|
1533
|
+
l("path", {
|
|
1136
1534
|
fill: "currentColor",
|
|
1137
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"
|
|
1138
1536
|
})
|
|
1139
1537
|
], -1),
|
|
1140
|
-
|
|
1141
|
-
])], 8,
|
|
1142
|
-
])) :
|
|
1538
|
+
l("span", null, "复制", -1)
|
|
1539
|
+
])], 8, Fs)
|
|
1540
|
+
])) : B("", !0)
|
|
1143
1541
|
]))
|
|
1144
1542
|
], 2))), 128)),
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
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", {
|
|
1149
1547
|
class: "typing-dot",
|
|
1150
1548
|
style: { "animation-delay": "0.2s" }
|
|
1151
1549
|
}),
|
|
1152
|
-
|
|
1550
|
+
l("div", {
|
|
1153
1551
|
class: "typing-dot",
|
|
1154
1552
|
style: { "animation-delay": "0.4s" }
|
|
1155
1553
|
})
|
|
1156
1554
|
], -1)
|
|
1157
|
-
])])) :
|
|
1555
|
+
])])) : B("", !0)
|
|
1158
1556
|
]))
|
|
1159
|
-
], 36)
|
|
1557
|
+
], 36),
|
|
1558
|
+
M(rt, { name: "fade-slide" }, {
|
|
1559
|
+
default: W(() => [
|
|
1560
|
+
H.value ? B("", !0) : (d(), p("button", {
|
|
1561
|
+
key: 0,
|
|
1562
|
+
class: "scroll-to-bottom-btn",
|
|
1563
|
+
style: be({ bottom: `calc(${r.contentPaddingBottom || "140px"} + 20px)` }),
|
|
1564
|
+
onClick: t[0] || (t[0] = (s) => ue("smooth", !0))
|
|
1565
|
+
}, [
|
|
1566
|
+
t[8] || (t[8] = l("div", { class: "btn-inner" }, [
|
|
1567
|
+
l("svg", {
|
|
1568
|
+
class: "arrow-icon",
|
|
1569
|
+
viewBox: "0 0 24 24",
|
|
1570
|
+
fill: "none",
|
|
1571
|
+
stroke: "currentColor"
|
|
1572
|
+
}, [
|
|
1573
|
+
l("path", {
|
|
1574
|
+
"stroke-linecap": "round",
|
|
1575
|
+
"stroke-linejoin": "round",
|
|
1576
|
+
"stroke-width": "2.5",
|
|
1577
|
+
d: "M19 9l-7 7-7-7"
|
|
1578
|
+
})
|
|
1579
|
+
])
|
|
1580
|
+
], -1)),
|
|
1581
|
+
r.isStreaming ? (d(), p("svg", Ws, [...t[7] || (t[7] = [
|
|
1582
|
+
l("circle", {
|
|
1583
|
+
class: "loading-circle",
|
|
1584
|
+
cx: "18",
|
|
1585
|
+
cy: "18",
|
|
1586
|
+
r: "16"
|
|
1587
|
+
}, null, -1)
|
|
1588
|
+
])])) : B("", !0)
|
|
1589
|
+
], 4))
|
|
1590
|
+
]),
|
|
1591
|
+
_: 1
|
|
1592
|
+
})
|
|
1160
1593
|
]));
|
|
1161
1594
|
}
|
|
1162
|
-
}),
|
|
1163
|
-
install(
|
|
1164
|
-
|
|
1595
|
+
}), Ys = /* @__PURE__ */ Ce(js, [["__scopeId", "data-v-eac8b914"]]), Js = {
|
|
1596
|
+
install(r) {
|
|
1597
|
+
r.component("ChatMessageList", Ys), r.component("MultimodalMessage", Re), r.component("MarkdownMessage", Je), r.component("AgentSteps", Ge);
|
|
1165
1598
|
}
|
|
1166
1599
|
};
|
|
1167
1600
|
export {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1601
|
+
Ge as AgentSteps,
|
|
1602
|
+
Ys as ChatMessageList,
|
|
1603
|
+
Je as MarkdownMessage,
|
|
1604
|
+
Re as MultimodalMessage,
|
|
1605
|
+
Js as default
|
|
1173
1606
|
};
|