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.
@@ -1,8 +1,8 @@
1
- import { defineComponent as J, ref as C, onMounted as De, computed as O, createBlock as G, createCommentVNode as H, openBlock as i, Teleport as st, createElementBlock as d, withModifiers as Z, normalizeClass as ne, createElementVNode as a, normalizeStyle as ve, renderSlot as be, h as Se, watch as ae, nextTick as de, onUnmounted as Re, createVNode as f, withCtx as T, unref as z, createTextVNode as ze, toDisplayString as P, Fragment as ue, renderList as me, resolveDynamicComponent as Pe, withDirectives as at, vShow as nt } from "vue";
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__ */ J({
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: u }) {
17
- const M = n, c = u, $ = C(!1);
16
+ setup(n, { emit: p }) {
17
+ const k = n, i = p, z = b(!1);
18
18
  De(() => {
19
- $.value = !0;
19
+ z.value = !0;
20
20
  });
21
- const b = O(() => M.fullscreen ? { width: "100%", height: "100%", margin: 0 } : { width: M.width }), x = () => {
22
- c("update:visible", !1), c("close");
23
- }, p = () => {
24
- M.closeOnClickModal && x();
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 (U, S) => $.value ? (i(), G(st, {
26
+ return (T, _) => z.value ? (o(), G(st, {
27
27
  key: 0,
28
28
  to: "body"
29
29
  }, [
30
- n.visible ? (i(), d("div", {
30
+ n.visible ? (o(), u("div", {
31
31
  key: 0,
32
- class: ne(["cm-dialog-overlay", { "is-fullscreen": n.fullscreen }]),
33
- onClick: Z(p, ["self"])
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(b.value),
37
+ style: ve($.value),
38
38
  role: "dialog",
39
39
  "aria-modal": "true"
40
40
  }, [
41
41
  a("div", it, [
42
- be(U.$slots, "default", {}, void 0, !0)
42
+ be(T.$slots, "default", {}, void 0, !0)
43
43
  ]),
44
- n.showClose ? (i(), d("button", {
44
+ n.showClose ? (o(), u("button", {
45
45
  key: 0,
46
46
  class: "cm-dialog__close",
47
- onClick: x
48
- }, [...S[0] || (S[0] = [
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
- ])])) : H("", !0)
59
+ ])])) : D("", !0)
60
60
  ], 4)
61
- ], 2)) : H("", !0)
62
- ])) : H("", !0);
61
+ ], 2)) : D("", !0)
62
+ ])) : D("", !0);
63
63
  }
