rt-chat-messages 1.0.1 → 1.0.3
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 +26 -11
- package/dist/chat-messages.es.js +419 -397
- package/dist/chat-messages.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/AgentSteps.vue.d.ts +5 -1
- package/package.json +1 -1
package/dist/chat-messages.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as Q, ref as b, onMounted as De, computed as X, createBlock as G, createCommentVNode as D, openBlock as o, Teleport as st, createElementBlock as u, withModifiers as Z, normalizeClass as le, createElementVNode as a, normalizeStyle as ve, renderSlot as be, h as Se, watch as J, nextTick as de, onUnmounted as Re, createVNode as f, withCtx as H, unref as I, createTextVNode as ze, toDisplayString as F, Fragment as ue, renderList as me, resolveDynamicComponent as Pe, withDirectives as at, vShow as nt } from "vue";
|
|
2
2
|
import lt from "markdown-it";
|
|
3
3
|
import ot from "@vscode/markdown-it-katex";
|
|
4
4
|
import Le from "mermaid";
|
|
5
|
-
const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */
|
|
5
|
+
const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ Q({
|
|
6
6
|
__name: "Dialog",
|
|
7
7
|
props: {
|
|
8
8
|
visible: { type: Boolean, default: !1 },
|
|
@@ -13,39 +13,39 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
13
13
|
appendToBody: { type: Boolean, default: !0 }
|
|
14
14
|
},
|
|
15
15
|
emits: ["update:visible", "close"],
|
|
16
|
-
setup(n, { emit:
|
|
17
|
-
const
|
|
16
|
+
setup(n, { emit: p }) {
|
|
17
|
+
const k = n, i = p, z = b(!1);
|
|
18
18
|
De(() => {
|
|
19
|
-
|
|
19
|
+
z.value = !0;
|
|
20
20
|
});
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
21
|
+
const $ = X(() => k.fullscreen ? { width: "100%", height: "100%", margin: 0 } : { width: k.width }), E = () => {
|
|
22
|
+
i("update:visible", !1), i("close");
|
|
23
|
+
}, x = () => {
|
|
24
|
+
k.closeOnClickModal && E();
|
|
25
25
|
};
|
|
26
|
-
return (
|
|
26
|
+
return (T, _) => z.value ? (o(), G(st, {
|
|
27
27
|
key: 0,
|
|
28
28
|
to: "body"
|
|
29
29
|
}, [
|
|
30
|
-
n.visible ? (
|
|
30
|
+
n.visible ? (o(), u("div", {
|
|
31
31
|
key: 0,
|
|
32
|
-
class:
|
|
33
|
-
onClick: Z(
|
|
32
|
+
class: le(["cm-dialog-overlay", { "is-fullscreen": n.fullscreen }]),
|
|
33
|
+
onClick: Z(x, ["self"])
|
|
34
34
|
}, [
|
|
35
35
|
a("div", {
|
|
36
36
|
class: "cm-dialog",
|
|
37
|
-
style: ve(
|
|
37
|
+
style: ve($.value),
|
|
38
38
|
role: "dialog",
|
|
39
39
|
"aria-modal": "true"
|
|
40
40
|
}, [
|
|
41
41
|
a("div", it, [
|
|
42
|
-
be(
|
|
42
|
+
be(T.$slots, "default", {}, void 0, !0)
|
|
43
43
|
]),
|
|
44
|
-
n.showClose ? (
|
|
44
|
+
n.showClose ? (o(), u("button", {
|
|
45
45
|
key: 0,
|
|
46
46
|
class: "cm-dialog__close",
|
|
47
|
-
onClick:
|
|
48
|
-
}, [...
|
|
47
|
+
onClick: E
|
|
48
|
+
}, [..._[0] || (_[0] = [
|
|
49
49
|
a("svg", {
|
|
50
50
|
viewBox: "0 0 1024 1024",
|
|
51
51
|
width: "16",
|
|
@@ -56,20 +56,20 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
56
56
|
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
57
|
})
|
|
58
58
|
], -1)
|
|
59
|
-
])])) :
|
|
59
|
+
])])) : D("", !0)
|
|
60
60
|
], 4)
|
|
61
|
-
], 2)) :
|
|
62
|
-
])) :
|
|
61
|
+
], 2)) : D("", !0)
|
|
62
|
+
])) : D("", !0);
|
|
63
63
|
}
|
|
64
|
-
}),
|
|
65
|
-
const
|
|
66
|
-
for (const [
|
|
67
|
-
|
|
68
|
-
return
|
|
69
|
-
}, Me = /* @__PURE__ */
|
|
64
|
+
}), oe = (n, p) => {
|
|
65
|
+
const k = n.__vccOpts || n;
|
|
66
|
+
for (const [i, z] of p)
|
|
67
|
+
k[i] = z;
|
|
68
|
+
return k;
|
|
69
|
+
}, Me = /* @__PURE__ */ oe(rt, [["__scopeId", "data-v-efdf0259"]]), ct = ["disabled"], dt = {
|
|
70
70
|
key: 0,
|
|
71
71
|
class: "cm-icon-loading"
|
|
72
|
-
}, ut = /* @__PURE__ */
|
|
72
|
+
}, ut = /* @__PURE__ */ Q({
|
|
73
73
|
__name: "Button",
|
|
74
74
|
props: {
|
|
75
75
|
type: { default: "default" },
|
|
@@ -79,20 +79,20 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
79
79
|
loading: { type: Boolean, default: !1 }
|
|
80
80
|
},
|
|
81
81
|
emits: ["click"],
|
|
82
|
-
setup(n, { emit:
|
|
83
|
-
const
|
|
84
|
-
|
|
82
|
+
setup(n, { emit: p }) {
|
|
83
|
+
const k = n, i = p, z = ($) => {
|
|
84
|
+
k.disabled || k.loading || i("click", $);
|
|
85
85
|
};
|
|
86
|
-
return (
|
|
87
|
-
class:
|
|
86
|
+
return ($, E) => (o(), u("button", {
|
|
87
|
+
class: le(["cm-button", [
|
|
88
88
|
`cm-button--${n.type}`,
|
|
89
89
|
`cm-button--${n.size}`,
|
|
90
90
|
{ "is-circle": n.circle, "is-disabled": n.disabled, "is-loading": n.loading }
|
|
91
91
|
]]),
|
|
92
92
|
disabled: n.disabled || n.loading,
|
|
93
|
-
onClick:
|
|
93
|
+
onClick: z
|
|
94
94
|
}, [
|
|
95
|
-
n.loading ? (
|
|
95
|
+
n.loading ? (o(), u("span", dt, [...E[0] || (E[0] = [
|
|
96
96
|
a("svg", {
|
|
97
97
|
viewBox: "0 0 1024 1024",
|
|
98
98
|
width: "1em",
|
|
@@ -103,10 +103,10 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
103
103
|
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
104
|
})
|
|
105
105
|
], -1)
|
|
106
|
-
])])) : be(
|
|
106
|
+
])])) : be($.$slots, "default", { key: 1 }, void 0, !0)
|
|
107
107
|
], 10, ct));
|
|
108
108
|
}
|
|
109
|
-
}),
|
|
109
|
+
}), N = /* @__PURE__ */ oe(ut, [["__scopeId", "data-v-bab126c7"]]), U = (n, p) => Q({
|
|
110
110
|
name: n,
|
|
111
111
|
render() {
|
|
112
112
|
return Se(
|
|
@@ -119,46 +119,46 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
119
119
|
fill: "currentColor",
|
|
120
120
|
style: "vertical-align: middle"
|
|
121
121
|
},
|
|
122
|
-
[Se("path", { d:
|
|
122
|
+
[Se("path", { d: p })]
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
|
-
}), fe =
|
|
125
|
+
}), fe = U(
|
|
126
126
|
"Close",
|
|
127
127
|
"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
|
-
), Ee =
|
|
128
|
+
), Ee = U(
|
|
129
129
|
"ZoomIn",
|
|
130
130
|
"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
|
-
), Ie =
|
|
131
|
+
), Ie = U(
|
|
132
132
|
"ZoomOut",
|
|
133
133
|
"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
|
-
), Be =
|
|
134
|
+
), Be = U(
|
|
135
135
|
"Document",
|
|
136
136
|
"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
|
-
), Ae =
|
|
137
|
+
), Ae = U(
|
|
138
138
|
"Download",
|
|
139
139
|
"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
|
-
), mt =
|
|
140
|
+
), mt = U(
|
|
141
141
|
"VideoPlay",
|
|
142
142
|
"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
|
-
), vt =
|
|
143
|
+
), vt = U(
|
|
144
144
|
"VideoPause",
|
|
145
145
|
"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
|
-
), gt =
|
|
146
|
+
), gt = U(
|
|
147
147
|
"ArrowLeft",
|
|
148
148
|
"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
|
-
), ht =
|
|
149
|
+
), ht = U(
|
|
150
150
|
"ArrowRight",
|
|
151
151
|
"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
|
-
), Te =
|
|
152
|
+
), Te = U(
|
|
153
153
|
"Spinner",
|
|
154
154
|
"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
|
-
), He =
|
|
155
|
+
), He = U(
|
|
156
156
|
"Check",
|
|
157
157
|
"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
|
-
), ft =
|
|
158
|
+
), ft = U(
|
|
159
159
|
"ChevronUp",
|
|
160
160
|
"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
|
-
), pt =
|
|
161
|
+
), pt = U(
|
|
162
162
|
"ChevronDown",
|
|
163
163
|
"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
164
|
), yt = ["src", "alt"], wt = { class: "preview-controls" }, kt = { class: "cm-button-group" }, Mt = {
|
|
@@ -167,15 +167,15 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
167
167
|
}, Ct = ["innerHTML"], bt = { class: "preview-controls" }, _t = { class: "cm-button-group" }, $t = {
|
|
168
168
|
key: 0,
|
|
169
169
|
class: "mobile-close-hint"
|
|
170
|
-
}, xt = /* @__PURE__ */
|
|
170
|
+
}, xt = /* @__PURE__ */ Q({
|
|
171
171
|
__name: "MarkdownMessage",
|
|
172
172
|
props: {
|
|
173
173
|
content: {},
|
|
174
174
|
isStreaming: { type: Boolean, default: !1 }
|
|
175
175
|
},
|
|
176
176
|
setup(n) {
|
|
177
|
-
const
|
|
178
|
-
let
|
|
177
|
+
const p = n, k = b(), i = b(), z = b(!1), $ = b(""), E = b(""), x = b(!1), T = b(""), _ = b(!1), c = b(1), d = b({ x: 0, y: 0 }), M = b(!1), L = b({ x: 0, y: 0 }), S = b(1), C = b({ x: 0, y: 0 }), ee = b(!1), te = b({ x: 0, y: 0 }), se = b(""), q = b(/* @__PURE__ */ new Map());
|
|
178
|
+
let ae = 0;
|
|
179
179
|
Le.initialize({
|
|
180
180
|
startOnLoad: !1,
|
|
181
181
|
theme: "default",
|
|
@@ -185,8 +185,8 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
185
185
|
const ge = (e) => {
|
|
186
186
|
const t = e.renderer.rules.fence;
|
|
187
187
|
e.renderer.rules.fence = (l, g, r, s, v) => {
|
|
188
|
-
const w = l[g],
|
|
189
|
-
return (w.info ? w.info.trim() : "") === "mermaid" ? (
|
|
188
|
+
const w = l[g], P = w.content.trim();
|
|
189
|
+
return (w.info ? w.info.trim() : "") === "mermaid" ? (ae++, `<div class="mermaid-container"><pre class="mermaid" data-mermaid-id="${`mermaid-${Date.now()}-${ae}`}">${P}</pre></div>`) : t(l, g, r, s, v);
|
|
190
190
|
};
|
|
191
191
|
}, j = new lt({
|
|
192
192
|
html: !0,
|
|
@@ -211,15 +211,15 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
211
211
|
j.renderer.rules.image = function(e, t, l, g, r) {
|
|
212
212
|
const s = e[t], v = s.attrIndex("src");
|
|
213
213
|
if (v >= 0) {
|
|
214
|
-
const w = s.attrs[v][1],
|
|
215
|
-
let
|
|
216
|
-
for (let
|
|
217
|
-
const
|
|
218
|
-
|
|
214
|
+
const w = s.attrs[v][1], A = "img-" + ((W) => {
|
|
215
|
+
let R = 0;
|
|
216
|
+
for (let Y = 0; Y < W.length; Y++) {
|
|
217
|
+
const V = W.charCodeAt(Y);
|
|
218
|
+
R = (R << 5) - R + V, R = R & R;
|
|
219
219
|
}
|
|
220
|
-
return Math.abs(
|
|
220
|
+
return Math.abs(R).toString(36);
|
|
221
221
|
})(w);
|
|
222
|
-
s.attrSet("id",
|
|
222
|
+
s.attrSet("id", A), s.attrSet("data-image-id", A), s.attrSet("key", A), s.attrSet("loading", "eager"), s.attrSet("decoding", "async"), s.attrSet("fetchpriority", "high"), s.attrSet("data-src", w), s.attrSet("data-cached", "true");
|
|
223
223
|
}
|
|
224
224
|
return ie(e, t, l, g, r);
|
|
225
225
|
}, j.use(ot, {
|
|
@@ -242,13 +242,13 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
242
242
|
(/^#{1,6}\s/.test(s) || /^\*{1,2}[^*]+\*{1,2}/.test(s) || /^[-*+]\s/.test(s) || /^\d+\.\s/.test(s) || /!\[.*?\]\(.*?\)/.test(s) || /\[.*?\]\(.*?\)/.test(s) || /^\|.+\|/.test(s) || /^\|[\s-:]+\|/m.test(s)) && (e = s);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
if (
|
|
245
|
+
if (p.isStreaming) {
|
|
246
246
|
const g = /^```(?:markdown|md)?\s*\n/;
|
|
247
247
|
if (g.test(e)) {
|
|
248
248
|
const s = e.replace(g, "");
|
|
249
249
|
(/^#{1,6}\s/.test(s) || /^\|.+\|/.test(s) || /^\|[\s-:]+\|/m.test(s) || /!\[.*?\]\(.*?\)/.test(s) || /\[.*?\]\(.*?\)/.test(s)) && (e = e.replace(g, ""));
|
|
250
250
|
}
|
|
251
|
-
if (/^```(?:markdown|md)?\s*\n/.test(
|
|
251
|
+
if (/^```(?:markdown|md)?\s*\n/.test(p.content)) {
|
|
252
252
|
const s = /\n```\s*$/;
|
|
253
253
|
s.test(e) && (e = e.replace(s, ""));
|
|
254
254
|
}
|
|
@@ -256,7 +256,7 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
256
256
|
return e = e.replace(
|
|
257
257
|
/```(?:markdown|md)\s*\n([\s\S]*?)\n```/g,
|
|
258
258
|
(g, r) => r
|
|
259
|
-
),
|
|
259
|
+
), p.isStreaming && (e = pe(e)), e;
|
|
260
260
|
}, ye = (e) => {
|
|
261
261
|
if (!e.includes("<img"))
|
|
262
262
|
return e;
|
|
@@ -275,11 +275,11 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
275
275
|
g = g.replace(s, v);
|
|
276
276
|
return g;
|
|
277
277
|
}, we = (e) => {
|
|
278
|
-
if (!
|
|
278
|
+
if (!i.value)
|
|
279
279
|
return;
|
|
280
|
-
const t =
|
|
281
|
-
if (!
|
|
282
|
-
t.innerHTML = e,
|
|
280
|
+
const t = i.value;
|
|
281
|
+
if (!p.isStreaming || t.children.length === 0) {
|
|
282
|
+
t.innerHTML = e, p.isStreaming || de(() => {
|
|
283
283
|
xe(), y();
|
|
284
284
|
});
|
|
285
285
|
return;
|
|
@@ -303,19 +303,19 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
303
303
|
t.innerHTML = "", t.appendChild(r);
|
|
304
304
|
}, K = () => {
|
|
305
305
|
try {
|
|
306
|
-
if (!
|
|
307
|
-
|
|
306
|
+
if (!p.content) {
|
|
307
|
+
se.value = "", i.value && (i.value.innerHTML = ""), p.isStreaming || q.value.clear();
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
const e = he(
|
|
310
|
+
const e = he(p.content);
|
|
311
311
|
let t = j.render(e);
|
|
312
|
-
|
|
312
|
+
p.isStreaming && t.includes("<img") && (t = ye(t)), t !== se.value && (se.value = t, we(t)), p.isStreaming || q.value.clear();
|
|
313
313
|
} catch (e) {
|
|
314
|
-
console.error("Markdown rendering error:", e),
|
|
314
|
+
console.error("Markdown rendering error:", e), i.value && (i.value.innerHTML = `<pre style="white-space: pre-wrap; word-wrap: break-word;">${p.content}</pre>`);
|
|
315
315
|
}
|
|
316
316
|
};
|
|
317
|
-
|
|
318
|
-
() =>
|
|
317
|
+
J(() => p.content, K), J(
|
|
318
|
+
() => p.isStreaming,
|
|
319
319
|
(e, t) => {
|
|
320
320
|
t && !e && de(() => {
|
|
321
321
|
K();
|
|
@@ -323,7 +323,7 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
323
323
|
}
|
|
324
324
|
);
|
|
325
325
|
const m = () => {
|
|
326
|
-
|
|
326
|
+
_.value = window.innerWidth < 768;
|
|
327
327
|
}, h = (e) => {
|
|
328
328
|
let t = e;
|
|
329
329
|
return t = t.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1"), [
|
|
@@ -340,8 +340,8 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
340
340
|
}), t;
|
|
341
341
|
}, y = async () => {
|
|
342
342
|
var t, l;
|
|
343
|
-
if (
|
|
344
|
-
const e =
|
|
343
|
+
if (p.isStreaming || (await de(), !k.value)) return;
|
|
344
|
+
const e = k.value.querySelectorAll(".mermaid");
|
|
345
345
|
if (e.length !== 0)
|
|
346
346
|
for (const g of Array.from(e)) {
|
|
347
347
|
const r = g;
|
|
@@ -349,12 +349,12 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
349
349
|
if (s && r.getAttribute("data-processed") !== "true")
|
|
350
350
|
try {
|
|
351
351
|
r.setAttribute("data-processed", "true"), s = h(s);
|
|
352
|
-
const v = r.getAttribute("data-mermaid-id") || `mermaid-${Date.now()}-${Math.random()}`, { svg: w } = await Le.render(v, s),
|
|
353
|
-
if (
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}),
|
|
352
|
+
const v = r.getAttribute("data-mermaid-id") || `mermaid-${Date.now()}-${Math.random()}`, { svg: w } = await Le.render(v, s), P = r.parentElement;
|
|
353
|
+
if (P) {
|
|
354
|
+
const A = document.createElement("div");
|
|
355
|
+
A.className = "mermaid-svg", A.innerHTML = w, A.setAttribute("data-mermaid-svg", "true"), A.style.cursor = "pointer", A.title = "Click to zoom", A.addEventListener("click", (W) => {
|
|
356
|
+
W.preventDefault(), W.stopPropagation(), T.value = w, S.value = 1, C.value = { x: 0, y: 0 }, x.value = !0;
|
|
357
|
+
}), P.replaceChild(A, r);
|
|
358
358
|
}
|
|
359
359
|
} catch (v) {
|
|
360
360
|
console.error("Mermaid render failure:", v);
|
|
@@ -362,209 +362,209 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
362
362
|
w.className = "mermaid-error", w.textContent = `Mermaid render error: ${v}`, (l = r.parentElement) == null || l.replaceChild(w, r);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
},
|
|
365
|
+
}, B = (e) => {
|
|
366
366
|
e.preventDefault(), e.stopPropagation();
|
|
367
367
|
const t = e.target;
|
|
368
|
-
|
|
369
|
-
},
|
|
370
|
-
|
|
371
|
-
}, Ve = () => {
|
|
372
|
-
o.value = Math.min(o.value + 1, 10), W();
|
|
368
|
+
$.value = t.src, E.value = t.alt || "Image Preview", c.value = 1, d.value = { x: 0, y: 0 }, z.value = !0;
|
|
369
|
+
}, O = () => {
|
|
370
|
+
c.value <= 1 && (d.value = { x: 0, y: 0 });
|
|
373
371
|
}, Ue = () => {
|
|
374
|
-
|
|
375
|
-
}, _e = () => {
|
|
376
|
-
o.value = 1, k.value = { x: 0, y: 0 };
|
|
372
|
+
c.value = Math.min(c.value + 1, 10), O();
|
|
377
373
|
}, Ye = () => {
|
|
378
|
-
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
374
|
+
c.value = Math.max(c.value - 1, 0.5), O();
|
|
375
|
+
}, _e = () => {
|
|
376
|
+
c.value = 1, d.value = { x: 0, y: 0 };
|
|
377
|
+
}, We = () => {
|
|
378
|
+
c.value <= 1 && (z.value = !1);
|
|
383
379
|
}, Oe = (e) => {
|
|
380
|
+
e.preventDefault();
|
|
381
|
+
const t = e.deltaY > 0 ? -0.5 : 0.5, l = Math.max(0.5, Math.min(10, c.value + t));
|
|
382
|
+
c.value = l, O();
|
|
383
|
+
}, Xe = (e) => {
|
|
384
384
|
var s;
|
|
385
|
-
if (
|
|
386
|
-
e.preventDefault(),
|
|
387
|
-
x: e.clientX -
|
|
388
|
-
y: e.clientY -
|
|
385
|
+
if (c.value <= 1) return;
|
|
386
|
+
e.preventDefault(), M.value = !0, L.value = {
|
|
387
|
+
x: e.clientX - d.value.x,
|
|
388
|
+
y: e.clientY - d.value.y
|
|
389
389
|
};
|
|
390
390
|
const t = e.target, l = (s = t.parentElement) == null ? void 0 : s.getBoundingClientRect(), g = (v) => {
|
|
391
|
-
if (!
|
|
392
|
-
let w = v.clientX -
|
|
393
|
-
const
|
|
394
|
-
|
|
391
|
+
if (!M.value || !l) return;
|
|
392
|
+
let w = v.clientX - L.value.x, P = v.clientY - L.value.y;
|
|
393
|
+
const A = t.offsetWidth, W = t.offsetHeight, R = A * c.value, Y = W * c.value, V = 0.3, ke = l.width * (1 - V - 0.5) - R / 2, re = R / 2 - l.width * (1 - V - 0.5), ce = l.height * (1 - V - 0.5) - Y / 2, ne = Y / 2 - l.height * (1 - V - 0.5);
|
|
394
|
+
R > l.width ? w = Math.max(ke, Math.min(re, w)) : w = 0, Y > l.height ? P = Math.max(ce, Math.min(ne, P)) : P = 0, d.value = { x: w, y: P };
|
|
395
395
|
}, r = () => {
|
|
396
|
-
|
|
396
|
+
M.value = !1, document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", r);
|
|
397
397
|
};
|
|
398
398
|
document.addEventListener("mousemove", g), document.addEventListener("mouseup", r);
|
|
399
|
-
},
|
|
400
|
-
var
|
|
399
|
+
}, Ve = (e) => {
|
|
400
|
+
var P;
|
|
401
401
|
if (e.touches.length !== 1) return;
|
|
402
402
|
const t = e.touches[0], l = t.clientX, g = t.clientY;
|
|
403
|
-
if (
|
|
404
|
-
|
|
405
|
-
x: l -
|
|
406
|
-
y: g -
|
|
403
|
+
if (c.value <= 1) return;
|
|
404
|
+
M.value = !0, L.value = {
|
|
405
|
+
x: l - d.value.x,
|
|
406
|
+
y: g - d.value.y
|
|
407
407
|
};
|
|
408
|
-
const r = e.target, s = (
|
|
409
|
-
if (!
|
|
408
|
+
const r = e.target, s = (P = r.parentElement) == null ? void 0 : P.getBoundingClientRect(), v = (A) => {
|
|
409
|
+
if (!M.value || A.touches.length !== 1 || !s)
|
|
410
410
|
return;
|
|
411
|
-
const
|
|
412
|
-
let
|
|
413
|
-
const
|
|
414
|
-
re > s.width ?
|
|
411
|
+
const W = A.touches[0];
|
|
412
|
+
let R = W.clientX - L.value.x, Y = W.clientY - L.value.y;
|
|
413
|
+
const V = r.offsetWidth, ke = r.offsetHeight, re = V * c.value, ce = ke * c.value, ne = 0.3, Je = s.width * (1 - ne - 0.5) - re / 2, Qe = re / 2 - s.width * (1 - ne - 0.5), et = s.height * (1 - ne - 0.5) - ce / 2, tt = ce / 2 - s.height * (1 - ne - 0.5);
|
|
414
|
+
re > s.width ? R = Math.max(Je, Math.min(Qe, R)) : R = 0, ce > s.height ? Y = Math.max(et, Math.min(tt, Y)) : Y = 0, d.value = { x: R, y: Y };
|
|
415
415
|
}, w = () => {
|
|
416
|
-
|
|
416
|
+
M.value = !1, document.removeEventListener("touchmove", v), document.removeEventListener("touchend", w);
|
|
417
417
|
};
|
|
418
418
|
document.addEventListener("touchmove", v, { passive: !1 }), document.addEventListener("touchend", w);
|
|
419
419
|
}, Ze = () => {
|
|
420
|
-
|
|
420
|
+
S.value = Math.min(S.value + 1, 10);
|
|
421
421
|
}, qe = () => {
|
|
422
|
-
|
|
422
|
+
S.value = Math.max(S.value - 1, 0.5);
|
|
423
423
|
}, $e = () => {
|
|
424
|
-
|
|
424
|
+
S.value = 1, C.value = { x: 0, y: 0 };
|
|
425
425
|
}, je = (e) => {
|
|
426
426
|
e.preventDefault();
|
|
427
427
|
const t = e.deltaY > 0 ? -0.5 : 0.5;
|
|
428
|
-
|
|
428
|
+
S.value = Math.max(0.5, Math.min(10, S.value + t));
|
|
429
429
|
}, Ke = (e) => {
|
|
430
430
|
var s, v;
|
|
431
|
-
if (
|
|
432
|
-
e.preventDefault(),
|
|
433
|
-
x: e.clientX -
|
|
434
|
-
y: e.clientY -
|
|
431
|
+
if (S.value <= 1) return;
|
|
432
|
+
e.preventDefault(), ee.value = !0, te.value = {
|
|
433
|
+
x: e.clientX - C.value.x,
|
|
434
|
+
y: e.clientY - C.value.y
|
|
435
435
|
};
|
|
436
436
|
const l = (v = (s = e.target.closest(".mermaid-preview-content")) == null ? void 0 : s.parentElement) == null ? void 0 : v.getBoundingClientRect(), g = (w) => {
|
|
437
|
-
if (!
|
|
438
|
-
let
|
|
439
|
-
|
|
437
|
+
if (!ee.value || !l) return;
|
|
438
|
+
let P = w.clientX - te.value.x, A = w.clientY - te.value.y;
|
|
439
|
+
C.value = { x: P, y: A };
|
|
440
440
|
}, r = () => {
|
|
441
|
-
|
|
441
|
+
ee.value = !1, document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", r);
|
|
442
442
|
};
|
|
443
443
|
document.addEventListener("mousemove", g), document.addEventListener("mouseup", r);
|
|
444
444
|
}, Ge = (e) => {
|
|
445
445
|
}, xe = () => {
|
|
446
|
-
|
|
447
|
-
if (!
|
|
448
|
-
|
|
446
|
+
p.isStreaming || de(() => {
|
|
447
|
+
if (!k.value) return;
|
|
448
|
+
k.value.querySelectorAll(
|
|
449
449
|
".markdown-content img"
|
|
450
450
|
).forEach((t) => {
|
|
451
451
|
const l = t;
|
|
452
|
-
l.getAttribute("data-processed") !== "true" && (l.setAttribute("data-processed", "true"), l.style.cursor = "pointer", l.addEventListener("click",
|
|
452
|
+
l.getAttribute("data-processed") !== "true" && (l.setAttribute("data-processed", "true"), l.style.cursor = "pointer", l.addEventListener("click", B));
|
|
453
453
|
});
|
|
454
454
|
});
|
|
455
455
|
};
|
|
456
456
|
return De(() => {
|
|
457
457
|
m(), window.addEventListener("resize", m), K(), xe(), y();
|
|
458
458
|
}), Re(() => {
|
|
459
|
-
|
|
459
|
+
k.value && k.value.querySelectorAll(
|
|
460
460
|
".markdown-content img"
|
|
461
461
|
).forEach((t) => {
|
|
462
|
-
t.removeEventListener("click",
|
|
462
|
+
t.removeEventListener("click", B);
|
|
463
463
|
});
|
|
464
|
-
}), (e, t) => (
|
|
464
|
+
}), (e, t) => (o(), u("div", {
|
|
465
465
|
class: "markdown-message",
|
|
466
466
|
ref_key: "markdownContainer",
|
|
467
|
-
ref:
|
|
467
|
+
ref: k
|
|
468
468
|
}, [
|
|
469
469
|
a("div", {
|
|
470
470
|
ref_key: "markdownContent",
|
|
471
|
-
ref:
|
|
471
|
+
ref: i,
|
|
472
472
|
class: "markdown-content"
|
|
473
473
|
}, null, 512),
|
|
474
474
|
f(Me, {
|
|
475
|
-
visible:
|
|
476
|
-
"onUpdate:visible": t[2] || (t[2] = (l) =>
|
|
477
|
-
width:
|
|
478
|
-
fullscreen:
|
|
475
|
+
visible: z.value,
|
|
476
|
+
"onUpdate:visible": t[2] || (t[2] = (l) => z.value = l),
|
|
477
|
+
width: _.value ? "95vw" : "80vw",
|
|
478
|
+
fullscreen: _.value,
|
|
479
479
|
class: "image-preview-dialog",
|
|
480
480
|
"close-on-click-modal": !1,
|
|
481
481
|
"append-to-body": ""
|
|
482
482
|
}, {
|
|
483
|
-
default:
|
|
483
|
+
default: H(() => [
|
|
484
484
|
a("div", {
|
|
485
485
|
class: "image-preview-container",
|
|
486
|
-
onClick: t[1] || (t[1] = Z((l) =>
|
|
486
|
+
onClick: t[1] || (t[1] = Z((l) => z.value = !1, ["self"]))
|
|
487
487
|
}, [
|
|
488
488
|
a("img", {
|
|
489
|
-
src:
|
|
490
|
-
alt:
|
|
489
|
+
src: $.value,
|
|
490
|
+
alt: E.value,
|
|
491
491
|
class: "preview-image",
|
|
492
492
|
style: ve({
|
|
493
|
-
transform: `translate(${
|
|
493
|
+
transform: `translate(${d.value.x}px, ${d.value.y}px) scale(${c.value})`
|
|
494
494
|
}),
|
|
495
|
-
onWheel: Z(
|
|
495
|
+
onWheel: Z(Oe, ["prevent"]),
|
|
496
496
|
onDblclick: _e,
|
|
497
|
-
onMousedown:
|
|
498
|
-
onTouchstart: Z(
|
|
499
|
-
onClick:
|
|
497
|
+
onMousedown: Xe,
|
|
498
|
+
onTouchstart: Z(Ve, ["prevent"]),
|
|
499
|
+
onClick: We
|
|
500
500
|
}, null, 44, yt),
|
|
501
501
|
a("div", wt, [
|
|
502
502
|
a("div", kt, [
|
|
503
|
-
f(
|
|
503
|
+
f(N, {
|
|
504
504
|
size: "small",
|
|
505
|
-
onClick:
|
|
506
|
-
disabled:
|
|
505
|
+
onClick: Ye,
|
|
506
|
+
disabled: c.value <= 0.5
|
|
507
507
|
}, {
|
|
508
|
-
default:
|
|
509
|
-
f(
|
|
508
|
+
default: H(() => [
|
|
509
|
+
f(I(Ie))
|
|
510
510
|
]),
|
|
511
511
|
_: 1
|
|
512
512
|
}, 8, ["disabled"]),
|
|
513
|
-
f(
|
|
513
|
+
f(N, {
|
|
514
514
|
size: "small",
|
|
515
515
|
onClick: _e
|
|
516
516
|
}, {
|
|
517
|
-
default:
|
|
518
|
-
ze(
|
|
517
|
+
default: H(() => [
|
|
518
|
+
ze(F(Math.round(c.value * 100)) + "% ", 1)
|
|
519
519
|
]),
|
|
520
520
|
_: 1
|
|
521
521
|
}),
|
|
522
|
-
f(
|
|
522
|
+
f(N, {
|
|
523
523
|
size: "small",
|
|
524
|
-
onClick:
|
|
525
|
-
disabled:
|
|
524
|
+
onClick: Ue,
|
|
525
|
+
disabled: c.value >= 10
|
|
526
526
|
}, {
|
|
527
|
-
default:
|
|
528
|
-
f(
|
|
527
|
+
default: H(() => [
|
|
528
|
+
f(I(Ee))
|
|
529
529
|
]),
|
|
530
530
|
_: 1
|
|
531
531
|
}, 8, ["disabled"])
|
|
532
532
|
]),
|
|
533
|
-
f(
|
|
533
|
+
f(N, {
|
|
534
534
|
size: "small",
|
|
535
|
-
onClick: t[0] || (t[0] = (l) =>
|
|
535
|
+
onClick: t[0] || (t[0] = (l) => z.value = !1),
|
|
536
536
|
type: "danger"
|
|
537
537
|
}, {
|
|
538
|
-
default:
|
|
539
|
-
f(
|
|
538
|
+
default: H(() => [
|
|
539
|
+
f(I(fe))
|
|
540
540
|
]),
|
|
541
541
|
_: 1
|
|
542
542
|
})
|
|
543
543
|
]),
|
|
544
|
-
|
|
544
|
+
_.value ? (o(), u("div", Mt, "双击重置 · 轻触关闭")) : D("", !0)
|
|
545
545
|
])
|
|
546
546
|
]),
|
|
547
547
|
_: 1
|
|
548
548
|
}, 8, ["visible", "width", "fullscreen"]),
|
|
549
549
|
f(Me, {
|
|
550
|
-
visible:
|
|
551
|
-
"onUpdate:visible": t[5] || (t[5] = (l) =>
|
|
552
|
-
width:
|
|
553
|
-
fullscreen:
|
|
550
|
+
visible: x.value,
|
|
551
|
+
"onUpdate:visible": t[5] || (t[5] = (l) => x.value = l),
|
|
552
|
+
width: _.value ? "95vw" : "90vw",
|
|
553
|
+
fullscreen: _.value,
|
|
554
554
|
class: "mermaid-preview-dialog",
|
|
555
555
|
"close-on-click-modal": !1,
|
|
556
556
|
"append-to-body": ""
|
|
557
557
|
}, {
|
|
558
|
-
default:
|
|
558
|
+
default: H(() => [
|
|
559
559
|
a("div", {
|
|
560
560
|
class: "mermaid-preview-container",
|
|
561
|
-
onClick: t[4] || (t[4] = Z((l) =>
|
|
561
|
+
onClick: t[4] || (t[4] = Z((l) => x.value = !1, ["self"]))
|
|
562
562
|
}, [
|
|
563
563
|
a("div", {
|
|
564
564
|
class: "mermaid-preview-content",
|
|
565
|
-
innerHTML:
|
|
565
|
+
innerHTML: T.value,
|
|
566
566
|
style: ve({
|
|
567
|
-
transform: `translate(${
|
|
567
|
+
transform: `translate(${C.value.x}px, ${C.value.y}px) scale(${S.value})`
|
|
568
568
|
}),
|
|
569
569
|
onWheel: Z(je, ["prevent"]),
|
|
570
570
|
onDblclick: $e,
|
|
@@ -573,55 +573,55 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
573
573
|
}, null, 44, Ct),
|
|
574
574
|
a("div", bt, [
|
|
575
575
|
a("div", _t, [
|
|
576
|
-
f(
|
|
576
|
+
f(N, {
|
|
577
577
|
size: "small",
|
|
578
578
|
onClick: qe,
|
|
579
|
-
disabled:
|
|
579
|
+
disabled: S.value <= 0.5
|
|
580
580
|
}, {
|
|
581
|
-
default:
|
|
582
|
-
f(
|
|
581
|
+
default: H(() => [
|
|
582
|
+
f(I(Ie))
|
|
583
583
|
]),
|
|
584
584
|
_: 1
|
|
585
585
|
}, 8, ["disabled"]),
|
|
586
|
-
f(
|
|
586
|
+
f(N, {
|
|
587
587
|
size: "small",
|
|
588
588
|
onClick: $e
|
|
589
589
|
}, {
|
|
590
|
-
default:
|
|
591
|
-
ze(
|
|
590
|
+
default: H(() => [
|
|
591
|
+
ze(F(Math.round(S.value * 100)) + "% ", 1)
|
|
592
592
|
]),
|
|
593
593
|
_: 1
|
|
594
594
|
}),
|
|
595
|
-
f(
|
|
595
|
+
f(N, {
|
|
596
596
|
size: "small",
|
|
597
597
|
onClick: Ze,
|
|
598
|
-
disabled:
|
|
598
|
+
disabled: S.value >= 10
|
|
599
599
|
}, {
|
|
600
|
-
default:
|
|
601
|
-
f(
|
|
600
|
+
default: H(() => [
|
|
601
|
+
f(I(Ee))
|
|
602
602
|
]),
|
|
603
603
|
_: 1
|
|
604
604
|
}, 8, ["disabled"])
|
|
605
605
|
]),
|
|
606
|
-
f(
|
|
606
|
+
f(N, {
|
|
607
607
|
size: "small",
|
|
608
|
-
onClick: t[3] || (t[3] = (l) =>
|
|
608
|
+
onClick: t[3] || (t[3] = (l) => x.value = !1),
|
|
609
609
|
type: "danger"
|
|
610
610
|
}, {
|
|
611
|
-
default:
|
|
612
|
-
f(
|
|
611
|
+
default: H(() => [
|
|
612
|
+
f(I(fe))
|
|
613
613
|
]),
|
|
614
614
|
_: 1
|
|
615
615
|
})
|
|
616
616
|
]),
|
|
617
|
-
|
|
617
|
+
_.value ? (o(), u("div", $t, "双击重置 · 轻触关闭")) : D("", !0)
|
|
618
618
|
])
|
|
619
619
|
]),
|
|
620
620
|
_: 1
|
|
621
621
|
}, 8, ["visible", "width", "fullscreen"])
|
|
622
622
|
], 512));
|
|
623
623
|
}
|
|
624
|
-
}), Fe = /* @__PURE__ */
|
|
624
|
+
}), Fe = /* @__PURE__ */ oe(xt, [["__scopeId", "data-v-e47faf67"]]), St = {
|
|
625
625
|
key: 0,
|
|
626
626
|
class: "text-content"
|
|
627
627
|
}, zt = {
|
|
@@ -636,13 +636,13 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
636
636
|
}, At = { class: "file-icon-wrapper" }, Tt = { class: "attachment-info" }, Ht = { class: "attachment-name" }, Dt = { class: "attachment-size" }, Rt = {
|
|
637
637
|
key: 3,
|
|
638
638
|
class: "files-content"
|
|
639
|
-
}, Pt = ["onClick"], Ft = { class: "file-icon-wrapper-small" }, Nt = { class: "file-info" },
|
|
639
|
+
}, Pt = ["onClick"], Ft = { class: "file-icon-wrapper-small" }, Nt = { class: "file-info" }, Ut = { class: "file-name" }, Yt = { class: "file-type" }, Wt = { class: "file-actions" }, Ot = {
|
|
640
640
|
key: 4,
|
|
641
641
|
class: "audio-content"
|
|
642
|
-
},
|
|
642
|
+
}, Xt = { class: "audio-player" }, Vt = { class: "audio-info" }, Zt = { class: "audio-progress" }, qt = { class: "progress-bar" }, jt = { class: "audio-time" }, Kt = { class: "image-preview-container" }, Gt = ["src"], Jt = {
|
|
643
643
|
key: 0,
|
|
644
644
|
class: "image-nav"
|
|
645
|
-
}, Qt = { class: "image-counter" }, es = /* @__PURE__ */
|
|
645
|
+
}, Qt = { class: "image-counter" }, es = /* @__PURE__ */ Q({
|
|
646
646
|
__name: "MultimodalMessage",
|
|
647
647
|
props: {
|
|
648
648
|
message: {},
|
|
@@ -650,237 +650,237 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
650
650
|
isStreaming: { type: Boolean, default: !1 }
|
|
651
651
|
},
|
|
652
652
|
setup(n) {
|
|
653
|
-
const
|
|
653
|
+
const p = n, k = X(() => {
|
|
654
654
|
try {
|
|
655
|
-
return
|
|
655
|
+
return p.message.metadata ? JSON.parse(p.message.metadata) : {};
|
|
656
656
|
} catch {
|
|
657
657
|
return {};
|
|
658
658
|
}
|
|
659
|
-
}),
|
|
660
|
-
() =>
|
|
661
|
-
),
|
|
662
|
-
let
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
},
|
|
666
|
-
|
|
667
|
-
},
|
|
668
|
-
|
|
659
|
+
}), i = X(
|
|
660
|
+
() => k.value.imageUrls || []
|
|
661
|
+
), z = X(() => k.value.fileUrls || []), $ = X(() => k.value.audioUrl), E = X(() => p.message.attachments && p.message.attachments.length > 0 ? p.message.attachments : k.value.attachments && Array.isArray(k.value.attachments) ? k.value.attachments : []), x = b(!1), T = b(""), _ = b(0), c = b(!1), d = b(!1), M = b(0), L = b(0), S = X(() => L.value > 0 ? M.value / L.value * 100 : 0);
|
|
662
|
+
let C = null;
|
|
663
|
+
const ee = (m, h) => {
|
|
664
|
+
T.value = m, _.value = h, x.value = !0;
|
|
665
|
+
}, te = () => {
|
|
666
|
+
_.value > 0 && (_.value--, T.value = i.value[_.value]);
|
|
667
|
+
}, se = () => {
|
|
668
|
+
_.value < i.value.length - 1 && (_.value++, T.value = i.value[_.value]);
|
|
669
669
|
}, q = (m, h) => {
|
|
670
670
|
console.error("Image load failed:", h);
|
|
671
671
|
const y = m.target;
|
|
672
672
|
y.style.display = "none";
|
|
673
|
-
},
|
|
673
|
+
}, ae = (m) => {
|
|
674
674
|
try {
|
|
675
|
-
const y = new URL(m).pathname,
|
|
676
|
-
return decodeURIComponent(
|
|
675
|
+
const y = new URL(m).pathname, B = y.substring(y.lastIndexOf("/") + 1);
|
|
676
|
+
return decodeURIComponent(B) || "Unknown File";
|
|
677
677
|
} catch {
|
|
678
678
|
return "Unknown File";
|
|
679
679
|
}
|
|
680
680
|
}, ge = (m) => {
|
|
681
|
-
var
|
|
682
|
-
return ((
|
|
681
|
+
var B;
|
|
682
|
+
return ((B = ae(m).split(".").pop()) == null ? void 0 : B.toUpperCase()) || "FILE";
|
|
683
683
|
}, j = (m) => {
|
|
684
684
|
const h = ge(m).toLowerCase();
|
|
685
685
|
["jpg", "jpeg", "png", "gif", "webp", "pdf"].includes(h) ? window.open(m, "_blank") : ie(m);
|
|
686
686
|
}, ie = (m) => {
|
|
687
687
|
try {
|
|
688
688
|
const h = document.createElement("a");
|
|
689
|
-
h.href = m, h.download =
|
|
689
|
+
h.href = m, h.download = ae(m), h.target = "_blank", document.body.appendChild(h), h.click(), document.body.removeChild(h);
|
|
690
690
|
} catch (h) {
|
|
691
691
|
console.error("Download failed:", h), alert("下载失败");
|
|
692
692
|
}
|
|
693
693
|
}, pe = async () => {
|
|
694
|
-
if (
|
|
694
|
+
if ($.value)
|
|
695
695
|
try {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}),
|
|
699
|
-
|
|
700
|
-
}),
|
|
701
|
-
|
|
702
|
-
}),
|
|
703
|
-
console.error("Audio playback error:", m),
|
|
704
|
-
})),
|
|
696
|
+
C || (C = new Audio(), C.src = $.value, C.addEventListener("loadedmetadata", () => {
|
|
697
|
+
L.value = (C == null ? void 0 : C.duration) || 0;
|
|
698
|
+
}), C.addEventListener("timeupdate", () => {
|
|
699
|
+
M.value = (C == null ? void 0 : C.currentTime) || 0;
|
|
700
|
+
}), C.addEventListener("ended", () => {
|
|
701
|
+
c.value = !1, M.value = 0;
|
|
702
|
+
}), C.addEventListener("error", (m) => {
|
|
703
|
+
console.error("Audio playback error:", m), d.value = !1, c.value = !1;
|
|
704
|
+
})), c.value ? (C.pause(), c.value = !1) : (d.value = !0, await C.play(), c.value = !0, d.value = !1);
|
|
705
705
|
} catch (m) {
|
|
706
|
-
console.error("Audio playback failed:", m),
|
|
706
|
+
console.error("Audio playback failed:", m), d.value = !1, c.value = !1;
|
|
707
707
|
}
|
|
708
708
|
}, he = (m) => {
|
|
709
709
|
const h = Math.floor(m / 60), y = Math.floor(m % 60);
|
|
710
710
|
return `${h}:${y.toString().padStart(2, "0")}`;
|
|
711
711
|
}, ye = (m) => {
|
|
712
712
|
if (m === 0) return "0 B";
|
|
713
|
-
const h = 1024, y = ["B", "KB", "MB", "GB"],
|
|
714
|
-
return (m / Math.pow(h,
|
|
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
715
|
}, we = (m) => {
|
|
716
716
|
var y;
|
|
717
717
|
return ((y = m.split(".").pop()) == null ? void 0 : y.toUpperCase()) || "FILE";
|
|
718
718
|
}, K = (m) => {
|
|
719
|
-
|
|
719
|
+
x.value && (m.key === "ArrowLeft" ? te() : m.key === "ArrowRight" ? se() : m.key === "Escape" && (x.value = !1));
|
|
720
720
|
};
|
|
721
|
-
return
|
|
721
|
+
return J(x, (m) => {
|
|
722
722
|
m ? document.addEventListener("keydown", K) : document.removeEventListener("keydown", K);
|
|
723
723
|
}), Re(() => {
|
|
724
|
-
|
|
725
|
-
}), (m, h) => (
|
|
726
|
-
class:
|
|
724
|
+
C && (C.pause(), C = null), document.removeEventListener("keydown", K);
|
|
725
|
+
}), (m, h) => (o(), u("div", {
|
|
726
|
+
class: le(["multimodal-message", { "is-user": n.isUser, "is-assistant": !n.isUser }])
|
|
727
727
|
}, [
|
|
728
|
-
n.message.content ? (
|
|
728
|
+
n.message.content ? (o(), u("div", St, [
|
|
729
729
|
f(Fe, {
|
|
730
730
|
content: n.message.content,
|
|
731
731
|
"is-streaming": n.isStreaming
|
|
732
732
|
}, null, 8, ["content", "is-streaming"])
|
|
733
|
-
])) :
|
|
734
|
-
|
|
733
|
+
])) : D("", !0),
|
|
734
|
+
i.value && i.value.length > 0 ? (o(), u("div", zt, [
|
|
735
735
|
a("div", {
|
|
736
|
-
class:
|
|
736
|
+
class: le(["images-grid", `grid-${Math.min(i.value.length, 4)}`])
|
|
737
737
|
}, [
|
|
738
|
-
(
|
|
739
|
-
key:
|
|
738
|
+
(o(!0), u(ue, null, me(i.value.slice(0, 4), (y, B) => (o(), u("div", {
|
|
739
|
+
key: B,
|
|
740
740
|
class: "image-item",
|
|
741
|
-
onClick: (
|
|
741
|
+
onClick: (O) => ee(y, B)
|
|
742
742
|
}, [
|
|
743
743
|
a("img", {
|
|
744
744
|
src: y,
|
|
745
|
-
alt: `图片 ${
|
|
746
|
-
onError: (
|
|
745
|
+
alt: `图片 ${B + 1}`,
|
|
746
|
+
onError: (O) => q(O, y),
|
|
747
747
|
loading: "lazy"
|
|
748
748
|
}, null, 40, Et),
|
|
749
|
-
|
|
749
|
+
B === 3 && i.value.length > 4 ? (o(), u("div", It, " +" + F(i.value.length - 4), 1)) : D("", !0)
|
|
750
750
|
], 8, Lt))), 128))
|
|
751
751
|
], 2)
|
|
752
|
-
])) :
|
|
753
|
-
|
|
754
|
-
(
|
|
755
|
-
key:
|
|
752
|
+
])) : D("", !0),
|
|
753
|
+
E.value && E.value.length > 0 ? (o(), u("div", Bt, [
|
|
754
|
+
(o(!0), u(ue, null, me(E.value, (y, B) => (o(), u("div", {
|
|
755
|
+
key: B,
|
|
756
756
|
class: "attachment-item"
|
|
757
757
|
}, [
|
|
758
758
|
a("div", At, [
|
|
759
|
-
f(
|
|
759
|
+
f(I(Be), { class: "file-icon" })
|
|
760
760
|
]),
|
|
761
761
|
a("div", Tt, [
|
|
762
|
-
a("span", Ht,
|
|
763
|
-
a("span", Dt,
|
|
762
|
+
a("span", Ht, F(y.name), 1),
|
|
763
|
+
a("span", Dt, F(we(y.name)) + " " + F(ye(y.size)), 1)
|
|
764
764
|
])
|
|
765
765
|
]))), 128))
|
|
766
|
-
])) :
|
|
767
|
-
|
|
768
|
-
(
|
|
769
|
-
key:
|
|
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,
|
|
770
770
|
class: "file-item",
|
|
771
|
-
onClick: (
|
|
771
|
+
onClick: (O) => j(y)
|
|
772
772
|
}, [
|
|
773
773
|
a("div", Ft, [
|
|
774
|
-
f(
|
|
774
|
+
f(I(Be), { class: "file-icon" })
|
|
775
775
|
]),
|
|
776
776
|
a("div", Nt, [
|
|
777
|
-
a("span",
|
|
778
|
-
a("span",
|
|
777
|
+
a("span", Ut, F(ae(y)), 1),
|
|
778
|
+
a("span", Yt, F(ge(y)), 1)
|
|
779
779
|
]),
|
|
780
|
-
a("div",
|
|
781
|
-
f(
|
|
780
|
+
a("div", Wt, [
|
|
781
|
+
f(N, {
|
|
782
782
|
size: "small",
|
|
783
783
|
type: "text",
|
|
784
|
-
onClick: Z((
|
|
784
|
+
onClick: Z((O) => ie(y), ["stop"])
|
|
785
785
|
}, {
|
|
786
|
-
default:
|
|
787
|
-
f(
|
|
786
|
+
default: H(() => [
|
|
787
|
+
f(I(Ae))
|
|
788
788
|
]),
|
|
789
789
|
_: 1
|
|
790
790
|
}, 8, ["onClick"])
|
|
791
791
|
])
|
|
792
792
|
], 8, Pt))), 128))
|
|
793
|
-
])) :
|
|
794
|
-
|
|
795
|
-
a("div",
|
|
796
|
-
f(
|
|
793
|
+
])) : D("", !0),
|
|
794
|
+
$.value ? (o(), u("div", Ot, [
|
|
795
|
+
a("div", Xt, [
|
|
796
|
+
f(N, {
|
|
797
797
|
onClick: pe,
|
|
798
|
-
loading:
|
|
798
|
+
loading: d.value,
|
|
799
799
|
circle: "",
|
|
800
800
|
size: "small",
|
|
801
801
|
class: "play-btn"
|
|
802
802
|
}, {
|
|
803
|
-
default:
|
|
804
|
-
(
|
|
803
|
+
default: H(() => [
|
|
804
|
+
(o(), G(Pe(c.value ? I(vt) : I(mt))))
|
|
805
805
|
]),
|
|
806
806
|
_: 1
|
|
807
807
|
}, 8, ["loading"]),
|
|
808
|
-
a("div",
|
|
808
|
+
a("div", Vt, [
|
|
809
809
|
a("div", Zt, [
|
|
810
810
|
a("div", qt, [
|
|
811
811
|
a("div", {
|
|
812
812
|
class: "progress-fill",
|
|
813
|
-
style: ve({ width:
|
|
813
|
+
style: ve({ width: S.value + "%" })
|
|
814
814
|
}, null, 4)
|
|
815
815
|
])
|
|
816
816
|
]),
|
|
817
817
|
a("div", jt, [
|
|
818
|
-
a("span", null,
|
|
818
|
+
a("span", null, F(he(M.value)), 1),
|
|
819
819
|
h[4] || (h[4] = a("span", null, "/", -1)),
|
|
820
|
-
a("span", null,
|
|
820
|
+
a("span", null, F(he(L.value)), 1)
|
|
821
821
|
])
|
|
822
822
|
]),
|
|
823
|
-
f(
|
|
824
|
-
onClick: h[0] || (h[0] = (y) => ie(
|
|
823
|
+
f(N, {
|
|
824
|
+
onClick: h[0] || (h[0] = (y) => ie($.value)),
|
|
825
825
|
size: "small",
|
|
826
826
|
type: "text",
|
|
827
827
|
class: "download-btn"
|
|
828
828
|
}, {
|
|
829
|
-
default:
|
|
830
|
-
f(
|
|
829
|
+
default: H(() => [
|
|
830
|
+
f(I(Ae))
|
|
831
831
|
]),
|
|
832
832
|
_: 1
|
|
833
833
|
})
|
|
834
834
|
])
|
|
835
|
-
])) :
|
|
835
|
+
])) : D("", !0),
|
|
836
836
|
f(Me, {
|
|
837
|
-
visible:
|
|
838
|
-
"onUpdate:visible": h[3] || (h[3] = (y) =>
|
|
837
|
+
visible: x.value,
|
|
838
|
+
"onUpdate:visible": h[3] || (h[3] = (y) => x.value = y),
|
|
839
839
|
width: "90%",
|
|
840
840
|
"show-close": !1,
|
|
841
841
|
"append-to-body": "",
|
|
842
842
|
class: "image-preview-dialog-wrapper"
|
|
843
843
|
}, {
|
|
844
|
-
default:
|
|
844
|
+
default: H(() => [
|
|
845
845
|
a("div", Kt, [
|
|
846
846
|
a("img", {
|
|
847
|
-
src:
|
|
847
|
+
src: T.value,
|
|
848
848
|
alt: "预览图片",
|
|
849
849
|
class: "preview-image",
|
|
850
|
-
onClick: h[1] || (h[1] = (y) =>
|
|
850
|
+
onClick: h[1] || (h[1] = (y) => x.value = !1)
|
|
851
851
|
}, null, 8, Gt),
|
|
852
|
-
|
|
853
|
-
f(
|
|
854
|
-
onClick:
|
|
855
|
-
disabled:
|
|
852
|
+
i.value && i.value.length > 1 ? (o(), u("div", Jt, [
|
|
853
|
+
f(N, {
|
|
854
|
+
onClick: te,
|
|
855
|
+
disabled: _.value === 0,
|
|
856
856
|
circle: "",
|
|
857
857
|
class: "nav-btn"
|
|
858
858
|
}, {
|
|
859
|
-
default:
|
|
860
|
-
f(
|
|
859
|
+
default: H(() => [
|
|
860
|
+
f(I(gt))
|
|
861
861
|
]),
|
|
862
862
|
_: 1
|
|
863
863
|
}, 8, ["disabled"]),
|
|
864
|
-
a("span", Qt,
|
|
865
|
-
f(
|
|
866
|
-
onClick:
|
|
867
|
-
disabled:
|
|
864
|
+
a("span", Qt, F(_.value + 1) + " / " + F(i.value.length), 1),
|
|
865
|
+
f(N, {
|
|
866
|
+
onClick: se,
|
|
867
|
+
disabled: _.value === i.value.length - 1,
|
|
868
868
|
circle: "",
|
|
869
869
|
class: "nav-btn"
|
|
870
870
|
}, {
|
|
871
|
-
default:
|
|
872
|
-
f(
|
|
871
|
+
default: H(() => [
|
|
872
|
+
f(I(ht))
|
|
873
873
|
]),
|
|
874
874
|
_: 1
|
|
875
875
|
}, 8, ["disabled"])
|
|
876
|
-
])) :
|
|
877
|
-
f(
|
|
878
|
-
onClick: h[2] || (h[2] = (y) =>
|
|
876
|
+
])) : D("", !0),
|
|
877
|
+
f(N, {
|
|
878
|
+
onClick: h[2] || (h[2] = (y) => x.value = !1),
|
|
879
879
|
class: "close-btn",
|
|
880
880
|
circle: ""
|
|
881
881
|
}, {
|
|
882
|
-
default:
|
|
883
|
-
f(
|
|
882
|
+
default: H(() => [
|
|
883
|
+
f(I(fe))
|
|
884
884
|
]),
|
|
885
885
|
_: 1
|
|
886
886
|
})
|
|
@@ -890,7 +890,7 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
890
890
|
}, 8, ["visible"])
|
|
891
891
|
], 2));
|
|
892
892
|
}
|
|
893
|
-
}), Ce = /* @__PURE__ */
|
|
893
|
+
}), Ce = /* @__PURE__ */ oe(es, [["__scopeId", "data-v-7795fedb"]]), ts = {
|
|
894
894
|
key: 0,
|
|
895
895
|
class: "agent-steps"
|
|
896
896
|
}, ss = { class: "steps-indicator" }, as = {
|
|
@@ -902,69 +902,74 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
902
902
|
}, ls = { class: "steps-summary" }, os = { class: "icon-chevron" }, is = { class: "steps-list" }, rs = { class: "step-icon" }, cs = {
|
|
903
903
|
key: 3,
|
|
904
904
|
class: "icon-dot"
|
|
905
|
-
}, ds = { class: "step-name" }, us = /* @__PURE__ */
|
|
905
|
+
}, ds = { class: "step-name" }, us = /* @__PURE__ */ Q({
|
|
906
906
|
__name: "AgentSteps",
|
|
907
907
|
props: {
|
|
908
908
|
steps: {}
|
|
909
909
|
},
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
910
|
+
emits: ["resize"],
|
|
911
|
+
setup(n, { emit: p }) {
|
|
912
|
+
const k = n, i = b(!0), z = p, $ = () => {
|
|
913
|
+
i.value = !i.value, setTimeout(() => {
|
|
914
|
+
z("resize");
|
|
915
|
+
}, 300);
|
|
916
|
+
}, E = X(
|
|
917
|
+
() => k.steps.some((T) => T.status === "running")
|
|
918
|
+
), x = X(() => {
|
|
919
|
+
const T = k.steps.find((c) => c.status === "running");
|
|
920
|
+
if (T)
|
|
921
|
+
return `正在${T.displayName}...`;
|
|
922
|
+
const _ = k.steps.filter(
|
|
923
|
+
(c) => c.status === "completed"
|
|
919
924
|
).length;
|
|
920
|
-
return
|
|
925
|
+
return _ === k.steps.length ? "处理完成" : `已完成 ${_}/${k.steps.length} 个步骤`;
|
|
921
926
|
});
|
|
922
|
-
return (
|
|
927
|
+
return (T, _) => n.steps.length > 0 ? (o(), u("div", ts, [
|
|
923
928
|
a("div", {
|
|
924
929
|
class: "steps-header",
|
|
925
|
-
onClick:
|
|
930
|
+
onClick: $
|
|
926
931
|
}, [
|
|
927
932
|
a("div", ss, [
|
|
928
|
-
|
|
929
|
-
f(
|
|
930
|
-
])) : (
|
|
931
|
-
f(
|
|
933
|
+
E.value ? (o(), u("div", as, [
|
|
934
|
+
f(I(Te))
|
|
935
|
+
])) : (o(), u("div", ns, [
|
|
936
|
+
f(I(He))
|
|
932
937
|
]))
|
|
933
938
|
]),
|
|
934
|
-
a("span", ls,
|
|
939
|
+
a("span", ls, F(x.value), 1),
|
|
935
940
|
a("div", os, [
|
|
936
|
-
(
|
|
941
|
+
(o(), G(Pe(i.value ? I(ft) : I(pt))))
|
|
937
942
|
])
|
|
938
943
|
]),
|
|
939
944
|
at(a("div", is, [
|
|
940
|
-
(
|
|
941
|
-
key:
|
|
942
|
-
class:
|
|
943
|
-
"is-running":
|
|
944
|
-
"is-completed":
|
|
945
|
-
"is-error":
|
|
945
|
+
(o(!0), u(ue, null, me(n.steps, (c) => (o(), u("div", {
|
|
946
|
+
key: c.name,
|
|
947
|
+
class: le(["step-item", {
|
|
948
|
+
"is-running": c.status === "running",
|
|
949
|
+
"is-completed": c.status === "completed",
|
|
950
|
+
"is-error": c.status === "error"
|
|
946
951
|
}])
|
|
947
952
|
}, [
|
|
948
953
|
a("div", rs, [
|
|
949
|
-
|
|
954
|
+
c.status === "running" ? (o(), G(I(Te), {
|
|
950
955
|
key: 0,
|
|
951
956
|
class: "icon-spin"
|
|
952
|
-
})) :
|
|
957
|
+
})) : c.status === "completed" ? (o(), G(I(He), { key: 1 })) : c.status === "error" ? (o(), G(I(fe), { key: 2 })) : (o(), u("div", cs))
|
|
953
958
|
]),
|
|
954
|
-
a("span", ds,
|
|
959
|
+
a("span", ds, F(c.displayName), 1)
|
|
955
960
|
], 2))), 128))
|
|
956
961
|
], 512), [
|
|
957
|
-
[nt,
|
|
962
|
+
[nt, i.value]
|
|
958
963
|
])
|
|
959
|
-
])) :
|
|
964
|
+
])) : D("", !0);
|
|
960
965
|
}
|
|
961
|
-
}), Ne = /* @__PURE__ */
|
|
966
|
+
}), Ne = /* @__PURE__ */ oe(us, [["__scopeId", "data-v-181f5844"]]), ms = { class: "chat-message-list-root" }, vs = {
|
|
962
967
|
key: 0,
|
|
963
968
|
class: "bg-grid"
|
|
964
969
|
}, gs = {
|
|
965
970
|
key: 0,
|
|
966
971
|
class: "welcome-screen"
|
|
967
|
-
}, hs = { class: "
|
|
972
|
+
}, hs = { class: "welcome-content" }, fs = { class: "welcome-logo" }, ps = ["src"], ys = {
|
|
968
973
|
key: 1,
|
|
969
974
|
class: "default-logo"
|
|
970
975
|
}, ws = { class: "welcome-title" }, ks = {
|
|
@@ -982,7 +987,7 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
982
987
|
}, $s = ["onClick"], xs = {
|
|
983
988
|
key: 0,
|
|
984
989
|
class: "message-row message-assistant"
|
|
985
|
-
}, Ss = /* @__PURE__ */
|
|
990
|
+
}, Ss = /* @__PURE__ */ Q({
|
|
986
991
|
__name: "ChatMessageList",
|
|
987
992
|
props: {
|
|
988
993
|
messages: { default: () => [] },
|
|
@@ -995,69 +1000,85 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
995
1000
|
showAgentSteps: { type: Boolean, default: !0 },
|
|
996
1001
|
autoScroll: { type: Boolean, default: !0 },
|
|
997
1002
|
contentPaddingTop: { default: "80px" },
|
|
998
|
-
contentPaddingBottom: { default: "
|
|
1003
|
+
contentPaddingBottom: { default: "140px" },
|
|
999
1004
|
showBackground: { type: Boolean, default: !0 }
|
|
1000
1005
|
},
|
|
1001
1006
|
emits: ["copy", "scroll", "scroll-bottom"],
|
|
1002
|
-
setup(n, { expose:
|
|
1003
|
-
const
|
|
1004
|
-
await de(),
|
|
1005
|
-
top:
|
|
1006
|
-
behavior:
|
|
1007
|
+
setup(n, { expose: p, emit: k }) {
|
|
1008
|
+
const i = n, z = k, $ = b(null), E = b(!1), x = async (d = "smooth") => {
|
|
1009
|
+
await de(), $.value && $.value.scrollTo({
|
|
1010
|
+
top: $.value.scrollHeight,
|
|
1011
|
+
behavior: d
|
|
1007
1012
|
});
|
|
1008
|
-
},
|
|
1009
|
-
|
|
1010
|
-
const
|
|
1011
|
-
if (!
|
|
1012
|
-
const { scrollTop: L, scrollHeight:
|
|
1013
|
-
|
|
1013
|
+
}, T = (d) => {
|
|
1014
|
+
z("scroll", d);
|
|
1015
|
+
const M = d.target;
|
|
1016
|
+
if (!M) return;
|
|
1017
|
+
const { scrollTop: L, scrollHeight: S, clientHeight: C } = M;
|
|
1018
|
+
S - L - C < 50 ? (E.value = !1, z("scroll-bottom")) : E.value = !0;
|
|
1014
1019
|
};
|
|
1015
|
-
|
|
1016
|
-
() =>
|
|
1017
|
-
async () => {
|
|
1018
|
-
|
|
1020
|
+
J(
|
|
1021
|
+
() => i.messages.length,
|
|
1022
|
+
async (d, M) => {
|
|
1023
|
+
d > (M || 0) && (E.value = !1), i.autoScroll && !E.value && x();
|
|
1019
1024
|
}
|
|
1020
|
-
),
|
|
1025
|
+
), J(
|
|
1021
1026
|
() => {
|
|
1022
|
-
var
|
|
1023
|
-
return (
|
|
1027
|
+
var d;
|
|
1028
|
+
return (d = i.messages[i.messages.length - 1]) == null ? void 0 : d.content;
|
|
1024
1029
|
},
|
|
1025
|
-
async (
|
|
1026
|
-
|
|
1030
|
+
async (d, M) => {
|
|
1031
|
+
if (i.isStreaming && i.autoScroll && !E.value) {
|
|
1032
|
+
const L = (d == null ? void 0 : d.length) || 0, S = (M == null ? void 0 : M.length) || 0;
|
|
1033
|
+
L > S && $.value && $.value.scrollTo({
|
|
1034
|
+
top: $.value.scrollHeight,
|
|
1035
|
+
behavior: "instant"
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1027
1038
|
}
|
|
1028
|
-
),
|
|
1029
|
-
() =>
|
|
1030
|
-
(
|
|
1031
|
-
|
|
1039
|
+
), J(
|
|
1040
|
+
() => i.isTyping,
|
|
1041
|
+
(d) => {
|
|
1042
|
+
d && i.autoScroll && x();
|
|
1032
1043
|
}
|
|
1033
1044
|
);
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1045
|
+
const _ = (d) => {
|
|
1046
|
+
z("copy", d), navigator.clipboard && d.content && navigator.clipboard.writeText(d.content);
|
|
1047
|
+
};
|
|
1048
|
+
J(
|
|
1049
|
+
() => i.agentSteps,
|
|
1050
|
+
() => {
|
|
1051
|
+
i.autoScroll && !E.value && x();
|
|
1052
|
+
},
|
|
1053
|
+
{ deep: !0 }
|
|
1054
|
+
);
|
|
1055
|
+
const c = () => {
|
|
1056
|
+
i.autoScroll && !E.value && x();
|
|
1036
1057
|
};
|
|
1037
|
-
return
|
|
1038
|
-
scrollToBottom:
|
|
1039
|
-
containerRef:
|
|
1040
|
-
}), (
|
|
1041
|
-
n.showBackground ? (
|
|
1058
|
+
return p({
|
|
1059
|
+
scrollToBottom: x,
|
|
1060
|
+
containerRef: $
|
|
1061
|
+
}), (d, M) => (o(), u("div", ms, [
|
|
1062
|
+
n.showBackground ? (o(), u("div", vs)) : D("", !0),
|
|
1042
1063
|
a("div", {
|
|
1043
1064
|
class: "chat-message-list",
|
|
1044
1065
|
ref_key: "containerRef",
|
|
1045
|
-
ref:
|
|
1046
|
-
onScroll:
|
|
1066
|
+
ref: $,
|
|
1067
|
+
onScroll: T,
|
|
1047
1068
|
style: ve({
|
|
1048
1069
|
paddingTop: n.contentPaddingTop,
|
|
1049
1070
|
paddingBottom: n.contentPaddingBottom
|
|
1050
1071
|
})
|
|
1051
1072
|
}, [
|
|
1052
|
-
n.showWelcome && n.messages.length === 0 ? (
|
|
1053
|
-
be(
|
|
1073
|
+
n.showWelcome && n.messages.length === 0 ? (o(), u("div", gs, [
|
|
1074
|
+
be(d.$slots, "welcome", {}, () => [
|
|
1054
1075
|
a("div", hs, [
|
|
1055
1076
|
a("div", fs, [
|
|
1056
|
-
n.appLogo ? (
|
|
1077
|
+
n.appLogo ? (o(), u("img", {
|
|
1057
1078
|
key: 0,
|
|
1058
1079
|
src: n.appLogo,
|
|
1059
1080
|
alt: "Logo"
|
|
1060
|
-
}, null, 8, ps)) : (
|
|
1081
|
+
}, null, 8, ps)) : (o(), u("div", ys, [...M[0] || (M[0] = [
|
|
1061
1082
|
a("svg", {
|
|
1062
1083
|
viewBox: "0 0 1024 1024",
|
|
1063
1084
|
width: "32",
|
|
@@ -1070,41 +1091,42 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
1070
1091
|
], -1)
|
|
1071
1092
|
])]))
|
|
1072
1093
|
]),
|
|
1073
|
-
a("h2", ws,
|
|
1074
|
-
|
|
1094
|
+
a("h2", ws, F(n.appName), 1),
|
|
1095
|
+
M[1] || (M[1] = a("p", { class: "welcome-desc" }, "今天有什么可以帮您?", -1))
|
|
1075
1096
|
])
|
|
1076
1097
|
], !0)
|
|
1077
|
-
])) : (
|
|
1078
|
-
(
|
|
1079
|
-
key: L.id ||
|
|
1080
|
-
class:
|
|
1098
|
+
])) : (o(), u("div", ks, [
|
|
1099
|
+
(o(!0), u(ue, null, me(n.messages, (L, S) => (o(), u("div", {
|
|
1100
|
+
key: L.id || S,
|
|
1101
|
+
class: le([
|
|
1081
1102
|
"message-row",
|
|
1082
1103
|
L.role === "user" ? "message-user" : "message-assistant"
|
|
1083
1104
|
])
|
|
1084
1105
|
}, [
|
|
1085
|
-
L.role === "user" ? (
|
|
1106
|
+
L.role === "user" ? (o(), u("div", Ms, [
|
|
1086
1107
|
f(Ce, {
|
|
1087
1108
|
message: L,
|
|
1088
1109
|
"is-user": !0
|
|
1089
1110
|
}, null, 8, ["message"])
|
|
1090
|
-
])) : (
|
|
1091
|
-
n.showAgentSteps &&
|
|
1111
|
+
])) : (o(), u("div", Cs, [
|
|
1112
|
+
n.showAgentSteps && S === n.messages.length - 1 && n.agentSteps && n.agentSteps.length > 0 ? (o(), G(Ne, {
|
|
1092
1113
|
key: 0,
|
|
1093
|
-
steps: n.agentSteps
|
|
1094
|
-
|
|
1114
|
+
steps: n.agentSteps,
|
|
1115
|
+
onResize: c
|
|
1116
|
+
}, null, 8, ["steps"])) : D("", !0),
|
|
1095
1117
|
a("div", bs, [
|
|
1096
1118
|
f(Ce, {
|
|
1097
1119
|
message: L,
|
|
1098
1120
|
"is-user": !1,
|
|
1099
|
-
"is-streaming": n.isStreaming &&
|
|
1121
|
+
"is-streaming": n.isStreaming && S === n.messages.length - 1
|
|
1100
1122
|
}, null, 8, ["message", "is-streaming"])
|
|
1101
1123
|
]),
|
|
1102
|
-
L.content && !(n.isStreaming &&
|
|
1124
|
+
L.content && !(n.isStreaming && S === n.messages.length - 1) ? (o(), u("div", _s, [
|
|
1103
1125
|
a("button", {
|
|
1104
1126
|
class: "action-btn",
|
|
1105
|
-
onClick: (
|
|
1127
|
+
onClick: (C) => _(L),
|
|
1106
1128
|
title: "复制"
|
|
1107
|
-
}, [...
|
|
1129
|
+
}, [...M[2] || (M[2] = [
|
|
1108
1130
|
a("svg", {
|
|
1109
1131
|
viewBox: "0 0 1024 1024",
|
|
1110
1132
|
width: "12",
|
|
@@ -1117,10 +1139,10 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
1117
1139
|
], -1),
|
|
1118
1140
|
a("span", null, "复制", -1)
|
|
1119
1141
|
])], 8, $s)
|
|
1120
|
-
])) :
|
|
1142
|
+
])) : D("", !0)
|
|
1121
1143
|
]))
|
|
1122
1144
|
], 2))), 128)),
|
|
1123
|
-
n.isTyping ? (
|
|
1145
|
+
n.isTyping ? (o(), u("div", xs, [...M[3] || (M[3] = [
|
|
1124
1146
|
a("div", { class: "typing-indicator" }, [
|
|
1125
1147
|
a("div", { class: "typing-dot" }),
|
|
1126
1148
|
a("div", {
|
|
@@ -1132,12 +1154,12 @@ const it = { class: "cm-dialog__body" }, rt = /* @__PURE__ */ J({
|
|
|
1132
1154
|
style: { "animation-delay": "0.4s" }
|
|
1133
1155
|
})
|
|
1134
1156
|
], -1)
|
|
1135
|
-
])])) :
|
|
1157
|
+
])])) : D("", !0)
|
|
1136
1158
|
]))
|
|
1137
1159
|
], 36)
|
|
1138
1160
|
]));
|
|
1139
1161
|
}
|
|
1140
|
-
}), zs = /* @__PURE__ */
|
|
1162
|
+
}), zs = /* @__PURE__ */ oe(Ss, [["__scopeId", "data-v-02d657d5"]]), As = {
|
|
1141
1163
|
install(n) {
|
|
1142
1164
|
n.component("ChatMessageList", zs), n.component("MultimodalMessage", Ce), n.component("MarkdownMessage", Fe), n.component("AgentSteps", Ne);
|
|
1143
1165
|
}
|