@somecat/ai-assist-sdk 1.3.5 → 1.3.7

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,6 +1,6 @@
1
- import { defineComponent as be, ref as p, watch as ae, nextTick as pe, onUnmounted as Re, openBlock as r, createElementBlock as f, normalizeClass as oe, createElementVNode as o, toDisplayString as Z, createVNode as se, Transition as kn, withCtx as Cn, unref as W, createCommentVNode as J, computed as P, Fragment as ye, renderList as Me, reactive as ke, createStaticVNode as _n, withModifiers as we, createBlock as he, Teleport as Bt, onMounted as _e, onBeforeUnmount as Wt, withDirectives as xe, withKeys as lt, vModelText as Nt, shallowRef as bn, normalizeStyle as ot, createTextVNode as An, vShow as Ye, createApp as Sn } from "vue";
2
- import { a as Yt, r as rt, p as ct, u as Dn, V as Fe, c as Tt, g as En, o as Mn, s as Tn, b as xt, e as Rt, d as xn, f as Rn, h as $n, i as Ge, j as Hn, l as Ln, k as Pn, m as On, n as Bn, q as Wn, t as vt, w as Nn, v as Yn, x as Vn, y as Vt } from "../chunks/index-BND0wsLs.mjs";
3
- import { t as ut, r as Xn, f as Fn, i as Qn, s as Gn, a as qn, S as zn, b as Jn, c as Ee, d as Kn, e as Xt, g as jn, h as Un, m as Zn } from "../chunks/index-BIUOuQxJ.mjs";
1
+ import { defineComponent as be, ref as f, watch as ie, nextTick as pe, onUnmounted as Re, openBlock as r, createElementBlock as g, normalizeClass as ae, createElementVNode as o, toDisplayString as Z, createVNode as oe, Transition as kn, withCtx as Cn, unref as W, createCommentVNode as z, computed as P, Fragment as ye, renderList as De, reactive as ke, createStaticVNode as _n, withModifiers as we, createBlock as he, Teleport as Bt, onMounted as _e, onBeforeUnmount as Wt, withDirectives as xe, withKeys as lt, vModelText as Nt, shallowRef as bn, normalizeStyle as ot, createTextVNode as An, vShow as Ye, createApp as Sn } from "vue";
2
+ import { a as Yt, r as rt, p as ct, u as Tn, V as Fe, c as Mt, g as En, o as Dn, s as Mn, b as xt, e as Rt, d as xn, f as Rn, h as $n, i as Qe, j as Hn, l as Ln, k as Pn, m as On, n as Bn, q as Wn, t as vt, w as Nn, v as Yn, x as Vn, y as Vt } from "../chunks/index-BND0wsLs.mjs";
3
+ import { t as ut, r as Xn, f as Fn, i as Gn, s as Qn, a as qn, S as Kn, b as zn, c as Ee, d as Jn, e as Xt, g as jn, h as Un, m as Zn } from "../chunks/index-BIUOuQxJ.mjs";
4
4
  import { SearchOutlined as Ft, BulbOutlined as In, CheckOutlined as es, CopyOutlined as ts, RedoOutlined as ns, CloseOutlined as ss } from "@ant-design/icons-vue";
5
5
  import { Icon as me } from "@iconify/vue";
6
6
  const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACQNJREFUeF7lmwuMlFcVx3/nY1lYYAEX6FJ22fIIUMvDUEAaqA9aSWqCL6oRaQlPoVbUKthqNdZGY6rtsoYaKwSBhhYbU5tYSWykVvDRWgq2AUp4WGCXXSiwPMpz2d2Z65z57rc7+83sPHbv0pq5yWSSmfude+7/3Hven9DFwxgzCPg4MBYYA4wGBgLF9qMcXLSfeuAgcAB4G/i7iJzuShalK4gbYybFNjIXmAmMAzq6jgH2AltjwG0WkV2u+e0oY0l8GGNUokuBRcAtrhm19PYB64G1IqKnptOj0wAYY/oDDwDfBD7UaY6yI3AOWA38UkTOZ/dI6lkdBsAYo88uAH4O6D1/P4bqh4eAjSKi1yXn0SEAjDEVeidjd3N6zit2zQP/Up0jIjW5ks8ZAGOMbvoF4IZcF+vi+aeA2SKiYGQ9cgLAGKMK7imgMOsVru/ERuBrIqKKMquRFQDGmG7A48C3s6L6/k+qAr4rIpFMrGQEwG5ej/xnMxH7gP3/or0SaUHIBoBV/0eSD8ugSkS+k04waQGwd/63HzDJ5srO4nQ6oV0ArLZ/xbXCOwv81xiOG7hkfeTeMdduiMAoka7wpFQx3tGedUgJgLXzb7g0dc3Aq82Gg0YwRn0W/ejy1n8xIJ4wWmBagVCQq5zTz1cTOSWVn5AEgPXw/uHSyWkAtjQYTkdNy36T+A2wEBjkCZ/pKfRwC4L6Bx8Le4ypAFhoAw5ny//xKtQ0RREJpJ+ZdEWB8LleGXV0ZkJtZywSkQ2JP7VZwQY2Go878+33NMLLl6MIgsHEv3XoNWgDiIj+CPptL8edvYXxbl0ujR1GJwZQYQB+HOPtkVxhbW++3u41Zw0XI/7GEwFouf6WgzAgOr+4GywtCSBzxRWPxoDXfbYAHUhE4/lqlyFtbRM8c8ZXckkSDyEQOgAtOvLeAUJ5d2ebV0IaSt8U5BNaToAxZgXwhMul/nkRtr2XGoDg+Ot3qhHYiE/2E25X0bgdK0WkMrhqgYQ0B+c0k7PlLOy82E6YnmQFW69JnDGrMKf09ZhV4nb3wD4R0Rylr5FsDm+n62WeOwl7L2WXp0iwgr5ALHNj+whzSl1zFqc3WXOMAQB6HNL6zB1hYfMJ2H0hOwCS6FtEJvQV5t7YkdUzPrMqpgdWBADsBsZnfCTHCZtqFQD/oWSzlyDmRJEHeFkAPtJPmFee48LZTd8jIhPE5u1PdiJ13e5yG2vgrfOpT0BYCSaZQasDJvYX5msCzv1QxkoVgLtjufvn3dOH9UfhzXMhkbbnCIUZsCfg1hJh0bCu4C5O84sKwI9i0n/UxRLbTumGYe4wKO0B6w7DTusHhJVcayCU3t2dVAJLRsKFZthSB+P6w4R+LriN03hEAXjWVnE6TfUbb0BDM9xVBndXwJqDsFPj3xQ6IOMVsJ7jlAHCstHwYi386Rj06Q5VkzvNakBgswKgYa8Tkgs13jJwx40wbyT8ej/sqPevQJIrnOUepgyE+2+GTYfhleO+ptrgLhm/UwE4EissOLll87b7AHyqDOaPgl/tg9dtabM9O9+iIkOOUeAJTL0Blt8CTx+Cl+v8YGnTJ7JEL/O0owqAVmQHZJ6becZX/urf7JnlsHAMrN4Lr6l96cS4rRS+NQ42HIC/1Pr0N9/ZCYJtHz2jAFxzlfaa87fWE7BkDPxmP2w7EegAP9KNJ4MSckGBCkw6AJbRGUPgvpth3QHYWgeewO9mOAOg0SkAX30V3ms0TB0krBgLzx2BF6pTm8GklFg4PrZ7nH0TzBkOlW/716lvIayb5hYAZ1dg5S6ovgwji+Gxib4FeGyPVYJt8x1JZ6A9R+j74wU1hQ/9Bw5fgoreUKndB25G/Ao4U4JPHoRtJw3dRFh3G/TwYPHrcDVic4EJOdAk/lNoyaICYf1UaIjAkh0QiRpmDBaWj3Kz+1h1O64EnZnB187AL/b7El82UrhrMDxbDc/XpsgChxMiKUKDLw0V5lbAS+/Cmnd8uivHCNO1wcbNiJtBZ45QQxQW74LLzYaSQuGpiaDCX7EbTjSEY4K2ai9IBwZKckiRR+UEKBC4700422joUyCsmwQ9PTe7j7fduHSFla3f18Ezx6JxDmcNFpYOE45egR/sM1xsbgUhXUaoOFYX+OmHYVgvWHvUsOVdtf9wT7nHl8ucbV4JxV1hp8GQnoL79xpOq8QFllV4zCqFugb42SFDzdX0+YGKIuHhUUJZT9hyEtZU+2CW9hCeHC8UuZO+ko0HQ5oCdxoOH7oMDx4wNEb8WsDswcKCct/i//mUYWu94dCVeIDQkgYf1QtmDvL4tE3Ib6w1/OFENP5/gSc8PkYYrTU0d8MPh5WeMcZ5QmT7OUPlEUOTvdQjioT5ZR4ftZHcpQjUa9VOmwYLoY92IAA7LsDTdYYj9qQUiPDgcOF2bcVyO/yEiAWgS1Jib12CnxyOcjmhLjCo0GNqXxheBCXd/VNxtkk3DP++YKhvbL0iqgu+N8xjkvussC7bJiWmroXzpKiuUt8Ea48btp2Ptjp/KVzhsHCn9xOWl3uUOK6SJqzTmhS1p8B5WjxxUwevwkvnDNvPR7nQ3FoWC+oC6gn26+4xrRg+P9BjRE+35z1ErW1a3ALgvDCSaguq0483Qs01Q1Wd4VxzlJFFwg+HdmOo2zpgOgRTFkacl8YyyXDBO9E4ELf2EZ6ocGvf0qydujRmT4HT4mgmAOYdjnDsWpRJvT0qK6wZyPRQ5/9PXRy1AKixcVoeT8fvvUciHGs0cQBWlV+XE5C+PG5BcN4g0R4I91RHqGmMMrmXR1XZdTkB6RskLABqnJ21yKg/U3U6Qq02CQXxj0XkwDXDtag6QcIILYEnhMuFnjC/vzCxyFmXSHYtMhYErcU4aZLafsXw8MnmFq83iPbCpyLcH6Dz9GSsHuzkZGTfJBUw5qpN7nQEvn6imWNNagATRJyiJSbxgHRHeGCAxxeKO60bcm+TSwBBm6Pzs1EyAYT8bZW1+kAvYf42SyeAkJ/t8onaOm9fmAiBkL+vzCQoxvx9aSoBBDXq+fnaXOhK5OeLk2FXNm9fnU0V6eXly9Pthbwf9Nfn/wcCtr9y4amOcAAAAABJRU5ErkJggg==", as = { class: "thinking-block__title" }, is = ["innerHTML"], ls = /* @__PURE__ */ be({
@@ -11,12 +11,12 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
11
11
  messageDone: { type: Boolean }
12
12
  },
13
13
  setup(n) {
14
- const _ = n, s = p(!!_.isStreaming || !!_.messageDone);
14
+ const C = n, s = f(!!C.isStreaming || !!C.messageDone);
15
15
  let c = 0;
16
- function i(L = 600) {
16
+ function i(O = 600) {
17
17
  clearTimeout(c), c = window.setTimeout(() => {
18
18
  c = 0, s.value = !1;
19
- }, L);
19
+ }, O);
20
20
  }