64
- }), le = (n, u) => {
65
- const M = n.__vccOpts || n;
66
- for (const [c, $] of u)
67
- M[c] = $;
68
- return M;
69
- }, Me = /* @__PURE__ */ le(rt, [["__scopeId", "data-v-efdf0259"]]), ct = ["disabled"], dt = {
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__ */ J({
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: u }) {
83
- const M = n, c = u, $ = (b) => {
84
- M.disabled || M.loading || c("click", b);
82
+ setup(n, { emit: p }) {
83
+ const k = n, i = p, z = ($) => {
84
+ k.disabled || k.loading || i("click", $);
85
85
  };
86
- return (b, x) => (i(), d("button", {
87
- class: ne(["cm-button", [
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 ? (i(), d("span", dt, [...x[0] || (x[0] = [
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(b.$slots, "default", { key: 1 }, void 0, !0)
106
+ ])])) : be($.$slots, "default", { key: 1 }, void 0, !0)
107
107
  ], 10, ct));
108
108
  }
109
- }), F = /* @__PURE__ */ le(ut, [["__scopeId", "data-v-bab126c7"]]), N = (n, u) => J({
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: u })]
122
+ [Se("path", { d: p })]
123
123
  );
124
124
  }
125
- }), fe = N(
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 = N(
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 = N(
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 = N(
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 = N(
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 = N(
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 = N(
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 = N(
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 = N(
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 = N(
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 = N(
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 = N(
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 = N(
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__ */ J({
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 u = n, M = C(), c = C(), $ = C(!1), b = C(""), x = C(""), p = C(!1), U = C(""), S = C(!1), o = C(1), k = C({ x: 0, y: 0 }), L = C(!1), B = C({ x: 0, y: 0 }), A = C(1), _ = C({ x: 0, y: 0 }), oe = C(!1), Q = C({ x: 0, y: 0 }), ee = C(""), q = C(/* @__PURE__ */ new Map());
178
- let te = 0;
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], R = w.content.trim();
189
- return (w.info ? w.info.trim() : "") === "mermaid" ? (te++, `<div class="mermaid-container"><pre class="mermaid" data-mermaid-id="${`mermaid-${Date.now()}-${te}`}">${R}</pre></div>`) : t(l, g, r, s, v);
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], I = "img-" + ((Y) => {
215
- let D = 0;
216
- for (let V = 0; V < Y.length; V++) {
217
- const X = Y.charCodeAt(V);
218
- D = (D << 5) - D + X, D = D & D;
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(D).toString(36);
220
+ return Math.abs(R).toString(36);
221
221
  })(w);
222
- s.attrSet("id", I), s.attrSet("data-image-id", I), s.attrSet("key", I), s.attrSet("loading", "eager"), s.attrSet("decoding", "async"), s.attrSet("fetchpriority", "high"), s.attrSet("data-src", w), s.attrSet("data-cached", "true");
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 (u.isStreaming) {
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(u.content)) {
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
- ), u.isStreaming && (e = pe(e)), e;
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 (!c.value)
278
+ if (!i.value)
279
279
  return;
280
- const t = c.value;
281
- if (!u.isStreaming || t.children.length === 0) {
282
- t.innerHTML = e, u.isStreaming || de(() => {
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 (!u.content) {
307
- ee.value = "", c.value && (c.value.innerHTML = ""), u.isStreaming || q.value.clear();
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(u.content);
310
+ const e = he(p.content);
311
311
  let t = j.render(e);
312
- u.isStreaming && t.includes("<img") && (t = ye(t)), t !== ee.value && (ee.value = t, we(t)), u.isStreaming || q.value.clear();
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), c.value && (c.value.innerHTML = `<pre style="white-space: pre-wrap; word-wrap: break-word;">${u.content}</pre>`);
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
- ae(() => u.content, K), ae(
318
- () => u.isStreaming,
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
- S.value = window.innerWidth < 768;
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 (u.isStreaming || (await de(), !M.value)) return;
344
- const e = M.value.querySelectorAll(".mermaid");
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), R = r.parentElement;
353
- if (R) {
354
- const I = document.createElement("div");
355
- I.className = "mermaid-svg", I.innerHTML = w, I.setAttribute("data-mermaid-svg", "true"), I.style.cursor = "pointer", I.title = "Click to zoom", I.addEventListener("click", (Y) => {
356
- Y.preventDefault(), Y.stopPropagation(), U.value = w, A.value = 1, _.value = { x: 0, y: 0 }, p.value = !0;
357
- }), R.replaceChild(I, r);
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
- }, E = (e) => {
365
+ }, B = (e) => {
366
366
  e.preventDefault(), e.stopPropagation();
367
367
  const t = e.target;
368
- b.value = t.src, x.value = t.alt || "Image Preview", o.value = 1, k.value = { x: 0, y: 0 }, $.value = !0;
369
- }, W = () => {
370
- o.value <= 1 && (k.value = { x: 0, y: 0 });
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
- o.value = Math.max(o.value - 1, 0.5), W();
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
- o.value <= 1 && ($.value = !1);
379
- }, We = (e) => {
380
- e.preventDefault();
381
- const t = e.deltaY > 0 ? -0.5 : 0.5, l = Math.max(0.5, Math.min(10, o.value + t));
382
- o.value = l, W();
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 (o.value <= 1) return;
386
- e.preventDefault(), L.value = !0, B.value = {
387
- x: e.clientX - k.value.x,
388
- y: e.clientY - k.value.y
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 (!L.value || !l) return;
392
- let w = v.clientX - B.value.x, R = v.clientY - B.value.y;
393
- const I = t.offsetWidth, Y = t.offsetHeight, D = I * o.value, V = Y * o.value, X = 0.3, ke = l.width * (1 - X - 0.5) - D / 2, re = D / 2 - l.width * (1 - X - 0.5), ce = l.height * (1 - X - 0.5) - V / 2, se = V / 2 - l.height * (1 - X - 0.5);
394
- D > l.width ? w = Math.max(ke, Math.min(re, w)) : w = 0, V > l.height ? R = Math.max(ce, Math.min(se, R)) : R = 0, k.value = { x: w, y: R };
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
- L.value = !1, document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", r);
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
- }, Xe = (e) => {
400
- var R;
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 (o.value <= 1) return;
404
- L.value = !0, B.value = {
405
- x: l - k.value.x,
406
- y: g - k.value.y
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 = (R = r.parentElement) == null ? void 0 : R.getBoundingClientRect(), v = (I) => {
409
- if (!L.value || I.touches.length !== 1 || !s)
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 Y = I.touches[0];
412
- let D = Y.clientX - B.value.x, V = Y.clientY - B.value.y;
413
- const X = r.offsetWidth, ke = r.offsetHeight, re = X * o.value, ce = ke * o.value, se = 0.3, Je = s.width * (1 - se - 0.5) - re / 2, Qe = re / 2 - s.width * (1 - se - 0.5), et = s.height * (1 - se - 0.5) - ce / 2, tt = ce / 2 - s.height * (1 - se - 0.5);
414
- re > s.width ? D = Math.max(Je, Math.min(Qe, D)) : D = 0, ce > s.height ? V = Math.max(et, Math.min(tt, V)) : V = 0, k.value = { x: D, y: V };
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
- L.value = !1, document.removeEventListener("touchmove", v), document.removeEventListener("touchend", w);
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
- A.value = Math.min(A.value + 1, 10);
420
+ S.value = Math.min(S.value + 1, 10);
421
421
  }, qe = () => {
422
- A.value = Math.max(A.value - 1, 0.5);
422
+ S.value = Math.max(S.value - 1, 0.5);
423
423
  }, $e = () => {
424
- A.value = 1, _.value = { x: 0, y: 0 };
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
- A.value = Math.max(0.5, Math.min(10, A.value + t));
428
+ S.value = Math.max(0.5, Math.min(10, S.value + t));
429
429
  }, Ke = (e) => {
430
430
  var s, v;
431
- if (A.value <= 1) return;
432
- e.preventDefault(), oe.value = !0, Q.value = {
433
- x: e.clientX - _.value.x,
434
- y: e.clientY - _.value.y
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 (!oe.value || !l) return;
438
- let R = w.clientX - Q.value.x, I = w.clientY - Q.value.y;
439
- _.value = { x: R, y: I };
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
- oe.value = !1, document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", r);
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
- u.isStreaming || de(() => {
447
- if (!M.value) return;
448
- M.value.querySelectorAll(
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", E));
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
- M.value && M.value.querySelectorAll(
459
+ k.value && k.value.querySelectorAll(
460
460
  ".markdown-content img"
461
461
  ).forEach((t) => {
462
- t.removeEventListener("click", E);
462
+ t.removeEventListener("click", B);
463
463
  });
464
- }), (e, t) => (i(), d("div", {
464
+ }), (e, t) => (o(), u("div", {
465
465
  class: "markdown-message",
466
466
  ref_key: "markdownContainer",
467
- ref: M
467
+ ref: k
468
468
  }, [
469
469
  a("div", {
470
470
  ref_key: "markdownContent",
471
- ref: c,
471
+ ref: i,
472
472
  class: "markdown-content"
473
473
  }, null, 512),
474
474
  f(Me, {
475
- visible: $.value,
476
- "onUpdate:visible": t[2] || (t[2] = (l) => $.value = l),
477
- width: S.value ? "95vw" : "80vw",
478
- fullscreen: S.value,
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: T(() => [
483
+ default: H(() => [
484
484
  a("div", {
485
485
  class: "image-preview-container",
486
- onClick: t[1] || (t[1] = Z((l) => $.value = !1, ["self"]))
486
+ onClick: t[1] || (t[1] = Z((l) => z.value = !1, ["self"]))
487
487
  }, [
488
488
  a("img", {
489
- src: b.value,
490
- alt: x.value,
489
+ src: $.value,
490
+ alt: E.value,
491
491
  class: "preview-image",
492
492
  style: ve({
493
- transform: `translate(${k.value.x}px, ${k.value.y}px) scale(${o.value})`
493
+ transform: `translate(${d.value.x}px, ${d.value.y}px) scale(${c.value})`
494
494
  }),
495
- onWheel: Z(We, ["prevent"]),
495
+ onWheel: Z(Oe, ["prevent"]),
496
496
  onDblclick: _e,
497
- onMousedown: Oe,
498
- onTouchstart: Z(Xe, ["prevent"]),
499
- onClick: Ye
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(F, {
503
+ f(N, {
504
504
  size: "small",
505
- onClick: Ue,
506
- disabled: o.value <= 0.5
505
+ onClick: Ye,
506
+ disabled: c.value <= 0.5
507
507
  }, {
508
- default: T(() => [
509
- f(z(Ie))
508
+ default: H(() => [
509
+ f(I(Ie))
510
510
  ]),
511
511
  _: 1
512
512
  }, 8, ["disabled"]),
513
- f(F, {
513
+ f(N, {
514
514
  size: "small",
515
515
  onClick: _e
516
516
  }, {
517
- default: T(() => [
518
- ze(P(Math.round(o.value * 100)) + "% ", 1)
517
+ default: H(() => [
518
+ ze(F(Math.round(c.value * 100)) + "% ", 1)
519
519
  ]),
520
520
  _: 1
521
521
  }),
522
- f(F, {
522
+ f(N, {
523
523
  size: "small",
524
- onClick: Ve,
525
- disabled: o.value >= 10
524
+ onClick: Ue,
525
+ disabled: c.value >= 10
526
526
  }, {
527
- default: T(() => [
528
- f(z(Ee))
527
+ default: H(() => [
528
+ f(I(Ee))
529
529
  ]),
530
530
  _: 1
531
531
  }, 8, ["disabled"])
532
532
  ]),
533
- f(F, {
533
+ f(N, {
534
534
  size: "small",
535
- onClick: t[0] || (t[0] = (l) => $.value = !1),
535
+ onClick: t[0] || (t[0] = (l) => z.value = !1),
536
536
  type: "danger"
537
537
  }, {
538
- default: T(() => [
539
- f(z(fe))
538
+ default: H(() => [
539
+ f(I(fe))
540
540
  ]),
541
541
  _: 1
542
542
  })
543
543
  ]),
544
- S.value ? (i(), d("div", Mt, "双击重置 · 轻触关闭")) : H("", !0)
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: p.value,
551
- "onUpdate:visible": t[5] || (t[5] = (l) => p.value = l),
552
- width: S.value ? "95vw" : "90vw",
553
- fullscreen: S.value,
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: T(() => [
558
+ default: H(() => [
559
559
  a("div", {
560
560
  class: "mermaid-preview-container",
561
- onClick: t[4] || (t[4] = Z((l) => p.value = !1, ["self"]))
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: U.value,
565
+ innerHTML: T.value,
566
566
  style: ve({
567
- transform: `translate(${_.value.x}px, ${_.value.y}px) scale(${A.value})`
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(F, {
576
+ f(N, {
577
577
  size: "small",
578
578
  onClick: qe,
579
- disabled: A.value <= 0.5
579
+ disabled: S.value <= 0.5
580
580
  }, {
581
- default: T(() => [
582
- f(z(Ie))
581
+ default: H(() => [
582
+ f(I(Ie))
583
583
  ]),
584
584
  _: 1
585
585
  }, 8, ["disabled"]),
586
- f(F, {
586
+ f(N, {
587
587
  size: "small",
588
588
  onClick: $e
589
589
  }, {
590
- default: T(() => [
591
- ze(P(Math.round(A.value * 100)) + "% ", 1)
590
+ default: H(() => [
591
+ ze(F(Math.round(S.value * 100)) + "% ", 1)
592
592
  ]),
593
593
  _: 1
594
594
  }),
595
- f(F, {
595
+ f(N, {
596
596
  size: "small",
597
597
  onClick: Ze,
598
- disabled: A.value >= 10
598
+ disabled: S.value >= 10
599
599
  }, {
600
- default: T(() => [
601
- f(z(Ee))
600
+ default: H(() => [
601
+ f(I(Ee))
602
602
  ]),
603
603
  _: 1
604
604
  }, 8, ["disabled"])
605
605
  ]),
606
- f(F, {
606
+ f(N, {
607
607
  size: "small",
608
- onClick: t[3] || (t[3] = (l) => p.value = !1),
608
+ onClick: t[3] || (t[3] = (l) => x.value = !1),
609
609
  type: "danger"
610
610
  }, {
611
- default: T(() => [
612
- f(z(fe))
611
+ default: H(() => [
612
+ f(I(fe))
613
613
  ]),
614
614
  _: 1
615
615
  })
616
616
  ]),
617
- S.value ? (i(), d("div", $t, "双击重置 · 轻触关闭")) : H("", !0)
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__ */ le(xt, [["__scopeId", "data-v-3b421627"]]), St = {
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" }, Vt = { class: "file-name" }, Ut = { class: "file-type" }, Yt = { class: "file-actions" }, Wt = {
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
- }, Ot = { class: "audio-player" }, Xt = { class: "audio-info" }, Zt = { class: "audio-progress" }, qt = { class: "progress-bar" }, jt = { class: "audio-time" }, Kt = { class: "image-preview-container" }, Gt = ["src"], Jt = {
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__ */ J({
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 u = n, M = O(() => {
653
+ const p = n, k = X(() => {
654
654
  try {
655
- return u.message.metadata ? JSON.parse(u.message.metadata) : {};
655
+ return p.message.metadata ? JSON.parse(p.message.metadata) : {};
656
656
  } catch {
657
657
  return {};
658
658
  }
659
- }), c = O(
660
- () => M.value.imageUrls || []
661
- ), $ = O(() => M.value.fileUrls || []), b = O(() => M.value.audioUrl), x = O(() => u.message.attachments && u.message.attachments.length > 0 ? u.message.attachments : M.value.attachments && Array.isArray(M.value.attachments) ? M.value.attachments : []), p = C(!1), U = C(""), S = C(0), o = C(!1), k = C(!1), L = C(0), B = C(0), A = O(() => B.value > 0 ? L.value / B.value * 100 : 0);
662
- let _ = null;
663
- const oe = (m, h) => {
664
- U.value = m, S.value = h, p.value = !0;
665
- }, Q = () => {
666
- S.value > 0 && (S.value--, U.value = c.value[S.value]);
667
- }, ee = () => {
668
- S.value < c.value.length - 1 && (S.value++, U.value = c.value[S.value]);
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
- }, te = (m) => {
673
+ }, ae = (m) => {
674
674
  try {
675
- const y = new URL(m).pathname, E = y.substring(y.lastIndexOf("/") + 1);
676
- return decodeURIComponent(E) || "Unknown File";
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 E;
682
- return ((E = te(m).split(".").pop()) == null ? void 0 : E.toUpperCase()) || "FILE";
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 = te(m), h.target = "_blank", document.body.appendChild(h), h.click(), document.body.removeChild(h);
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 (b.value)
694
+ if ($.value)
695
695
  try {
696
- _ || (_ = new Audio(), _.src = b.value, _.addEventListener("loadedmetadata", () => {
697
- B.value = (_ == null ? void 0 : _.duration) || 0;
698
- }), _.addEventListener("timeupdate", () => {
699
- L.value = (_ == null ? void 0 : _.currentTime) || 0;
700
- }), _.addEventListener("ended", () => {
701
- o.value = !1, L.value = 0;
702
- }), _.addEventListener("error", (m) => {
703
- console.error("Audio playback error:", m), k.value = !1, o.value = !1;
704
- })), o.value ? (_.pause(), o.value = !1) : (k.value = !0, await _.play(), o.value = !0, k.value = !1);
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), k.value = !1, o.value = !1;
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"], E = Math.floor(Math.log(m) / Math.log(h));
714
- return (m / Math.pow(h, E)).toFixed(2) + y[E];
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
- p.value && (m.key === "ArrowLeft" ? Q() : m.key === "ArrowRight" ? ee() : m.key === "Escape" && (p.value = !1));
719
+ x.value && (m.key === "ArrowLeft" ? te() : m.key === "ArrowRight" ? se() : m.key === "Escape" && (x.value = !1));
720
720
  };
721
- return ae(p, (m) => {
721
+ return J(x, (m) => {
722
722
  m ? document.addEventListener("keydown", K) : document.removeEventListener("keydown", K);
723
723
  }), Re(() => {
724
- _ && (_.pause(), _ = null), document.removeEventListener("keydown", K);
725
- }), (m, h) => (i(), d("div", {
726
- class: ne(["multimodal-message", { "is-user": n.isUser, "is-assistant": !n.isUser }])
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 ? (i(), d("div", St, [
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
- ])) : H("", !0),
734
- c.value && c.value.length > 0 ? (i(), d("div", zt, [
733
+ ])) : D("", !0),
734
+ i.value && i.value.length > 0 ? (o(), u("div", zt, [
735
735
  a("div", {
736
- class: ne(["images-grid", `grid-${Math.min(c.value.length, 4)}`])
736
+ class: le(["images-grid", `grid-${Math.min(i.value.length, 4)}`])
737
737
  }, [
738
- (i(!0), d(ue, null, me(c.value.slice(0, 4), (y, E) => (i(), d("div", {
739
- key: E,
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: (W) => oe(y, E)
741
+ onClick: (O) => ee(y, B)
742
742
  }, [
743
743
  a("img", {
744
744
  src: y,
745
- alt: `图片 ${E + 1}`,
746
- onError: (W) => q(W, y),
745
+ alt: `图片 ${B + 1}`,
746
+ onError: (O) => q(O, y),
747
747
  loading: "lazy"
748
748
  }, null, 40, Et),
749
- E === 3 && c.value.length > 4 ? (i(), d("div", It, " +" + P(c.value.length - 4), 1)) : H("", !0)
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
- ])) : H("", !0),
753
- x.value && x.value.length > 0 ? (i(), d("div", Bt, [
754
- (i(!0), d(ue, null, me(x.value, (y, E) => (i(), d("div", {
755
- key: E,
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(z(Be), { class: "file-icon" })
759
+ f(I(Be), { class: "file-icon" })
760
760
  ]),
761
761
  a("div", Tt, [
762
- a("span", Ht, P(y.name), 1),
763
- a("span", Dt, P(we(y.name)) + "   " + P(ye(y.size)), 1)
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
- ])) : H("", !0),
767
- $.value && $.value.length > 0 ? (i(), d("div", Rt, [
768
- (i(!0), d(ue, null, me($.value, (y, E) => (i(), d("div", {
769
- key: E,
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: (W) => j(y)
771
+ onClick: (O) => j(y)
772
772
  }, [
773
773
  a("div", Ft, [
774
- f(z(Be), { class: "file-icon" })
774
+ f(I(Be), { class: "file-icon" })
775
775
  ]),
776
776
  a("div", Nt, [
777
- a("span", Vt, P(te(y)), 1),
778
- a("span", Ut, P(ge(y)), 1)
777
+ a("span", Ut, F(ae(y)), 1),
778
+ a("span", Yt, F(ge(y)), 1)
779
779
  ]),
780
- a("div", Yt, [
781
- f(F, {
780
+ a("div", Wt, [
781
+ f(N, {
782
782
  size: "small",
783
783
  type: "text",
784
- onClick: Z((W) => ie(y), ["stop"])
784
+ onClick: Z((O) => ie(y), ["stop"])
785
785
  }, {
786
- default: T(() => [
787
- f(z(Ae))
786
+ default: H(() => [
787
+ f(I(Ae))
788
788
  ]),
789
789
  _: 1
790
790
  }, 8, ["onClick"])
791
791
  ])
792
792
  ], 8, Pt))), 128))
793
- ])) : H("", !0),
794
- b.value ? (i(), d("div", Wt, [
795
- a("div", Ot, [
796
- f(F, {
793
+ ])) : D("", !0),
794
+ $.value ? (o(), u("div", Ot, [
795
+ a("div", Xt, [
796
+ f(N, {
797
797
  onClick: pe,
798
- loading: k.value,
798
+ loading: d.value,
799
799
  circle: "",
800
800
  size: "small",
801
801
  class: "play-btn"
802
802
  }, {
803
- default: T(() => [
804
- (i(), G(Pe(o.value ? z(vt) : z(mt))))
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", Xt, [
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: A.value + "%" })
813
+ style: ve({ width: S.value + "%" })
814
814
  }, null, 4)
815
815
  ])
816
816
  ]),
817
817
  a("div", jt, [
818
- a("span", null, P(he(L.value)), 1),
818
+ a("span", null, F(he(M.value)), 1),
819
819
  h[4] || (h[4] = a("span", null, "/", -1)),
820
- a("span", null, P(he(B.value)), 1)
820
+ a("span", null, F(he(L.value)), 1)
821
821
  ])
822
822
  ]),
823
- f(F, {
824
- onClick: h[0] || (h[0] = (y) => ie(b.value)),
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: T(() => [
830
- f(z(Ae))
829
+ default: H(() => [
830
+ f(I(Ae))
831
831
  ]),
832
832
  _: 1
833
833
  })
834
834
  ])
835
- ])) : H("", !0),
835
+ ])) : D("", !0),
836
836
  f(Me, {
837
- visible: p.value,
838
- "onUpdate:visible": h[3] || (h[3] = (y) => p.value = 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: T(() => [
844
+ default: H(() => [
845
845
  a("div", Kt, [
846
846
  a("img", {
847
- src: U.value,
847
+ src: T.value,
848
848
  alt: "预览图片",
849
849
  class: "preview-image",
850
- onClick: h[1] || (h[1] = (y) => p.value = !1)
850
+ onClick: h[1] || (h[1] = (y) => x.value = !1)
851
851
  }, null, 8, Gt),
852
- c.value && c.value.length > 1 ? (i(), d("div", Jt, [
853
- f(F, {
854
- onClick: Q,
855
- disabled: S.value === 0,
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: T(() => [
860
- f(z(gt))
859
+ default: H(() => [
860
+ f(I(gt))
861
861
  ]),
862
862
  _: 1
863
863
  }, 8, ["disabled"]),
864
- a("span", Qt, P(S.value + 1) + " / " + P(c.value.length), 1),
865
- f(F, {
866
- onClick: ee,
867
- disabled: S.value === c.value.length - 1,
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: T(() => [
872
- f(z(ht))
871
+ default: H(() => [
872
+ f(I(ht))
873
873
  ]),
874
874
  _: 1
875
875
  }, 8, ["disabled"])
876
- ])) : H("", !0),
877
- f(F, {
878
- onClick: h[2] || (h[2] = (y) => p.value = !1),
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: T(() => [
883
- f(z(fe))
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__ */ le(es, [["__scopeId", "data-v-8a954827"]]), ts = {
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__ */ J({
905
+ }, ds = { class: "step-name" }, us = /* @__PURE__ */ Q({
906
906
  __name: "AgentSteps",
907
907
  props: {
908
908
  steps: {}
909
909
  },
910
- setup(n) {
911
- const u = n, M = C(!0), c = O(
912
- () => u.steps.some((b) => b.status === "running")
913
- ), $ = O(() => {
914
- const b = u.steps.find((p) => p.status === "running");
915
- if (b)
916
- return `正在${b.displayName}...`;
917
- const x = u.steps.filter(
918
- (p) => p.status === "completed"
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 x === u.steps.length ? "处理完成" : `已完成 ${x}/${u.steps.length} 个步骤`;
925
+ return _ === k.steps.length ? "处理完成" : `已完成 ${_}/${k.steps.length} 个步骤`;
921
926
  });
922
- return (b, x) => n.steps.length > 0 ? (i(), d("div", ts, [
927
+ return (T, _) => n.steps.length > 0 ? (o(), u("div", ts, [
923
928
  a("div", {
924
929
  class: "steps-header",
925
- onClick: x[0] || (x[0] = (p) => M.value = !M.value)
930
+ onClick: $
926
931
  }, [
927
932
  a("div", ss, [
928
- c.value ? (i(), d("div", as, [
929
- f(z(Te))
930
- ])) : (i(), d("div", ns, [
931
- f(z(He))
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, P($.value), 1),
939
+ a("span", ls, F(x.value), 1),
935
940
  a("div", os, [
936
- (i(), G(Pe(M.value ? z(ft) : z(pt))))
941
+ (o(), G(Pe(i.value ? I(ft) : I(pt))))
937
942
  ])
938
943
  ]),
939
944
  at(a("div", is, [
940
- (i(!0), d(ue, null, me(n.steps, (p) => (i(), d("div", {
941
- key: p.name,
942
- class: ne(["step-item", {
943
- "is-running": p.status === "running",
944
- "is-completed": p.status === "completed",
945
- "is-error": p.status === "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
- p.status === "running" ? (i(), G(z(Te), {
954
+ c.status === "running" ? (o(), G(I(Te), {
950
955
  key: 0,
951
956
  class: "icon-spin"
952
- })) : p.status === "completed" ? (i(), G(z(He), { key: 1 })) : p.status === "error" ? (i(), G(z(fe), { key: 2 })) : (i(), d("div", cs))
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, P(p.displayName), 1)
959
+ a("span", ds, F(c.displayName), 1)
955
960
  ], 2))), 128))
956
961
  ], 512), [
957
- [nt, M.value]
962
+ [nt, i.value]
958
963
  ])
959
- ])) : H("", !0);
964
+ ])) : D("", !0);
960
965
  }
961
- }), Ne = /* @__PURE__ */ le(us, [["__scopeId", "data-v-eaae06ac"]]), ms = { class: "chat-message-list-root" }, vs = {
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: "cm-welcome-center" }, fs = { class: "welcome-logo" }, ps = ["src"], ys = {
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__ */ J({
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: "100px" },
1003
+ contentPaddingBottom: { default: "140px" },
999
1004
  showBackground: { type: Boolean, default: !0 }
1000
1005
  },
1001
1006
  emits: ["copy", "scroll", "scroll-bottom"],
1002
- setup(n, { expose: u, emit: M }) {
1003
- const c = n, $ = M, b = C(null), x = C(!1), p = async (o = "smooth") => {
1004
- await de(), b.value && b.value.scrollTo({
1005
- top: b.value.scrollHeight,
1006
- behavior: o
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
- }, U = (o) => {
1009
- $("scroll", o);
1010
- const k = o.target;
1011
- if (!k) return;
1012
- const { scrollTop: L, scrollHeight: B, clientHeight: A } = k;
1013
- B - L - A < 50 ? (x.value = !1, $("scroll-bottom")) : c.isStreaming && (x.value = !0);
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
- ae(
1016
- () => c.messages.length,
1017
- async () => {
1018
- c.autoScroll && !x.value && p();
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
- ), ae(
1025
+ ), J(
1021
1026
  () => {
1022
- var o;
1023
- return (o = c.messages[c.messages.length - 1]) == null ? void 0 : o.content;
1027
+ var d;
1028
+ return (d = i.messages[i.messages.length - 1]) == null ? void 0 : d.content;
1024
1029
  },
1025
- async (o, k) => {
1026
- c.isStreaming && c.autoScroll && !x.value && o && k && o.length > k.length && b.value && (b.value.scrollTop = b.value.scrollHeight);
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
- ), ae(
1029
- () => c.isTyping,
1030
- (o) => {
1031
- o && c.autoScroll && p();
1039
+ ), J(
1040
+ () => i.isTyping,
1041
+ (d) => {
1042
+ d && i.autoScroll && x();
1032
1043
  }
1033
1044
  );
1034
- const S = (o) => {
1035
- $("copy", o), navigator.clipboard && o.content && navigator.clipboard.writeText(o.content);
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 u({
1038
- scrollToBottom: p,
1039
- containerRef: b
1040
- }), (o, k) => (i(), d("div", ms, [
1041
- n.showBackground ? (i(), d("div", vs)) : H("", !0),
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: b,
1046
- onScroll: U,
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 ? (i(), d("div", gs, [
1053
- be(o.$slots, "welcome", {}, () => [
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 ? (i(), d("img", {
1077
+ n.appLogo ? (o(), u("img", {
1057
1078
  key: 0,
1058
1079
  src: n.appLogo,
1059
1080
  alt: "Logo"
1060
- }, null, 8, ps)) : (i(), d("div", ys, [...k[0] || (k[0] = [
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, P(n.appName), 1),
1074
- k[1] || (k[1] = a("p", { class: "welcome-desc" }, "今天有什么可以帮您?", -1))
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
- ])) : (i(), d("div", ks, [
1078
- (i(!0), d(ue, null, me(n.messages, (L, B) => (i(), d("div", {
1079
- key: L.id || B,
1080
- class: ne([
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" ? (i(), d("div", Ms, [
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
- ])) : (i(), d("div", Cs, [
1091
- n.showAgentSteps && B === n.messages.length - 1 && n.agentSteps && n.agentSteps.length > 0 ? (i(), G(Ne, {
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
- }, null, 8, ["steps"])) : H("", !0),
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 && B === n.messages.length - 1
1121
+ "is-streaming": n.isStreaming && S === n.messages.length - 1
1100
1122
  }, null, 8, ["message", "is-streaming"])
1101
1123
  ]),
1102
- L.content && !(n.isStreaming && B === n.messages.length - 1) ? (i(), d("div", _s, [
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: (A) => S(L),
1127
+ onClick: (C) => _(L),
1106
1128
  title: "复制"
1107
- }, [...k[2] || (k[2] = [
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
- ])) : H("", !0)
1142
+ ])) : D("", !0)
1121
1143
  ]))
1122
1144
  ], 2))), 128)),
1123
- n.isTyping ? (i(), d("div", xs, [...k[3] || (k[3] = [
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
- ])])) : H("", !0)
1157
+ ])])) : D("", !0)
1136
1158
  ]))
1137
1159
  ], 36)
1138
1160
  ]));
1139
1161
  }
1140
- }), zs = /* @__PURE__ */ le(Ss, [["__scopeId", "data-v-bbd7bdf6"]]), As = {
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
  }