21
21
  function h() {
22
22
  c && (clearTimeout(c), c = 0);
@@ -24,42 +24,42 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
24
24
  function l() {
25
25
  h(), s.value = !s.value;
26
26
  }
27
- ae(
28
- () => _.isStreaming,
29
- (L) => {
30
- L ? (h(), s.value = !0) : _.messageDone || i();
27
+ ie(
28
+ () => C.isStreaming,
29
+ (O) => {
30
+ O ? (h(), s.value = !0) : C.messageDone || i();
31
31
  },
32
32
  { immediate: !0 }
33
- ), ae(
34
- () => _.messageDone,
35
- (L) => {
36
- L && (h(), s.value = !0);
33
+ ), ie(
34
+ () => C.messageDone,
35
+ (O) => {
36
+ O && (h(), s.value = !0);
37
37
  },
38
38
  { immediate: !0 }
39
39
  );
40
- const a = p(null);
40
+ const a = f(null);
41
41
  let u = !1;
42
42
  function y() {
43
- const L = a.value;
44
- if (!L) return;
45
- u = L.scrollHeight - L.scrollTop - L.clientHeight > 12;
43
+ const O = a.value;
44
+ if (!O) return;
45
+ u = O.scrollHeight - O.scrollTop - O.clientHeight > 12;
46
46
  }
47
47
  function w() {
48
- const L = a.value;
49
- !L || !s.value || u || (L.scrollTop = L.scrollHeight);
48
+ const O = a.value;
49
+ !O || !s.value || u || (O.scrollTop = O.scrollHeight);
50
50
  }
51
- function R() {
52
- _.isStreaming && w();
51
+ function $() {
52
+ C.isStreaming && w();
53
53
  }
54
- return ae(
55
- () => _.content,
54
+ return ie(
55
+ () => C.content,
56
56
  () => {
57
- _.isStreaming && pe(w);
57
+ C.isStreaming && pe(w);
58
58
  }
59
59
  ), Re(() => {
60
60
  h();
61
- }), (L, q) => (r(), f("div", {
62
- class: oe(["thinking-block", {
61
+ }), (O, q) => (r(), g("div", {
62
+ class: ae(["thinking-block", {
63
63
  "thinking-block--expanded": s.value,
64
64
  "thinking-block--active": n.isStreaming
65
65
  }])
@@ -70,8 +70,8 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
70
70
  }, [
71
71
  q[1] || (q[1] = o("span", { class: "thinking-block__indicator" }, null, -1)),
72
72
  o("span", as, Z(n.isStreaming ? "深度思考中" : "深度思考"), 1),
73
- (r(), f("svg", {
74
- class: oe(["thinking-block__arrow", { "thinking-block__arrow--down": s.value }]),
73
+ (r(), g("svg", {
74
+ class: ae(["thinking-block__arrow", { "thinking-block__arrow--down": s.value }]),
75
75
  viewBox: "0 0 24 24",
76
76
  width: "14",
77
77
  height: "14",
@@ -84,12 +84,12 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
84
84
  o("polyline", { points: "6 9 12 15 18 9" }, null, -1)
85
85
  ])], 2))
86
86
  ]),
87
- se(kn, {
87
+ oe(kn, {
88
88
  name: "thinking-expand",
89
- onAfterEnter: R
89
+ onAfterEnter: $
90
90
  }, {
91
91
  default: Cn(() => [
92
- s.value ? (r(), f("div", {
92
+ s.value ? (r(), g("div", {
93
93
  key: 0,
94
94
  ref_key: "contentRef",
95
95
  ref: a,
@@ -98,9 +98,9 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
98
98
  }, [
99
99
  o("div", {
100
100
  class: "thinking-block__markdown",
101
- innerHTML: W(Yt)(W(rt)(W(ct)(_.content)), n.isStreaming)
101
+ innerHTML: W(Yt)(W(rt)(W(ct)(C.content)), n.isStreaming)
102
102
  }, null, 8, is)
103
- ], 544)) : J("", !0)
103
+ ], 544)) : z("", !0)
104
104
  ]),
105
105
  _: 1
106
106
  })
@@ -150,30 +150,30 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
150
150
  steps: {}
151
151
  },
152
152
  setup(n) {
153
- const _ = n, s = P(() => _.steps.some((h) => h.state !== "done")), c = P(
154
- () => _.steps.reduce((h, l) => h + (l.duration ?? 0), 0)
153
+ const C = n, s = P(() => C.steps.some((h) => h.state !== "done")), c = P(
154
+ () => C.steps.reduce((h, l) => h + (l.duration ?? 0), 0)
155
155
  );
156
156
  function i(h) {
157
157
  return h == null || h <= 0 ? "" : h < 1 ? `${Math.round(h * 1e3)}ms` : h < 60 ? `${h.toFixed(1)}s` : `${Math.floor(h / 60)}m${Math.round(h % 60)}s`;
158
158
  }
159
- return (h, l) => (r(), f("div", {
160
- class: oe(["step-block", { "step-block--active": s.value }])
159
+ return (h, l) => (r(), g("div", {
160
+ class: ae(["step-block", { "step-block--active": s.value }])
161
161
  }, [
162
- n.steps.length > 1 ? (r(), f("div", us, [
162
+ n.steps.length > 1 ? (r(), g("div", us, [
163
163
  l[0] || (l[0] = o("span", { class: "step-block__indicator" }, null, -1)),
164
164
  l[1] || (l[1] = o("span", { class: "step-block__title" }, "执行步骤", -1)),
165
- s.value ? J("", !0) : (r(), f("span", rs, Z(n.steps.length) + " 步", 1)),
166
- !s.value && c.value > 0 ? (r(), f("span", cs, Z(i(c.value)), 1)) : J("", !0)
167
- ])) : J("", !0),
165
+ s.value ? z("", !0) : (r(), g("span", rs, Z(n.steps.length) + " 步", 1)),
166
+ !s.value && c.value > 0 ? (r(), g("span", cs, Z(i(c.value)), 1)) : z("", !0)
167
+ ])) : z("", !0),
168
168
  o("ul", vs, [
169
- (r(!0), f(ye, null, Me(n.steps, (a, u) => (r(), f("li", {
169
+ (r(!0), g(ye, null, De(n.steps, (a, u) => (r(), g("li", {
170
170
  key: u,
171
- class: oe(["step-item", `step-item--${a.state}`])
171
+ class: ae(["step-item", `step-item--${a.state}`])
172
172
  }, [
173
173
  o("span", ds, [
174
- a.state === "done" ? (r(), f("svg", hs, [...l[2] || (l[2] = [
174
+ a.state === "done" ? (r(), g("svg", hs, [...l[2] || (l[2] = [
175
175
  o("polyline", { points: "20 6 9 17 4 12" }, null, -1)
176
- ])])) : a.state === "active" ? (r(), f("svg", ms, [...l[3] || (l[3] = [
176
+ ])])) : a.state === "active" ? (r(), g("svg", ms, [...l[3] || (l[3] = [
177
177
  o("circle", {
178
178
  cx: "12",
179
179
  cy: "12",
@@ -181,14 +181,14 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
181
181
  "stroke-dasharray": "42",
182
182
  "stroke-dashoffset": "14"
183
183
  }, null, -1)
184
- ])])) : (r(), f("span", gs))
184
+ ])])) : (r(), g("span", gs))
185
185
  ]),
186
186
  o("div", fs, [
187
187
  o("div", ps, [
188
188
  o("span", ys, Z(a.title || "处理中"), 1),
189
- a.state === "done" && a.duration != null && a.duration > 0 ? (r(), f("span", ws, Z(i(a.duration)), 1)) : J("", !0)
189
+ a.state === "done" && a.duration != null && a.duration > 0 ? (r(), g("span", ws, Z(i(a.duration)), 1)) : z("", !0)
190
190
  ]),
191
- a.content ? (r(), f("div", ks, Z(a.content), 1)) : J("", !0)
191
+ a.content ? (r(), g("div", ks, Z(a.content), 1)) : z("", !0)
192
192
  ])
193
193
  ], 2))), 128))
194
194
  ])
@@ -203,7 +203,7 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
203
203
  }, As = { class: "agent-thought__text" }, Ss = {
204
204
  key: 2,
205
205
  class: "agent-thought__duration"
206
- }, Ds = {
206
+ }, Ts = {
207
207
  key: 3,
208
208
  class: "agent-thought__duration"
209
209
  }, $t = /* @__PURE__ */ be({
@@ -214,15 +214,15 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
214
214
  duration: {}
215
215
  },
216
216
  setup(n) {
217
- function _(s) {
217
+ function C(s) {
218
218
  return s == null || s <= 0 ? "" : s < 1 ? `${Math.round(s * 1e3)}ms` : s < 60 ? `${s.toFixed(1)}s` : `${Math.floor(s / 60)}m${Math.round(s % 60)}s`;
219
219
  }
220
- return (s, c) => (r(), f("div", {
221
- class: oe(["agent-thought", { "agent-thought--done": n.isDone }])
220
+ return (s, c) => (r(), g("div", {
221
+ class: ae(["agent-thought", { "agent-thought--done": n.isDone }])
222
222
  }, [
223
- n.isDone ? (r(), f("span", _s, [
224
- se(W(Ft))
225
- ])) : (r(), f("span", bs, [...c[0] || (c[0] = [
223
+ n.isDone ? (r(), g("span", _s, [
224
+ oe(W(Ft))
225
+ ])) : (r(), g("span", bs, [...c[0] || (c[0] = [
226
226
  o("svg", {
227
227
  viewBox: "0 0 24 24",
228
228
  width: "14",
@@ -245,80 +245,80 @@ const os = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
245
245
  ], -1)
246
246
  ])])),
247
247
  o("span", As, Z(n.isDone ? "工具调用" : "工具调用中"), 1),
248
- n.isDone && (n.count ?? 0) > 1 ? (r(), f("span", Ss, "已调用 " + Z(n.count) + " 次", 1)) : J("", !0),
249
- n.isDone && (n.duration ?? 0) > 0 ? (r(), f("span", Ds, Z(_(n.duration)), 1)) : J("", !0)
248
+ n.isDone && (n.count ?? 0) > 1 ? (r(), g("span", Ss, "已调用 " + Z(n.count) + " 次", 1)) : z("", !0),
249
+ n.isDone && (n.duration ?? 0) > 0 ? (r(), g("span", Ts, Z(C(n.duration)), 1)) : z("", !0)
250
250
  ], 2));
251
251
  }
252
252
  });
253
- function Es(n, _, s) {
253
+ function Es(n, C, s) {
254
254
  const c = P(() => n().segments), i = P(() => ut(c.value)), h = P(() => !!n().streamed), l = P(() => {
255
- const $ = n().status;
256
- return $ === "stop" || $ === "error";
255
+ const H = n().status;
256
+ return H === "stop" || H === "error";
257
257
  }), a = Math.min(
258
258
  Math.max((s == null ? void 0 : s.initial) ?? 0, 0),
259
259
  ut(n().segments)
260
- ), u = p(n().streamed ? a : ut(n().segments));
261
- ae(u, ($) => {
262
- var K;
263
- return (K = s == null ? void 0 : s.onProgress) == null ? void 0 : K.call(s, $);
260
+ ), u = f(n().streamed ? a : ut(n().segments));
261
+ ie(u, (H) => {
262
+ var J;
263
+ return (J = s == null ? void 0 : s.onProgress) == null ? void 0 : J.call(s, H);
264
264
  });
265
- const y = p(0);
266
- let w = 0, R = 0;
267
- function L($) {
268
- u.value !== $ && (u.value = $);
265
+ const y = f(0);
266
+ let w = 0, $ = 0;
267
+ function O(H) {
268
+ u.value !== H && (u.value = H);
269
269
  }
270
270
  function q() {
271
271
  if (w) return;
272
- const $ = (K) => {
273
- if (R === 0) {
274
- R = K, w = requestAnimationFrame($);
272
+ const H = (J) => {
273
+ if ($ === 0) {
274
+ $ = J, w = requestAnimationFrame(H);
275
275
  return;
276
276
  }
277
- const e = Math.min(K - R, 100);
278
- R = K;
279
- const A = i.value, d = Gn(c.value, u.value), E = qn(u.value, A, y.value, e, d);
280
- if (y.value = E.frac, E.reveal !== u.value && (u.value = E.reveal, _ == null || _()), u.value >= A) {
281
- w = 0, R = 0;
277
+ const e = Math.min(J - $, 100);
278
+ $ = J;
279
+ const A = i.value, d = Qn(c.value, u.value), M = qn(u.value, A, y.value, e, d);
280
+ if (y.value = M.frac, M.reveal !== u.value && (u.value = M.reveal, C == null || C()), u.value >= A) {
281
+ w = 0, $ = 0;
282
282
  return;
283
283
  }
284
- w = requestAnimationFrame($);
284
+ w = requestAnimationFrame(H);
285
285
  };
286
- R = 0, w = requestAnimationFrame($);
286
+ $ = 0, w = requestAnimationFrame(H);
287
287
  }
288
- function T() {
288
+ function x() {
289
289
  w && (cancelAnimationFrame(w), w = 0);
290
290
  }
291
- ae(
291
+ ie(
292
292
  [h, i],
293
293
  () => {
294
294
  if (!h.value || l.value) {
295
- L(i.value);
295
+ O(i.value);
296
296
  return;
297
297
  }
298
298
  u.value < i.value && q();
299
299
  },
300
300
  { immediate: !0 }
301
- ), ae(l, ($) => {
302
- $ && h.value && L(i.value);
303
- }), ae(
301
+ ), ie(l, (H) => {
302
+ H && h.value && O(i.value);
303
+ }), ie(
304
304
  () => n().status,
305
- ($, K) => {
306
- $ === "rethinking" && K !== "rethinking" && (y.value = 0, L(0), i.value > 0 && q());
305
+ (H, J) => {
306
+ H === "rethinking" && J !== "rethinking" && (y.value = 0, O(0), i.value > 0 && q());
307
307
  }
308
- ), Re(T);
309
- const S = P(() => Xn(c.value, u.value)), z = P(
308
+ ), Re(x);
309
+ const E = P(() => Xn(c.value, u.value)), K = P(
310
310
  () => h.value ? Fn(c.value, u.value) : -1
311
311
  ), j = P(() => !h.value || u.value >= i.value);
312
- function C($) {
313
- return Qn(c.value, $, u.value);
312
+ function b(H) {
313
+ return Gn(c.value, H, u.value);
314
314
  }
315
- return { reveal: u, segmentContents: S, frontier: z, revealDone: j, isSegRevealed: C, stopLoop: T };
315
+ return { reveal: u, segmentContents: E, frontier: K, revealDone: j, isSegRevealed: b, stopLoop: x };
316
316
  }
317
- function Ms(n, _, s = zn) {
318
- const c = p(!1);
317
+ function Ds(n, C, s = Kn) {
318
+ const c = f(!1);
319
319
  let i = 0;
320
- return ae(
321
- [n, _],
320
+ return ie(
321
+ [n, C],
322
322
  () => {
323
323
  i && (clearTimeout(i), i = 0), c.value = !1, n.value && (i = window.setTimeout(() => {
324
324
  c.value = !0, i = 0;
@@ -329,7 +329,7 @@ function Ms(n, _, s = zn) {
329
329
  i && clearTimeout(i);
330
330
  }), P(() => n.value && c.value);
331
331
  }
332
- const Ts = {
332
+ const Ms = {
333
333
  key: 0,
334
334
  class: "message-content ba-markdown"
335
335
  }, xs = { class: "thought-collapse-bar__text" }, Rs = {
@@ -361,87 +361,89 @@ const Ts = {
361
361
  initialReveal: {}
362
362
  },
363
363
  emits: ["regenerate", "reveal-progress"],
364
- setup(n, { emit: _ }) {
365
- const s = n, c = _, { reveal: i, segmentContents: h, frontier: l, revealDone: a } = Es(
364
+ setup(n, { emit: C }) {
365
+ const s = n, c = C, { reveal: i, segmentContents: h, frontier: l, revealDone: a } = Es(
366
366
  () => s.msg,
367
367
  () => s.scrollToBottom(),
368
368
  {
369
369
  initial: s.initialReveal,
370
- onProgress: (g) => c("reveal-progress", g)
370
+ onProgress: (T) => c("reveal-progress", T)
371
371
  }
372
372
  ), u = P(
373
373
  () => s.msg.status === s.STATUS.COMPLETED || s.msg.status === s.STATUS.STOP
374
- ), y = P(() => u.value && a.value), w = p(!1);
375
- ae(y, (g) => {
376
- g && (w.value = !1);
374
+ ), y = P(() => u.value && a.value), w = f(!1);
375
+ ie(y, (T) => {
376
+ T && (w.value = !1);
377
377
  });
378
- const R = P(() => Jn(s.msg.segments, i.value)), L = P(() => R.value.length > 0), q = P(() => R.value.some((g) => g.kind === "thinking")), T = P(() => R.value.some((g) => g.kind === "tools")), S = P(() => R.value.some((g) => g.kind === "steps")), z = P(
379
- () => R.value.some(
380
- (g) => g.kind === "thinking" && g.streaming || g.kind === "tools" && g.calling || g.kind === "steps" && g.items.some((V) => V.state !== "done")
378
+ const $ = P(() => zn(s.msg.segments, i.value)), O = P(() => $.value.length > 0), q = P(() => $.value.some((T) => T.kind === "thinking")), x = P(() => $.value.some((T) => T.kind === "tools")), E = P(() => $.value.some((T) => T.kind === "steps")), K = P(
379
+ () => $.value.some(
380
+ (T) => T.kind === "thinking" && T.streaming || T.kind === "tools" && T.calling || T.kind === "steps" && T.items.some((p) => p.state !== "done")
381
381
  )
382
382
  ), j = P(
383
- () => !y.value && !!s.msg.streamed && a.value && !z.value && s.msg.lastChunkAt != null && s.msg.status !== s.STATUS.ERROR && s.msg.status !== s.STATUS.PAUSED
384
- ), C = Ms(j, P(() => s.msg.lastChunkAt));
385
- ae(C, (g) => {
386
- g && s.scrollToBottom();
383
+ () => s.msg.status === s.STATUS.THINKING || s.msg.status === s.STATUS.RETHINKING || s.msg.status === s.STATUS.ANSWERING
384
+ ), b = P(
385
+ () => j.value && !!s.msg.streamed && a.value && !K.value && s.msg.lastChunkAt != null
386
+ ), H = Ds(b, P(() => s.msg.lastChunkAt));
387
+ ie(H, (T) => {
388
+ T && s.scrollToBottom();
387
389
  });
388
- const $ = P(() => {
389
- const g = [];
390
- return q.value && g.push("深度思考"), T.value && g.push("工具调用"), S.value && g.push("执行步骤"), g.join(" · ") || "思考过程";
391
- }), K = P(() => !y.value || w.value), e = P(
390
+ const J = P(() => {
391
+ const T = [];
392
+ return q.value && T.push("深度思考"), x.value && T.push("工具调用"), E.value && T.push("执行步骤"), T.join(" · ") || "思考过程";
393
+ }), e = P(() => !y.value || w.value), A = P(
392
394
  () => (s.msg.segments ?? []).reduce(
393
- (g, V) => V.type === "thinking" || V.type === "agent_thought" || V.type === "step" ? g + (V.duration ?? 0) : g,
395
+ (T, p) => p.type === "thinking" || p.type === "agent_thought" || p.type === "step" ? T + (p.duration ?? 0) : T,
394
396
  0
395
397
  )
396
- ), A = P(
398
+ ), d = P(
397
399
  () => (s.msg.segments ?? []).some(
398
- (g, V) => g.type === "answer" && (h.value[V] || "").length > 0
400
+ (T, p) => T.type === "answer" && (h.value[p] || "").length > 0
399
401
  )
400
- ), d = P(
401
- () => !y.value && !C.value && s.msg.status !== s.STATUS.ERROR && s.msg.status !== s.STATUS.PAUSED && R.value.length === 0 && !A.value
402
+ ), M = P(
403
+ () => !y.value && !H.value && s.msg.status !== s.STATUS.ERROR && s.msg.status !== s.STATUS.PAUSED && $.value.length === 0 && !d.value
402
404
  );
403
- function E(g) {
404
- return g == null || g <= 0 ? "" : g < 1 ? `${Math.round(g * 1e3)}ms` : g < 60 ? `${g.toFixed(1)}s` : `${Math.floor(g / 60)}m${Math.round(g % 60)}s`;
405
+ function S(T) {
406
+ return T == null || T <= 0 ? "" : T < 1 ? `${Math.round(T * 1e3)}ms` : T < 60 ? `${T.toFixed(1)}s` : `${Math.floor(T / 60)}m${Math.round(T % 60)}s`;
405
407
  }
406
- const b = ke(/* @__PURE__ */ new Map()), B = p("");
407
- function U(g) {
408
- const V = g.target;
409
- V.tagName === "IMG" && (B.value = V.src);
408
+ const B = ke(/* @__PURE__ */ new Map()), U = f("");
409
+ function ee(T) {
410
+ const p = T.target;
411
+ p.tagName === "IMG" && (U.value = p.src);
410
412
  }
411
- function ee() {
412
- B.value = "";
413
+ function se() {
414
+ U.value = "";
413
415
  }
414
- function ie(g, V) {
415
- var O;
416
+ function G(T, p) {
417
+ var _;
416
418
  try {
417
- let m = g.content;
418
- if (!m && ((O = g.segments) != null && O.length) && (m = g.segments.filter((k) => k.type === "answer").map((k) => k.content).join(`
419
+ let m = T.content;
420
+ if (!m && ((_ = T.segments) != null && _.length) && (m = T.segments.filter((k) => k.type === "answer").map((k) => k.content).join(`
419
421
  `)), m) {
420
- const { copy: k } = Dn();
421
- k(m), b.set(V, !0), setTimeout(() => b.set(V, !1), 2e3);
422
+ const { copy: k } = Tn();
423
+ k(m), B.set(p, !0), setTimeout(() => B.set(p, !1), 2e3);
422
424
  }
423
425
  } catch {
424
426
  }
425
427
  }
426
- return (g, V) => {
427
- var O;
428
- return r(), f("div", {
429
- class: oe(["message", `${n.msg.type}-message`])
428
+ return (T, p) => {
429
+ var _;
430
+ return r(), g("div", {
431
+ class: ae(["message", `${n.msg.type}-message`])
430
432
  }, [
431
- n.msg.type === "ai" ? (r(), f(ye, { key: 0 }, [
432
- d.value ? (r(), f("div", Ts, [...V[4] || (V[4] = [
433
+ n.msg.type === "ai" ? (r(), g(ye, { key: 0 }, [
434
+ M.value ? (r(), g("div", Ms, [...p[4] || (p[4] = [
433
435
  _n('<div class="scale-animation-container"><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span></div>', 1)
434
- ])])) : J("", !0),
435
- n.msg.segments && n.msg.segments.length ? (r(), f("div", {
436
+ ])])) : z("", !0),
437
+ n.msg.segments && n.msg.segments.length ? (r(), g("div", {
436
438
  key: 1,
437
439
  class: "message-content ba-markdown",
438
440
  ref: (m) => n.setMessageRef(m, n.index),
439
- onClick: U
441
+ onClick: ee
440
442
  }, [
441
- y.value && L.value ? (r(), f("div", {
443
+ y.value && O.value ? (r(), g("div", {
442
444
  key: 0,
443
- class: oe(["thought-collapse-bar", { "thought-collapse-bar--expanded": w.value }]),
444
- onClick: V[0] || (V[0] = we((m) => w.value = !w.value, ["stop"]))
445
+ class: ae(["thought-collapse-bar", { "thought-collapse-bar--expanded": w.value }]),
446
+ onClick: p[0] || (p[0] = we((m) => w.value = !w.value, ["stop"]))
445
447
  }, [
446
448
  q.value ? (r(), he(W(In), {
447
449
  key: 0,
@@ -450,11 +452,11 @@ const Ts = {
450
452
  key: 1,
451
453
  class: "thought-collapse-bar__icon"
452
454
  })),
453
- o("span", xs, Z($.value), 1),
454
- e.value > 0 ? (r(), f("span", Rs, Z(E(e.value)), 1)) : J("", !0),
455
+ o("span", xs, Z(J.value), 1),
456
+ A.value > 0 ? (r(), g("span", Rs, Z(S(A.value)), 1)) : z("", !0),
455
457
  o("span", $s, Z(w.value ? "收起" : "查看"), 1),
456
- (r(), f("svg", {
457
- class: oe(["thought-collapse-bar__arrow", { "thought-collapse-bar__arrow--down": w.value }]),
458
+ (r(), g("svg", {
459
+ class: ae(["thought-collapse-bar__arrow", { "thought-collapse-bar__arrow--down": w.value }]),
458
460
  viewBox: "0 0 24 24",
459
461
  width: "12",
460
462
  height: "12",
@@ -463,12 +465,12 @@ const Ts = {
463
465
  "stroke-width": "2.5",
464
466
  "stroke-linecap": "round",
465
467
  "stroke-linejoin": "round"
466
- }, [...V[5] || (V[5] = [
468
+ }, [...p[5] || (p[5] = [
467
469
  o("polyline", { points: "6 9 12 15 18 9" }, null, -1)
468
470
  ])], 2))
469
- ], 2)) : J("", !0),
470
- K.value ? (r(), f(ye, { key: 1 }, [
471
- (r(!0), f(ye, null, Me(R.value, (m, k) => (r(), f(ye, { key: k }, [
471
+ ], 2)) : z("", !0),
472
+ e.value ? (r(), g(ye, { key: 1 }, [
473
+ (r(!0), g(ye, null, De($.value, (m, k) => (r(), g(ye, { key: k }, [
472
474
  m.kind === "steps" ? (r(), he(Cs, {
473
475
  key: 0,
474
476
  steps: m.items
@@ -484,91 +486,91 @@ const Ts = {
484
486
  duration: m.duration
485
487
  }, null, 8, ["is-done", "count", "duration"]))
486
488
  ], 64))), 128)),
487
- W(C) ? (r(), f("div", Hs, [
488
- se($t)
489
- ])) : J("", !0)
490
- ], 64)) : J("", !0),
491
- (r(!0), f(ye, null, Me(n.msg.segments, (m, k) => (r(), f(ye, { key: k }, [
492
- m.type === "answer" ? (r(), f("div", Ls, [
489
+ W(H) ? (r(), g("div", Hs, [
490
+ oe($t)
491
+ ])) : z("", !0)
492
+ ], 64)) : z("", !0),
493
+ (r(!0), g(ye, null, De(n.msg.segments, (m, k) => (r(), g(ye, { key: k }, [
494
+ m.type === "answer" ? (r(), g("div", Ls, [
493
495
  o("div", {
494
496
  innerHTML: W(Yt)(
495
497
  W(rt)(W(ct)(W(h)[k] ?? "")),
496
498
  !W(a) && W(l) === k && n.msg.status !== n.STATUS.STOP
497
499
  )
498
500
  }, null, 8, Ps)
499
- ])) : J("", !0)
501
+ ])) : z("", !0)
500
502
  ], 64))), 128))
501
- ], 512)) : J("", !0),
502
- !((O = n.msg.segments) != null && O.length) && n.msg.content ? (r(), f("div", {
503
+ ], 512)) : z("", !0),
504
+ !((_ = n.msg.segments) != null && _.length) && n.msg.content ? (r(), g("div", {
503
505
  key: 2,
504
506
  class: "message-content ba-markdown",
505
507
  ref: (m) => n.setMessageRef(m, n.index),
506
- onClick: U
508
+ onClick: ee
507
509
  }, [
508
510
  o("div", {
509
511
  innerHTML: W(rt)(W(ct)(n.msg.content))
510
512
  }, null, 8, Os)
511
- ], 512)) : J("", !0),
512
- n.msg.errorMessage ? (r(), f("div", Bs, [
513
- V[6] || (V[6] = o("span", { class: "message-error__icon" }, "⚠️", -1)),
513
+ ], 512)) : z("", !0),
514
+ n.msg.errorMessage ? (r(), g("div", Bs, [
515
+ p[6] || (p[6] = o("span", { class: "message-error__icon" }, "⚠️", -1)),
514
516
  o("span", null, Z(n.msg.errorMessage), 1)
515
- ])) : J("", !0),
516
- y.value ? (r(), f("div", Ws, [
517
+ ])) : z("", !0),
518
+ y.value ? (r(), g("div", Ws, [
517
519
  o("div", {
518
520
  class: "tooltip-enhanced",
519
- "data-tooltip": b.get(n.index) ? "已复制" : "复制回答"
521
+ "data-tooltip": B.get(n.index) ? "已复制" : "复制回答"
520
522
  }, [
521
- b.get(n.index) ? (r(), he(W(es), {
523
+ B.get(n.index) ? (r(), he(W(es), {
522
524
  key: 0,
523
525
  class: "message-toolbar__check"
524
526
  })) : (r(), he(W(ts), {
525
527
  key: 1,
526
- onClick: V[1] || (V[1] = (m) => ie(n.msg, n.index))
528
+ onClick: p[1] || (p[1] = (m) => G(n.msg, n.index))
527
529
  }))
528
530
  ], 8, Ns),
529
531
  o("div", Ys, [
530
- se(W(ns), {
531
- onClick: V[2] || (V[2] = (m) => g.$emit("regenerate"))
532
+ oe(W(ns), {
533
+ onClick: p[2] || (p[2] = (m) => T.$emit("regenerate"))
532
534
  })
533
535
  ])
534
- ])) : J("", !0)
535
- ], 64)) : (r(), f("div", Vs, Z(n.msg.content), 1)),
536
+ ])) : z("", !0)
537
+ ], 64)) : (r(), g("div", Vs, Z(n.msg.content), 1)),
536
538
  (r(), he(Bt, { to: "#ai-assist-root" }, [
537
- B.value ? (r(), f("div", {
539
+ U.value ? (r(), g("div", {
538
540
  key: 0,
539
541
  class: "ai-image-preview-overlay",
540
- onClick: ee
542
+ onClick: se
541
543
  }, [
542
544
  o("img", {
543
- src: B.value,
545
+ src: U.value,
544
546
  class: "ai-image-preview-overlay__img",
545
- onClick: V[3] || (V[3] = we(() => {
547
+ onClick: p[3] || (p[3] = we(() => {
546
548
  }, ["stop"]))
547
549
  }, null, 8, Xs),
548
550
  o("button", {
549
551
  class: "ai-image-preview-overlay__close",
550
- onClick: we(ee, ["stop"])
552
+ onClick: we(se, ["stop"])
551
553
  }, [
552
- se(W(ss))
554
+ oe(W(ss))
553
555
  ])
554
- ])) : J("", !0)
556
+ ])) : z("", !0)
555
557
  ]))
556
558
  ], 2);
557
559
  };
558
560
  }
559
- }), Qs = {
561
+ }), Gs = {
560
562
  key: 0,
561
563
  class: "input-container voice-mode"
562
- }, Gs = {
564
+ }, Qs = {
563
565
  key: 0,
564
566
  class: "final"
565
567
  }, qs = {
566
568
  key: 1,
567
569
  class: "interim"
568
- }, zs = {
570
+ }, Ks = {
569
571
  key: 2,
570
572
  class: "placeholder"
571
- }, Js = ["onKeydown"], Ks = ["data-tooltip"], js = {
573
+ }, zs = ["onKeydown"], Js = ["data-tooltip"], js = {
572
574
  key: 2,
573
575
  class: "moveTB"
574
576
  }, Us = {
@@ -590,149 +592,149 @@ const Ts = {
590
592
  isAtBottom: { type: Boolean }
591
593
  },
592
594
  emits: ["update:modelValue", "send", "stop", "scroll-to-bottom"],
593
- setup(n, { emit: _ }) {
594
- const s = n, c = _, i = p(!1), h = p(""), l = p(""), a = p("idle"), u = p(""), y = p(null), w = p(null), R = p(!1), L = p(!1);
595
- let q = !1, T = null, S = null, z = !1, j = !1, C = null;
596
- const $ = P(() => a.value === "connecting"), K = P(
595
+ setup(n, { emit: C }) {
596
+ const s = n, c = C, i = f(!1), h = f(""), l = f(""), a = f("idle"), u = f(""), y = f(null), w = f(null), $ = f(!1), O = f(!1);
597
+ let q = !1, x = null, E = null, K = !1, j = !1, b = null;
598
+ const H = P(() => a.value === "connecting"), J = P(
597
599
  () => a.value === "recording" || a.value === "stopping"
598
600
  ), e = P(
599
601
  () => a.value === "connecting" || a.value === "recording" || a.value === "stopping"
600
602
  ), A = P(() => i.value && !e.value), d = P(
601
603
  () => A.value ? !!u.value.trim() : !!(h.value.trim() || l.value.trim())
602
- ), E = P(
604
+ ), M = P(
603
605
  () => Fe.isSupported() && !s.modelValue.trim() && !s.isGenerating
604
- ), b = p(!1);
605
- function B(X) {
606
- X.pointerType === "mouse" && (b.value = !0);
606
+ ), S = f(!1);
607
+ function B(V) {
608
+ V.pointerType === "mouse" && (S.value = !0);
607
609
  }
608
- function U(X) {
609
- X.pointerType === "mouse" && (b.value = !1);
610
+ function U(V) {
611
+ V.pointerType === "mouse" && (S.value = !1);
610
612
  }
611
- const ee = P(() => L.value ? "正在请求麦克风权限…" : b.value && E.value ? "发消息...(按住可语音输入)" : "发消息..."), ie = P(
612
- () => R.value ? "正在聆听…松手结束" : "正在聆听…点击结束"
613
+ const ee = P(() => O.value ? "正在请求麦克风权限…" : S.value && M.value ? "发消息...(按住可语音输入)" : "发消息..."), se = P(
614
+ () => $.value ? "正在聆听…松手结束" : "正在聆听…点击结束"
613
615
  );
614
- function g() {
615
- C = new Fe({}, {
616
- onStatusChange: (X) => {
617
- a.value = X;
616
+ function G() {
617
+ b = new Fe({}, {
618
+ onStatusChange: (V) => {
619
+ a.value = V;
618
620
  },
619
- onInterim: (X) => {
620
- l.value = X;
621
+ onInterim: (V) => {
622
+ l.value = V;
621
623
  },
622
- onFinal: (X) => {
623
- h.value += X, l.value = "";
624
+ onFinal: (V) => {
625
+ h.value += V, l.value = "";
624
626
  },
625
627
  onError: () => {
626
628
  i.value = !1;
627
629
  }
628
630
  });
629
631
  }
630
- _e(g), Wt(() => {
631
- m(), C == null || C.destroy(), C = null;
632
- }), ae([h, l], () => {
632
+ _e(G), Wt(() => {
633
+ _(), b == null || b.destroy(), b = null;
634
+ }), ie([h, l], () => {
633
635
  pe(() => {
634
636
  y.value && (y.value.scrollTop = y.value.scrollHeight);
635
637
  });
636
- }), ae(a, (X) => {
637
- if (X === "recording" && j) {
638
- j = !1, C == null || C.stop();
638
+ }), ie(a, (V) => {
639
+ if (V === "recording" && j) {
640
+ j = !1, b == null || b.stop();
639
641
  return;
640
642
  }
641
- X === "idle" && i.value && (u.value = (h.value + l.value).trim(), pe(() => {
642
- var G;
643
- return (G = w.value) == null ? void 0 : G.focus();
643
+ V === "idle" && i.value && (u.value = (h.value + l.value).trim(), pe(() => {
644
+ var Q;
645
+ return (Q = w.value) == null ? void 0 : Q.focus();
644
646
  }));
645
647
  });
646
- function V() {
647
- e.value && (C == null || C.stop());
648
+ function T() {
649
+ e.value && (b == null || b.stop());
650
+ }
651
+ function p() {
652
+ window.removeEventListener("pointerup", Y), window.removeEventListener("pointercancel", Y), window.removeEventListener("pointermove", N), window.removeEventListener("blur", L);
648
653
  }
649
- function O() {
650
- window.removeEventListener("pointerup", Y), window.removeEventListener("pointercancel", Y), window.removeEventListener("pointermove", N), window.removeEventListener("blur", H);
654
+ function _() {
655
+ x !== null && (clearTimeout(x), x = null), E = null, p();
651
656
  }
652
657
  function m() {
653
- T !== null && (clearTimeout(T), T = null), S = null, O();
658
+ a.value === "recording" ? b == null || b.stop() : (a.value === "connecting" || a.value === "stopping") && (j = !0);
654
659
  }
655
660
  function k() {
656
- a.value === "recording" ? C == null || C.stop() : (a.value === "connecting" || a.value === "stopping") && (j = !0);
661
+ const V = K;
662
+ K = !1, _(), V && m();
657
663
  }
658
- function M() {
659
- const X = z;
660
- z = !1, m(), X && k();
661
- }
662
- function N(X) {
663
- if (!S) return;
664
- if (z) {
665
- X.buttons === 0 && M();
664
+ function N(V) {
665
+ if (!E) return;
666
+ if (K) {
667
+ V.buttons === 0 && k();
666
668
  return;
667
669
  }
668
- const G = X.clientX - S.x, x = X.clientY - S.y;
669
- Math.hypot(G, x) > so && m();
670
+ const Q = V.clientX - E.x, R = V.clientY - E.y;
671
+ Math.hypot(Q, R) > so && _();
670
672
  }
671
673
  function Y() {
672
- M();
673
- }
674
- function H() {
675
- z && M();
676
- }
677
- function Q(X) {
678
- E.value && (X.pointerType === "mouse" && X.button !== 0 || (S = { x: X.clientX, y: X.clientY }, z = !1, j = !1, T !== null && clearTimeout(T), T = setTimeout(() => {
679
- var x, F, ne;
680
- T = null, z = !0;
681
- const G = X.target;
682
- G && typeof G.blur == "function" && G.blur(), (ne = (F = (x = window.getSelection) == null ? void 0 : x.call(window)) == null ? void 0 : F.removeAllRanges) == null || ne.call(F), te(!0);
683
- }, no), window.addEventListener("pointerup", Y), window.addEventListener("pointercancel", Y), window.addEventListener("pointermove", N), window.addEventListener("blur", H)));
684
- }
685
- async function te(X = !1) {
686
- if (!C || q) return;
687
- L.value = !0, q = !0;
688
- const { granted: G, prompted: x } = await Fe.ensurePermission();
689
- if (L.value = !1, q = !1, !G) {
674
+ k();
675
+ }
676
+ function L() {
677
+ K && k();
678
+ }
679
+ function F(V) {
680
+ M.value && (V.pointerType === "mouse" && V.button !== 0 || (E = { x: V.clientX, y: V.clientY }, K = !1, j = !1, x !== null && clearTimeout(x), x = setTimeout(() => {
681
+ var R, X, ne;
682
+ x = null, K = !0;
683
+ const Q = V.target;
684
+ Q && typeof Q.blur == "function" && Q.blur(), (ne = (X = (R = window.getSelection) == null ? void 0 : R.call(window)) == null ? void 0 : X.removeAllRanges) == null || ne.call(X), te(!0);
685
+ }, no), window.addEventListener("pointerup", Y), window.addEventListener("pointercancel", Y), window.addEventListener("pointermove", N), window.addEventListener("blur", L)));
686
+ }
687
+ async function te(V = !1) {
688
+ if (!b || q) return;
689
+ O.value = !0, q = !0;
690
+ const { granted: Q, prompted: R } = await Fe.ensurePermission();
691
+ if (O.value = !1, q = !1, !Q) {
690
692
  Ee("麦克风不可用,请允许浏览器使用麦克风后重试");
691
693
  return;
692
694
  }
693
- if (X && !z) {
694
- x && Ee("麦克风已开启,请重新按住输入框开始说话", "info");
695
+ if (V && !K) {
696
+ R && Ee("麦克风已开启,请重新按住输入框开始说话", "info");
695
697
  return;
696
698
  }
697
- R.value = X, h.value = "", l.value = "", u.value = "", i.value = !0;
699
+ $.value = V, h.value = "", l.value = "", u.value = "", i.value = !0;
698
700
  try {
699
- await C.start();
701
+ await b.start();
700
702
  } catch {
701
703
  i.value = !1;
702
704
  }
703
705
  }
704
706
  function re() {
705
- C == null || C.cancel(), i.value = !1, R.value = !1, j = !1, h.value = "", l.value = "", u.value = "";
707
+ b == null || b.cancel(), i.value = !1, $.value = !1, j = !1, h.value = "", l.value = "", u.value = "";
706
708
  }
707
709
  function ce() {
708
- const X = (A.value ? u.value : h.value + l.value).trim();
709
- X && (C == null || C.stop(), i.value = !1, R.value = !1, j = !1, c("update:modelValue", X), setTimeout(() => c("send"), 0));
710
+ const V = (A.value ? u.value : h.value + l.value).trim();
711
+ V && (b == null || b.stop(), i.value = !1, $.value = !1, j = !1, c("update:modelValue", V), setTimeout(() => c("send"), 0));
710
712
  }
711
- return (X, G) => i.value ? (r(), f("div", Qs, [
713
+ return (V, Q) => i.value ? (r(), g("div", Gs, [
712
714
  o("div", {
713
- class: oe(["voice-visual", { recording: K.value }])
715
+ class: ae(["voice-visual", { recording: J.value }])
714
716
  }, null, 2),
715
- e.value ? (r(), f("div", {
717
+ e.value ? (r(), g("div", {
716
718
  key: 0,
717
719
  class: "voice-text",
718
720
  ref_key: "voiceTextEl",
719
721
  ref: y,
720
- onClick: V
722
+ onClick: T
721
723
  }, [
722
- h.value ? (r(), f("span", Gs, Z(h.value), 1)) : J("", !0),
723
- l.value ? (r(), f("span", qs, Z(l.value), 1)) : J("", !0),
724
- !h.value && !l.value ? (r(), f("span", zs, Z($.value ? "启动中…" : ie.value), 1)) : J("", !0)
725
- ], 512)) : xe((r(), f("input", {
724
+ h.value ? (r(), g("span", Qs, Z(h.value), 1)) : z("", !0),
725
+ l.value ? (r(), g("span", qs, Z(l.value), 1)) : z("", !0),
726
+ !h.value && !l.value ? (r(), g("span", Ks, Z(H.value ? "启动中…" : se.value), 1)) : z("", !0)
727
+ ], 512)) : xe((r(), g("input", {
726
728
  key: 1,
727
729
  ref_key: "editorEl",
728
730
  ref: w,
729
- "onUpdate:modelValue": G[0] || (G[0] = (x) => u.value = x),
731
+ "onUpdate:modelValue": Q[0] || (Q[0] = (R) => u.value = R),
730
732
  type: "text",
731
733
  class: "voice-editor",
732
734
  placeholder: "识别结果,可点击直接修改…",
733
735
  onKeydown: lt(we(re, ["prevent"]), ["esc"]),
734
- onKeyup: G[1] || (G[1] = lt((x) => d.value && ce(), ["enter"]))
735
- }, null, 40, Js)), [
736
+ onKeyup: Q[1] || (Q[1] = lt((R) => d.value && ce(), ["enter"]))
737
+ }, null, 40, zs)), [
736
738
  [Nt, u.value]
737
739
  ]),
738
740
  o("div", {
@@ -740,87 +742,87 @@ const Ts = {
740
742
  "data-tooltip": "关闭",
741
743
  onClick: re
742
744
  }, [
743
- se(W(me), {
745
+ oe(W(me), {
744
746
  class: "op-icon",
745
747
  icon: "heroicons-solid:x-mark"
746
748
  })
747
749
  ]),
748
750
  o("div", {
749
- class: oe(["tooltip-enhanced voice-send", { disabled: !d.value }]),
751
+ class: ae(["tooltip-enhanced voice-send", { disabled: !d.value }]),
750
752
  "data-tooltip": d.value ? "发送" : "未识别到文字",
751
- onClick: G[2] || (G[2] = (x) => d.value && ce())
753
+ onClick: Q[2] || (Q[2] = (R) => d.value && ce())
752
754
  }, [
753
- se(W(me), {
755
+ oe(W(me), {
754
756
  class: "op-icon",
755
757
  icon: "fluent-color:send-16"
756
758
  })
757
- ], 10, Ks),
758
- n.hasScroll && !n.isAtBottom ? (r(), f("div", js, [
759
- se(W(me), {
759
+ ], 10, Js),
760
+ n.hasScroll && !n.isAtBottom ? (r(), g("div", js, [
761
+ oe(W(me), {
760
762
  class: "op-icon",
761
763
  icon: "ep:bottom",
762
- onClick: G[3] || (G[3] = (x) => X.$emit("scroll-to-bottom"))
764
+ onClick: Q[3] || (Q[3] = (R) => V.$emit("scroll-to-bottom"))
763
765
  })
764
- ])) : J("", !0)
765
- ])) : (r(), f("div", Us, [
766
+ ])) : z("", !0)
767
+ ])) : (r(), g("div", Us, [
766
768
  o("input", {
767
769
  value: n.modelValue,
768
770
  type: "text",
769
771
  placeholder: ee.value,
770
- onInput: G[4] || (G[4] = (x) => X.$emit("update:modelValue", x.target.value)),
771
- onKeyup: G[5] || (G[5] = lt((x) => n.modelValue.trim() && X.$emit("send"), ["enter"])),
772
+ onInput: Q[4] || (Q[4] = (R) => V.$emit("update:modelValue", R.target.value)),
773
+ onKeyup: Q[5] || (Q[5] = lt((R) => n.modelValue.trim() && V.$emit("send"), ["enter"])),
772
774
  disabled: n.isGenerating,
773
- onPointerdown: Q,
775
+ onPointerdown: F,
774
776
  onPointerenter: B,
775
777
  onPointerleave: U
776
778
  }, null, 40, Zs),
777
- n.isGenerating ? (r(), f("div", Is, [
778
- se(W(me), {
779
+ n.isGenerating ? (r(), g("div", Is, [
780
+ oe(W(me), {
779
781
  class: "op-icon stop-icon",
780
782
  icon: "heroicons-solid:stop",
781
- onClick: G[6] || (G[6] = (x) => X.$emit("stop"))
783
+ onClick: Q[6] || (Q[6] = (R) => V.$emit("stop"))
782
784
  })
783
- ])) : E.value ? (r(), f("div", {
785
+ ])) : M.value ? (r(), g("div", {
784
786
  key: 1,
785
787
  class: "tooltip-enhanced send voice",
786
788
  "data-tooltip": "语音输入(也可按住输入框说话)",
787
- onClick: G[7] || (G[7] = (x) => te())
789
+ onClick: Q[7] || (Q[7] = (R) => te())
788
790
  }, [
789
- se(W(me), {
791
+ oe(W(me), {
790
792
  class: "op-icon",
791
793
  icon: "mingcute:voice-line"
792
794
  })
793
- ])) : (r(), f("div", {
795
+ ])) : (r(), g("div", {
794
796
  key: 2,
795
- class: oe(["tooltip-enhanced send", { disabled: !n.modelValue.trim() }]),
797
+ class: ae(["tooltip-enhanced send", { disabled: !n.modelValue.trim() }]),
796
798
  "data-tooltip": n.modelValue.trim() ? "开始回答" : "请输入你的问题"
797
799
  }, [
798
- se(W(me), {
800
+ oe(W(me), {
799
801
  class: "op-icon",
800
802
  icon: "fluent-color:send-16",
801
- onClick: G[8] || (G[8] = (x) => n.modelValue.trim() && X.$emit("send"))
803
+ onClick: Q[8] || (Q[8] = (R) => n.modelValue.trim() && V.$emit("send"))
802
804
  })
803
805
  ], 10, eo)),
804
- n.hasScroll && !n.isAtBottom ? (r(), f("div", to, [
805
- se(W(me), {
806
+ n.hasScroll && !n.isAtBottom ? (r(), g("div", to, [
807
+ oe(W(me), {
806
808
  class: "op-icon",
807
809
  icon: "ep:bottom",
808
- onClick: G[9] || (G[9] = (x) => X.$emit("scroll-to-bottom"))
810
+ onClick: Q[9] || (Q[9] = (R) => V.$emit("scroll-to-bottom"))
809
811
  })
810
- ])) : J("", !0)
812
+ ])) : z("", !0)
811
813
  ]));
812
814
  }
813
815
  });
814
816
  function ao(n) {
815
- const _ = p(!0), s = p(!1);
817
+ const C = f(!0), s = f(!1);
816
818
  function c(l) {
817
819
  const a = l.closest(".chat-wrap") || l, u = l.scrollHeight, y = l.clientHeight;
818
820
  if (u <= y) {
819
821
  a.style.setProperty("--ai-thumb-height", "0px"), a.style.setProperty("--ai-thumb-top", "0px");
820
822
  return;
821
823
  }
822
- const w = Math.max(y * y / u, 32), R = y - w, L = l.scrollTop / (u - y);
823
- a.style.setProperty("--ai-thumb-height", `${w}px`), a.style.setProperty("--ai-thumb-top", `${L * R}px`);
824
+ const w = Math.max(y * y / u, 32), $ = y - w, O = l.scrollTop / (u - y);
825
+ a.style.setProperty("--ai-thumb-height", `${w}px`), a.style.setProperty("--ai-thumb-top", `${O * $}px`);
824
826
  }
825
827
  function i() {
826
828
  pe(() => {
@@ -830,13 +832,13 @@ function ao(n) {
830
832
  function h() {
831
833
  if (!n.value) return;
832
834
  const l = n.value, a = l.scrollTop + l.clientHeight >= l.scrollHeight - 1, u = l.scrollHeight > l.clientHeight;
833
- _.value = a, s.value = u, c(l);
835
+ C.value = a, s.value = u, c(l);
834
836
  }
835
- return { isAtBottom: _, hasScroll: s, scrollToBottom: i, checkScrollStatus: h };
837
+ return { isAtBottom: C, hasScroll: s, scrollToBottom: i, checkScrollStatus: h };
836
838
  }
837
839
  function io() {
838
- function n(_) {
839
- _.querySelectorAll("pre").forEach((c) => {
840
+ function n(C) {
841
+ C.querySelectorAll("pre").forEach((c) => {
840
842
  if (c.querySelector(".copy-button")) return;
841
843
  const i = c.querySelector("code");
842
844
  if (!i) return;
@@ -858,119 +860,119 @@ function io() {
858
860
  return { enhanceCodeBlocks: n };
859
861
  }
860
862
  function lo(n) {
861
- let _ = null, s = 0;
863
+ let C = null, s = 0;
862
864
  function c(h) {
863
- _ = h(_ || [...n.value]), s || (s = requestAnimationFrame(() => {
864
- s = 0, _ && (n.value = _, _ = null);
865
+ C = h(C || [...n.value]), s || (s = requestAnimationFrame(() => {
866
+ s = 0, C && (n.value = C, C = null);
865
867
  }));
866
868
  }
867
869
  function i() {
868
- s && (cancelAnimationFrame(s), s = 0), _ && (n.value = _, _ = null);
870
+ s && (cancelAnimationFrame(s), s = 0), C && (n.value = C, C = null);
869
871
  }
870
872
  return { batchMessagesUpdate: c, flushMessagesBatch: i };
871
873
  }
872
874
  function uo({
873
875
  messages: n,
874
- isGenerating: _,
876
+ isGenerating: C,
875
877
  lastUserMessage: s,
876
878
  batchMessagesUpdate: c,
877
879
  flushMessagesBatch: i,
878
880
  STATUS: h,
879
881
  cfg: l
880
882
  }) {
881
- const a = p(/* @__PURE__ */ new Map()), u = p(/* @__PURE__ */ new Map()), y = p(/* @__PURE__ */ new Map()), w = p(/* @__PURE__ */ new Map()), R = p(!1), L = p(/* @__PURE__ */ new Map()), q = p(/* @__PURE__ */ new Map()), T = p(!1);
882
- function S($) {
883
- const K = a.value.get($) || [];
883
+ const a = f(/* @__PURE__ */ new Map()), u = f(/* @__PURE__ */ new Map()), y = f(/* @__PURE__ */ new Map()), w = f(/* @__PURE__ */ new Map()), $ = f(!1), O = f(/* @__PURE__ */ new Map()), q = f(/* @__PURE__ */ new Map()), x = f(!1);
884
+ function E(H) {
885
+ const J = a.value.get(H) || [];
884
886
  c((e) => {
885
- if (e[$]) {
887
+ if (e[H]) {
886
888
  const A = [...e];
887
- return A[$] = { ...A[$], segments: K.map((d) => ({ ...d })) }, A;
889
+ return A[H] = { ...A[H], segments: J.map((d) => ({ ...d })) }, A;
888
890
  }
889
891
  return e;
890
892
  });
891
893
  }
892
- function z($) {
893
- const K = Date.now();
894
+ function K(H) {
895
+ const J = Date.now();
894
896
  c((e) => {
895
- const A = e[$];
897
+ const A = e[H];
896
898
  if (!A || A.status === h.COMPLETED || A.status === h.STOP || A.status === h.ERROR)
897
899
  return e;
898
900
  const d = [...e];
899
- return d[$] = { ...A, lastChunkAt: K }, d;
901
+ return d[H] = { ...A, lastChunkAt: J }, d;
900
902
  });
901
903
  }
902
- function j($) {
903
- const K = a.value.get($) || [], e = y.value.get($), A = q.value.get($);
904
- let d = 0, E = !1;
905
- K.forEach((b) => {
906
- if ((b.type === "thinking" || b.type === "step") && b.duration == null) {
907
- const U = (b.id != null ? A == null ? void 0 : A.get(b.id) : void 0) ?? e, ee = U ? Math.round((Date.now() - U) / 1e3 * 10) / 10 : 0;
908
- b.duration = ee, b.type === "thinking" && (d += ee), E = !0;
904
+ function j(H) {
905
+ const J = a.value.get(H) || [], e = y.value.get(H), A = q.value.get(H);
906
+ let d = 0, M = !1;
907
+ J.forEach((S) => {
908
+ if ((S.type === "thinking" || S.type === "step") && S.duration == null) {
909
+ const U = (S.id != null ? A == null ? void 0 : A.get(S.id) : void 0) ?? e, ee = U ? Math.round((Date.now() - U) / 1e3 * 10) / 10 : 0;
910
+ S.duration = ee, S.type === "thinking" && (d += ee), M = !0;
909
911
  }
910
- }), E && (a.value.set($, K), c((b) => {
911
- if (b[$]) {
912
- const B = [...b];
913
- return B[$] = {
914
- ...B[$],
915
- segments: K.map((U) => ({ ...U })),
916
- thinkingDuration: (B[$].thinkingDuration || 0) + d
912
+ }), M && (a.value.set(H, J), c((S) => {
913
+ if (S[H]) {
914
+ const B = [...S];
915
+ return B[H] = {
916
+ ...B[H],
917
+ segments: J.map((U) => ({ ...U })),
918
+ thinkingDuration: (B[H].thinkingDuration || 0) + d
917
919
  }, B;
918
920
  }
919
- return b;
921
+ return S;
920
922
  }));
921
923
  }
922
- async function C($, K, e, A, d = !1) {
923
- T.value = !1, R.value = !1, a.value.set(e, []), L.value.set(e, /* @__PURE__ */ new Map()), q.value.set(e, /* @__PURE__ */ new Map()), _.value = !0;
924
+ async function b(H, J, e, A, d = !1) {
925
+ x.value = !1, $.value = !1, a.value.set(e, []), O.value.set(e, /* @__PURE__ */ new Map()), q.value.set(e, /* @__PURE__ */ new Map()), C.value = !0;
924
926
  try {
925
- const E = l.baseUrl.replace(/\/+$/, "") + "/" + $.replace(/^\/+/, "");
926
- await Kn(E, {
927
+ const M = l.baseUrl.replace(/\/+$/, "") + "/" + H.replace(/^\/+/, "");
928
+ await Jn(M, {
927
929
  method: "POST",
928
930
  headers: {
929
931
  "Content-Type": "application/json",
930
932
  Authorization: `Bearer ${l.token}`
931
933
  },
932
- body: JSON.stringify({ app: l.app ?? 1, data: K }),
934
+ body: JSON.stringify({ app: l.app ?? 1, data: J }),
933
935
  signal: A,
934
936
  openWhenHidden: !0,
935
- async onopen(b) {
936
- b.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", b.status, b.statusText);
937
+ async onopen(S) {
938
+ S.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", S.status, S.statusText);
937
939
  },
938
- onmessage(b) {
939
- var B, U, ee, ie, g;
940
+ onmessage(S) {
941
+ var B, U, ee, se, G;
940
942
  try {
941
- let V = b.data || "";
942
- for (; V.startsWith("data:"); )
943
- V = V.replace(/^data:\s*/, "");
944
- if (!V) return;
945
- let O;
943
+ let T = S.data || "";
944
+ for (; T.startsWith("data:"); )
945
+ T = T.replace(/^data:\s*/, "");
946
+ if (!T) return;
947
+ let p;
946
948
  try {
947
- O = JSON.parse(V);
949
+ p = JSON.parse(T);
948
950
  } catch {
949
951
  return;
950
952
  }
951
- switch (z(e), O.event) {
953
+ switch (K(e), p.event) {
952
954
  case "message_start":
953
- d || (s.value = O.id), u.value.set(e, "answer");
955
+ d || (s.value = p.id), u.value.set(e, "answer");
954
956
  break;
955
957
  // ── 对话流型智能体:流程开始,标记进入 flow 协议 ──
956
958
  case "flow_start":
957
- R.value = !0;
959
+ $.value = !0;
958
960
  break;
959
961
  case "think_message_output_start": {
960
962
  y.value.set(e, Date.now()), u.value.set(e, "thinking");
961
- const m = a.value.get(e) || [];
962
- a.value.set(e, [...m, { type: "thinking", content: "" }]), S(e);
963
+ const _ = a.value.get(e) || [];
964
+ a.value.set(e, [..._, { type: "thinking", content: "" }]), E(e);
963
965
  break;
964
966
  }
965
967
  case "agent_thought": {
966
- const m = O.thought || O.thinking || "", k = a.value.get(e) || [], M = k[k.length - 1];
967
- M && M.type === "agent_thought" && M.duration == null ? M.content += m : (u.value.set(e, "agent_thought"), k.push({ type: "agent_thought", content: m }), w.value.set(e, Date.now())), a.value.set(e, k), c((N) => {
968
+ const _ = p.thought || p.thinking || "", m = a.value.get(e) || [], k = m[m.length - 1];
969
+ k && k.type === "agent_thought" && k.duration == null ? k.content += _ : (u.value.set(e, "agent_thought"), m.push({ type: "agent_thought", content: _ }), w.value.set(e, Date.now())), a.value.set(e, m), c((N) => {
968
970
  if (N[e]) {
969
971
  const Y = [...N];
970
972
  return Y[e] = {
971
973
  ...Y[e],
972
- segments: k.map((H) => ({ ...H })),
973
- thinkingContent: (Y[e].thinkingContent || "") + m,
974
+ segments: m.map((L) => ({ ...L })),
975
+ thinkingContent: (Y[e].thinkingContent || "") + _,
974
976
  status: h.THINKING
975
977
  }, Y;
976
978
  }
@@ -979,14 +981,14 @@ function uo({
979
981
  break;
980
982
  }
981
983
  case "think_message": {
982
- const m = O.thinking || O.answer || O.text || "", k = a.value.get(e) || [], M = k[k.length - 1];
983
- M && M.type === "thinking" ? M.content += m : (k.push({ type: "thinking", content: m }), y.value.set(e, Date.now())), a.value.set(e, k), c((N) => {
984
+ const _ = p.thinking || p.answer || p.text || "", m = a.value.get(e) || [], k = m[m.length - 1];
985
+ k && k.type === "thinking" ? k.content += _ : (m.push({ type: "thinking", content: _ }), y.value.set(e, Date.now())), a.value.set(e, m), c((N) => {
984
986
  if (N[e]) {
985
987
  const Y = [...N];
986
988
  return Y[e] = {
987
989
  ...Y[e],
988
- segments: k.map((H) => ({ ...H })),
989
- thinkingContent: (Y[e].thinkingContent || "") + m,
990
+ segments: m.map((L) => ({ ...L })),
991
+ thinkingContent: (Y[e].thinkingContent || "") + _,
990
992
  status: h.THINKING
991
993
  }, Y;
992
994
  }
@@ -995,30 +997,30 @@ function uo({
995
997
  break;
996
998
  }
997
999
  case "agent_thought_end": {
998
- const m = w.value.get(e), k = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0, M = a.value.get(e) || [], N = M[M.length - 1];
999
- N && N.type === "agent_thought" && (N.duration = k), a.value.set(e, M), c((Y) => {
1000
+ const _ = w.value.get(e), m = _ ? Math.round((Date.now() - _) / 1e3 * 10) / 10 : 0, k = a.value.get(e) || [], N = k[k.length - 1];
1001
+ N && N.type === "agent_thought" && (N.duration = m), a.value.set(e, k), c((Y) => {
1000
1002
  if (Y[e]) {
1001
- const H = [...Y];
1002
- return H[e] = {
1003
- ...H[e],
1004
- segments: M.map((Q) => ({ ...Q })),
1005
- thinkingDuration: (H[e].thinkingDuration || 0) + k
1006
- }, H;
1003
+ const L = [...Y];
1004
+ return L[e] = {
1005
+ ...L[e],
1006
+ segments: k.map((F) => ({ ...F })),
1007
+ thinkingDuration: (L[e].thinkingDuration || 0) + m
1008
+ }, L;
1007
1009
  }
1008
1010
  return Y;
1009
1011
  });
1010
1012
  break;
1011
1013
  }
1012
1014
  case "think_message_output_end": {
1013
- const m = y.value.get(e), k = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0, M = a.value.get(e) || [], N = M[M.length - 1];
1014
- N && N.type === "thinking" && (N.duration = k), a.value.set(e, M), c((Y) => {
1015
+ const _ = y.value.get(e), m = _ ? Math.round((Date.now() - _) / 1e3 * 10) / 10 : 0, k = a.value.get(e) || [], N = k[k.length - 1];
1016
+ N && N.type === "thinking" && (N.duration = m), a.value.set(e, k), c((Y) => {
1015
1017
  if (Y[e]) {
1016
- const H = [...Y];
1017
- return H[e] = {
1018
- ...H[e],
1019
- segments: M.map((Q) => ({ ...Q })),
1020
- thinkingDuration: (H[e].thinkingDuration || 0) + k
1021
- }, H;
1018
+ const L = [...Y];
1019
+ return L[e] = {
1020
+ ...L[e],
1021
+ segments: k.map((F) => ({ ...F })),
1022
+ thinkingDuration: (L[e].thinkingDuration || 0) + m
1023
+ }, L;
1022
1024
  }
1023
1025
  return Y;
1024
1026
  });
@@ -1028,79 +1030,79 @@ function uo({
1028
1030
  // message_config.reasoning === true 的步骤(如「正在思考」)归入深度思考,
1029
1031
  // 其余(執行準備/資料獲取/...)归入流程步骤。
1030
1032
  case "tool_message_output_start": {
1031
- R.value = !0;
1032
- const m = ((B = O.message_config) == null ? void 0 : B.reasoning) === !0 || O.reasoning === !0, k = Date.now(), M = a.value.get(e) || [];
1033
- M.push({
1034
- type: m ? "thinking" : "step",
1035
- title: O.message_title || "",
1036
- id: O.id,
1033
+ $.value = !0;
1034
+ const _ = ((B = p.message_config) == null ? void 0 : B.reasoning) === !0 || p.reasoning === !0, m = Date.now(), k = a.value.get(e) || [];
1035
+ k.push({
1036
+ type: _ ? "thinking" : "step",
1037
+ title: p.message_title || "",
1038
+ id: p.id,
1037
1039
  content: "",
1038
- reasoning: m
1040
+ reasoning: _
1039
1041
  });
1040
- const N = M.length - 1;
1041
- if (a.value.set(e, M), u.value.set(e, m ? "thinking" : "step"), O.id != null) {
1042
- const Y = L.value.get(e) || /* @__PURE__ */ new Map();
1043
- Y.set(String(O.id), N), L.value.set(e, Y);
1044
- const H = q.value.get(e) || /* @__PURE__ */ new Map();
1045
- H.set(String(O.id), k), q.value.set(e, H);
1042
+ const N = k.length - 1;
1043
+ if (a.value.set(e, k), u.value.set(e, _ ? "thinking" : "step"), p.id != null) {
1044
+ const Y = O.value.get(e) || /* @__PURE__ */ new Map();
1045
+ Y.set(String(p.id), N), O.value.set(e, Y);
1046
+ const L = q.value.get(e) || /* @__PURE__ */ new Map();
1047
+ L.set(String(p.id), m), q.value.set(e, L);
1046
1048
  }
1047
- m && y.value.set(e, k), S(e);
1049
+ _ && y.value.set(e, m), E(e);
1048
1050
  break;
1049
1051
  }
1050
1052
  case "tool_message": {
1051
- const m = O.answer || O.text || O.content || "";
1052
- if (!m) break;
1053
- const k = a.value.get(e) || [];
1054
- if (R.value) {
1055
- const M = O.id != null ? String(O.id) : null, N = L.value.get(e);
1056
- let Y = M != null ? N == null ? void 0 : N.get(M) : void 0;
1057
- if (Y == null || !k[Y]) {
1058
- const H = ((U = O.message_config) == null ? void 0 : U.reasoning) === !0 || O.reasoning === !0;
1059
- if (k.push({
1060
- type: H ? "thinking" : "step",
1061
- title: O.message_title || "",
1062
- id: O.id,
1063
- content: m,
1064
- reasoning: H
1065
- }), Y = k.length - 1, M != null) {
1066
- const Q = N || /* @__PURE__ */ new Map();
1067
- Q.set(M, Y), L.value.set(e, Q), H && y.value.set(e, Date.now());
1053
+ const _ = p.answer || p.text || p.content || "";
1054
+ if (!_) break;
1055
+ const m = a.value.get(e) || [];
1056
+ if ($.value) {
1057
+ const k = p.id != null ? String(p.id) : null, N = O.value.get(e);
1058
+ let Y = k != null ? N == null ? void 0 : N.get(k) : void 0;
1059
+ if (Y == null || !m[Y]) {
1060
+ const L = ((U = p.message_config) == null ? void 0 : U.reasoning) === !0 || p.reasoning === !0;
1061
+ if (m.push({
1062
+ type: L ? "thinking" : "step",
1063
+ title: p.message_title || "",
1064
+ id: p.id,
1065
+ content: _,
1066
+ reasoning: L
1067
+ }), Y = m.length - 1, k != null) {
1068
+ const F = N || /* @__PURE__ */ new Map();
1069
+ F.set(k, Y), O.value.set(e, F), L && y.value.set(e, Date.now());
1068
1070
  }
1069
1071
  } else {
1070
- const H = k[Y];
1071
- k[Y] = { ...H, content: H.content + m };
1072
+ const L = m[Y];
1073
+ m[Y] = { ...L, content: L.content + _ };
1072
1074
  }
1073
- a.value.set(e, k), c((H) => {
1074
- if (H[e]) {
1075
- const Q = [...H];
1076
- return Q[e] = {
1077
- ...Q[e],
1078
- segments: k.map((te) => ({ ...te })),
1075
+ a.value.set(e, m), c((L) => {
1076
+ if (L[e]) {
1077
+ const F = [...L];
1078
+ return F[e] = {
1079
+ ...F[e],
1080
+ segments: m.map((te) => ({ ...te })),
1079
1081
  status: h.THINKING
1080
- }, Q;
1082
+ }, F;
1081
1083
  }
1082
- return H;
1084
+ return L;
1083
1085
  });
1084
1086
  break;
1085
1087
  }
1086
- k.push({ type: "answer", content: m }), a.value.set(e, k), S(e);
1088
+ m.push({ type: "answer", content: _ }), a.value.set(e, m), E(e);
1087
1089
  break;
1088
1090
  }
1089
1091
  // ── 对话流型智能体:步骤/推理消息结束,记录该步骤耗时 ──
1090
1092
  case "tool_message_output_end": {
1091
- const m = a.value.get(e) || [], k = O.id != null ? String(O.id) : null;
1092
- let M = k != null ? (ee = L.value.get(e)) == null ? void 0 : ee.get(k) : m.length - 1;
1093
- (M == null || !m[M]) && (M = m.length - 1);
1094
- const N = (k != null ? (ie = q.value.get(e)) == null ? void 0 : ie.get(k) : void 0) ?? y.value.get(e), Y = N ? Math.round((Date.now() - N) / 1e3 * 10) / 10 : 0;
1095
- let H = 0;
1096
- const Q = m[M];
1097
- Q && Q.duration == null && (m[M] = { ...Q, duration: Y }, Q.type === "thinking" && (H = Y)), a.value.set(e, m), c((te) => {
1093
+ const _ = a.value.get(e) || [], m = p.id != null ? String(p.id) : null;
1094
+ let k = m != null ? (ee = O.value.get(e)) == null ? void 0 : ee.get(m) : _.length - 1;
1095
+ (k == null || !_[k]) && (k = _.length - 1);
1096
+ const N = (m != null ? (se = q.value.get(e)) == null ? void 0 : se.get(m) : void 0) ?? y.value.get(e), Y = N ? Math.round((Date.now() - N) / 1e3 * 10) / 10 : 0;
1097
+ let L = 0;
1098
+ const F = _[k];
1099
+ F && F.duration == null && (_[k] = { ...F, duration: Y }, F.type === "thinking" && (L = Y)), a.value.set(e, _), c((te) => {
1098
1100
  if (te[e]) {
1099
1101
  const re = [...te];
1100
1102
  return re[e] = {
1101
1103
  ...re[e],
1102
- segments: m.map((ce) => ({ ...ce })),
1103
- ...H ? { thinkingDuration: (re[e].thinkingDuration || 0) + H } : {}
1104
+ segments: _.map((ce) => ({ ...ce })),
1105
+ ...L ? { thinkingDuration: (re[e].thinkingDuration || 0) + L } : {}
1104
1106
  }, re;
1105
1107
  }
1106
1108
  return te;
@@ -1115,50 +1117,50 @@ function uo({
1115
1117
  case "flow_end":
1116
1118
  break;
1117
1119
  case "message": {
1118
- const m = O.answer || "", k = u.value.get(e), M = a.value.get(e) || [], N = M[M.length - 1];
1119
- k === "answer" && N && N.type === "answer" ? N.content += m : (j(e), u.value.set(e, "answer"), M.push({ type: "answer", content: m })), a.value.set(e, M);
1120
- const Y = M.filter((H) => H.type === "answer").map((H) => H.content).join("");
1121
- c((H) => {
1122
- if (H[e]) {
1123
- const Q = [...H];
1124
- return Q[e] = {
1125
- ...Q[e],
1126
- segments: M.map((te) => ({ ...te })),
1120
+ const _ = p.answer || "", m = u.value.get(e), k = a.value.get(e) || [], N = k[k.length - 1];
1121
+ m === "answer" && N && N.type === "answer" ? N.content += _ : (j(e), u.value.set(e, "answer"), k.push({ type: "answer", content: _ })), a.value.set(e, k);
1122
+ const Y = k.filter((L) => L.type === "answer").map((L) => L.content).join("");
1123
+ c((L) => {
1124
+ if (L[e]) {
1125
+ const F = [...L];
1126
+ return F[e] = {
1127
+ ...F[e],
1128
+ segments: k.map((te) => ({ ...te })),
1127
1129
  content: Y,
1128
- status: T.value ? h.STOP : h.ANSWERING
1129
- }, Q;
1130
+ status: x.value ? h.STOP : h.ANSWERING
1131
+ }, F;
1130
1132
  }
1131
- return H;
1133
+ return L;
1132
1134
  });
1133
1135
  break;
1134
1136
  }
1135
1137
  case "message_end": {
1136
1138
  i();
1137
- const m = [...n.value];
1138
- m[e] && (m[e] = { ...m[e], status: T.value ? h.STOP : h.COMPLETED }), n.value = m, _.value = !1;
1139
+ const _ = [...n.value];
1140
+ _[e] && (_[e] = { ..._[e], status: x.value ? h.STOP : h.COMPLETED }), n.value = _, C.value = !1;
1139
1141
  break;
1140
1142
  }
1141
1143
  case "agent_error":
1142
1144
  case "message_failed": {
1143
1145
  i();
1144
- const m = [...n.value];
1145
- m[e] && (m[e] = {
1146
- ...m[e],
1146
+ const _ = [...n.value];
1147
+ _[e] && (_[e] = {
1148
+ ..._[e],
1147
1149
  status: h.ERROR,
1148
- content: O.error_msg || O.message || "请求失败",
1149
- errorMessage: O.error_msg || O.message || "请求失败"
1150
- }, n.value = m), _.value = !1;
1150
+ content: p.error_msg || p.message || "请求失败",
1151
+ errorMessage: p.error_msg || p.message || "请求失败"
1152
+ }, n.value = _), C.value = !1;
1151
1153
  break;
1152
1154
  }
1153
1155
  case "message_replace": {
1154
- const m = O.answer || "", k = a.value.get(e) || [], M = (g = k.map((N, Y) => ({ s: N, i: Y })).reverse().find((N) => N.s.type === "answer")) == null ? void 0 : g.i;
1155
- M != null ? k[M] = { ...k[M], content: m } : k.push({ type: "answer", content: m }), a.value.set(e, k), c((N) => {
1156
+ const _ = p.answer || "", m = a.value.get(e) || [], k = (G = m.map((N, Y) => ({ s: N, i: Y })).reverse().find((N) => N.s.type === "answer")) == null ? void 0 : G.i;
1157
+ k != null ? m[k] = { ...m[k], content: _ } : m.push({ type: "answer", content: _ }), a.value.set(e, m), c((N) => {
1156
1158
  if (N[e]) {
1157
1159
  const Y = [...N];
1158
1160
  return Y[e] = {
1159
1161
  ...Y[e],
1160
- segments: k.map((H) => ({ ...H })),
1161
- content: m
1162
+ segments: m.map((L) => ({ ...L })),
1163
+ content: _
1162
1164
  }, Y;
1163
1165
  }
1164
1166
  return N;
@@ -1166,25 +1168,25 @@ function uo({
1166
1168
  break;
1167
1169
  }
1168
1170
  case "message_cost": {
1169
- const m = {
1170
- inputTokens: O.input_tokens || 0,
1171
- outputTokens: O.output_tokens || 0,
1172
- latency: O.latency || 0,
1173
- latencyFirstResp: O.latency_first_resp
1171
+ const _ = {
1172
+ inputTokens: p.input_tokens || 0,
1173
+ outputTokens: p.output_tokens || 0,
1174
+ latency: p.latency || 0,
1175
+ latencyFirstResp: p.latency_first_resp
1174
1176
  };
1175
- c((k) => {
1176
- if (k[e]) {
1177
- const M = [...k];
1178
- return M[e] = { ...M[e], cost: m }, M;
1177
+ c((m) => {
1178
+ if (m[e]) {
1179
+ const k = [...m];
1180
+ return k[e] = { ...k[e], cost: _ }, k;
1179
1181
  }
1180
- return k;
1182
+ return m;
1181
1183
  });
1182
1184
  break;
1183
1185
  }
1184
1186
  default:
1185
1187
  }
1186
- } catch (V) {
1187
- console.error("[ai-assist-sdk] onmessage 解析失败:", V);
1188
+ } catch (T) {
1189
+ console.error("[ai-assist-sdk] onmessage 解析失败:", T);
1188
1190
  }
1189
1191
  },
1190
1192
  onclose() {
@@ -1192,33 +1194,33 @@ function uo({
1192
1194
  const B = (a.value.get(e) || []).filter((ee) => ee.type === "answer").map((ee) => ee.content).join(""), U = [...n.value];
1193
1195
  U[e] && U[e].status !== h.ERROR && (U[e] = {
1194
1196
  ...U[e],
1195
- content: T.value && !B ? "已停止回答" : B,
1196
- status: T.value ? h.STOP : h.COMPLETED
1197
- }), n.value = U, _.value = !1;
1197
+ content: x.value && !B ? "已停止回答" : B,
1198
+ status: x.value ? h.STOP : h.COMPLETED
1199
+ }), n.value = U, C.value = !1;
1198
1200
  },
1199
- onerror(b) {
1200
- console.error("[ai-assist-sdk] ❌ 连接错误:", b), i();
1201
+ onerror(S) {
1202
+ console.error("[ai-assist-sdk] ❌ 连接错误:", S), i();
1201
1203
  const B = [...n.value];
1202
1204
  B[e] && (B[e] = { ...B[e], content: `
1203
- ⚠️ 请求异常,已终止`, status: h.ERROR }), n.value = B, _.value = !1;
1205
+ ⚠️ 请求异常,已终止`, status: h.ERROR }), n.value = B, C.value = !1;
1204
1206
  }
1205
1207
  });
1206
- } catch (E) {
1207
- if (console.error("[ai-assist-sdk] doStreamRequest error:", E), !T.value) {
1208
+ } catch (M) {
1209
+ if (console.error("[ai-assist-sdk] doStreamRequest error:", M), !x.value) {
1208
1210
  i();
1209
- const b = [...n.value];
1210
- b[e] && (b[e] = { ...b[e], content: "服务连接失败,请稍后重试", status: h.ERROR }), n.value = b, _.value = !1;
1211
+ const S = [...n.value];
1212
+ S[e] && (S[e] = { ...S[e], content: "服务连接失败,请稍后重试", status: h.ERROR }), n.value = S, C.value = !1;
1211
1213
  }
1212
1214
  }
1213
1215
  }
1214
- return { doStreamRequest: C, issTop: T };
1216
+ return { doStreamRequest: b, issTop: x };
1215
1217
  }
1216
1218
  function ro(n) {
1217
1219
  return n.queryAgainStreamApi || n.queryAgainApi || n.chatQueryStreamApi || n.chatQueryApi;
1218
1220
  }
1219
1221
  function co({
1220
1222
  messages: n,
1221
- userInput: _,
1223
+ userInput: C,
1222
1224
  isGenerating: s,
1223
1225
  lastUserMessage: c,
1224
1226
  conversationId: i,
@@ -1229,47 +1231,47 @@ function co({
1229
1231
  cfg: y,
1230
1232
  onTitleGenerated: w
1231
1233
  }) {
1232
- const R = y.apis, L = ke({
1234
+ const $ = y.apis, O = ke({
1233
1235
  first: new AbortController(),
1234
1236
  again: new AbortController()
1235
- }), q = p(!1);
1236
- async function T(e, A) {
1237
- var E;
1238
- if (!y.titleGenerateApp || !R.updateConversationApi || q.value) return;
1237
+ }), q = f(!1);
1238
+ async function x(e, A) {
1239
+ var M;
1240
+ if (!y.titleGenerateApp || !$.updateConversationApi || q.value) return;
1239
1241
  let d = i.value;
1240
1242
  if (!d)
1241
1243
  try {
1242
- const b = await Tt(R);
1243
- (E = b == null ? void 0 : b.conversation) != null && E.appConversationID && (d = b.conversation.appConversationID, i.value = d);
1244
- } catch (b) {
1245
- console.error("[ai-assist-sdk] 创建会话失败:", b);
1244
+ const S = await Mt($);
1245
+ (M = S == null ? void 0 : S.conversation) != null && M.appConversationID && (d = S.conversation.appConversationID, i.value = d);
1246
+ } catch (S) {
1247
+ console.error("[ai-assist-sdk] 创建会话失败:", S);
1246
1248
  return;
1247
1249
  }
1248
1250
  if (d)
1249
1251
  try {
1250
- const b = await xn(R, y.titleGenerateApp);
1251
- if (!b) return;
1252
+ const S = await xn($, y.titleGenerateApp);
1253
+ if (!S) return;
1252
1254
  const B = A.length > 500 ? A.slice(0, 500) : A, U = `用户提问:${e}
1253
- AI回答:${B}`, ie = await xt().post(R.chatQueryApi, {
1255
+ AI回答:${B}`, se = await xt().post($.chatQueryApi, {
1254
1256
  app: y.titleGenerateApp,
1255
- data: { Query: U, AppConversationID: b }
1256
- }), g = Rn(Rt(ie.data));
1257
- g && (await $n(R, d, g), q.value = !0, w == null || w(g));
1258
- } catch (b) {
1259
- console.error("[ai-assist-sdk] 生成对话标题失败:", b);
1257
+ data: { Query: U, AppConversationID: S }
1258
+ }), G = Rn(Rt(se.data));
1259
+ G && (await $n($, d, G), q.value = !0, w == null || w(G));
1260
+ } catch (S) {
1261
+ console.error("[ai-assist-sdk] 生成对话标题失败:", S);
1260
1262
  }
1261
1263
  }
1262
- async function S() {
1263
- var b;
1264
- const e = _.value.trim();
1264
+ async function E() {
1265
+ var S;
1266
+ const e = C.value.trim();
1265
1267
  if (!e || s.value) return;
1266
- if (!i.value && (await $(), !i.value)) {
1268
+ if (!i.value && (await H(), !i.value)) {
1267
1269
  Ee("创建会话失败,请重试");
1268
1270
  return;
1269
1271
  }
1270
1272
  const A = n.value.length === 0;
1271
1273
  try {
1272
- (b = y.onMessageSend) == null || b.call(y, { text: e, isFirstMessage: A, conversationId: i.value });
1274
+ (S = y.onMessageSend) == null || S.call(y, { text: e, isFirstMessage: A, conversationId: i.value });
1273
1275
  } catch {
1274
1276
  }
1275
1277
  const d = [
@@ -1278,105 +1280,105 @@ AI回答:${B}`, ie = await xt().post(R.chatQueryApi, {
1278
1280
  // streamed:标记该条由实时流产生,前端按序逐字揭示(后端批量转发,终态可能早于渲染)
1279
1281
  { type: "ai", content: "", status: u.THINKING, streamed: !0 }
1280
1282
  ];
1281
- n.value = d, _.value = "", a();
1282
- const E = d.length - 1;
1283
- if (R.chatQueryStreamApi) {
1284
- if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", R.chatQueryStreamApi), await h(R.chatQueryStreamApi, {
1283
+ n.value = d, C.value = "", a();
1284
+ const M = d.length - 1;
1285
+ if ($.chatQueryStreamApi) {
1286
+ if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", $.chatQueryStreamApi), await h($.chatQueryStreamApi, {
1285
1287
  Query: e,
1286
1288
  AppConversationID: i.value,
1287
1289
  ResponseMode: "streaming"
1288
- }, E, L.first.signal), A && !q.value) {
1289
- const B = n.value[E];
1290
- B && B.status !== u.ERROR && T(e, B.content);
1290
+ }, M, O.first.signal), A && !q.value) {
1291
+ const B = n.value[M];
1292
+ B && B.status !== u.ERROR && x(e, B.content);
1291
1293
  }
1292
1294
  return;
1293
1295
  }
1294
1296
  console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
1295
1297
  try {
1296
- const U = await xt().post(R.chatQueryApi, {
1298
+ const U = await xt().post($.chatQueryApi, {
1297
1299
  app: y.app ?? 1,
1298
1300
  data: { Query: e, AppConversationID: i.value }
1299
1301
  }), ee = Rt(U.data);
1300
1302
  n.value = [
1301
1303
  ...n.value.slice(0, -1),
1302
1304
  { type: "ai", content: ee || "未获取到回答内容,请稍后重试", status: u.COMPLETED }
1303
- ], A && !q.value && ee && T(e, ee);
1305
+ ], A && !q.value && ee && x(e, ee);
1304
1306
  } catch (B) {
1305
1307
  n.value = [...n.value.slice(0, -1), { type: "ai", content: (B == null ? void 0 : B.message) || "服务连接失败,请稍后重试", status: u.ERROR }];
1306
1308
  }
1307
1309
  }
1308
- async function z() {
1310
+ async function K() {
1309
1311
  if (!c.value || s.value) return;
1310
- L.again.abort(), L.again = new AbortController();
1312
+ O.again.abort(), O.again = new AbortController();
1311
1313
  const e = [...n.value];
1312
1314
  e.length > 0 && e[e.length - 1].type === "ai" && e.pop(), e.push({ type: "ai", content: "", status: u.RETHINKING, streamed: !0 }), n.value = e, a();
1313
- const A = n.value.length - 1, d = ro(R);
1315
+ const A = n.value.length - 1, d = ro($);
1314
1316
  await h(d, {
1315
1317
  MessageID: c.value,
1316
1318
  AppConversationID: i.value,
1317
1319
  ResponseMode: "streaming"
1318
- }, A, L.again.signal, !0);
1320
+ }, A, O.again.signal, !0);
1319
1321
  }
1320
1322
  async function j() {
1321
1323
  if (!s.value) return;
1322
- const e = n.value.length - 1 - 1;
1323
- if (c.value && R.stopMessageApi)
1324
+ const e = n.value.length - 1;
1325
+ if (c.value && $.stopMessageApi)
1324
1326
  try {
1325
- await Tn(R, c.value);
1327
+ await Mn($, c.value);
1326
1328
  } catch (d) {
1327
- const E = [...n.value];
1328
- E[e] && (E[e] = { ...E[e], content: (d == null ? void 0 : d.message) || "系统繁忙,请稍后再试", status: u.ERROR }), n.value = E;
1329
+ const M = [...n.value];
1330
+ M[e] && (M[e] = { ...M[e], content: (d == null ? void 0 : d.message) || "系统繁忙,请稍后再试", status: u.ERROR }), n.value = M;
1329
1331
  return;
1330
1332
  }
1331
1333
  const A = [...n.value];
1332
- A[e] && (A[e] = { ...A[e], content: A[e].content || "已停止回答", status: u.STOP }), n.value = A, s.value = !1, L.first.abort(), L.first = new AbortController(), L.again.abort(), L.again = new AbortController(), l.value = !0;
1334
+ A[e] && (A[e] = { ...A[e], content: A[e].content || "已停止回答", status: u.STOP }), n.value = A, s.value = !1, O.first.abort(), O.first = new AbortController(), O.again.abort(), O.again = new AbortController(), l.value = !0;
1333
1335
  }
1334
- async function C(e) {
1336
+ async function b(e) {
1335
1337
  var A;
1336
1338
  i.value = e, q.value = !0;
1337
1339
  try {
1338
- const d = await En(R, e), E = [], b = Mn(d == null ? void 0 : d.messages);
1339
- for (const B of b)
1340
- B.query && E.push({ type: "user", content: B.query }), (A = B.answerInfo) != null && A.answer && E.push({ type: "ai", content: B.answerInfo.answer, status: u.COMPLETED });
1341
- n.value = E, a();
1340
+ const d = await En($, e), M = [], S = Dn(d == null ? void 0 : d.messages);
1341
+ for (const B of S)
1342
+ B.query && M.push({ type: "user", content: B.query }), (A = B.answerInfo) != null && A.answer && M.push({ type: "ai", content: B.answerInfo.answer, status: u.COMPLETED });
1343
+ n.value = M, a();
1342
1344
  } catch (d) {
1343
1345
  Ee((d == null ? void 0 : d.message) || "加载历史会话失败");
1344
1346
  }
1345
1347
  }
1346
- async function $() {
1348
+ async function H() {
1347
1349
  var e;
1348
1350
  q.value = !1;
1349
1351
  try {
1350
- const A = await Tt(R);
1352
+ const A = await Mt($);
1351
1353
  (e = A == null ? void 0 : A.conversation) != null && e.appConversationID && (i.value = A.conversation.appConversationID);
1352
1354
  } catch (A) {
1353
1355
  Ee((A == null ? void 0 : A.message) || "创建会话失败");
1354
1356
  }
1355
1357
  }
1356
- function K() {
1358
+ function J() {
1357
1359
  i.value = "", q.value = !1;
1358
1360
  }
1359
- return { sendMessage: S, regenerateResponse: z, toggleStop: j, goHistoryMessage: C, initConversation: $, resetConversation: K, controllers: L };
1361
+ return { sendMessage: E, regenerateResponse: K, toggleStop: j, goHistoryMessage: b, initConversation: H, resetConversation: J, controllers: O };
1360
1362
  }
1361
1363
  function vo({
1362
1364
  cfg: n,
1363
- STATUS: _,
1365
+ STATUS: C,
1364
1366
  userInput: s,
1365
1367
  isActive: c,
1366
1368
  scrollToBottom: i,
1367
1369
  onSessionTitle: h
1368
1370
  }) {
1369
- const l = bn([]), a = p("");
1371
+ const l = bn([]), a = f("");
1370
1372
  let u = 0;
1371
1373
  const y = P(
1372
1374
  () => l.value.find((d) => d.uid === a.value) ?? null
1373
1375
  ), w = P(() => {
1374
1376
  var d;
1375
1377
  return ((d = y.value) == null ? void 0 : d.messages.value) ?? [];
1376
- }), R = P(() => {
1378
+ }), $ = P(() => {
1377
1379
  var d;
1378
1380
  return ((d = y.value) == null ? void 0 : d.isGenerating.value) ?? !1;
1379
- }), L = P(
1381
+ }), O = P(
1380
1382
  () => {
1381
1383
  var d;
1382
1384
  return (((d = y.value) == null ? void 0 : d.messages.value.length) ?? 0) === 0;
@@ -1389,102 +1391,102 @@ function vo({
1389
1391
  updatedAt: d.updatedAt.value
1390
1392
  }))
1391
1393
  );
1392
- function T(d = "") {
1393
- const E = d || `draft-${++u}`, b = p([]), B = p(!1), U = p(""), ee = p(d), ie = p(""), g = p(Date.now()), V = /* @__PURE__ */ new Map(), { batchMessagesUpdate: O, flushMessagesBatch: m } = lo(b), { doStreamRequest: k, issTop: M } = uo({
1394
- messages: b,
1394
+ function x(d = "") {
1395
+ const M = d || `draft-${++u}`, S = f([]), B = f(!1), U = f(""), ee = f(d), se = f(""), G = f(Date.now()), T = /* @__PURE__ */ new Map(), { batchMessagesUpdate: p, flushMessagesBatch: _ } = lo(S), { doStreamRequest: m, issTop: k } = uo({
1396
+ messages: S,
1395
1397
  isGenerating: B,
1396
1398
  lastUserMessage: U,
1397
- batchMessagesUpdate: O,
1398
- flushMessagesBatch: m,
1399
- STATUS: _,
1399
+ batchMessagesUpdate: p,
1400
+ flushMessagesBatch: _,
1401
+ STATUS: C,
1400
1402
  cfg: n
1401
- }), H = co({
1402
- messages: b,
1403
+ }), L = co({
1404
+ messages: S,
1403
1405
  userInput: s,
1404
1406
  isGenerating: B,
1405
1407
  lastUserMessage: U,
1406
1408
  conversationId: ee,
1407
- doStreamRequest: async (Q, te, re, ce, X) => {
1408
- g.value = Date.now();
1409
+ doStreamRequest: async (F, te, re, ce, V) => {
1410
+ G.value = Date.now();
1409
1411
  try {
1410
- return await k(Q, te, re, ce, X);
1412
+ return await m(F, te, re, ce, V);
1411
1413
  } finally {
1412
- g.value = Date.now();
1414
+ G.value = Date.now();
1413
1415
  }
1414
1416
  },
1415
- issTop: M,
1417
+ issTop: k,
1416
1418
  scrollToBottom: () => {
1417
- c(E) && i();
1419
+ c(M) && i();
1418
1420
  },
1419
- STATUS: _,
1421
+ STATUS: C,
1420
1422
  cfg: n,
1421
- onTitleGenerated: (Q) => {
1422
- ie.value = Q, g.value = Date.now(), h == null || h(E, Q);
1423
+ onTitleGenerated: (F) => {
1424
+ se.value = F, G.value = Date.now(), h == null || h(M, F);
1423
1425
  }
1424
1426
  });
1425
1427
  return {
1426
- uid: E,
1428
+ uid: M,
1427
1429
  conversationId: ee,
1428
- messages: b,
1430
+ messages: S,
1429
1431
  isGenerating: B,
1430
1432
  lastUserMessage: U,
1431
- title: ie,
1432
- updatedAt: g,
1433
- reveal: V,
1434
- sendMessage: H.sendMessage,
1435
- regenerateResponse: H.regenerateResponse,
1436
- toggleStop: H.toggleStop,
1437
- loadHistory: H.goHistoryMessage,
1438
- resetConversation: H.resetConversation
1433
+ title: se,
1434
+ updatedAt: G,
1435
+ reveal: T,
1436
+ sendMessage: L.sendMessage,
1437
+ regenerateResponse: L.regenerateResponse,
1438
+ toggleStop: L.toggleStop,
1439
+ loadHistory: L.goHistoryMessage,
1440
+ resetConversation: L.resetConversation
1439
1441
  };
1440
1442
  }
1441
- function S(d) {
1443
+ function E(d) {
1442
1444
  a.value = d, i();
1443
1445
  }
1444
- function z() {
1446
+ function K() {
1445
1447
  let d = l.value.find(
1446
- (E) => !E.conversationId.value && !E.isGenerating.value && E.messages.value.length === 0
1448
+ (M) => !M.conversationId.value && !M.isGenerating.value && M.messages.value.length === 0
1447
1449
  );
1448
- d || (d = T(""), l.value = [...l.value, d]), d.resetConversation(), S(d.uid);
1450
+ d || (d = x(""), l.value = [...l.value, d]), d.resetConversation(), E(d.uid);
1449
1451
  }
1450
1452
  function j(d) {
1451
- const E = l.value.find((B) => B.conversationId.value === d);
1452
- if (E) {
1453
- S(E.uid);
1453
+ const M = l.value.find((B) => B.conversationId.value === d);
1454
+ if (M) {
1455
+ E(M.uid);
1454
1456
  return;
1455
1457
  }
1456
- const b = T(d);
1457
- l.value = [...l.value, b], S(b.uid), b.loadHistory(d);
1458
+ const S = x(d);
1459
+ l.value = [...l.value, S], E(S.uid), S.loadHistory(d);
1458
1460
  }
1459
- function C() {
1461
+ function b() {
1460
1462
  return y.value;
1461
1463
  }
1462
- async function $() {
1464
+ async function H() {
1463
1465
  var d;
1464
- await ((d = C()) == null ? void 0 : d.sendMessage());
1466
+ await ((d = b()) == null ? void 0 : d.sendMessage());
1465
1467
  }
1466
- async function K() {
1468
+ async function J() {
1467
1469
  var d;
1468
- await ((d = C()) == null ? void 0 : d.toggleStop());
1470
+ await ((d = b()) == null ? void 0 : d.toggleStop());
1469
1471
  }
1470
1472
  async function e() {
1471
1473
  var d;
1472
- await ((d = C()) == null ? void 0 : d.regenerateResponse());
1474
+ await ((d = b()) == null ? void 0 : d.regenerateResponse());
1473
1475
  }
1474
- const A = T("");
1476
+ const A = x("");
1475
1477
  return l.value = [A], a.value = A.uid, {
1476
1478
  sessions: l,
1477
1479
  activeUid: a,
1478
1480
  activeSession: y,
1479
1481
  messages: w,
1480
- isGenerating: R,
1481
- isEmptyConversation: L,
1482
+ isGenerating: $,
1483
+ isEmptyConversation: O,
1482
1484
  sessionMetas: q,
1483
- sendMessage: $,
1484
- toggleStop: K,
1485
+ sendMessage: H,
1486
+ toggleStop: J,
1485
1487
  regenerateResponse: e,
1486
1488
  goHistoryMessage: j,
1487
- createNewConversation: z
1489
+ createNewConversation: K
1488
1490
  };
1489
1491
  }
1490
1492
  const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "message ai-message greet-message" }, fo = { class: "ai-greet" }, po = ["src"], yo = {
@@ -1497,7 +1499,7 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1497
1499
  defaultRecommend: {}
1498
1500
  },
1499
1501
  emits: ["title-generated", "sessions-change"],
1500
- setup(n, { expose: _, emit: s }) {
1502
+ setup(n, { expose: C, emit: s }) {
1501
1503
  const c = {
1502
1504
  THINKING: "thinking",
1503
1505
  RETHINKING: "rethinking",
@@ -1506,102 +1508,102 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1506
1508
  COMPLETED: "completed",
1507
1509
  STOP: "stop",
1508
1510
  ERROR: "error"
1509
- }, i = n, h = s, l = Ge(), a = p(""), u = p(null), y = ke({ text1: "", text2: "" }), w = p([]), R = p(0), L = P(
1510
- () => w.value[R.value % (w.value.length || 1)]
1511
+ }, i = n, h = s, l = Qe(), a = f(""), u = f(null), y = ke({ text1: "", text2: "" }), w = f([]), $ = f(0), O = P(
1512
+ () => w.value[$.value % (w.value.length || 1)]
1511
1513
  );
1512
1514
  function q() {
1513
- R.value++;
1515
+ $.value++;
1514
1516
  }
1515
- function T(x) {
1516
- a.value = x;
1517
+ function x(R) {
1518
+ a.value = R;
1517
1519
  }
1518
- const { isAtBottom: S, hasScroll: z, scrollToBottom: j, checkScrollStatus: C } = ao(u), { enhanceCodeBlocks: $ } = io();
1519
- let K = (x) => !1;
1520
+ const { isAtBottom: E, hasScroll: K, scrollToBottom: j, checkScrollStatus: b } = ao(u), { enhanceCodeBlocks: H } = io();
1521
+ let J = (R) => !1;
1520
1522
  const {
1521
1523
  activeSession: e,
1522
1524
  messages: A,
1523
1525
  isGenerating: d,
1524
- isEmptyConversation: E,
1525
- sessionMetas: b,
1526
+ isEmptyConversation: M,
1527
+ sessionMetas: S,
1526
1528
  sendMessage: B,
1527
1529
  regenerateResponse: U,
1528
1530
  toggleStop: ee,
1529
- goHistoryMessage: ie,
1530
- createNewConversation: g
1531
+ goHistoryMessage: se,
1532
+ createNewConversation: G
1531
1533
  } = vo({
1532
1534
  cfg: l,
1533
1535
  STATUS: c,
1534
1536
  userInput: a,
1535
- isActive: (x) => K(x),
1537
+ isActive: (R) => J(R),
1536
1538
  scrollToBottom: j,
1537
- onSessionTitle: (x, F) => {
1538
- K(x) && h("title-generated", F);
1539
+ onSessionTitle: (R, X) => {
1540
+ J(R) && h("title-generated", X);
1539
1541
  }
1540
1542
  });
1541
- K = (x) => {
1542
- var F;
1543
- return ((F = e.value) == null ? void 0 : F.uid) === x;
1544
- }, ae(e, (x) => {
1545
- h("title-generated", (x == null ? void 0 : x.title.value) ?? "");
1546
- }), ae(b, (x) => h("sessions-change", x), { immediate: !0 });
1547
- function V(x, F) {
1543
+ J = (R) => {
1544
+ var X;
1545
+ return ((X = e.value) == null ? void 0 : X.uid) === R;
1546
+ }, ie(e, (R) => {
1547
+ h("title-generated", (R == null ? void 0 : R.title.value) ?? "");
1548
+ }), ie(S, (R) => h("sessions-change", R), { immediate: !0 });
1549
+ function T(R, X) {
1548
1550
  var ne;
1549
- (ne = e.value) == null || ne.reveal.set(x, F);
1551
+ (ne = e.value) == null || ne.reveal.set(R, X);
1550
1552
  }
1551
- _({ goHistoryMessage: ie, createNewConversation: g, isEmptyConversation: E });
1552
- const O = p(/* @__PURE__ */ new Map());
1553
- function m(x, F) {
1554
- x ? O.value.set(F, x) : O.value.delete(F);
1553
+ C({ goHistoryMessage: se, createNewConversation: G, isEmptyConversation: M });
1554
+ const p = f(/* @__PURE__ */ new Map());
1555
+ function _(R, X) {
1556
+ R ? p.value.set(X, R) : p.value.delete(X);
1555
1557
  }
1556
- ae(A, () => {
1558
+ ie(A, () => {
1557
1559
  pe(() => {
1558
- O.value.forEach((x) => {
1559
- $(x);
1560
- }), C();
1560
+ p.value.forEach((R) => {
1561
+ H(R);
1562
+ }), b();
1561
1563
  });
1562
1564
  }, { deep: !0 });
1563
- let k = null;
1565
+ let m = null;
1564
1566
  _e(() => {
1565
1567
  i.defaultSayhello && (y.text1 = i.defaultSayhello.text1, y.text2 = i.defaultSayhello.text2), i.defaultRecommend && (w.value = Hn(i.defaultRecommend));
1566
1568
  }), _e(() => {
1567
- u.value && (k = () => C(), u.value.addEventListener("scroll", k), C());
1569
+ u.value && (m = () => b(), u.value.addEventListener("scroll", m), b());
1568
1570
  });
1569
- const M = p(null);
1570
- let N = !1, Y = 0, H = 0;
1571
- function Q(x) {
1571
+ const k = f(null);
1572
+ let N = !1, Y = 0, L = 0;
1573
+ function F(R) {
1572
1574
  var ne;
1573
- const F = (ne = u.value) == null ? void 0 : ne.closest(".chat-wrap");
1574
- return parseFloat((F == null ? void 0 : F.style.getPropertyValue(x)) ?? "") || 0;
1575
+ const X = (ne = u.value) == null ? void 0 : ne.closest(".chat-wrap");
1576
+ return parseFloat((X == null ? void 0 : X.style.getPropertyValue(R)) ?? "") || 0;
1575
1577
  }
1576
- function te(x) {
1577
- return "touches" in x ? x.touches[0].clientY : x.clientY;
1578
+ function te(R) {
1579
+ return "touches" in R ? R.touches[0].clientY : R.clientY;
1578
1580
  }
1579
- function re(x) {
1580
- const F = u.value;
1581
- F && (x.preventDefault(), N = !0, Y = te(x), F.scrollTop, H = Q("--ai-thumb-top"), window.addEventListener("mousemove", ce), window.addEventListener("mouseup", X), window.addEventListener("touchmove", ce, { passive: !1 }), window.addEventListener("touchend", X));
1581
+ function re(R) {
1582
+ const X = u.value;
1583
+ X && (R.preventDefault(), N = !0, Y = te(R), X.scrollTop, L = F("--ai-thumb-top"), window.addEventListener("mousemove", ce), window.addEventListener("mouseup", V), window.addEventListener("touchmove", ce, { passive: !1 }), window.addEventListener("touchend", V));
1582
1584
  }
1583
- function ce(x) {
1584
- const F = u.value;
1585
- if (!N || !F) return;
1586
- x.preventDefault();
1587
- const ne = te(x) - Y, le = F.clientHeight, ve = F.scrollHeight, Ae = Q("--ai-thumb-height"), ge = le - Ae, ue = Math.min(Math.max(H + ne, 0), ge);
1588
- F.scrollTop = ue / ge * (ve - le);
1585
+ function ce(R) {
1586
+ const X = u.value;
1587
+ if (!N || !X) return;
1588
+ R.preventDefault();
1589
+ const ne = te(R) - Y, le = X.clientHeight, ve = X.scrollHeight, Ae = F("--ai-thumb-height"), ge = le - Ae, ue = Math.min(Math.max(L + ne, 0), ge);
1590
+ X.scrollTop = ue / ge * (ve - le);
1589
1591
  }
1590
- function X() {
1591
- N = !1, window.removeEventListener("mousemove", ce), window.removeEventListener("mouseup", X), window.removeEventListener("touchmove", ce), window.removeEventListener("touchend", X);
1592
+ function V() {
1593
+ N = !1, window.removeEventListener("mousemove", ce), window.removeEventListener("mouseup", V), window.removeEventListener("touchmove", ce), window.removeEventListener("touchend", V);
1592
1594
  }
1593
- function G(x) {
1594
- const F = u.value, ne = M.value;
1595
- if (!F || !ne) return;
1596
- x.preventDefault();
1597
- const le = ne.getBoundingClientRect(), Ae = (te(x) - le.top) / le.height;
1598
- F.scrollTop = Ae * (F.scrollHeight - F.clientHeight);
1595
+ function Q(R) {
1596
+ const X = u.value, ne = k.value;
1597
+ if (!X || !ne) return;
1598
+ R.preventDefault();
1599
+ const le = ne.getBoundingClientRect(), Ae = (te(R) - le.top) / le.height;
1600
+ X.scrollTop = Ae * (X.scrollHeight - X.clientHeight);
1599
1601
  }
1600
1602
  return Re(() => {
1601
- u.value && k && u.value.removeEventListener("scroll", k), X();
1602
- }), (x, F) => {
1603
+ u.value && m && u.value.removeEventListener("scroll", m), V();
1604
+ }), (R, X) => {
1603
1605
  var ne;
1604
- return r(), f("div", ho, [
1606
+ return r(), g("div", ho, [
1605
1607
  o("div", mo, [
1606
1608
  o("div", {
1607
1609
  class: "chat-box scrollWrap",
@@ -1615,47 +1617,47 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1615
1617
  o("p", null, Z(y.text2), 1)
1616
1618
  ])
1617
1619
  ]),
1618
- (ne = L.value) != null && ne.length ? (r(), f("div", yo, [
1620
+ (ne = O.value) != null && ne.length ? (r(), g("div", yo, [
1619
1621
  o("div", wo, [
1620
1622
  o("div", ko, [
1621
- F[2] || (F[2] = o("span", null, "你可以尝试这样问我:", -1)),
1623
+ X[2] || (X[2] = o("span", null, "你可以尝试这样问我:", -1)),
1622
1624
  o("p", {
1623
1625
  class: "refresh-btn",
1624
1626
  onClick: q
1625
1627
  }, [
1626
1628
  o("img", { src: W(os) }, null, 8, Co),
1627
- F[1] || (F[1] = o("span", null, "换一换", -1))
1629
+ X[1] || (X[1] = o("span", null, "换一换", -1))
1628
1630
  ])
1629
1631
  ]),
1630
1632
  o("ul", null, [
1631
- (r(!0), f(ye, null, Me(L.value, (le, ve) => (r(), f("li", {
1633
+ (r(!0), g(ye, null, De(O.value, (le, ve) => (r(), g("li", {
1632
1634
  key: ve,
1633
- onClick: (Ae) => T(le)
1635
+ onClick: (Ae) => x(le)
1634
1636
  }, Z(le), 9, _o))), 128))
1635
1637
  ])
1636
1638
  ])
1637
- ])) : J("", !0),
1638
- (r(!0), f(ye, null, Me(W(A), (le, ve) => {
1639
+ ])) : z("", !0),
1640
+ (r(!0), g(ye, null, De(W(A), (le, ve) => {
1639
1641
  var Ae, ge;
1640
1642
  return r(), he(Fs, {
1641
1643
  key: `${((Ae = W(e)) == null ? void 0 : Ae.uid) ?? ""}-${ve}`,
1642
1644
  msg: le,
1643
1645
  index: ve,
1644
1646
  STATUS: c,
1645
- setMessageRef: m,
1647
+ setMessageRef: _,
1646
1648
  scrollToBottom: W(j),
1647
1649
  initialReveal: (ge = W(e)) == null ? void 0 : ge.reveal.get(ve),
1648
1650
  onRegenerate: W(U),
1649
- onRevealProgress: (ue) => V(ve, ue)
1651
+ onRevealProgress: (ue) => T(ve, ue)
1650
1652
  }, null, 8, ["msg", "index", "scrollToBottom", "initialReveal", "onRegenerate", "onRevealProgress"]);
1651
1653
  }), 128))
1652
1654
  ], 512),
1653
1655
  o("div", {
1654
1656
  ref_key: "scrollbarRef",
1655
- ref: M,
1657
+ ref: k,
1656
1658
  class: "chat-box__scrollbar",
1657
- onMousedown: we(G, ["prevent"]),
1658
- onTouchstart: we(G, ["prevent"])
1659
+ onMousedown: we(Q, ["prevent"]),
1660
+ onTouchstart: we(Q, ["prevent"])
1659
1661
  }, [
1660
1662
  o("div", {
1661
1663
  class: "chat-box__scrollbar-thumb",
@@ -1664,25 +1666,25 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1664
1666
  }, null, 32)
1665
1667
  ], 544)
1666
1668
  ]),
1667
- se(oo, {
1669
+ oe(oo, {
1668
1670
  modelValue: a.value,
1669
- "onUpdate:modelValue": F[0] || (F[0] = (le) => a.value = le),
1671
+ "onUpdate:modelValue": X[0] || (X[0] = (le) => a.value = le),
1670
1672
  isGenerating: W(d),
1671
- hasScroll: W(z),
1672
- isAtBottom: W(S),
1673
+ hasScroll: W(K),
1674
+ isAtBottom: W(E),
1673
1675
  onSend: W(B),
1674
1676
  onRegenerate: W(U),
1675
1677
  onStop: W(ee),
1676
1678
  onScrollToBottom: W(j)
1677
1679
  }, null, 8, ["modelValue", "isGenerating", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"]),
1678
- F[3] || (F[3] = o("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
1680
+ X[3] || (X[3] = o("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
1679
1681
  ]);
1680
1682
  };
1681
1683
  }
1682
- }), Ao = { class: "ai-history" }, So = { class: "content" }, Do = {
1684
+ }), Ao = { class: "ai-history" }, So = { class: "content" }, To = {
1683
1685
  key: 0,
1684
1686
  class: "ai-history-loading"
1685
- }, Eo = { class: "ai-history-group-title" }, Mo = ["onClick"], To = { class: "ai-history-item-title" }, xo = {
1687
+ }, Eo = { class: "ai-history-group-title" }, Do = ["onClick"], Mo = { class: "ai-history-item-title" }, xo = {
1686
1688
  key: 0,
1687
1689
  class: "ai-history-item-badge"
1688
1690
  }, Ro = ["onClick"], $o = {
@@ -1694,26 +1696,26 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1694
1696
  localSessions: {}
1695
1697
  },
1696
1698
  emits: ["history-detail", "new-conversation"],
1697
- setup(n, { emit: _ }) {
1698
- const s = n, i = Ge().apis, h = p([]), l = p(!0), a = p(!1), u = p(""), y = P(() => {
1699
- const T = h.value.map((S) => ({ ...S }));
1700
- for (const S of s.localSessions ?? []) {
1701
- if (!S.conversationId) continue;
1702
- const z = T.findIndex((C) => C.appConversationID === S.conversationId);
1703
- if (z >= 0) {
1704
- T[z] = {
1705
- ...T[z],
1699
+ setup(n, { emit: C }) {
1700
+ const s = n, i = Qe().apis, h = f([]), l = f(!0), a = f(!1), u = f(""), y = P(() => {
1701
+ const x = h.value.map((E) => ({ ...E }));
1702
+ for (const E of s.localSessions ?? []) {
1703
+ if (!E.conversationId) continue;
1704
+ const K = x.findIndex((b) => b.appConversationID === E.conversationId);
1705
+ if (K >= 0) {
1706
+ x[K] = {
1707
+ ...x[K],
1706
1708
  // 本地标题(标题生成完成)优先于服务端默认名
1707
- conversationName: S.title || T[z].conversationName,
1708
- generating: S.generating
1709
+ conversationName: E.title || x[K].conversationName,
1710
+ generating: E.generating
1709
1711
  };
1710
1712
  continue;
1711
1713
  }
1712
- const j = Math.floor(S.updatedAt / 1e3);
1713
- T.push({
1714
- appConversationID: S.conversationId,
1715
- conversationID: S.conversationId,
1716
- conversationName: S.title || "新对话",
1714
+ const j = Math.floor(E.updatedAt / 1e3);
1715
+ x.push({
1716
+ appConversationID: E.conversationId,
1717
+ conversationID: E.conversationId,
1718
+ conversationName: E.title || "新对话",
1717
1719
  createTime: "",
1718
1720
  createTimestamp: j,
1719
1721
  lastChatTime: "",
@@ -1721,83 +1723,83 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1721
1723
  emptyConversation: !1,
1722
1724
  isPinned: !1,
1723
1725
  selected: !1,
1724
- generating: S.generating
1726
+ generating: E.generating
1725
1727
  });
1726
1728
  }
1727
- return T.map((S) => ({
1728
- ...S,
1729
- conversationName: Ln(S.conversationName) ? "新的对话" : S.conversationName
1729
+ return x.map((E) => ({
1730
+ ...E,
1731
+ conversationName: Ln(E.conversationName) ? "新的对话" : E.conversationName
1730
1732
  }));
1731
1733
  }), w = P(() => Pn(y.value));
1732
- async function R() {
1734
+ async function $() {
1733
1735
  try {
1734
- const T = await On(i);
1735
- T != null && T.conversationList && (h.value = T.conversationList.filter((S) => S !== null).map((S) => ({ ...S, selected: !1 })));
1736
- } catch (T) {
1737
- Ee((T == null ? void 0 : T.message) || "获取历史记录失败");
1736
+ const x = await On(i);
1737
+ x != null && x.conversationList && (h.value = x.conversationList.filter((E) => E !== null).map((E) => ({ ...E, selected: !1 })));
1738
+ } catch (x) {
1739
+ Ee((x == null ? void 0 : x.message) || "获取历史记录失败");
1738
1740
  } finally {
1739
1741
  l.value = !1;
1740
1742
  }
1741
1743
  }
1742
- function L(T) {
1743
- u.value = T, a.value = !0;
1744
+ function O(x) {
1745
+ u.value = x, a.value = !0;
1744
1746
  }
1745
1747
  async function q() {
1746
1748
  a.value = !1;
1747
1749
  try {
1748
- await Bn(i, u.value), await R();
1749
- } catch (T) {
1750
- Ee((T == null ? void 0 : T.message) || "删除失败"), await R();
1750
+ await Bn(i, u.value), await $();
1751
+ } catch (x) {
1752
+ Ee((x == null ? void 0 : x.message) || "删除失败"), await $();
1751
1753
  }
1752
1754
  }
1753
1755
  return _e(() => {
1754
- R();
1755
- }), (T, S) => (r(), f("div", Ao, [
1756
+ $();
1757
+ }), (x, E) => (r(), g("div", Ao, [
1756
1758
  o("div", So, [
1757
- l.value ? (r(), f("div", Do, [...S[3] || (S[3] = [
1759
+ l.value ? (r(), g("div", To, [...E[3] || (E[3] = [
1758
1760
  o("div", { class: "ai-history-spinner" }, null, -1)
1759
- ])])) : w.value.length > 0 ? (r(!0), f(ye, { key: 1 }, Me(w.value, (z) => (r(), f("div", {
1760
- key: z.label,
1761
+ ])])) : w.value.length > 0 ? (r(!0), g(ye, { key: 1 }, De(w.value, (K) => (r(), g("div", {
1762
+ key: K.label,
1761
1763
  class: "ai-history-group"
1762
1764
  }, [
1763
- o("div", Eo, Z(z.label), 1),
1764
- (r(!0), f(ye, null, Me(z.items, (j, C) => (r(), f("div", {
1765
+ o("div", Eo, Z(K.label), 1),
1766
+ (r(!0), g(ye, null, De(K.items, (j, b) => (r(), g("div", {
1765
1767
  key: j.appConversationID,
1766
1768
  class: "ai-history-item",
1767
- style: ot({ "--i": C }),
1768
- onClick: ($) => T.$emit("history-detail", j.appConversationID)
1769
+ style: ot({ "--i": b }),
1770
+ onClick: (H) => x.$emit("history-detail", j.appConversationID)
1769
1771
  }, [
1770
- o("div", To, [
1772
+ o("div", Mo, [
1771
1773
  An(Z(j.conversationName) + " ", 1),
1772
- j.generating ? (r(), f("span", xo, "生成中")) : J("", !0)
1774
+ j.generating ? (r(), g("span", xo, "生成中")) : z("", !0)
1773
1775
  ]),
1774
1776
  o("div", {
1775
1777
  class: "ai-history-item-delete",
1776
- onClick: we(($) => L(j.appConversationID), ["stop"])
1778
+ onClick: we((H) => O(j.appConversationID), ["stop"])
1777
1779
  }, "删除", 8, Ro)
1778
- ], 12, Mo))), 128))
1779
- ]))), 128)) : (r(), f("div", $o, "暂无历史记录"))
1780
+ ], 12, Do))), 128))
1781
+ ]))), 128)) : (r(), g("div", $o, "暂无历史记录"))
1780
1782
  ]),
1781
1783
  o("div", {
1782
1784
  class: "ai-add",
1783
- onClick: S[0] || (S[0] = (z) => T.$emit("new-conversation"))
1785
+ onClick: E[0] || (E[0] = (K) => x.$emit("new-conversation"))
1784
1786
  }, [
1785
1787
  o("img", { src: W(jn) }, null, 8, Ho),
1786
- S[4] || (S[4] = o("span", null, "新建AI对话", -1))
1788
+ E[4] || (E[4] = o("span", null, "新建AI对话", -1))
1787
1789
  ]),
1788
1790
  (r(), he(Bt, { to: "#ai-assist-root" }, [
1789
- a.value ? (r(), f("div", {
1791
+ a.value ? (r(), g("div", {
1790
1792
  key: 0,
1791
1793
  class: "ai-modal-overlay",
1792
- onClick: S[2] || (S[2] = we((z) => a.value = !1, ["self"]))
1794
+ onClick: E[2] || (E[2] = we((K) => a.value = !1, ["self"]))
1793
1795
  }, [
1794
1796
  o("div", Lo, [
1795
- S[5] || (S[5] = o("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
1796
- S[6] || (S[6] = o("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
1797
+ E[5] || (E[5] = o("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
1798
+ E[6] || (E[6] = o("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
1797
1799
  o("div", Po, [
1798
1800
  o("button", {
1799
1801
  class: "ai-modal-btn cancel",
1800
- onClick: S[1] || (S[1] = (z) => a.value = !1)
1802
+ onClick: E[1] || (E[1] = (K) => a.value = !1)
1801
1803
  }, "取消"),
1802
1804
  o("button", {
1803
1805
  class: "ai-modal-btn confirm",
@@ -1805,23 +1807,23 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1805
1807
  }, "确定")
1806
1808
  ])
1807
1809
  ])
1808
- ])) : J("", !0)
1810
+ ])) : z("", !0)
1809
1811
  ]))
1810
1812
  ]));
1811
1813
  }
1812
- }), Bo = { class: "container info" }, Wo = { class: "info-item" }, No = { class: "basic-content" }, Yo = { class: "basic-content-text" }, Vo = { class: "basic-content" }, Xo = { class: "basic-content-text" }, Fo = { class: "info-item" }, Qo = { class: "permission-content" }, Go = { class: "info-item" }, qo = { class: "basic-content" }, zo = { class: "basic-content-text" }, Jo = { class: "basic-content" }, Ko = { class: "basic-content-text" }, jo = /* @__PURE__ */ be({
1814
+ }), Bo = { class: "container info" }, Wo = { class: "info-item" }, No = { class: "basic-content" }, Yo = { class: "basic-content-text" }, Vo = { class: "basic-content" }, Xo = { class: "basic-content-text" }, Fo = { class: "info-item" }, Go = { class: "permission-content" }, Qo = { class: "info-item" }, qo = { class: "basic-content" }, Ko = { class: "basic-content-text" }, zo = { class: "basic-content" }, Jo = { class: "basic-content-text" }, jo = /* @__PURE__ */ be({
1813
1815
  __name: "Info",
1814
1816
  setup(n) {
1815
- const _ = Ge(), s = p(null);
1817
+ const C = Qe(), s = f(null);
1816
1818
  return _e(async () => {
1817
1819
  try {
1818
- s.value = await Wn(_.apis);
1820
+ s.value = await Wn(C.apis);
1819
1821
  } catch (c) {
1820
1822
  Ee((c == null ? void 0 : c.message) || "获取个人信息失败");
1821
1823
  }
1822
1824
  }), (c, i) => {
1823
1825
  var h, l, a, u, y;
1824
- return r(), f("div", Bo, [
1826
+ return r(), g("div", Bo, [
1825
1827
  o("div", Wo, [
1826
1828
  i[2] || (i[2] = o("div", { class: "heading" }, [
1827
1829
  o("div", { class: "heading-column" }),
@@ -1841,91 +1843,91 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1841
1843
  o("div", { class: "heading-column" }),
1842
1844
  o("div", { class: "heading-title" }, "数据权限")
1843
1845
  ], -1)),
1844
- o("div", Qo, [
1845
- (r(!0), f(ye, null, Me((a = s.value) == null ? void 0 : a.ptnameList, (w, R) => (r(), f("div", {
1846
- key: R,
1846
+ o("div", Go, [
1847
+ (r(!0), g(ye, null, De((a = s.value) == null ? void 0 : a.ptnameList, (w, $) => (r(), g("div", {
1848
+ key: $,
1847
1849
  class: "permission-content-text"
1848
1850
  }, Z(w), 1))), 128))
1849
1851
  ])
1850
1852
  ]),
1851
- o("div", Go, [
1853
+ o("div", Qo, [
1852
1854
  i[6] || (i[6] = o("div", { class: "heading" }, [
1853
1855
  o("div", { class: "heading-column" }),
1854
1856
  o("div", { class: "heading-title" }, "帮助信息")
1855
1857
  ], -1)),
1856
1858
  o("div", qo, [
1857
1859
  i[4] || (i[4] = o("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
1858
- o("div", zo, Z(((u = s.value) == null ? void 0 : u.dept) || ""), 1)
1860
+ o("div", Ko, Z(((u = s.value) == null ? void 0 : u.dept) || ""), 1)
1859
1861
  ]),
1860
- o("div", Jo, [
1862
+ o("div", zo, [
1861
1863
  i[5] || (i[5] = o("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
1862
- o("div", Ko, Z(((y = s.value) == null ? void 0 : y.email) || ""), 1)
1864
+ o("div", Jo, Z(((y = s.value) == null ? void 0 : y.email) || ""), 1)
1863
1865
  ])
1864
1866
  ])
1865
1867
  ]);
1866
1868
  };
1867
1869
  }
1868
- }), Uo = { key: 1 }, Zo = ["src"], Io = { class: "header-title" }, ea = ["title"], ta = { class: "ai-history-drawer-panel" }, na = { class: "ai-history-drawer-header" }, sa = { class: "setTitle" }, oa = { class: "content" }, aa = { class: "main" }, ia = { class: "btn" }, la = ["src"], ua = 78, Ve = 78, fe = 8, Xe = 26, Le = 490, Ht = "aiPanelPosition", Lt = "aiPanelDocked", Pt = "aiDockWidth", ra = 60, ca = 150, Ot = 400, va = 320, Qt = /* @__PURE__ */ be({
1870
+ }), Uo = { key: 1 }, Zo = ["src"], Io = { class: "header-title" }, ea = ["title"], ta = { class: "ai-history-drawer-panel" }, na = { class: "ai-history-drawer-header" }, sa = { class: "setTitle" }, oa = { class: "content" }, aa = { class: "main" }, ia = { class: "btn" }, la = ["src"], ua = 78, Ve = 78, fe = 8, Xe = 26, Le = 490, Ht = "aiPanelPosition", Lt = "aiPanelDocked", Pt = "aiDockWidth", ra = 60, ca = 150, Ot = 400, va = 320, Gt = /* @__PURE__ */ be({
1869
1871
  __name: "AiAssist",
1870
1872
  setup(n) {
1871
1873
  var Et;
1872
- const _ = ua / 2, s = Ge(), c = p(!1), i = p("idle"), h = p(!1), l = ke({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), a = p(!1), u = p(window.innerWidth < 768), y = p(window.innerWidth < 768), w = p("answer"), R = p(!1), L = p(""), q = p(""), T = p(""), S = p(!1), z = p(!1), j = p([]), C = ke({
1873
- x: window.innerWidth - _,
1874
+ const C = ua / 2, s = Qe(), c = f(!1), i = f("idle"), h = f(!1), l = ke({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), a = f(!1), u = f(window.innerWidth < 768), y = f(window.innerWidth < 768), w = f("answer"), $ = f(!1), O = f(""), q = f(""), x = f(""), E = f(!1), K = f(!1), j = f([]), b = ke({
1875
+ x: window.innerWidth - C,
1874
1876
  y: window.innerHeight / 2 - Ve / 2
1875
- }), $ = p(!1), K = p(!1), e = p("right"), A = p("left"), d = p(null), E = ke({ x: 0, y: 0 }), b = p(!1), B = p(!1), U = ke({ x: 0, y: 0 }), ee = p(!1), ie = ke({ x: 0, y: 0 }), g = p(!1), V = p(!1), O = p(!1), m = ke({ x: 0, width: 0 }), k = p(!1);
1876
- let M = 0;
1877
- const N = p("idle"), Y = p(!1), H = p("none"), Q = ke({ x: 0, y: 0, w: Le, h: 0, radius: "14px" });
1877
+ }), H = f(!1), J = f(!1), e = f("right"), A = f("left"), d = f(null), M = ke({ x: 0, y: 0 }), S = f(!1), B = f(!1), U = ke({ x: 0, y: 0 }), ee = f(!1), se = ke({ x: 0, y: 0 }), G = f(!1), T = f(!1), p = f(!1), _ = ke({ x: 0, width: 0 }), m = f(!1);
1878
+ let k = 0;
1879
+ const N = f("idle"), Y = f(!1), L = f("none"), F = ke({ x: 0, y: 0, w: Le, h: 0, radius: "14px" });
1878
1880
  let te = null, re = !1, ce = !1;
1879
- const X = ke({ x: 0, y: 0 }), G = p(!1), x = p(null);
1880
- let F = null, ne = null, le = null;
1881
+ const V = ke({ x: 0, y: 0 }), Q = f(!1), R = f(null);
1882
+ let X = null, ne = null, le = null;
1881
1883
  const ve = P(() => {
1882
1884
  const t = window.innerWidth / 2;
1883
- return C.x + _ < t ? 5 : -5;
1884
- }), Ae = P(() => y.value || g.value || N.value !== "idle" ? "" : `panel-${e.value}`), ge = P(() => {
1885
+ return b.x + C < t ? 5 : -5;
1886
+ }), Ae = P(() => y.value || G.value || N.value !== "idle" ? "" : `panel-${e.value}`), ge = P(() => {
1885
1887
  var t;
1886
1888
  return !!((t = s.dock) != null && t.containerId) && !u.value;
1887
- }), ue = p(((Et = s.dock) == null ? void 0 : Et.width) || Le), dt = P(() => s.panelDraggable !== !1), Gt = P(() => {
1889
+ }), ue = f(((Et = s.dock) == null ? void 0 : Et.width) || Le), dt = P(() => s.panelDraggable !== !1), Qt = P(() => {
1888
1890
  var t;
1889
- return !((t = x.value) != null && t.isEmptyConversation);
1891
+ return !((t = R.value) != null && t.isEmptyConversation);
1890
1892
  }), qt = P(() => ({
1891
- left: `${C.x}px`,
1892
- top: `${C.y}px`,
1893
- transition: $.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
1893
+ left: `${b.x}px`,
1894
+ top: `${b.y}px`,
1895
+ transition: H.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
1894
1896
  "--direction": String(ve.value)
1895
- })), zt = P(() => s.characterImage || Un), Jt = P(() => i.value === "idle" ? {} : {
1897
+ })), Kt = P(() => s.characterImage || Un), zt = P(() => i.value === "idle" ? {} : {
1896
1898
  left: `${l.x}px`,
1897
1899
  top: `${l.y}px`,
1898
1900
  width: `${l.w}px`,
1899
1901
  height: `${l.h}px`,
1900
1902
  borderRadius: l.radius
1901
- }), Kt = P(() => {
1903
+ }), Jt = P(() => {
1902
1904
  const t = {};
1903
- return b.value && !y.value && !u.value && !g.value && (t["--ai-panel-x"] = `${E.x}px`, t["--ai-panel-y"] = `${E.y}px`), g.value && (t["--ai-dock-width"] = `${ue.value}px`), t;
1905
+ return S.value && !y.value && !u.value && !G.value && (t["--ai-panel-x"] = `${M.x}px`, t["--ai-panel-y"] = `${M.y}px`), G.value && (t["--ai-dock-width"] = `${ue.value}px`), t;
1904
1906
  }), jt = P(() => N.value === "idle" ? {} : {
1905
- left: `${Q.x}px`,
1906
- top: `${Q.y}px`,
1907
- width: `${Q.w}px`,
1908
- height: `${Q.h}px`,
1909
- borderRadius: Q.radius
1907
+ left: `${F.x}px`,
1908
+ top: `${F.y}px`,
1909
+ width: `${F.w}px`,
1910
+ height: `${F.h}px`,
1911
+ borderRadius: F.radius
1910
1912
  });
1911
1913
  function qe() {
1912
1914
  const t = window.innerWidth / 2;
1913
- C.x + _ < t ? (e.value = "left", A.value = "right") : (e.value = "right", A.value = "left");
1915
+ b.x + C < t ? (e.value = "left", A.value = "right") : (e.value = "right", A.value = "left");
1914
1916
  }
1915
1917
  function Ut() {
1916
- const t = window.innerWidth, v = Math.max(0, Math.min(C.y, window.innerHeight - Ve));
1917
- return { x: C.x + _ >= t / 2 ? t - _ : -_, y: v };
1918
+ const t = window.innerWidth, v = Math.max(0, Math.min(b.y, window.innerHeight - Ve));
1919
+ return { x: b.x + C >= t / 2 ? t - C : -C, y: v };
1918
1920
  }
1919
1921
  function ht() {
1920
- K.value = !0;
1922
+ J.value = !0;
1921
1923
  const t = Ut();
1922
- C.x = t.x, C.y = t.y, setTimeout(() => {
1923
- K.value = !1, qe(), Zt();
1924
+ b.x = t.x, b.y = t.y, setTimeout(() => {
1925
+ J.value = !1, qe(), Zt();
1924
1926
  }, 400);
1925
1927
  }
1926
1928
  function Zt() {
1927
1929
  try {
1928
- localStorage.setItem("characterPosition", JSON.stringify({ x: C.x, y: C.y })), localStorage.setItem("panelPosition", e.value), localStorage.setItem("backPosition", A.value);
1930
+ localStorage.setItem("characterPosition", JSON.stringify({ x: b.x, y: b.y })), localStorage.setItem("panelPosition", e.value), localStorage.setItem("backPosition", A.value);
1929
1931
  } catch {
1930
1932
  }
1931
1933
  }
@@ -1933,24 +1935,24 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1933
1935
  const t = localStorage.getItem("characterPosition");
1934
1936
  if (t) {
1935
1937
  const I = JSON.parse(t);
1936
- C.x = I.x, C.y = Math.min(Math.max(I.y, 0), window.innerHeight - Ve);
1938
+ b.x = I.x, b.y = Math.min(Math.max(I.y, 0), window.innerHeight - Ve);
1937
1939
  } else
1938
- C.x = window.innerWidth - _, C.y = window.innerHeight / 2 - Ve / 2;
1940
+ b.x = window.innerWidth - C, b.y = window.innerHeight / 2 - Ve / 2;
1939
1941
  const v = localStorage.getItem("panelPosition"), D = localStorage.getItem("backPosition");
1940
1942
  v && (e.value = v), D && (A.value = D);
1941
1943
  }
1942
- function ze(t) {
1943
- if (!$.value) return;
1944
- const v = "touches" in t ? t.touches[0].clientX : t.clientX, D = "touches" in t ? t.touches[0].clientY : t.clientY, I = v - X.x, de = Math.max(0, Math.min(D - X.y, window.innerHeight - Ve)), Ce = Math.abs(I - C.x), Se = Math.abs(de - C.y);
1945
- Ce + Se > 5 && (G.value = !0), C.x = I, C.y = de;
1944
+ function Ke(t) {
1945
+ if (!H.value) return;
1946
+ const v = "touches" in t ? t.touches[0].clientX : t.clientX, D = "touches" in t ? t.touches[0].clientY : t.clientY, I = v - V.x, de = Math.max(0, Math.min(D - V.y, window.innerHeight - Ve)), Ce = Math.abs(I - b.x), Se = Math.abs(de - b.y);
1947
+ Ce + Se > 5 && (Q.value = !0), b.x = I, b.y = de;
1946
1948
  }
1947
- function Je() {
1948
- $.value && ($.value = !1, G.value && (ht(), G.value = !1));
1949
+ function ze() {
1950
+ H.value && (H.value = !1, Q.value && (ht(), Q.value = !1));
1949
1951
  }
1950
1952
  function mt(t) {
1951
- K.value = !1, $.value = !0, G.value = !1;
1953
+ J.value = !1, H.value = !0, Q.value = !1;
1952
1954
  const v = "touches" in t ? t.touches[0].clientX : t.clientX, D = "touches" in t ? t.touches[0].clientY : t.clientY;
1953
- X.x = v - C.x, X.y = D - C.y;
1955
+ V.x = v - b.x, V.y = D - b.y;
1954
1956
  }
1955
1957
  function en() {
1956
1958
  const t = d.value, v = (t == null ? void 0 : t.offsetWidth) || Le, D = (t == null ? void 0 : t.offsetHeight) || window.innerHeight - 78;
@@ -1959,33 +1961,33 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1959
1961
  maxY: Math.max(Xe, window.innerHeight - D - fe)
1960
1962
  };
1961
1963
  }
1962
- function Ke(t, v) {
1964
+ function Je(t, v) {
1963
1965
  const D = d.value, I = t ?? (D == null ? void 0 : D.offsetWidth) ?? Le, de = v ?? (D == null ? void 0 : D.offsetHeight) ?? window.innerHeight - 78, Ce = Math.max(fe, window.innerWidth - I - fe), Se = Math.max(Xe, window.innerHeight - de - fe);
1964
- E.x = Math.min(Math.max(E.x, fe), Ce), E.y = Math.min(Math.max(E.y, Xe), Se);
1966
+ M.x = Math.min(Math.max(M.x, fe), Ce), M.y = Math.min(Math.max(M.y, Xe), Se);
1965
1967
  }
1966
1968
  function gt(t) {
1967
- if (!dt.value || y.value || u.value || g.value || i.value !== "idle") return;
1968
- if (ce = !1, B.value = !0, ee.value = !1, !b.value) {
1969
+ if (!dt.value || y.value || u.value || G.value || i.value !== "idle") return;
1970
+ if (ce = !1, B.value = !0, ee.value = !1, !S.value) {
1969
1971
  const I = d.value;
1970
1972
  if (I) {
1971
1973
  const de = I.getBoundingClientRect();
1972
- E.x = de.left, E.y = de.top, b.value = !0;
1974
+ M.x = de.left, M.y = de.top, S.value = !0;
1973
1975
  }
1974
1976
  }
1975
1977
  const v = "touches" in t ? t.touches[0].clientX : t.clientX, D = "touches" in t ? t.touches[0].clientY : t.clientY;
1976
- ie.x = v, ie.y = D, U.x = v - E.x, U.y = D - E.y;
1978
+ se.x = v, se.y = D, U.x = v - M.x, U.y = D - M.y;
1977
1979
  }
1978
1980
  function je(t) {
1979
- var De, Mt;
1981
+ var Te, Dt;
1980
1982
  if (!B.value) return;
1981
1983
  const v = "touches" in t ? t.touches[0].clientX : t.clientX, D = "touches" in t ? t.touches[0].clientY : t.clientY;
1982
1984
  if (!ee.value) {
1983
- const yn = Math.abs(v - ie.x), wn = Math.abs(D - ie.y);
1985
+ const yn = Math.abs(v - se.x), wn = Math.abs(D - se.y);
1984
1986
  if (yn + wn <= 5) return;
1985
1987
  ee.value = !0;
1986
1988
  }
1987
- const { maxX: I, maxY: de } = en(), Ce = ge.value ? I + ca : I, Se = Math.min(Math.max(v - U.x, fe), Ce), He = Math.min(Math.max(D - U.y, Xe), de), Te = ge.value && Se > I + ra;
1988
- Te !== ce && (ce = Te, (Mt = (De = s.dock) == null ? void 0 : De.onDockChange) == null || Mt.call(De, Te)), V.value = Te, E.x = Se, E.y = He;
1989
+ const { maxX: I, maxY: de } = en(), Ce = ge.value ? I + ca : I, Se = Math.min(Math.max(v - U.x, fe), Ce), He = Math.min(Math.max(D - U.y, Xe), de), Me = ge.value && Se > I + ra;
1990
+ Me !== ce && (ce = Me, (Dt = (Te = s.dock) == null ? void 0 : Te.onDockChange) == null || Dt.call(Te, Me)), T.value = Me, M.x = Se, M.y = He;
1989
1991
  }
1990
1992
  function Ue() {
1991
1993
  var v, D;
@@ -1994,14 +1996,14 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
1994
1996
  let t = !1;
1995
1997
  ee.value && (ee.value = !1, re = !0, setTimeout(() => {
1996
1998
  re = !1;
1997
- }, 0), V.value && ge.value ? (wt(), t = !0) : (Ke(), tn())), ce && !t && (ce = !1, (D = (v = s.dock) == null ? void 0 : v.onDockChange) == null || D.call(v, !1)), V.value = !1;
1999
+ }, 0), T.value && ge.value ? (wt(), t = !0) : (Je(), tn())), ce && !t && (ce = !1, (D = (v = s.dock) == null ? void 0 : v.onDockChange) == null || D.call(v, !1)), T.value = !1;
1998
2000
  }
1999
2001
  function ft(t) {
2000
2002
  re && (t.preventDefault(), t.stopPropagation(), re = !1);
2001
2003
  }
2002
2004
  function tn() {
2003
2005
  try {
2004
- localStorage.setItem(Ht, JSON.stringify({ x: E.x, y: E.y }));
2006
+ localStorage.setItem(Ht, JSON.stringify({ x: M.x, y: M.y }));
2005
2007
  } catch {
2006
2008
  }
2007
2009
  }
@@ -2010,14 +2012,14 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2010
2012
  const t = localStorage.getItem(Ht);
2011
2013
  if (t) {
2012
2014
  const v = JSON.parse(t);
2013
- typeof v.x == "number" && typeof v.y == "number" && (E.x = v.x, E.y = v.y, b.value = !0);
2015
+ typeof v.x == "number" && typeof v.y == "number" && (M.x = v.x, M.y = v.y, S.value = !0);
2014
2016
  }
2015
2017
  } catch {
2016
2018
  }
2017
2019
  }
2018
2020
  function pt() {
2019
2021
  try {
2020
- localStorage.setItem(Lt, g.value ? "1" : "0");
2022
+ localStorage.setItem(Lt, G.value ? "1" : "0");
2021
2023
  } catch {
2022
2024
  }
2023
2025
  }
@@ -2026,7 +2028,7 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2026
2028
  try {
2027
2029
  if (localStorage.getItem(Lt) === "1" && ge.value) {
2028
2030
  const D = (t = s.dock) == null ? void 0 : t.containerId;
2029
- D && document.getElementById(D) && (g.value = !0);
2031
+ D && document.getElementById(D) && (G.value = !0);
2030
2032
  }
2031
2033
  } catch {
2032
2034
  }
@@ -2042,8 +2044,8 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2042
2044
  }
2043
2045
  function on() {
2044
2046
  return {
2045
- x: Math.max(0, Math.min(window.innerWidth - 53, C.x + ve.value * 3)),
2046
- y: C.y,
2047
+ x: Math.max(0, Math.min(window.innerWidth - 53, b.x + ve.value * 3)),
2048
+ y: b.y,
2047
2049
  w: 53,
2048
2050
  h: 53,
2049
2051
  radius: "50%"
@@ -2063,17 +2065,17 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2063
2065
  y.value ? ($e(yt(), _t()), y.value = !1) : ($e(Pe(), yt()), y.value = !0);
2064
2066
  }
2065
2067
  function $e(t, v, D, I = "none") {
2066
- te && clearTimeout(te), N.value = "switching", Y.value = !0, H.value = I, Q.x = t.x, Q.y = t.y, Q.w = t.w, Q.h = t.h, Q.radius = t.radius, pe(() => {
2068
+ te && clearTimeout(te), N.value = "switching", Y.value = !0, L.value = I, F.x = t.x, F.y = t.y, F.w = t.w, F.h = t.h, F.radius = t.radius, pe(() => {
2067
2069
  requestAnimationFrame(() => {
2068
- Y.value = !1, Q.x = v.x, Q.y = v.y, Q.w = v.w, Q.h = v.h, Q.radius = v.radius;
2070
+ Y.value = !1, F.x = v.x, F.y = v.y, F.w = v.w, F.h = v.h, F.radius = v.radius;
2069
2071
  });
2070
2072
  }), te = setTimeout(() => {
2071
- N.value = "idle", H.value = "none", te = null, D == null || D();
2073
+ N.value = "idle", L.value = "none", te = null, D == null || D();
2072
2074
  }, 400);
2073
2075
  }
2074
2076
  function wt() {
2075
- var de, Ce, Se, He, Te;
2076
- if (!ge.value || g.value) return;
2077
+ var de, Ce, Se, He, Me;
2078
+ if (!ge.value || G.value) return;
2077
2079
  y.value && (y.value = !1);
2078
2080
  const t = (de = s.dock) == null ? void 0 : de.containerId;
2079
2081
  if (t && !document.getElementById(t)) {
@@ -2083,11 +2085,11 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2083
2085
  const v = d.value;
2084
2086
  let D = Pe();
2085
2087
  if (v) {
2086
- const De = v.getBoundingClientRect();
2087
- D = { x: De.left, y: De.top, w: De.width, h: De.height, radius: getComputedStyle(v).borderRadius };
2088
+ const Te = v.getBoundingClientRect();
2089
+ D = { x: Te.left, y: Te.top, w: Te.width, h: Te.height, radius: getComputedStyle(v).borderRadius };
2088
2090
  }
2089
2091
  const I = Ze();
2090
- $e(D, I), g.value = !0, i.value = "idle", V.value = !1, pt(), (Se = (Ce = s.dock) == null ? void 0 : Ce.onDockChange) == null || Se.call(Ce, !0), (Te = (He = s.dock) == null ? void 0 : He.onDockWidthChange) == null || Te.call(He, ue.value);
2092
+ $e(D, I), G.value = !0, i.value = "idle", T.value = !1, pt(), (Se = (Ce = s.dock) == null ? void 0 : Ce.onDockChange) == null || Se.call(Ce, !0), (Me = (He = s.dock) == null ? void 0 : He.onDockWidthChange) == null || Me.call(He, ue.value);
2091
2093
  }
2092
2094
  function ln() {
2093
2095
  return Math.max(Ot, window.innerWidth - va);
@@ -2112,31 +2114,31 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2112
2114
  }
2113
2115
  }
2114
2116
  function kt(t) {
2115
- if (!g.value) return;
2116
- O.value = !0, k.value = !1;
2117
+ if (!G.value) return;
2118
+ p.value = !0, m.value = !1;
2117
2119
  const v = "touches" in t ? t.touches[0].clientX : t.clientX;
2118
- m.x = v, m.width = ue.value;
2120
+ _.x = v, _.width = ue.value;
2119
2121
  }
2120
2122
  function Ie(t) {
2121
- if (!O.value) return;
2122
- const v = "touches" in t ? t.touches[0].clientX : t.clientX, D = at(m.width + (m.x - v));
2123
- Math.abs(D - m.width) > 3 && (k.value = !0), ue.value = D, M || (M = requestAnimationFrame(() => {
2123
+ if (!p.value) return;
2124
+ const v = "touches" in t ? t.touches[0].clientX : t.clientX, D = at(_.width + (_.x - v));
2125
+ Math.abs(D - _.width) > 3 && (m.value = !0), ue.value = D, k || (k = requestAnimationFrame(() => {
2124
2126
  var I, de;
2125
- M = 0, (de = (I = s.dock) == null ? void 0 : I.onDockWidthChange) == null || de.call(I, ue.value);
2127
+ k = 0, (de = (I = s.dock) == null ? void 0 : I.onDockWidthChange) == null || de.call(I, ue.value);
2126
2128
  }));
2127
2129
  }
2128
2130
  function et() {
2129
2131
  var t, v;
2130
- O.value && (O.value = !1, k.value && (k.value = !1, un(), (v = (t = s.dock) == null ? void 0 : t.onDockWidthChange) == null || v.call(t, ue.value)));
2132
+ p.value && (p.value = !1, m.value && (m.value = !1, un(), (v = (t = s.dock) == null ? void 0 : t.onDockWidthChange) == null || v.call(t, ue.value)));
2131
2133
  }
2132
2134
  function Ct() {
2133
2135
  var t, v;
2134
- g.value && (b.value ? Ke(Le, window.innerHeight - 78) : qe(), $e(Ze(), Pe()), g.value = !1, pt(), (v = (t = s.dock) == null ? void 0 : t.onDockChange) == null || v.call(t, !1));
2136
+ G.value && (S.value ? Je(Le, window.innerHeight - 78) : qe(), $e(Ze(), Pe()), G.value = !1, pt(), (v = (t = s.dock) == null ? void 0 : t.onDockChange) == null || v.call(t, !1));
2135
2137
  }
2136
2138
  function cn() {
2137
2139
  var t, v;
2138
- if (!G.value && !K.value) {
2139
- if (g.value) {
2140
+ if (!Q.value && !J.value) {
2141
+ if (G.value) {
2140
2142
  $e(
2141
2143
  { x: window.innerWidth, y: 0, w: ue.value, h: window.innerHeight, radius: "0px" },
2142
2144
  Ze(),
@@ -2147,7 +2149,7 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2147
2149
  }
2148
2150
  qe();
2149
2151
  const D = Pe();
2150
- l.x = Math.max(0, Math.min(window.innerWidth - 53, C.x + ve.value * 3)), l.y = C.y - ve.value * 2, l.w = 53, l.h = 53, l.radius = "50%", h.value = !0, i.value = "expanding", c.value = !0, pe(() => {
2152
+ l.x = Math.max(0, Math.min(window.innerWidth - 53, b.x + ve.value * 3)), l.y = b.y - ve.value * 2, l.w = 53, l.h = 53, l.radius = "50%", h.value = !0, i.value = "expanding", c.value = !0, pe(() => {
2151
2153
  requestAnimationFrame(() => {
2152
2154
  h.value = !1, l.x = D.x, l.y = D.y, l.w = D.w, l.h = D.h, l.radius = D.radius;
2153
2155
  });
@@ -2155,7 +2157,7 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2155
2157
  i.value = "idle";
2156
2158
  }, 400);
2157
2159
  } else
2158
- G.value = !1;
2160
+ Q.value = !1;
2159
2161
  }
2160
2162
  function Pe() {
2161
2163
  if (window.innerWidth < 768)
@@ -2189,11 +2191,11 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2189
2191
  function _t() {
2190
2192
  const t = Le, v = window.innerHeight - 78;
2191
2193
  let D = 54, I;
2192
- return b.value ? (I = Math.min(Math.max(E.x, fe), Math.max(fe, window.innerWidth - t - fe)), D = Math.min(Math.max(E.y, Xe), Math.max(fe, v - fe))) : I = e.value === "left" ? 24 : window.innerWidth - t - 24, { x: I, y: D, w: t, h: v, radius: "14px" };
2194
+ return S.value ? (I = Math.min(Math.max(M.x, fe), Math.max(fe, window.innerWidth - t - fe)), D = Math.min(Math.max(M.y, Xe), Math.max(fe, v - fe))) : I = e.value === "left" ? 24 : window.innerWidth - t - 24, { x: I, y: D, w: t, h: v, radius: "14px" };
2193
2195
  }
2194
2196
  function vn() {
2195
2197
  var v, D;
2196
- if (g.value) {
2198
+ if (G.value) {
2197
2199
  $e(Ze(), on(), () => {
2198
2200
  c.value = !1, i.value = "idle", a.value = !0, setTimeout(() => {
2199
2201
  a.value = !1;
@@ -2205,7 +2207,7 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2205
2207
  const t = Pe();
2206
2208
  l.x = t.x, l.y = t.y, l.w = t.w, l.h = t.h, l.radius = t.radius, h.value = !0, i.value = "collapsing", pe(() => {
2207
2209
  requestAnimationFrame(() => {
2208
- h.value = !1, l.x = Math.max(0, Math.min(window.innerWidth - 53, C.x + ve.value * 3)), l.y = C.y + Math.abs(ve.value) * 2, l.w = 53, l.h = 53, l.radius = "50%";
2210
+ h.value = !1, l.x = Math.max(0, Math.min(window.innerWidth - 53, b.x + ve.value * 3)), l.y = b.y + Math.abs(ve.value) * 2, l.w = 53, l.h = 53, l.radius = "50%";
2209
2211
  });
2210
2212
  }), setTimeout(() => {
2211
2213
  c.value = !1, i.value = "idle", a.value = !0;
@@ -2216,36 +2218,36 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2216
2218
  function dn(t) {
2217
2219
  Oe(), w.value = "answer", pe(() => {
2218
2220
  var v;
2219
- (v = x.value) == null || v.goHistoryMessage(t);
2221
+ (v = R.value) == null || v.goHistoryMessage(t);
2220
2222
  });
2221
2223
  }
2222
2224
  function hn() {
2223
- T.value = "", w.value = "answer", pe(() => {
2225
+ x.value = "", w.value = "answer", pe(() => {
2224
2226
  var t;
2225
- (t = x.value) == null || t.createNewConversation();
2227
+ (t = R.value) == null || t.createNewConversation();
2226
2228
  });
2227
2229
  }
2228
2230
  function mn() {
2229
- Oe(), T.value = "", pe(() => {
2231
+ Oe(), x.value = "", pe(() => {
2230
2232
  var t;
2231
- (t = x.value) == null || t.createNewConversation();
2233
+ (t = R.value) == null || t.createNewConversation();
2232
2234
  });
2233
2235
  }
2234
2236
  function gn() {
2235
- z.value = !1, S.value = !0;
2237
+ K.value = !1, E.value = !0;
2236
2238
  }
2237
2239
  function Oe() {
2238
- z.value = !0, setTimeout(() => {
2239
- S.value = !1, z.value = !1;
2240
+ K.value = !0, setTimeout(() => {
2241
+ E.value = !1, K.value = !1;
2240
2242
  }, 300);
2241
2243
  }
2242
2244
  function fn() {
2243
- q.value = L.value, R.value = !1;
2245
+ q.value = O.value, $.value = !1;
2244
2246
  }
2245
- ae(y, (t) => {
2247
+ ie(y, (t) => {
2246
2248
  t ? e.value = "center" : qe();
2247
- }), ae(c, (t) => {
2248
- t && b.value && pe(() => Ke());
2249
+ }), ie(c, (t) => {
2250
+ t && S.value && pe(() => Je());
2249
2251
  });
2250
2252
  const pn = Math.max(1e3, Number(s.activityInterval) || 3e4);
2251
2253
  let tt = null, Be = 0, nt = 0, st = 0;
@@ -2253,7 +2255,7 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2253
2255
  if (typeof s.onPanelActive == "function")
2254
2256
  try {
2255
2257
  if (t === "open") {
2256
- Be = Date.now(), nt = 0, st = 0, s.onPanelActive({ phase: t, docked: g.value, durationMs: 0, totalMs: 0 });
2258
+ Be = Date.now(), nt = 0, st = 0, s.onPanelActive({ phase: t, docked: G.value, durationMs: 0, totalMs: 0 });
2257
2259
  return;
2258
2260
  }
2259
2261
  if (document.visibilityState !== "hidden") {
@@ -2262,7 +2264,7 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2262
2264
  }
2263
2265
  const v = Math.round(nt);
2264
2266
  if (v <= 0 && t !== "close") return;
2265
- nt = 0, st += v, s.onPanelActive({ phase: t, docked: g.value, durationMs: v, totalMs: st }), t === "close" && (st = 0);
2267
+ nt = 0, st += v, s.onPanelActive({ phase: t, docked: G.value, durationMs: v, totalMs: st }), t === "close" && (st = 0);
2266
2268
  } catch {
2267
2269
  }
2268
2270
  }
@@ -2283,7 +2285,7 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2283
2285
  function St() {
2284
2286
  !c.value || document.visibilityState === "hidden" || (Be = Date.now(), it());
2285
2287
  }
2286
- ae(c, (t) => {
2288
+ ie(c, (t) => {
2287
2289
  t ? (We("open"), document.visibilityState !== "hidden" && it()) : (Ne(), We("close"));
2288
2290
  }), _e(() => {
2289
2291
  document.addEventListener("visibilitychange", bt), window.addEventListener("pagehide", At), window.addEventListener("pageshow", St);
@@ -2294,63 +2296,63 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2294
2296
  const t = s.theme || "light";
2295
2297
  vt(t), t === "auto" && (ne = Nn(() => vt("auto"))), le = Zn(() => d.value);
2296
2298
  });
2297
- function Dt() {
2298
- F && clearTimeout(F), F = setTimeout(() => {
2299
+ function Tt() {
2300
+ X && clearTimeout(X), X = setTimeout(() => {
2299
2301
  const t = window.innerWidth < 768;
2300
- u.value = t, t && (y.value = !0, g.value && Ct()), ht(), b.value && Ke(), g.value && (ue.value = at(ue.value));
2302
+ u.value = t, t && (y.value = !0, G.value && Ct()), ht(), S.value && Je(), G.value && (ue.value = at(ue.value));
2301
2303
  }, 100);
2302
2304
  }
2303
2305
  return _e(() => {
2304
- window.addEventListener("resize", Dt);
2306
+ window.addEventListener("resize", Tt);
2305
2307
  }), Re(() => {
2306
- window.removeEventListener("resize", Dt), F && clearTimeout(F), ne == null || ne(), le == null || le(), le = null;
2308
+ window.removeEventListener("resize", Tt), X && clearTimeout(X), ne == null || ne(), le == null || le(), le = null;
2307
2309
  }), _e(() => {
2308
- document.addEventListener("mousemove", ze), document.addEventListener("touchmove", ze, { passive: !0 }), document.addEventListener("mouseup", Je), document.addEventListener("touchend", Je), document.addEventListener("mousemove", je), document.addEventListener("touchmove", je, { passive: !0 }), document.addEventListener("mouseup", Ue), document.addEventListener("touchend", Ue), document.addEventListener("click", ft, !0), document.addEventListener("mousemove", Ie), document.addEventListener("touchmove", Ie, { passive: !0 }), document.addEventListener("mouseup", et), document.addEventListener("touchend", et);
2310
+ document.addEventListener("mousemove", Ke), document.addEventListener("touchmove", Ke, { passive: !0 }), document.addEventListener("mouseup", ze), document.addEventListener("touchend", ze), document.addEventListener("mousemove", je), document.addEventListener("touchmove", je, { passive: !0 }), document.addEventListener("mouseup", Ue), document.addEventListener("touchend", Ue), document.addEventListener("click", ft, !0), document.addEventListener("mousemove", Ie), document.addEventListener("touchmove", Ie, { passive: !0 }), document.addEventListener("mouseup", et), document.addEventListener("touchend", et);
2309
2311
  }), Re(() => {
2310
- document.removeEventListener("mousemove", ze), document.removeEventListener("touchmove", ze), document.removeEventListener("mouseup", Je), document.removeEventListener("touchend", Je), document.removeEventListener("mousemove", je), document.removeEventListener("touchmove", je), document.removeEventListener("mouseup", Ue), document.removeEventListener("touchend", Ue), document.removeEventListener("click", ft, !0), document.removeEventListener("mousemove", Ie), document.removeEventListener("touchmove", Ie), document.removeEventListener("mouseup", et), document.removeEventListener("touchend", et), te && clearTimeout(te), M && cancelAnimationFrame(M);
2311
- }), (t, v) => (r(), f("div", null, [
2312
+ document.removeEventListener("mousemove", Ke), document.removeEventListener("touchmove", Ke), document.removeEventListener("mouseup", ze), document.removeEventListener("touchend", ze), document.removeEventListener("mousemove", je), document.removeEventListener("touchmove", je), document.removeEventListener("mouseup", Ue), document.removeEventListener("touchend", Ue), document.removeEventListener("click", ft, !0), document.removeEventListener("mousemove", Ie), document.removeEventListener("touchmove", Ie), document.removeEventListener("mouseup", et), document.removeEventListener("touchend", et), te && clearTimeout(te), k && cancelAnimationFrame(k);
2313
+ }), (t, v) => (r(), g("div", null, [
2312
2314
  xe(o("div", {
2313
2315
  ref_key: "panelRef",
2314
2316
  ref: d,
2315
- class: oe([
2317
+ class: ae([
2316
2318
  "ai-panel",
2317
2319
  y.value ? "maxWrap" : "minWrap",
2318
2320
  Ae.value,
2319
2321
  {
2320
- "panel-custom": b.value && !y.value && !u.value && !g.value && N.value === "idle",
2322
+ "panel-custom": S.value && !y.value && !u.value && !G.value && N.value === "idle",
2321
2323
  dragging: B.value,
2322
- "dock-preview": V.value,
2323
- docked: g.value,
2324
- "dock-resizing": O.value,
2324
+ "dock-preview": T.value,
2325
+ docked: G.value,
2326
+ "dock-resizing": p.value,
2325
2327
  "dock-switching": N.value !== "idle",
2326
2328
  "dock-switch-instant": Y.value,
2327
- "dock-switch-fade-in": H.value === "in",
2328
- "dock-switch-fade-out": H.value === "out",
2329
+ "dock-switch-fade-in": L.value === "in",
2330
+ "dock-switch-fade-out": L.value === "out",
2329
2331
  "no-drag": !dt.value
2330
2332
  },
2331
2333
  i.value !== "idle" ? i.value : "",
2332
2334
  { morphing: i.value !== "idle", "morph-instant": h.value }
2333
2335
  ]),
2334
- style: ot([Kt.value, Jt.value, jt.value])
2336
+ style: ot([Jt.value, zt.value, jt.value])
2335
2337
  }, [
2336
- g.value ? (r(), f("div", {
2338
+ G.value ? (r(), g("div", {
2337
2339
  key: 0,
2338
2340
  class: "ai-dock-resizer",
2339
2341
  onMousedown: we(kt, ["stop"]),
2340
2342
  onTouchstart: we(kt, ["stop"])
2341
- }, null, 32)) : J("", !0),
2343
+ }, null, 32)) : z("", !0),
2342
2344
  o("div", {
2343
2345
  class: "header",
2344
2346
  onMousedown: gt,
2345
2347
  onTouchstart: gt
2346
2348
  }, [
2347
- w.value === "info" ? (r(), f("span", {
2349
+ w.value === "info" ? (r(), g("span", {
2348
2350
  key: 0,
2349
- class: oe(["back", A.value]),
2351
+ class: ae(["back", A.value]),
2350
2352
  onClick: v[0] || (v[0] = (D) => w.value = "answer")
2351
2353
  }, [...v[6] || (v[6] = [
2352
2354
  o("span", { style: { "font-size": "14px" } }, "←", -1)
2353
- ])], 2)) : (r(), f("p", Uo, [
2355
+ ])], 2)) : (r(), g("p", Uo, [
2354
2356
  o("img", {
2355
2357
  src: W(Xt),
2356
2358
  draggable: "false"
@@ -2358,58 +2360,58 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2358
2360
  ])),
2359
2361
  o("div", Io, [
2360
2362
  o("span", {
2361
- title: w.value === "info" ? "个人信息" : T.value || W(s).name
2362
- }, Z(w.value === "info" ? "个人信息" : T.value || W(s).name), 9, ea)
2363
+ title: w.value === "info" ? "个人信息" : x.value || W(s).name
2364
+ }, Z(w.value === "info" ? "个人信息" : x.value || W(s).name), 9, ea)
2363
2365
  ]),
2364
2366
  o("p", null, [
2365
- xe(se(W(me), {
2367
+ xe(oe(W(me), {
2366
2368
  class: "op-icon",
2367
2369
  icon: "ic:round-add",
2368
2370
  onClick: hn
2369
2371
  }, null, 512), [
2370
- [Ye, Gt.value]
2372
+ [Ye, Qt.value]
2371
2373
  ]),
2372
- se(W(me), {
2373
- class: oe(["mute", { active: S.value }]),
2374
+ oe(W(me), {
2375
+ class: ae(["mute", { active: E.value }]),
2374
2376
  icon: "ic:round-history",
2375
- onClick: v[1] || (v[1] = (D) => S.value ? Oe() : gn())
2377
+ onClick: v[1] || (v[1] = (D) => E.value ? Oe() : gn())
2376
2378
  }, null, 8, ["class"]),
2377
- !u.value && !g.value ? (r(), he(W(me), {
2379
+ !u.value && !G.value ? (r(), he(W(me), {
2378
2380
  key: 0,
2379
2381
  onClick: an,
2380
2382
  icon: y.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
2381
- }, null, 8, ["icon"])) : J("", !0),
2382
- g.value ? (r(), he(W(me), {
2383
+ }, null, 8, ["icon"])) : z("", !0),
2384
+ G.value ? (r(), he(W(me), {
2383
2385
  key: 1,
2384
2386
  icon: "material-symbols:float-landscape-2-outline-rounded",
2385
2387
  onClick: Ct
2386
- })) : J("", !0),
2387
- ge.value && !g.value ? (r(), he(W(me), {
2388
+ })) : z("", !0),
2389
+ ge.value && !G.value ? (r(), he(W(me), {
2388
2390
  key: 2,
2389
2391
  icon: "boxicons:arrow-in-up-right-stroke-square",
2390
2392
  onClick: wt,
2391
2393
  class: "__minimize"
2392
- })) : J("", !0),
2393
- se(W(me), {
2394
+ })) : z("", !0),
2395
+ oe(W(me), {
2394
2396
  onClick: vn,
2395
2397
  icon: "ic:round-close"
2396
2398
  })
2397
2399
  ])
2398
2400
  ], 32),
2399
- xe(se(bo, {
2401
+ xe(oe(bo, {
2400
2402
  ref_key: "answerRef",
2401
- ref: x,
2403
+ ref: R,
2402
2404
  defaultSayhello: W(s).defaultSayhello,
2403
2405
  defaultRecommend: W(s).defaultRecommend,
2404
- onTitleGenerated: v[2] || (v[2] = (D) => T.value = D),
2406
+ onTitleGenerated: v[2] || (v[2] = (D) => x.value = D),
2405
2407
  onSessionsChange: v[3] || (v[3] = (D) => j.value = D)
2406
2408
  }, null, 8, ["defaultSayhello", "defaultRecommend"]), [
2407
2409
  [Ye, w.value === "answer"]
2408
2410
  ]),
2409
- w.value === "info" ? (r(), he(jo, { key: 1 })) : J("", !0),
2410
- S.value ? (r(), f("div", {
2411
+ w.value === "info" ? (r(), he(jo, { key: 1 })) : z("", !0),
2412
+ E.value ? (r(), g("div", {
2411
2413
  key: 2,
2412
- class: oe(["ai-history-drawer", { closing: z.value }])
2414
+ class: ae(["ai-history-drawer", { closing: K.value }])
2413
2415
  }, [
2414
2416
  o("div", {
2415
2417
  class: "ai-history-backdrop",
@@ -2418,58 +2420,58 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2418
2420
  o("div", ta, [
2419
2421
  o("div", na, [
2420
2422
  v[7] || (v[7] = o("span", null, "对话记录", -1)),
2421
- se(W(me), {
2423
+ oe(W(me), {
2422
2424
  icon: "ic:round-close",
2423
2425
  class: "ai-history-drawer-close",
2424
2426
  onClick: Oe
2425
2427
  })
2426
2428
  ]),
2427
- se(Oo, {
2429
+ oe(Oo, {
2428
2430
  localSessions: j.value,
2429
2431
  onHistoryDetail: dn,
2430
2432
  onNewConversation: mn
2431
2433
  }, null, 8, ["localSessions"])
2432
2434
  ])
2433
- ], 2)) : J("", !0),
2435
+ ], 2)) : z("", !0),
2434
2436
  xe(o("div", sa, [
2435
2437
  o("div", oa, [
2436
2438
  o("div", aa, [
2437
2439
  v[8] || (v[8] = o("p", { class: "title" }, "修改标题", -1)),
2438
2440
  xe(o("textarea", {
2439
- "onUpdate:modelValue": v[4] || (v[4] = (D) => L.value = D),
2441
+ "onUpdate:modelValue": v[4] || (v[4] = (D) => O.value = D),
2440
2442
  placeholder: "请输入新标题"
2441
2443
  }, null, 512), [
2442
- [Nt, L.value]
2444
+ [Nt, O.value]
2443
2445
  ]),
2444
2446
  o("p", ia, [
2445
2447
  o("span", {
2446
- onClick: v[5] || (v[5] = (D) => R.value = !1)
2448
+ onClick: v[5] || (v[5] = (D) => $.value = !1)
2447
2449
  }, "取消"),
2448
2450
  o("span", { onClick: fn }, "确定")
2449
2451
  ])
2450
2452
  ])
2451
2453
  ])
2452
2454
  ], 512), [
2453
- [Ye, R.value]
2455
+ [Ye, $.value]
2454
2456
  ])
2455
2457
  ], 6), [
2456
2458
  [Ye, c.value || i.value !== "idle"]
2457
2459
  ]),
2458
- V.value && ge.value ? (r(), f("div", {
2460
+ T.value && ge.value ? (r(), g("div", {
2459
2461
  key: 0,
2460
2462
  class: "ai-dock-preview",
2461
2463
  style: ot({ width: ue.value + "px" })
2462
2464
  }, [...v[9] || (v[9] = [
2463
2465
  o("span", { class: "ai-dock-preview__text" }, "松开以停靠到右侧", -1)
2464
- ])], 4)) : J("", !0),
2466
+ ])], 4)) : z("", !0),
2465
2467
  xe(o("div", {
2466
- class: oe(["character", { dragging: $.value, recycling: K.value, "hover-preview": a.value }]),
2468
+ class: ae(["character", { dragging: H.value, recycling: J.value, "hover-preview": a.value }]),
2467
2469
  style: ot(qt.value),
2468
2470
  onMousedown: mt,
2469
2471
  onTouchstart: mt,
2470
2472
  onClick: cn
2471
2473
  }, [
2472
- o("img", { src: zt.value }, null, 8, la)
2474
+ o("img", { src: Kt.value }, null, 8, la)
2473
2475
  ], 38), [
2474
2476
  [Ye, !c.value]
2475
2477
  ])
@@ -2515,21 +2517,21 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2515
2517
  className: {}
2516
2518
  },
2517
2519
  emits: ["result", "final", "error", "statusChange", "complete"],
2518
- setup(n, { expose: _, emit: s }) {
2520
+ setup(n, { expose: C, emit: s }) {
2519
2521
  const c = n, i = s, h = {
2520
2522
  idle: "开始录音",
2521
2523
  connecting: "启动中…",
2522
2524
  recording: "停止录音",
2523
2525
  stopping: "识别中…",
2524
2526
  error: "重试"
2525
- }, l = p(""), a = p(""), u = p("idle"), y = Fe.isSupported();
2527
+ }, l = f(""), a = f(""), u = f("idle"), y = Fe.isSupported();
2526
2528
  let w = null;
2527
- const R = P(() => Yn(c.theme)), L = () => ({
2529
+ const $ = P(() => Yn(c.theme)), O = () => ({
2528
2530
  lang: c.lang,
2529
2531
  continuous: c.continuous,
2530
2532
  interimResults: c.interimResults
2531
2533
  }), q = () => {
2532
- y && (w = new Fe(L(), {
2534
+ y && (w = new Fe(O(), {
2533
2535
  onStatusChange: (e) => {
2534
2536
  u.value = e, i("statusChange", e), e === "idle" && i("complete", l.value);
2535
2537
  },
@@ -2545,13 +2547,13 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2545
2547
  };
2546
2548
  _e(q), Wt(() => {
2547
2549
  w == null || w.destroy(), w = null;
2548
- }), ae(
2550
+ }), ie(
2549
2551
  () => [c.lang, c.continuous, c.interimResults],
2550
2552
  () => {
2551
2553
  w == null || w.destroy(), q();
2552
2554
  }
2553
2555
  );
2554
- const T = async () => {
2556
+ const x = async () => {
2555
2557
  if (w)
2556
2558
  if (u.value === "idle" || u.value === "error")
2557
2559
  try {
@@ -2559,17 +2561,17 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2559
2561
  } catch {
2560
2562
  }
2561
2563
  else u.value === "recording" && w.stop();
2562
- }, S = () => {
2564
+ }, E = () => {
2563
2565
  l.value = "", a.value = "";
2564
- }, z = P(() => !l.value && !a.value), j = P(
2566
+ }, K = P(() => !l.value && !a.value), j = P(
2565
2567
  () => y ? c.placeholder || "点击按钮开始语音输入…" : "当前浏览器不支持语音识别"
2566
- ), C = P(() => y ? u.value === "connecting" ? c.connectingText || h.connecting : u.value === "recording" ? c.stopText || h.recording : u.value === "stopping" ? c.stoppingText || h.stopping : u.value === "error" ? h.error : c.startText || h.idle : "不支持"), $ = P(() => {
2568
+ ), b = P(() => y ? u.value === "connecting" ? c.connectingText || h.connecting : u.value === "recording" ? c.stopText || h.recording : u.value === "stopping" ? c.stoppingText || h.stopping : u.value === "error" ? h.error : c.startText || h.idle : "不支持"), H = P(() => {
2567
2569
  const e = ["ai-voice-input-btn"];
2568
2570
  return u.value === "recording" && e.push("is-recording"), u.value === "connecting" && e.push("is-connecting"), u.value === "stopping" && e.push("is-stopping"), e.join(" ");
2569
- }), K = P(
2571
+ }), J = P(
2570
2572
  () => !y || u.value === "connecting" || u.value === "stopping"
2571
2573
  );
2572
- return _({
2574
+ return C({
2573
2575
  start: async () => {
2574
2576
  await (w == null ? void 0 : w.start());
2575
2577
  },
@@ -2580,73 +2582,73 @@ const ho = { class: "container" }, mo = { class: "chat-wrap" }, go = { class: "m
2580
2582
  l.value = "", a.value = "";
2581
2583
  },
2582
2584
  getStatus: () => (w == null ? void 0 : w.getStatus()) ?? "idle"
2583
- }), (e, A) => (r(), f("div", {
2584
- class: oe(["ai-voice-input", n.className]),
2585
- "data-theme": R.value
2585
+ }), (e, A) => (r(), g("div", {
2586
+ class: ae(["ai-voice-input", n.className]),
2587
+ "data-theme": $.value
2586
2588
  }, [
2587
2589
  o("div", {
2588
- class: oe(["ai-voice-input-display", { "is-empty": z.value }])
2590
+ class: ae(["ai-voice-input-display", { "is-empty": K.value }])
2589
2591
  }, [
2590
- l.value ? (r(), f("span", ha, Z(l.value), 1)) : J("", !0),
2591
- a.value ? (r(), f("span", ma, Z(a.value), 1)) : J("", !0),
2592
- u.value === "recording" && !a.value ? (r(), f("span", ga)) : J("", !0),
2593
- z.value ? (r(), f("span", fa, Z(j.value), 1)) : J("", !0)
2592
+ l.value ? (r(), g("span", ha, Z(l.value), 1)) : z("", !0),
2593
+ a.value ? (r(), g("span", ma, Z(a.value), 1)) : z("", !0),
2594
+ u.value === "recording" && !a.value ? (r(), g("span", ga)) : z("", !0),
2595
+ K.value ? (r(), g("span", fa, Z(j.value), 1)) : z("", !0)
2594
2596
  ], 2),
2595
2597
  o("button", {
2596
2598
  type: "button",
2597
- class: oe($.value),
2598
- disabled: K.value,
2599
- onClick: T
2599
+ class: ae(H.value),
2600
+ disabled: J.value,
2601
+ onClick: x
2600
2602
  }, [
2601
- u.value === "recording" ? (r(), f("span", ya)) : u.value === "connecting" || u.value === "stopping" ? (r(), f("span", wa, [...A[0] || (A[0] = [
2603
+ u.value === "recording" ? (r(), g("span", ya)) : u.value === "connecting" || u.value === "stopping" ? (r(), g("span", wa, [...A[0] || (A[0] = [
2602
2604
  o("span", null, null, -1),
2603
2605
  o("span", null, null, -1),
2604
2606
  o("span", null, null, -1),
2605
2607
  o("span", null, null, -1),
2606
2608
  o("span", null, null, -1)
2607
- ])])) : (r(), f("svg", ka, [...A[1] || (A[1] = [
2609
+ ])])) : (r(), g("svg", ka, [...A[1] || (A[1] = [
2608
2610
  o("path", { d: "M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3z" }, null, -1),
2609
2611
  o("path", { d: "M19 11a7 7 0 0 1-14 0H3a9 9 0 0 0 8 8.94V23h2v-3.06A9 9 0 0 0 21 11h-2z" }, null, -1)
2610
2612
  ])])),
2611
- o("span", null, Z(C.value), 1)
2613
+ o("span", null, Z(b.value), 1)
2612
2614
  ], 10, pa),
2613
- z.value ? J("", !0) : (r(), f("button", {
2615
+ K.value ? z("", !0) : (r(), g("button", {
2614
2616
  key: 0,
2615
2617
  type: "button",
2616
2618
  class: "ai-voice-input-btn ai-voice-input-clear-btn",
2617
2619
  title: "清空",
2618
- onClick: S
2620
+ onClick: E
2619
2621
  }, " 清空 "))
2620
2622
  ], 10, da));
2621
2623
  }
2622
- }), _a = (n, _) => {
2624
+ }), _a = (n, C) => {
2623
2625
  const s = n.__vccOpts || n;
2624
- for (const [c, i] of _)
2626
+ for (const [c, i] of C)
2625
2627
  s[c] = i;
2626
2628
  return s;
2627
2629
  }, ba = /* @__PURE__ */ _a(Ca, [["__scopeId", "data-v-53d3cc6e"]]);
2628
- let Qe = null;
2629
- const Ta = (n) => {
2630
+ let Ge = null;
2631
+ const Ma = (n) => {
2630
2632
  Vt(n);
2631
2633
  }, xa = (n) => {
2632
- const _ = n || document.body, s = document.createElement("div");
2634
+ const C = n || document.body, s = document.createElement("div");
2633
2635
  s.id = "ai-assist-root";
2634
- const c = Ge();
2635
- vt(c.theme), Vn(), _.appendChild(s), Qe = Sn(Qt), Qe.mount(s);
2636
+ const c = Qe();
2637
+ vt(c.theme), Vn(), C.appendChild(s), Ge = Sn(Gt), Ge.mount(s);
2636
2638
  }, Ra = () => {
2637
- Qe && (Qe.unmount(), Qe = null);
2639
+ Ge && (Ge.unmount(), Ge = null);
2638
2640
  const n = document.getElementById("ai-assist-root");
2639
2641
  n && n.remove();
2640
2642
  }, $a = {
2641
- install(n, _) {
2642
- Vt(_), n.component("AiAssist", Qt), n.component("VoiceInput", ba);
2643
+ install(n, C) {
2644
+ Vt(C), n.component("AiAssist", Gt), n.component("VoiceInput", ba);
2643
2645
  }
2644
2646
  };
2645
2647
  export {
2646
- Qt as AiAssist,
2648
+ Gt as AiAssist,
2647
2649
  ba as VoiceInput,
2648
2650
  $a as default,
2649
- Ta as initAiAssist,
2651
+ Ma as initAiAssist,
2650
2652
  xa as mountAiAssist,
2651
2653
  Ra as unmountAiAssist
2652
2654
  };