@somecat/ai-assist-sdk 1.2.4 → 1.2.5

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,9 +1,9 @@
1
- import { defineComponent as xe, ref as p, watch as ae, nextTick as ne, onUnmounted as st, openBlock as m, createElementBlock as S, normalizeClass as J, createElementVNode as a, toDisplayString as Q, createVNode as U, Transition as on, withCtx as sn, unref as H, createCommentVNode as Y, computed as O, reactive as te, Fragment as Se, createStaticVNode as an, withModifiers as se, createBlock as oe, renderList as Oe, Teleport as _t, onMounted as pe, onBeforeUnmount as Ht, withDirectives as De, withKeys as lt, vModelText as $t, normalizeStyle as ot, vShow as Ve, createApp as ln } from "vue";
2
- import { a as un, r as ut, p as ct, u as cn, V as at, c as At, g as rn, s as vn, b as St, e as dn, d as hn, f as Ge, h as gn, i as mn, j as fn, k as pn, l as yn, m as rt, w as wn, n as kn, o as Cn, q as Pt } from "../chunks/index-Bqxc2mD6.mjs";
3
- import { f as bn, s as Le, a as Lt, b as An, c as Sn } from "../chunks/index-DBik4Gma.mjs";
4
- import { BulbOutlined as xn, SearchOutlined as xt, CheckOutlined as Tn, CopyOutlined as En, RedoOutlined as Mn, CloseOutlined as Dn } from "@ant-design/icons-vue";
5
- import { Icon as I } from "@iconify/vue";
6
- const Rn = "data:image/png;base64,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", _n = { class: "thinking-block__title" }, Hn = ["innerHTML"], $n = /* @__PURE__ */ xe({
1
+ import { defineComponent as xe, ref as p, watch as ae, nextTick as ne, onUnmounted as st, openBlock as m, createElementBlock as x, normalizeClass as q, createElementVNode as a, toDisplayString as G, createVNode as K, Transition as sn, withCtx as an, unref as $, createCommentVNode as X, computed as O, reactive as te, Fragment as Se, createStaticVNode as ln, withModifiers as se, createBlock as oe, renderList as Oe, Teleport as _t, onMounted as pe, onBeforeUnmount as $t, withDirectives as De, withKeys as lt, vModelText as Pt, normalizeStyle as ot, vShow as Ve, createApp as un } from "vue";
2
+ import { a as ut, r as ct, p as rt, u as cn, V as at, c as St, g as rn, s as vn, b as xt, e as dn, d as hn, f as Qe, h as gn, i as mn, j as fn, k as pn, l as yn, m as vt, w as wn, n as kn, o as Cn, q as Lt } from "../chunks/index-DElfgKrt.mjs";
3
+ import { f as bn, s as Le, a as Ot, b as An, c as Sn } from "../chunks/index-DBik4Gma.mjs";
4
+ import { BulbOutlined as xn, SearchOutlined as Tt, CheckOutlined as Tn, CopyOutlined as En, RedoOutlined as Mn, CloseOutlined as Dn } from "@ant-design/icons-vue";
5
+ import { Icon as Z } from "@iconify/vue";
6
+ const Rn = "data:image/png;base64,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", Hn = { class: "thinking-block__title" }, _n = ["innerHTML"], $n = /* @__PURE__ */ xe({
7
7
  __name: "ThinkingBlock",
8
8
  props: {
9
9
  content: {},
@@ -11,105 +11,105 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
11
11
  messageDone: { type: Boolean }
12
12
  },
13
13
  setup(e) {
14
- const y = e, h = p(!!y.isStreaming || !!y.messageDone);
15
- let g = 0;
16
- function l(M = 600) {
17
- clearTimeout(g), g = window.setTimeout(() => {
18
- g = 0, h.value = !1;
19
- }, M);
14
+ const y = e, d = p(!!y.isStreaming || !!y.messageDone);
15
+ let h = 0;
16
+ function u(T = 600) {
17
+ clearTimeout(h), h = window.setTimeout(() => {
18
+ h = 0, d.value = !1;
19
+ }, T);
20
20
  }
21
21
  function k() {
22
- g && (clearTimeout(g), g = 0);
23
- }
24
- function u() {
25
- k(), h.value = !h.value;
26
- }
27
- const c = p(y.isStreaming ? "" : y.content), v = p(y.isStreaming ? 0 : y.content.length), b = p(0);
28
- let C = 0, A = 0;
29
- function x() {
30
- if (C) return;
31
- const M = 80, i = (w) => {
32
- if (A === 0) {
33
- A = w, C = requestAnimationFrame(i);
22
+ h && (clearTimeout(h), h = 0);
23
+ }
24
+ function c() {
25
+ k(), d.value = !d.value;
26
+ }
27
+ const l = p(y.isStreaming ? "" : y.content), r = p(y.isStreaming ? 0 : y.content.length), C = p(0);
28
+ let w = 0, S = 0;
29
+ function E() {
30
+ if (w) return;
31
+ const T = 80, i = (f) => {
32
+ if (S === 0) {
33
+ S = f, w = requestAnimationFrame(i);
34
34
  return;
35
35
  }
36
- const o = Math.min(w - A, 100);
37
- A = w;
38
- const s = y.content;
39
- if (s.length - v.value > 0) {
40
- b.value += M * o / 1e3;
41
- const f = Math.floor(b.value);
42
- f > 0 && (b.value -= f, v.value = Math.min(v.value + f, s.length), c.value = s.slice(0, v.value));
36
+ const g = Math.min(f - S, 100);
37
+ S = f;
38
+ const o = y.content;
39
+ if (o.length - r.value > 0) {
40
+ C.value += T * g / 1e3;
41
+ const A = Math.floor(C.value);
42
+ A > 0 && (C.value -= A, r.value = Math.min(r.value + A, o.length), l.value = o.slice(0, r.value));
43
43
  } else
44
- b.value = 0;
45
- if (v.value >= s.length) {
46
- C = 0;
44
+ C.value = 0;
45
+ if (r.value >= o.length) {
46
+ w = 0;
47
47
  return;
48
48
  }
49
- C = requestAnimationFrame(i);
49
+ w = requestAnimationFrame(i);
50
50
  };
51
- A = 0, C = requestAnimationFrame(i);
51
+ S = 0, w = requestAnimationFrame(i);
52
52
  }
53
- function E() {
54
- C && (cancelAnimationFrame(C), C = 0);
53
+ function D() {
54
+ w && (cancelAnimationFrame(w), w = 0);
55
55
  }
56
- function $() {
57
- E(), c.value = y.content, v.value = y.content.length, b.value = 0;
56
+ function P() {
57
+ D(), l.value = y.content, r.value = y.content.length, C.value = 0;
58
58
  }
59
59
  ae(
60
60
  () => y.content,
61
61
  () => {
62
62
  if (y.messageDone) {
63
- $();
63
+ P();
64
64
  return;
65
65
  }
66
- y.isStreaming && v.value > y.content.length && (v.value = 0, b.value = 0, c.value = ""), y.content.length > v.value && x();
66
+ y.isStreaming && r.value > y.content.length && (r.value = 0, C.value = 0, l.value = ""), y.content.length > r.value && E();
67
67
  }
68
68
  ), ae(
69
69
  () => y.isStreaming,
70
- (M) => {
71
- M ? (k(), h.value = !0, x()) : y.messageDone || l();
70
+ (T) => {
71
+ T ? (k(), d.value = !0, E()) : y.messageDone || u();
72
72
  },
73
73
  { immediate: !0 }
74
74
  ), ae(
75
75
  () => y.messageDone,
76
- (M) => {
77
- M && (k(), $(), h.value = !0);
76
+ (T) => {
77
+ T && (k(), P(), d.value = !0);
78
78
  },
79
79
  { immediate: !0 }
80
80
  );
81
- const _ = p(null);
82
- let P = !1;
81
+ const R = p(null);
82
+ let L = !1;
83
83
  function n() {
84
- const M = _.value;
85
- if (!M) return;
86
- P = M.scrollHeight - M.scrollTop - M.clientHeight > 12;
84
+ const T = R.value;
85
+ if (!T) return;
86
+ L = T.scrollHeight - T.scrollTop - T.clientHeight > 12;
87
87
  }
88
- function W() {
89
- const M = _.value;
90
- !M || !h.value || P || (M.scrollTop = M.scrollHeight);
88
+ function B() {
89
+ const T = R.value;
90
+ !T || !d.value || L || (T.scrollTop = T.scrollHeight);
91
91
  }
92
- function L() {
93
- y.isStreaming && W();
92
+ function W() {
93
+ y.isStreaming && B();
94
94
  }
95
- return ae(c, () => {
96
- y.isStreaming && ne(W);
95
+ return ae(l, () => {
96
+ y.isStreaming && ne(B);
97
97
  }), st(() => {
98
- k(), E();
99
- }), (M, i) => (m(), S("div", {
100
- class: J(["thinking-block", {
101
- "thinking-block--expanded": h.value,
98
+ k(), D();
99
+ }), (T, i) => (m(), x("div", {
100
+ class: q(["thinking-block", {
101
+ "thinking-block--expanded": d.value,
102
102
  "thinking-block--active": e.isStreaming
103
103
  }])
104
104
  }, [
105
105
  a("div", {
106
106
  class: "thinking-block__header",
107
- onClick: u
107
+ onClick: c
108
108
  }, [
109
109
  i[1] || (i[1] = a("span", { class: "thinking-block__indicator" }, null, -1)),
110
- a("span", _n, Q(e.isStreaming ? "深度思考中" : "深度思考"), 1),
111
- (m(), S("svg", {
112
- class: J(["thinking-block__arrow", { "thinking-block__arrow--down": h.value }]),
110
+ a("span", Hn, G(e.isStreaming ? "深度思考中" : "深度思考"), 1),
111
+ (m(), x("svg", {
112
+ class: q(["thinking-block__arrow", { "thinking-block__arrow--down": d.value }]),
113
113
  viewBox: "0 0 24 24",
114
114
  width: "14",
115
115
  height: "14",
@@ -122,23 +122,23 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
122
122
  a("polyline", { points: "6 9 12 15 18 9" }, null, -1)
123
123
  ])], 2))
124
124
  ]),
125
- U(on, {
125
+ K(sn, {
126
126
  name: "thinking-expand",
127
- onAfterEnter: L
127
+ onAfterEnter: W
128
128
  }, {
129
- default: sn(() => [
130
- h.value ? (m(), S("div", {
129
+ default: an(() => [
130
+ d.value ? (m(), x("div", {
131
131
  key: 0,
132
132
  ref_key: "contentRef",
133
- ref: _,
133
+ ref: R,
134
134
  class: "thinking-block__content",
135
135
  onScroll: n
136
136
  }, [
137
137
  a("div", {
138
138
  class: "thinking-block__markdown",
139
- innerHTML: H(un)(H(ut)(H(ct)(c.value)), e.isStreaming)
140
- }, null, 8, Hn)
141
- ], 544)) : Y("", !0)
139
+ innerHTML: $(ut)($(ct)($(rt)(l.value)), e.isStreaming)
140
+ }, null, 8, _n)
141
+ ], 544)) : X("", !0)
142
142
  ]),
143
143
  _: 1
144
144
  })
@@ -150,31 +150,25 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
150
150
  }, Ln = { class: "thought-collapse-bar__text" }, On = {
151
151
  key: 2,
152
152
  class: "thought-collapse-bar__duration"
153
- }, Wn = { class: "thought-collapse-bar__action" }, Bn = { class: "agent-thought__spinner" }, Nn = { class: "agent-thought__text" }, Yn = {
153
+ }, Nn = { class: "thought-collapse-bar__action" }, Wn = { class: "agent-thought__spinner" }, Bn = { class: "agent-thought__text" }, Yn = {
154
154
  key: 0,
155
155
  class: "agent-thought__duration"
156
156
  }, Vn = {
157
157
  key: 1,
158
158
  class: "agent-thought__duration"
159
- }, Xn = { key: 0 }, Fn = ["innerHTML"], Qn = {
160
- key: 3,
161
- class: "streaming-cursor"
162
- }, Gn = ["innerHTML"], Un = {
163
- key: 0,
164
- class: "streaming-cursor"
165
- }, qn = {
159
+ }, Xn = { key: 0 }, Fn = ["innerHTML"], Gn = ["innerHTML"], Qn = {
166
160
  key: 3,
167
161
  class: "message-error"
168
- }, Jn = {
162
+ }, Kn = {
169
163
  key: 4,
170
164
  class: "message-toolbar"
171
- }, Kn = ["data-tooltip"], zn = {
165
+ }, In = ["data-tooltip"], qn = {
172
166
  class: "tooltip-enhanced",
173
167
  "data-tooltip": "重新回答"
174
- }, jn = {
168
+ }, Jn = {
175
169
  key: 1,
176
170
  class: "message-content"
177
- }, In = ["src"], Zn = /* @__PURE__ */ xe({
171
+ }, zn = ["src"], Un = /* @__PURE__ */ xe({
178
172
  __name: "MessageItem",
179
173
  props: {
180
174
  msg: {},
@@ -186,83 +180,89 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
186
180
  },
187
181
  emits: ["regenerate"],
188
182
  setup(e, { emit: y }) {
189
- const h = e, g = O(
190
- () => h.msg.status === h.STATUS.COMPLETED || h.msg.status === h.STATUS.STOP
191
- ), l = p(!1);
192
- ae(g, (o) => {
193
- o && (l.value = !1);
183
+ const d = e, h = O(
184
+ () => d.msg.status === d.STATUS.COMPLETED || d.msg.status === d.STATUS.STOP
185
+ ), u = p(!1);
186
+ ae(h, (o) => {
187
+ o && (u.value = !1);
194
188
  });
195
189
  const k = O(() => {
196
190
  var o;
197
- return ((o = h.msg.segments) == null ? void 0 : o.filter((s) => s.type === "thinking")) ?? [];
198
- }), u = O(() => k.value.map((o) => o.content).join(`
191
+ return ((o = d.msg.segments) == null ? void 0 : o.filter((s) => s.type === "thinking")) ?? [];
192
+ }), c = O(() => k.value.map((o) => o.content).join(`
199
193
 
200
- `)), c = O(
201
- () => k.value.some((o) => o.duration == null) && (h.msg.status === h.STATUS.THINKING || h.msg.status === h.STATUS.RETHINKING)
202
- ), v = O(() => {
194
+ `)), l = O(
195
+ () => k.value.some((o) => o.duration == null) && (d.msg.status === d.STATUS.THINKING || d.msg.status === d.STATUS.RETHINKING)
196
+ ), r = O(() => {
197
+ const o = d.msg.segments ?? [];
198
+ let s = -1;
199
+ return o.forEach((A, b) => {
200
+ A.type === "answer" && (s = b);
201
+ }), s;
202
+ }), C = O(() => {
203
203
  var o;
204
- return ((o = h.msg.segments) == null ? void 0 : o.filter((s) => s.type === "agent_thought")) ?? [];
205
- }), b = O(() => v.value.some((o) => o.duration == null)), C = O(() => v.value.reduce((o, s) => o + (s.duration ?? 0), 0)), A = O(() => [...k.value, ...v.value]), x = O(() => A.value.length > 0), E = O(() => A.value.some((o) => o.type === "thinking")), $ = O(() => {
204
+ return ((o = d.msg.segments) == null ? void 0 : o.filter((s) => s.type === "agent_thought")) ?? [];
205
+ }), w = O(() => C.value.some((o) => o.duration == null)), S = O(() => C.value.reduce((o, s) => o + (s.duration ?? 0), 0)), E = O(() => [...k.value, ...C.value]), D = O(() => E.value.length > 0), P = O(() => E.value.some((o) => o.type === "thinking")), R = O(() => {
206
206
  const o = [];
207
- return E.value && o.push("深度思考"), A.value.some((s) => s.type === "agent_thought") && o.push("工具调用"), o.join(" · ") || "思考过程";
208
- }), _ = O(() => !g.value || l.value), P = O(
209
- () => A.value.reduce((o, s) => o + (s.duration ?? 0), 0)
207
+ return P.value && o.push("深度思考"), E.value.some((s) => s.type === "agent_thought") && o.push("工具调用"), o.join(" · ") || "思考过程";
208
+ }), L = O(() => !h.value || u.value), n = O(
209
+ () => E.value.reduce((o, s) => o + (s.duration ?? 0), 0)
210
210
  );
211
- function n(o) {
211
+ function B(o) {
212
212
  return o == null || o <= 0 ? "" : o < 1 ? `${Math.round(o * 1e3)}ms` : o < 60 ? `${o.toFixed(1)}s` : `${Math.floor(o / 60)}m${Math.round(o % 60)}s`;
213
213
  }
214
- const W = te(/* @__PURE__ */ new Map()), L = p("");
215
- function M(o) {
214
+ const W = te(/* @__PURE__ */ new Map()), T = p("");
215
+ function i(o) {
216
216
  const s = o.target;
217
- s.tagName === "IMG" && (L.value = s.src);
217
+ s.tagName === "IMG" && (T.value = s.src);
218
218
  }
219
- function i() {
220
- L.value = "";
219
+ function f() {
220
+ T.value = "";
221
221
  }
222
- function w(o, s) {
223
- var r;
222
+ function g(o, s) {
223
+ var A;
224
224
  try {
225
- let f = o.content;
226
- if (!f && ((r = o.segments) != null && r.length) && (f = o.segments.filter((D) => D.type !== "thinking" && D.type !== "agent_thought").map((D) => D.content).join(`
227
- `)), f) {
228
- const { copy: D } = cn();
229
- D(f), W.set(s, !0), setTimeout(() => W.set(s, !1), 2e3);
225
+ let b = o.content;
226
+ if (!b && ((A = o.segments) != null && A.length) && (b = o.segments.filter((_) => _.type !== "thinking" && _.type !== "agent_thought").map((_) => _.content).join(`
227
+ `)), b) {
228
+ const { copy: _ } = cn();
229
+ _(b), W.set(s, !0), setTimeout(() => W.set(s, !1), 2e3);
230
230
  }
231
231
  } catch {
232
232
  }
233
233
  }
234
234
  return (o, s) => {
235
- var r;
236
- return m(), S("div", {
237
- class: J(["message", `${e.msg.type}-message`])
235
+ var A;
236
+ return m(), x("div", {
237
+ class: q(["message", `${e.msg.type}-message`])
238
238
  }, [
239
- e.msg.type === "ai" ? (m(), S(Se, { key: 0 }, [
240
- (e.msg.status === e.STATUS.THINKING || e.msg.status === e.STATUS.RETHINKING) && !e.msg.thinkingContent && !e.msg.content ? (m(), S("div", Pn, [...s[4] || (s[4] = [
241
- an('<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)
242
- ])])) : Y("", !0),
243
- e.msg.segments && e.msg.segments.length ? (m(), S("div", {
239
+ e.msg.type === "ai" ? (m(), x(Se, { key: 0 }, [
240
+ (e.msg.status === e.STATUS.THINKING || e.msg.status === e.STATUS.RETHINKING) && !e.msg.thinkingContent && !e.msg.content ? (m(), x("div", Pn, [...s[4] || (s[4] = [
241
+ ln('<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)
242
+ ])])) : X("", !0),
243
+ e.msg.segments && e.msg.segments.length ? (m(), x("div", {
244
244
  key: 1,
245
245
  class: "message-content ba-markdown",
246
- ref: (f) => e.setMessageRef(f, e.index),
247
- onClick: M
246
+ ref: (b) => e.setMessageRef(b, e.index),
247
+ onClick: i
248
248
  }, [
249
- g.value && x.value ? (m(), S("div", {
249
+ h.value && D.value ? (m(), x("div", {
250
250
  key: 0,
251
- class: J(["thought-collapse-bar", { "thought-collapse-bar--expanded": l.value }]),
252
- onClick: s[0] || (s[0] = se((f) => l.value = !l.value, ["stop"]))
251
+ class: q(["thought-collapse-bar", { "thought-collapse-bar--expanded": u.value }]),
252
+ onClick: s[0] || (s[0] = se((b) => u.value = !u.value, ["stop"]))
253
253
  }, [
254
- E.value ? (m(), oe(H(xn), {
254
+ P.value ? (m(), oe($(xn), {
255
255
  key: 0,
256
256
  class: "thought-collapse-bar__icon"
257
- })) : (m(), oe(H(xt), {
257
+ })) : (m(), oe($(Tt), {
258
258
  key: 1,
259
259
  class: "thought-collapse-bar__icon"
260
260
  })),
261
- a("span", Ln, Q($.value), 1),
262
- P.value > 0 ? (m(), S("span", On, Q(n(P.value)), 1)) : Y("", !0),
263
- a("span", Wn, Q(l.value ? "收起" : "查看"), 1),
264
- (m(), S("svg", {
265
- class: J(["thought-collapse-bar__arrow", { "thought-collapse-bar__arrow--down": l.value }]),
261
+ a("span", Ln, G(R.value), 1),
262
+ n.value > 0 ? (m(), x("span", On, G(B(n.value)), 1)) : X("", !0),
263
+ a("span", Nn, G(u.value ? "收起" : "查看"), 1),
264
+ (m(), x("svg", {
265
+ class: q(["thought-collapse-bar__arrow", { "thought-collapse-bar__arrow--down": u.value }]),
266
266
  viewBox: "0 0 24 24",
267
267
  width: "12",
268
268
  height: "12",
@@ -274,117 +274,121 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
274
274
  }, [...s[5] || (s[5] = [
275
275
  a("polyline", { points: "6 9 12 15 18 9" }, null, -1)
276
276
  ])], 2))
277
- ], 2)) : Y("", !0),
278
- E.value && _.value ? (m(), oe($n, {
277
+ ], 2)) : X("", !0),
278
+ P.value && L.value ? (m(), oe($n, {
279
279
  key: 1,
280
- content: u.value,
281
- "is-streaming": c.value,
282
- "message-done": g.value
283
- }, null, 8, ["content", "is-streaming", "message-done"])) : Y("", !0),
284
- v.value.length && _.value ? (m(), S("div", {
280
+ content: c.value,
281
+ "is-streaming": l.value,
282
+ "message-done": h.value
283
+ }, null, 8, ["content", "is-streaming", "message-done"])) : X("", !0),
284
+ C.value.length && L.value ? (m(), x("div", {
285
285
  key: 2,
286
- class: J(["agent-thought", { "agent-thought--done": !b.value }])
286
+ class: q(["agent-thought", { "agent-thought--done": !w.value }])
287
287
  }, [
288
- a("span", Bn, [
289
- U(H(xt))
288
+ a("span", Wn, [
289
+ K($(Tt))
290
290
  ]),
291
- a("span", Nn, Q(b.value ? "工具调用中" : "工具调用"), 1),
292
- !b.value && v.value.length > 1 ? (m(), S("span", Yn, " 已调用 " + Q(v.value.length) + " 次 ", 1)) : Y("", !0),
293
- !b.value && C.value > 0 ? (m(), S("span", Vn, Q(n(C.value)), 1)) : Y("", !0)
294
- ], 2)) : Y("", !0),
295
- (m(!0), S(Se, null, Oe(e.msg.segments, (f, D) => (m(), S(Se, { key: D }, [
296
- f.type === "answer" ? (m(), S("div", Xn, [
291
+ a("span", Bn, G(w.value ? "工具调用中" : "工具调用"), 1),
292
+ !w.value && C.value.length > 1 ? (m(), x("span", Yn, " 已调用 " + G(C.value.length) + " 次 ", 1)) : X("", !0),
293
+ !w.value && S.value > 0 ? (m(), x("span", Vn, G(B(S.value)), 1)) : X("", !0)
294
+ ], 2)) : X("", !0),
295
+ (m(!0), x(Se, null, Oe(e.msg.segments, (b, _) => (m(), x(Se, { key: _ }, [
296
+ b.type === "answer" ? (m(), x("div", Xn, [
297
297
  a("div", {
298
- innerHTML: H(ut)(H(ct)(e.getSegmentDisplayContent(e.index, D, f, e.msg)))
298
+ innerHTML: $(ut)(
299
+ $(ct)($(rt)(e.getSegmentDisplayContent(e.index, _, b, e.msg))),
300
+ e.msg.status === e.STATUS.ANSWERING && _ === r.value
301
+ )
299
302
  }, null, 8, Fn)
300
- ])) : Y("", !0)
301
- ], 64))), 128)),
302
- e.msg.status === e.STATUS.ANSWERING ? (m(), S("span", Qn)) : Y("", !0)
303
- ], 512)) : Y("", !0),
304
- !((r = e.msg.segments) != null && r.length) && e.msg.content ? (m(), S("div", {
303
+ ])) : X("", !0)
304
+ ], 64))), 128))
305
+ ], 512)) : X("", !0),
306
+ !((A = e.msg.segments) != null && A.length) && e.msg.content ? (m(), x("div", {
305
307
  key: 2,
306
308
  class: "message-content ba-markdown",
307
- ref: (f) => e.setMessageRef(f, e.index),
308
- onClick: M
309
+ ref: (b) => e.setMessageRef(b, e.index),
310
+ onClick: i
309
311
  }, [
310
312
  a("div", {
311
- innerHTML: H(ut)(H(ct)(e.displayedContent.get(e.index) ?? e.msg.content))
312
- }, null, 8, Gn),
313
- e.msg.status === e.STATUS.ANSWERING ? (m(), S("span", Un)) : Y("", !0)
314
- ], 512)) : Y("", !0),
315
- e.msg.errorMessage ? (m(), S("div", qn, [
313
+ innerHTML: $(ut)(
314
+ $(ct)($(rt)(e.displayedContent.get(e.index) ?? e.msg.content)),
315
+ e.msg.status === e.STATUS.ANSWERING
316
+ )
317
+ }, null, 8, Gn)
318
+ ], 512)) : X("", !0),
319
+ e.msg.errorMessage ? (m(), x("div", Qn, [
316
320
  s[6] || (s[6] = a("span", { class: "message-error__icon" }, "⚠️", -1)),
317
- a("span", null, Q(e.msg.errorMessage), 1)
318
- ])) : Y("", !0),
319
- e.msg.status === e.STATUS.COMPLETED || e.msg.status === e.STATUS.STOP ? (m(), S("div", Jn, [
321
+ a("span", null, G(e.msg.errorMessage), 1)
322
+ ])) : X("", !0),
323
+ e.msg.status === e.STATUS.COMPLETED || e.msg.status === e.STATUS.STOP ? (m(), x("div", Kn, [
320
324
  a("div", {
321
325
  class: "tooltip-enhanced",
322
326
  "data-tooltip": W.get(e.index) ? "已复制" : "复制回答"
323
327
  }, [
324
- W.get(e.index) ? (m(), oe(H(Tn), {
328
+ W.get(e.index) ? (m(), oe($(Tn), {
325
329
  key: 0,
326
330
  class: "message-toolbar__check"
327
- })) : (m(), oe(H(En), {
331
+ })) : (m(), oe($(En), {
328
332
  key: 1,
329
- onClick: s[1] || (s[1] = (f) => w(e.msg, e.index))
333
+ onClick: s[1] || (s[1] = (b) => g(e.msg, e.index))
330
334
  }))
331
- ], 8, Kn),
332
- a("div", zn, [
333
- U(H(Mn), {
334
- onClick: s[2] || (s[2] = (f) => o.$emit("regenerate"))
335
+ ], 8, In),
336
+ a("div", qn, [
337
+ K($(Mn), {
338
+ onClick: s[2] || (s[2] = (b) => o.$emit("regenerate"))
335
339
  })
336
340
  ])
337
- ])) : Y("", !0)
338
- ], 64)) : (m(), S("div", jn, Q(e.msg.content), 1)),
341
+ ])) : X("", !0)
342
+ ], 64)) : (m(), x("div", Jn, G(e.msg.content), 1)),
339
343
  (m(), oe(_t, { to: "#ai-assist-root" }, [
340
- L.value ? (m(), S("div", {
344
+ T.value ? (m(), x("div", {
341
345
  key: 0,
342
346
  class: "ai-image-preview-overlay",
343
- onClick: i
347
+ onClick: f
344
348
  }, [
345
349
  a("img", {
346
- src: L.value,
350
+ src: T.value,
347
351
  class: "ai-image-preview-overlay__img",
348
352
  onClick: s[3] || (s[3] = se(() => {
349
353
  }, ["stop"]))
350
- }, null, 8, In),
354
+ }, null, 8, zn),
351
355
  a("button", {
352
356
  class: "ai-image-preview-overlay__close",
353
- onClick: se(i, ["stop"])
357
+ onClick: se(f, ["stop"])
354
358
  }, [
355
- U(H(Dn))
359
+ K($(Dn))
356
360
  ])
357
- ])) : Y("", !0)
361
+ ])) : X("", !0)
358
362
  ]))
359
363
  ], 2);
360
364
  };
361
365
  }
362
- }), eo = {
366
+ }), jn = {
363
367
  key: 0,
364
368
  class: "input-container voice-mode"
365
- }, to = {
369
+ }, Zn = {
366
370
  key: 0,
367
371
  class: "final"
368
- }, no = {
372
+ }, eo = {
369
373
  key: 1,
370
374
  class: "interim"
371
- }, oo = {
375
+ }, to = {
372
376
  key: 2,
373
377
  class: "placeholder"
374
- }, so = ["onKeydown"], ao = ["data-tooltip"], io = {
378
+ }, no = ["onKeydown"], oo = ["data-tooltip"], so = {
375
379
  key: 2,
376
380
  class: "moveTB"
377
- }, lo = {
381
+ }, ao = {
378
382
  key: 1,
379
383
  class: "input-container"
380
- }, uo = ["value", "disabled"], co = {
384
+ }, io = ["value", "disabled"], lo = {
381
385
  key: 0,
382
386
  class: "tooltip-enhanced stop",
383
387
  "data-tooltip": "停止生成"
384
- }, ro = ["data-tooltip"], vo = {
388
+ }, uo = ["data-tooltip"], co = {
385
389
  key: 3,
386
390
  class: "moveTB"
387
- }, ho = /* @__PURE__ */ xe({
391
+ }, ro = /* @__PURE__ */ xe({
388
392
  __name: "ChatInput",
389
393
  props: {
390
394
  modelValue: {},
@@ -395,695 +399,695 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
395
399
  },
396
400
  emits: ["update:modelValue", "send", "stop", "scroll-to-bottom"],
397
401
  setup(e, { emit: y }) {
398
- const h = e, g = y, l = p(!1), k = p(""), u = p(""), c = p("idle"), v = p(""), b = p(null), C = p(null);
399
- let A = null;
400
- const x = O(() => c.value === "connecting"), E = O(
401
- () => c.value === "recording" || c.value === "stopping"
402
- ), $ = O(
403
- () => c.value === "connecting" || c.value === "recording" || c.value === "stopping"
404
- ), _ = O(() => l.value && !$.value), P = O(
405
- () => _.value ? !!v.value.trim() : !!(k.value.trim() || u.value.trim())
402
+ const d = e, h = y, u = p(!1), k = p(""), c = p(""), l = p("idle"), r = p(""), C = p(null), w = p(null);
403
+ let S = null;
404
+ const E = O(() => l.value === "connecting"), D = O(
405
+ () => l.value === "recording" || l.value === "stopping"
406
+ ), P = O(
407
+ () => l.value === "connecting" || l.value === "recording" || l.value === "stopping"
408
+ ), R = O(() => u.value && !P.value), L = O(
409
+ () => R.value ? !!r.value.trim() : !!(k.value.trim() || c.value.trim())
406
410
  ), n = O(
407
- () => at.isSupported() && !h.modelValue.trim() && !h.isGenerating
411
+ () => at.isSupported() && !d.modelValue.trim() && !d.isGenerating
408
412
  );
409
- function W() {
410
- A = new at({}, {
411
- onStatusChange: (o) => {
412
- c.value = o;
413
+ function B() {
414
+ S = new at({}, {
415
+ onStatusChange: (g) => {
416
+ l.value = g;
413
417
  },
414
- onInterim: (o) => {
415
- u.value = o;
418
+ onInterim: (g) => {
419
+ c.value = g;
416
420
  },
417
- onFinal: (o) => {
418
- k.value += o, u.value = "";
421
+ onFinal: (g) => {
422
+ k.value += g, c.value = "";
419
423
  },
420
424
  onError: () => {
421
- l.value = !1;
425
+ u.value = !1;
422
426
  }
423
427
  });
424
428
  }
425
- pe(W), Ht(() => {
426
- A == null || A.destroy(), A = null;
427
- }), ae([k, u], () => {
429
+ pe(B), $t(() => {
430
+ S == null || S.destroy(), S = null;
431
+ }), ae([k, c], () => {
428
432
  ne(() => {
429
- b.value && (b.value.scrollTop = b.value.scrollHeight);
433
+ C.value && (C.value.scrollTop = C.value.scrollHeight);
430
434
  });
431
- }), ae(c, (o) => {
432
- o === "idle" && l.value && (v.value = (k.value + u.value).trim(), ne(() => {
433
- var s;
434
- return (s = C.value) == null ? void 0 : s.focus();
435
+ }), ae(l, (g) => {
436
+ g === "idle" && u.value && (r.value = (k.value + c.value).trim(), ne(() => {
437
+ var o;
438
+ return (o = w.value) == null ? void 0 : o.focus();
435
439
  }));
436
440
  });
437
- function L() {
438
- $.value && (A == null || A.stop());
441
+ function W() {
442
+ P.value && (S == null || S.stop());
439
443
  }
440
- async function M() {
441
- if (A) {
442
- k.value = "", u.value = "", v.value = "", l.value = !0;
444
+ async function T() {
445
+ if (S) {
446
+ k.value = "", c.value = "", r.value = "", u.value = !0;
443
447
  try {
444
- await A.start();
448
+ await S.start();
445
449
  } catch {
446
- l.value = !1;
450
+ u.value = !1;
447
451
  }
448
452
  }
449
453
  }
450
454
  function i() {
451
- A == null || A.cancel(), l.value = !1, k.value = "", u.value = "", v.value = "";
455
+ S == null || S.cancel(), u.value = !1, k.value = "", c.value = "", r.value = "";
452
456
  }
453
- function w() {
454
- const o = (_.value ? v.value : k.value + u.value).trim();
455
- o && (A == null || A.stop(), l.value = !1, g("update:modelValue", o), setTimeout(() => g("send"), 0));
457
+ function f() {
458
+ const g = (R.value ? r.value : k.value + c.value).trim();
459
+ g && (S == null || S.stop(), u.value = !1, h("update:modelValue", g), setTimeout(() => h("send"), 0));
456
460
  }
457
- return (o, s) => l.value ? (m(), S("div", eo, [
461
+ return (g, o) => u.value ? (m(), x("div", jn, [
458
462
  a("div", {
459
- class: J(["voice-visual", { recording: E.value }])
463
+ class: q(["voice-visual", { recording: D.value }])
460
464
  }, null, 2),
461
- $.value ? (m(), S("div", {
465
+ P.value ? (m(), x("div", {
462
466
  key: 0,
463
467
  class: "voice-text",
464
468
  ref_key: "voiceTextEl",
465
- ref: b,
466
- onClick: L
469
+ ref: C,
470
+ onClick: W
467
471
  }, [
468
- k.value ? (m(), S("span", to, Q(k.value), 1)) : Y("", !0),
469
- u.value ? (m(), S("span", no, Q(u.value), 1)) : Y("", !0),
470
- !k.value && !u.value ? (m(), S("span", oo, Q(x.value ? "启动中…" : "正在聆听…"), 1)) : Y("", !0)
471
- ], 512)) : De((m(), S("input", {
472
+ k.value ? (m(), x("span", Zn, G(k.value), 1)) : X("", !0),
473
+ c.value ? (m(), x("span", eo, G(c.value), 1)) : X("", !0),
474
+ !k.value && !c.value ? (m(), x("span", to, G(E.value ? "启动中…" : "正在聆听…"), 1)) : X("", !0)
475
+ ], 512)) : De((m(), x("input", {
472
476
  key: 1,
473
477
  ref_key: "editorEl",
474
- ref: C,
475
- "onUpdate:modelValue": s[0] || (s[0] = (r) => v.value = r),
478
+ ref: w,
479
+ "onUpdate:modelValue": o[0] || (o[0] = (s) => r.value = s),
476
480
  type: "text",
477
481
  class: "voice-editor",
478
482
  placeholder: "识别结果,可点击直接修改…",
479
483
  onKeydown: lt(se(i, ["prevent"]), ["esc"]),
480
- onKeyup: s[1] || (s[1] = lt((r) => P.value && w(), ["enter"]))
481
- }, null, 40, so)), [
482
- [$t, v.value]
484
+ onKeyup: o[1] || (o[1] = lt((s) => L.value && f(), ["enter"]))
485
+ }, null, 40, no)), [
486
+ [Pt, r.value]
483
487
  ]),
484
488
  a("div", {
485
489
  class: "tooltip-enhanced voice-close",
486
490
  "data-tooltip": "关闭",
487
491
  onClick: i
488
492
  }, [
489
- U(H(I), {
493
+ K($(Z), {
490
494
  class: "op-icon",
491
495
  icon: "heroicons-solid:x-mark"
492
496
  })
493
497
  ]),
494
498
  a("div", {
495
- class: J(["tooltip-enhanced voice-send", { disabled: !P.value }]),
496
- "data-tooltip": P.value ? "发送" : "未识别到文字",
497
- onClick: s[2] || (s[2] = (r) => P.value && w())
499
+ class: q(["tooltip-enhanced voice-send", { disabled: !L.value }]),
500
+ "data-tooltip": L.value ? "发送" : "未识别到文字",
501
+ onClick: o[2] || (o[2] = (s) => L.value && f())
498
502
  }, [
499
- U(H(I), {
503
+ K($(Z), {
500
504
  class: "op-icon",
501
505
  icon: "fluent-color:send-16"
502
506
  })
503
- ], 10, ao),
504
- e.hasScroll && !e.isAtBottom ? (m(), S("div", io, [
505
- U(H(I), {
507
+ ], 10, oo),
508
+ e.hasScroll && !e.isAtBottom ? (m(), x("div", so, [
509
+ K($(Z), {
506
510
  class: "op-icon",
507
511
  icon: "ep:bottom",
508
- onClick: s[3] || (s[3] = (r) => o.$emit("scroll-to-bottom"))
512
+ onClick: o[3] || (o[3] = (s) => g.$emit("scroll-to-bottom"))
509
513
  })
510
- ])) : Y("", !0)
511
- ])) : (m(), S("div", lo, [
514
+ ])) : X("", !0)
515
+ ])) : (m(), x("div", ao, [
512
516
  a("input", {
513
517
  value: e.modelValue,
514
518
  type: "text",
515
519
  placeholder: "给AI助手发送消息...",
516
- onInput: s[4] || (s[4] = (r) => o.$emit("update:modelValue", r.target.value)),
517
- onKeyup: s[5] || (s[5] = lt((r) => e.modelValue.trim() && o.$emit("send"), ["enter"])),
520
+ onInput: o[4] || (o[4] = (s) => g.$emit("update:modelValue", s.target.value)),
521
+ onKeyup: o[5] || (o[5] = lt((s) => e.modelValue.trim() && g.$emit("send"), ["enter"])),
518
522
  disabled: e.isGenerating
519
- }, null, 40, uo),
520
- e.isGenerating && e.lastUserMessage ? (m(), S("div", co, [
521
- U(H(I), {
523
+ }, null, 40, io),
524
+ e.isGenerating && e.lastUserMessage ? (m(), x("div", lo, [
525
+ K($(Z), {
522
526
  class: "op-icon stop-icon",
523
527
  icon: "heroicons-solid:stop",
524
- onClick: s[6] || (s[6] = (r) => o.$emit("stop"))
528
+ onClick: o[6] || (o[6] = (s) => g.$emit("stop"))
525
529
  })
526
- ])) : n.value ? (m(), S("div", {
530
+ ])) : n.value ? (m(), x("div", {
527
531
  key: 1,
528
532
  class: "tooltip-enhanced send voice",
529
533
  "data-tooltip": "语音输入",
530
- onClick: M
534
+ onClick: T
531
535
  }, [
532
- U(H(I), {
536
+ K($(Z), {
533
537
  class: "op-icon",
534
538
  icon: "mingcute:voice-line"
535
539
  })
536
- ])) : (m(), S("div", {
540
+ ])) : (m(), x("div", {
537
541
  key: 2,
538
- class: J(["tooltip-enhanced send", { disabled: !e.modelValue.trim() }]),
542
+ class: q(["tooltip-enhanced send", { disabled: !e.modelValue.trim() }]),
539
543
  "data-tooltip": e.modelValue.trim() ? "开始回答" : "请输入你的问题"
540
544
  }, [
541
- U(H(I), {
545
+ K($(Z), {
542
546
  class: "op-icon",
543
547
  icon: "fluent-color:send-16",
544
- onClick: s[7] || (s[7] = (r) => e.modelValue.trim() && o.$emit("send"))
548
+ onClick: o[7] || (o[7] = (s) => e.modelValue.trim() && g.$emit("send"))
545
549
  })
546
- ], 10, ro)),
547
- e.hasScroll && !e.isAtBottom ? (m(), S("div", vo, [
548
- U(H(I), {
550
+ ], 10, uo)),
551
+ e.hasScroll && !e.isAtBottom ? (m(), x("div", co, [
552
+ K($(Z), {
549
553
  class: "op-icon",
550
554
  icon: "ep:bottom",
551
- onClick: s[8] || (s[8] = (r) => o.$emit("scroll-to-bottom"))
555
+ onClick: o[8] || (o[8] = (s) => g.$emit("scroll-to-bottom"))
552
556
  })
553
- ])) : Y("", !0)
557
+ ])) : X("", !0)
554
558
  ]));
555
559
  }
556
560
  });
557
- function go(e) {
558
- const y = p(!0), h = p(!1);
559
- function g(u) {
560
- const c = u.closest(".chat-wrap") || u, v = u.scrollHeight, b = u.clientHeight;
561
- if (v <= b) {
562
- c.style.setProperty("--ai-thumb-height", "0px"), c.style.setProperty("--ai-thumb-top", "0px");
561
+ function vo(e) {
562
+ const y = p(!0), d = p(!1);
563
+ function h(c) {
564
+ const l = c.closest(".chat-wrap") || c, r = c.scrollHeight, C = c.clientHeight;
565
+ if (r <= C) {
566
+ l.style.setProperty("--ai-thumb-height", "0px"), l.style.setProperty("--ai-thumb-top", "0px");
563
567
  return;
564
568
  }
565
- const C = Math.max(b * b / v, 32), A = b - C, x = u.scrollTop / (v - b);
566
- c.style.setProperty("--ai-thumb-height", `${C}px`), c.style.setProperty("--ai-thumb-top", `${x * A}px`);
569
+ const w = Math.max(C * C / r, 32), S = C - w, E = c.scrollTop / (r - C);
570
+ l.style.setProperty("--ai-thumb-height", `${w}px`), l.style.setProperty("--ai-thumb-top", `${E * S}px`);
567
571
  }
568
- function l() {
572
+ function u() {
569
573
  ne(() => {
570
574
  e.value && (e.value.scrollTop = e.value.scrollHeight);
571
575
  });
572
576
  }
573
577
  function k() {
574
578
  if (!e.value) return;
575
- const u = e.value, c = u.scrollTop + u.clientHeight >= u.scrollHeight - 1, v = u.scrollHeight > u.clientHeight;
576
- y.value = c, h.value = v, g(u);
579
+ const c = e.value, l = c.scrollTop + c.clientHeight >= c.scrollHeight - 1, r = c.scrollHeight > c.clientHeight;
580
+ y.value = l, d.value = r, h(c);
577
581
  }
578
- return { isAtBottom: y, hasScroll: h, scrollToBottom: l, checkScrollStatus: k };
582
+ return { isAtBottom: y, hasScroll: d, scrollToBottom: u, checkScrollStatus: k };
579
583
  }
580
- function mo() {
584
+ function ho() {
581
585
  function e(y) {
582
- y.querySelectorAll("pre").forEach((g) => {
583
- if (g.querySelector(".copy-button")) return;
584
- const l = g.querySelector("code");
585
- if (!l) return;
586
- const u = (Array.from(l.classList).find((v) => v.startsWith("language-")) || "").replace("language-", "");
587
- if (u) {
588
- const v = document.createElement("span");
589
- v.className = "code-lang", v.textContent = u, g.appendChild(v);
586
+ y.querySelectorAll("pre").forEach((h) => {
587
+ if (h.querySelector(".copy-button")) return;
588
+ const u = h.querySelector("code");
589
+ if (!u) return;
590
+ const c = (Array.from(u.classList).find((r) => r.startsWith("language-")) || "").replace("language-", "");
591
+ if (c) {
592
+ const r = document.createElement("span");
593
+ r.className = "code-lang", r.textContent = c, h.appendChild(r);
590
594
  }
591
- const c = document.createElement("button");
592
- c.className = "copy-button", c.textContent = "复制", c.onclick = () => {
593
- navigator.clipboard.writeText(l.textContent || "").then(() => {
594
- c.textContent = "已复制", setTimeout(() => {
595
- c.textContent = "复制";
595
+ const l = document.createElement("button");
596
+ l.className = "copy-button", l.textContent = "复制", l.onclick = () => {
597
+ navigator.clipboard.writeText(u.textContent || "").then(() => {
598
+ l.textContent = "已复制", setTimeout(() => {
599
+ l.textContent = "复制";
596
600
  }, 2e3);
597
601
  });
598
- }, g.appendChild(c);
602
+ }, h.appendChild(l);
599
603
  });
600
604
  }
601
605
  return { enhanceCodeBlocks: e };
602
606
  }
603
- function fo(e) {
604
- let y = null, h = 0;
605
- function g(k) {
606
- y = k(y || [...e.value]), h || (h = requestAnimationFrame(() => {
607
- h = 0, y && (e.value = y, y = null);
607
+ function go(e) {
608
+ let y = null, d = 0;
609
+ function h(k) {
610
+ y = k(y || [...e.value]), d || (d = requestAnimationFrame(() => {
611
+ d = 0, y && (e.value = y, y = null);
608
612
  }));
609
613
  }
610
- function l() {
611
- h && (cancelAnimationFrame(h), h = 0), y && (e.value = y, y = null);
614
+ function u() {
615
+ d && (cancelAnimationFrame(d), d = 0), y && (e.value = y, y = null);
612
616
  }
613
- return { batchMessagesUpdate: g, flushMessagesBatch: l };
617
+ return { batchMessagesUpdate: h, flushMessagesBatch: u };
614
618
  }
615
- function po(e, y, h) {
616
- const g = te(/* @__PURE__ */ new Map()), l = p(/* @__PURE__ */ new Map()), k = p(/* @__PURE__ */ new Map());
617
- let u = 0, c = 0;
618
- function v() {
619
- if (u) return;
620
- const x = 50, E = 100, $ = (_) => {
621
- if (c === 0) {
622
- c = _, u = requestAnimationFrame($);
619
+ function mo(e, y, d) {
620
+ const h = /* @__PURE__ */ new Set([d.ANSWERING, d.THINKING, d.RETHINKING]), u = te(/* @__PURE__ */ new Map()), k = p(/* @__PURE__ */ new Map()), c = p(/* @__PURE__ */ new Map());
621
+ let l = 0, r = 0;
622
+ function C() {
623
+ if (l) return;
624
+ const D = 50, P = 100, R = (L) => {
625
+ if (r === 0) {
626
+ r = L, l = requestAnimationFrame(R);
623
627
  return;
624
628
  }
625
- const P = Math.min(_ - c, 100);
626
- c = _;
627
- let n = !1;
628
- if (e.value.forEach((L, M) => {
629
- if (L.type !== "ai" || L.status !== h) return;
630
- const i = L.content, w = l.value.get(M) ?? 0, o = i.length - w;
629
+ const n = Math.min(L - r, 100);
630
+ r = L;
631
+ let B = !1;
632
+ if (e.value.forEach((T, i) => {
633
+ if (T.type !== "ai" || !h.has(T.status)) return;
634
+ const f = T.content, g = k.value.get(i) ?? 0, o = f.length - g;
631
635
  if (o > 0) {
632
- n = !0;
633
- const s = Math.min(x + o, E), r = (k.value.get(M) ?? 0) + s * P / 1e3, f = Math.floor(r);
634
- if (f > 0) {
635
- k.value.set(M, r - f);
636
- const D = Math.min(w + f, i.length);
637
- l.value.set(M, D), g.set(M, i.slice(0, D));
636
+ B = !0;
637
+ const s = Math.min(D + o, P), A = (c.value.get(i) ?? 0) + s * n / 1e3, b = Math.floor(A);
638
+ if (b > 0) {
639
+ c.value.set(i, A - b);
640
+ const _ = Math.min(g + b, f.length);
641
+ k.value.set(i, _), u.set(i, f.slice(0, _));
638
642
  } else
639
- k.value.set(M, r);
643
+ c.value.set(i, A);
640
644
  } else
641
- k.value.set(M, 0);
642
- }), n && y(), !e.value.some((L) => L.type === "ai" && L.status === h)) {
643
- u = 0;
645
+ c.value.set(i, 0);
646
+ }), B && y(), !e.value.some((T) => T.type === "ai" && h.has(T.status))) {
647
+ l = 0;
644
648
  return;
645
649
  }
646
- u = requestAnimationFrame($);
650
+ l = requestAnimationFrame(R);
647
651
  };
648
- c = 0, u = requestAnimationFrame($);
652
+ r = 0, l = requestAnimationFrame(R);
649
653
  }
650
- function b() {
651
- u && (cancelAnimationFrame(u), u = 0), e.value.forEach((x, E) => {
652
- x.type === "ai" && (g.set(E, x.content), l.value.set(E, x.content.length), k.value.set(E, 0));
654
+ function w() {
655
+ l && (cancelAnimationFrame(l), l = 0), e.value.forEach((D, P) => {
656
+ D.type === "ai" && (u.set(P, D.content), k.value.set(P, D.content.length), c.value.set(P, 0));
653
657
  });
654
658
  }
655
- function C() {
656
- u && (cancelAnimationFrame(u), u = 0);
659
+ function S() {
660
+ l && (cancelAnimationFrame(l), l = 0);
657
661
  }
658
- function A(x, E, $, _) {
659
- if ($.type !== "answer" || _.status !== h) return $.content;
660
- const P = _.segments || [];
661
- if (P.slice(E + 1).some((i) => i.type === "answer")) return $.content;
662
- const W = l.value.get(x);
663
- if (W == null) return $.content;
664
- let L = 0;
665
- for (let i = 0; i < E; i++)
666
- P[i].type === "answer" && (L += P[i].content.length);
667
- const M = L + $.content.length;
668
- return W >= M ? $.content : W <= L ? "" : $.content.slice(0, W - L);
662
+ function E(D, P, R, L) {
663
+ if (R.type !== "answer" || !h.has(L.status)) return R.content;
664
+ const n = L.segments || [];
665
+ if (n.slice(P + 1).some((g) => g.type === "answer")) return R.content;
666
+ const W = k.value.get(D);
667
+ if (W == null) return "";
668
+ let T = 0;
669
+ for (let g = 0; g < P; g++)
670
+ n[g].type === "answer" && (T += n[g].content.length);
671
+ const i = T + R.content.length;
672
+ return W >= i ? R.content : W <= T ? "" : R.content.slice(0, W - T);
669
673
  }
670
- return { displayedContent: g, streamingIndexRef: l, startTypewriter: v, flushTypewriter: b, getSegmentDisplayContent: A, stopTypewriter: C };
674
+ return { displayedContent: u, streamingIndexRef: k, startTypewriter: C, flushTypewriter: w, getSegmentDisplayContent: E, stopTypewriter: S };
671
675
  }
672
- function yo({
676
+ function fo({
673
677
  messages: e,
674
678
  isGenerating: y,
675
- lastUserMessage: h,
676
- batchMessagesUpdate: g,
677
- flushMessagesBatch: l,
679
+ lastUserMessage: d,
680
+ batchMessagesUpdate: h,
681
+ flushMessagesBatch: u,
678
682
  STATUS: k,
679
- cfg: u
683
+ cfg: c
680
684
  }) {
681
- const c = p(/* @__PURE__ */ new Map()), v = p(/* @__PURE__ */ new Map()), b = p(/* @__PURE__ */ new Map()), C = p(/* @__PURE__ */ new Map()), A = p(!1);
682
- function x(_) {
683
- const P = c.value.get(_) || [];
684
- g((n) => {
685
- if (n[_]) {
686
- const W = [...n];
687
- return W[_] = { ...W[_], segments: P.map((L) => ({ ...L })) }, W;
685
+ const l = p(/* @__PURE__ */ new Map()), r = p(/* @__PURE__ */ new Map()), C = p(/* @__PURE__ */ new Map()), w = p(/* @__PURE__ */ new Map()), S = p(!1);
686
+ function E(R) {
687
+ const L = l.value.get(R) || [];
688
+ h((n) => {
689
+ if (n[R]) {
690
+ const B = [...n];
691
+ return B[R] = { ...B[R], segments: L.map((W) => ({ ...W })) }, B;
688
692
  }
689
693
  return n;
690
694
  });
691
695
  }
692
- function E(_) {
693
- const P = c.value.get(_) || [], n = b.value.get(_);
694
- let W = 0, L = !1;
695
- P.forEach((M) => {
696
- if (M.type === "thinking" && M.duration == null) {
696
+ function D(R) {
697
+ const L = l.value.get(R) || [], n = C.value.get(R);
698
+ let B = 0, W = !1;
699
+ L.forEach((T) => {
700
+ if (T.type === "thinking" && T.duration == null) {
697
701
  const i = n ? Math.round((Date.now() - n) / 1e3 * 10) / 10 : 0;
698
- M.duration = i, W += i, L = !0;
702
+ T.duration = i, B += i, W = !0;
699
703
  }
700
- }), L && (c.value.set(_, P), g((M) => {
701
- if (M[_]) {
702
- const i = [...M];
703
- return i[_] = {
704
- ...i[_],
705
- segments: P.map((w) => ({ ...w })),
706
- thinkingDuration: (i[_].thinkingDuration || 0) + W
704
+ }), W && (l.value.set(R, L), h((T) => {
705
+ if (T[R]) {
706
+ const i = [...T];
707
+ return i[R] = {
708
+ ...i[R],
709
+ segments: L.map((f) => ({ ...f })),
710
+ thinkingDuration: (i[R].thinkingDuration || 0) + B
707
711
  }, i;
708
712
  }
709
- return M;
713
+ return T;
710
714
  }));
711
715
  }
712
- async function $(_, P, n, W, L = !1) {
713
- A.value = !1, c.value.set(n, []), y.value = !0;
716
+ async function P(R, L, n, B, W = !1) {
717
+ S.value = !1, l.value.set(n, []), y.value = !0;
714
718
  try {
715
- const M = u.baseUrl.replace(/\/+$/, "") + "/" + _.replace(/^\/+/, "");
716
- await bn(M, {
719
+ const T = c.baseUrl.replace(/\/+$/, "") + "/" + R.replace(/^\/+/, "");
720
+ await bn(T, {
717
721
  method: "POST",
718
722
  headers: {
719
723
  "Content-Type": "application/json",
720
- Authorization: `Bearer ${u.token}`
724
+ Authorization: `Bearer ${c.token}`
721
725
  },
722
- body: JSON.stringify({ app: u.app ?? 1, data: P }),
723
- signal: W,
726
+ body: JSON.stringify({ app: c.app ?? 1, data: L }),
727
+ signal: B,
724
728
  openWhenHidden: !0,
725
729
  async onopen(i) {
726
730
  i.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", i.status, i.statusText);
727
731
  },
728
732
  onmessage(i) {
729
- var w;
733
+ var f;
730
734
  try {
731
- let o = i.data || "";
732
- for (; o.startsWith("data:"); )
733
- o = o.replace(/^data:\s*/, "");
734
- if (!o) return;
735
- let s;
735
+ let g = i.data || "";
736
+ for (; g.startsWith("data:"); )
737
+ g = g.replace(/^data:\s*/, "");
738
+ if (!g) return;
739
+ let o;
736
740
  try {
737
- s = JSON.parse(o);
741
+ o = JSON.parse(g);
738
742
  } catch {
739
743
  return;
740
744
  }
741
- switch (s.event) {
745
+ switch (o.event) {
742
746
  case "message_start":
743
- L || (h.value = s.id), v.value.set(n, "answer");
747
+ W || (d.value = o.id), r.value.set(n, "answer");
744
748
  break;
745
749
  case "think_message_output_start": {
746
- b.value.set(n, Date.now()), v.value.set(n, "thinking");
747
- const r = c.value.get(n) || [];
748
- c.value.set(n, [...r, { type: "thinking", content: "" }]), x(n);
750
+ C.value.set(n, Date.now()), r.value.set(n, "thinking");
751
+ const s = l.value.get(n) || [];
752
+ l.value.set(n, [...s, { type: "thinking", content: "" }]), E(n);
749
753
  break;
750
754
  }
751
755
  case "agent_thought": {
752
- const r = s.thought || s.thinking || "", f = c.value.get(n) || [], D = f[f.length - 1];
753
- D && D.type === "agent_thought" ? D.content += r : (v.value.set(n, "agent_thought"), f.push({ type: "agent_thought", content: r }), C.value.set(n, Date.now())), c.value.set(n, f), g((N) => {
754
- if (N[n]) {
755
- const R = [...N];
756
- return R[n] = {
757
- ...R[n],
758
- segments: f.map((B) => ({ ...B })),
759
- thinkingContent: (R[n].thinkingContent || "") + r,
756
+ const s = o.thought || o.thinking || "", A = l.value.get(n) || [], b = A[A.length - 1];
757
+ b && b.type === "agent_thought" && b.duration == null ? b.content += s : (r.value.set(n, "agent_thought"), A.push({ type: "agent_thought", content: s }), w.value.set(n, Date.now())), l.value.set(n, A), h((_) => {
758
+ if (_[n]) {
759
+ const H = [..._];
760
+ return H[n] = {
761
+ ...H[n],
762
+ segments: A.map((N) => ({ ...N })),
763
+ thinkingContent: (H[n].thinkingContent || "") + s,
760
764
  status: k.THINKING
761
- }, R;
765
+ }, H;
762
766
  }
763
- return N;
767
+ return _;
764
768
  });
765
769
  break;
766
770
  }
767
771
  case "think_message": {
768
- const r = s.thinking || s.answer || s.text || "", f = c.value.get(n) || [], D = f[f.length - 1];
769
- D && D.type === "thinking" ? D.content += r : (f.push({ type: "thinking", content: r }), b.value.set(n, Date.now())), c.value.set(n, f), g((N) => {
770
- if (N[n]) {
771
- const R = [...N];
772
- return R[n] = {
773
- ...R[n],
774
- segments: f.map((B) => ({ ...B })),
775
- thinkingContent: (R[n].thinkingContent || "") + r,
772
+ const s = o.thinking || o.answer || o.text || "", A = l.value.get(n) || [], b = A[A.length - 1];
773
+ b && b.type === "thinking" ? b.content += s : (A.push({ type: "thinking", content: s }), C.value.set(n, Date.now())), l.value.set(n, A), h((_) => {
774
+ if (_[n]) {
775
+ const H = [..._];
776
+ return H[n] = {
777
+ ...H[n],
778
+ segments: A.map((N) => ({ ...N })),
779
+ thinkingContent: (H[n].thinkingContent || "") + s,
776
780
  status: k.THINKING
777
- }, R;
781
+ }, H;
778
782
  }
779
- return N;
783
+ return _;
780
784
  });
781
785
  break;
782
786
  }
783
787
  case "agent_thought_end": {
784
- const r = C.value.get(n), f = r ? Math.round((Date.now() - r) / 1e3 * 10) / 10 : 0, D = c.value.get(n) || [], N = D[D.length - 1];
785
- N && N.type === "agent_thought" && (N.duration = f), c.value.set(n, D), g((R) => {
786
- if (R[n]) {
787
- const B = [...R];
788
- return B[n] = {
789
- ...B[n],
790
- segments: D.map((K) => ({ ...K })),
791
- thinkingDuration: (B[n].thinkingDuration || 0) + f
792
- }, B;
788
+ const s = w.value.get(n), A = s ? Math.round((Date.now() - s) / 1e3 * 10) / 10 : 0, b = l.value.get(n) || [], _ = b[b.length - 1];
789
+ _ && _.type === "agent_thought" && (_.duration = A), l.value.set(n, b), h((H) => {
790
+ if (H[n]) {
791
+ const N = [...H];
792
+ return N[n] = {
793
+ ...N[n],
794
+ segments: b.map((J) => ({ ...J })),
795
+ thinkingDuration: (N[n].thinkingDuration || 0) + A
796
+ }, N;
793
797
  }
794
- return R;
798
+ return H;
795
799
  });
796
800
  break;
797
801
  }
798
802
  case "think_message_output_end": {
799
- const r = b.value.get(n), f = r ? Math.round((Date.now() - r) / 1e3 * 10) / 10 : 0, D = c.value.get(n) || [], N = D[D.length - 1];
800
- N && N.type === "thinking" && (N.duration = f), c.value.set(n, D), g((R) => {
801
- if (R[n]) {
802
- const B = [...R];
803
- return B[n] = {
804
- ...B[n],
805
- segments: D.map((K) => ({ ...K })),
806
- thinkingDuration: (B[n].thinkingDuration || 0) + f
807
- }, B;
803
+ const s = C.value.get(n), A = s ? Math.round((Date.now() - s) / 1e3 * 10) / 10 : 0, b = l.value.get(n) || [], _ = b[b.length - 1];
804
+ _ && _.type === "thinking" && (_.duration = A), l.value.set(n, b), h((H) => {
805
+ if (H[n]) {
806
+ const N = [...H];
807
+ return N[n] = {
808
+ ...N[n],
809
+ segments: b.map((J) => ({ ...J })),
810
+ thinkingDuration: (N[n].thinkingDuration || 0) + A
811
+ }, N;
808
812
  }
809
- return R;
813
+ return H;
810
814
  });
811
815
  break;
812
816
  }
813
817
  case "tool_message": {
814
- const r = s.answer || s.text || s.content || "";
815
- if (!r) break;
816
- const f = c.value.get(n) || [];
817
- f.push({ type: "answer", content: r }), c.value.set(n, f), x(n);
818
+ const s = o.answer || o.text || o.content || "";
819
+ if (!s) break;
820
+ const A = l.value.get(n) || [];
821
+ A.push({ type: "answer", content: s }), l.value.set(n, A), E(n);
818
822
  break;
819
823
  }
820
824
  case "message_output_start":
821
- v.value.set(n, "answer"), E(n);
825
+ r.value.set(n, "answer"), D(n);
822
826
  break;
823
827
  case "message": {
824
- const r = s.answer || "", f = v.value.get(n), D = c.value.get(n) || [], N = D[D.length - 1];
825
- f === "answer" && N && N.type === "answer" ? N.content += r : (E(n), v.value.set(n, "answer"), D.push({ type: "answer", content: r })), c.value.set(n, D);
826
- const R = D.filter((B) => B.type === "answer").map((B) => B.content).join("");
827
- g((B) => {
828
- if (B[n]) {
829
- const K = [...B];
830
- return K[n] = {
831
- ...K[n],
832
- segments: D.map((ue) => ({ ...ue })),
833
- content: R,
834
- status: A.value ? k.STOP : k.ANSWERING
835
- }, K;
828
+ const s = o.answer || "", A = r.value.get(n), b = l.value.get(n) || [], _ = b[b.length - 1];
829
+ A === "answer" && _ && _.type === "answer" ? _.content += s : (D(n), r.value.set(n, "answer"), b.push({ type: "answer", content: s })), l.value.set(n, b);
830
+ const H = b.filter((N) => N.type === "answer").map((N) => N.content).join("");
831
+ h((N) => {
832
+ if (N[n]) {
833
+ const J = [...N];
834
+ return J[n] = {
835
+ ...J[n],
836
+ segments: b.map((ue) => ({ ...ue })),
837
+ content: H,
838
+ status: S.value ? k.STOP : k.ANSWERING
839
+ }, J;
836
840
  }
837
- return B;
841
+ return N;
838
842
  });
839
843
  break;
840
844
  }
841
845
  case "message_end": {
842
- l();
843
- const r = [...e.value];
844
- r[n] && (r[n] = { ...r[n], status: A.value ? k.STOP : k.COMPLETED }), e.value = r, y.value = !1;
846
+ u();
847
+ const s = [...e.value];
848
+ s[n] && (s[n] = { ...s[n], status: S.value ? k.STOP : k.COMPLETED }), e.value = s, y.value = !1;
845
849
  break;
846
850
  }
847
851
  case "agent_error":
848
852
  case "message_failed": {
849
- l();
850
- const r = [...e.value];
851
- r[n] && (r[n] = {
852
- ...r[n],
853
+ u();
854
+ const s = [...e.value];
855
+ s[n] && (s[n] = {
856
+ ...s[n],
853
857
  status: k.ERROR,
854
- content: s.error_msg || s.message || "请求失败",
855
- errorMessage: s.error_msg || s.message || "请求失败"
856
- }, e.value = r), y.value = !1;
858
+ content: o.error_msg || o.message || "请求失败",
859
+ errorMessage: o.error_msg || o.message || "请求失败"
860
+ }, e.value = s), y.value = !1;
857
861
  break;
858
862
  }
859
863
  case "message_replace": {
860
- const r = s.answer || "", f = c.value.get(n) || [], D = (w = f.map((N, R) => ({ s: N, i: R })).reverse().find((N) => N.s.type === "answer")) == null ? void 0 : w.i;
861
- D != null ? f[D] = { ...f[D], content: r } : f.push({ type: "answer", content: r }), c.value.set(n, f), g((N) => {
862
- if (N[n]) {
863
- const R = [...N];
864
- return R[n] = {
865
- ...R[n],
866
- segments: f.map((B) => ({ ...B })),
867
- content: r
868
- }, R;
864
+ const s = o.answer || "", A = l.value.get(n) || [], b = (f = A.map((_, H) => ({ s: _, i: H })).reverse().find((_) => _.s.type === "answer")) == null ? void 0 : f.i;
865
+ b != null ? A[b] = { ...A[b], content: s } : A.push({ type: "answer", content: s }), l.value.set(n, A), h((_) => {
866
+ if (_[n]) {
867
+ const H = [..._];
868
+ return H[n] = {
869
+ ...H[n],
870
+ segments: A.map((N) => ({ ...N })),
871
+ content: s
872
+ }, H;
869
873
  }
870
- return N;
874
+ return _;
871
875
  });
872
876
  break;
873
877
  }
874
878
  case "message_cost": {
875
- const r = {
876
- inputTokens: s.input_tokens || 0,
877
- outputTokens: s.output_tokens || 0,
878
- latency: s.latency || 0,
879
- latencyFirstResp: s.latency_first_resp
879
+ const s = {
880
+ inputTokens: o.input_tokens || 0,
881
+ outputTokens: o.output_tokens || 0,
882
+ latency: o.latency || 0,
883
+ latencyFirstResp: o.latency_first_resp
880
884
  };
881
- g((f) => {
882
- if (f[n]) {
883
- const D = [...f];
884
- return D[n] = { ...D[n], cost: r }, D;
885
+ h((A) => {
886
+ if (A[n]) {
887
+ const b = [...A];
888
+ return b[n] = { ...b[n], cost: s }, b;
885
889
  }
886
- return f;
890
+ return A;
887
891
  });
888
892
  break;
889
893
  }
890
894
  default:
891
895
  }
892
- } catch (o) {
893
- console.error("[ai-assist-sdk] onmessage 解析失败:", o);
896
+ } catch (g) {
897
+ console.error("[ai-assist-sdk] onmessage 解析失败:", g);
894
898
  }
895
899
  },
896
900
  onclose() {
897
- l(), E(n), l();
898
- const w = (c.value.get(n) || []).filter((s) => s.type === "answer").map((s) => s.content).join(""), o = [...e.value];
899
- o[n] && o[n].status !== k.ERROR && (o[n] = {
900
- ...o[n],
901
- content: A.value && !w ? "已停止回答" : w,
902
- status: A.value ? k.STOP : k.COMPLETED
903
- }), e.value = o, y.value = !1;
901
+ u(), D(n), u();
902
+ const f = (l.value.get(n) || []).filter((o) => o.type === "answer").map((o) => o.content).join(""), g = [...e.value];
903
+ g[n] && g[n].status !== k.ERROR && (g[n] = {
904
+ ...g[n],
905
+ content: S.value && !f ? "已停止回答" : f,
906
+ status: S.value ? k.STOP : k.COMPLETED
907
+ }), e.value = g, y.value = !1;
904
908
  },
905
909
  onerror(i) {
906
- console.error("[ai-assist-sdk] ❌ 连接错误:", i), l();
907
- const w = [...e.value];
908
- w[n] && (w[n] = { ...w[n], content: `
909
- ⚠️ 请求异常,已终止`, status: k.ERROR }), e.value = w, y.value = !1;
910
+ console.error("[ai-assist-sdk] ❌ 连接错误:", i), u();
911
+ const f = [...e.value];
912
+ f[n] && (f[n] = { ...f[n], content: `
913
+ ⚠️ 请求异常,已终止`, status: k.ERROR }), e.value = f, y.value = !1;
910
914
  }
911
915
  });
912
- } catch (M) {
913
- if (console.error("[ai-assist-sdk] doStreamRequest error:", M), !A.value) {
914
- l();
916
+ } catch (T) {
917
+ if (console.error("[ai-assist-sdk] doStreamRequest error:", T), !S.value) {
918
+ u();
915
919
  const i = [...e.value];
916
920
  i[n] && (i[n] = { ...i[n], content: "服务连接失败,请稍后重试", status: k.ERROR }), e.value = i, y.value = !1;
917
921
  }
918
922
  }
919
923
  }
920
- return { doStreamRequest: $, issTop: A };
924
+ return { doStreamRequest: P, issTop: S };
921
925
  }
922
- function Tt(e) {
926
+ function Et(e) {
923
927
  var y;
924
928
  if (e && typeof e == "object" && typeof e.data == "string" && (e = e.data), typeof e == "string") {
925
- const h = e.split(`
929
+ const d = e.split(`
926
930
  `);
927
- let g = "";
928
- for (const l of h) {
929
- const k = l.startsWith("data:") ? l.slice(5).trim() : "";
931
+ let h = "";
932
+ for (const u of d) {
933
+ const k = u.startsWith("data:") ? u.slice(5).trim() : "";
930
934
  if (k)
931
935
  try {
932
- const u = JSON.parse(k);
933
- u.event === "message" && u.answer !== void 0 && (g += u.answer);
936
+ const c = JSON.parse(k);
937
+ c.event === "message" && c.answer !== void 0 && (h += c.answer);
934
938
  } catch {
935
939
  }
936
940
  }
937
- return g || e;
941
+ return h || e;
938
942
  }
939
943
  return (e == null ? void 0 : e.answer) || ((y = e == null ? void 0 : e.data) == null ? void 0 : y.answer) || String(e || "");
940
944
  }
941
- function wo(e) {
945
+ function po(e) {
942
946
  return e.queryAgainStreamApi || e.queryAgainApi || e.chatQueryStreamApi || e.chatQueryApi;
943
947
  }
944
- function ko({
948
+ function yo({
945
949
  messages: e,
946
950
  userInput: y,
947
- isGenerating: h,
948
- lastUserMessage: g,
949
- conversationId: l,
951
+ isGenerating: d,
952
+ lastUserMessage: h,
953
+ conversationId: u,
950
954
  doStreamRequest: k,
951
- issTop: u,
952
- scrollToBottom: c,
953
- STATUS: v,
954
- cfg: b,
955
- onTitleGenerated: C
955
+ issTop: c,
956
+ scrollToBottom: l,
957
+ STATUS: r,
958
+ cfg: C,
959
+ onTitleGenerated: w
956
960
  }) {
957
- const A = b.apis, x = te({
961
+ const S = C.apis, E = te({
958
962
  first: new AbortController(),
959
963
  again: new AbortController()
960
- }), E = p(!1);
961
- async function $(i, w) {
962
- var s;
963
- if (!b.titleGenerateApp || !A.updateConversationApi || E.value) return;
964
- let o = l.value;
965
- if (!o)
964
+ }), D = p(!1);
965
+ async function P(i, f) {
966
+ var o;
967
+ if (!C.titleGenerateApp || !S.updateConversationApi || D.value) return;
968
+ let g = u.value;
969
+ if (!g)
966
970
  try {
967
- const r = await At(A);
968
- (s = r == null ? void 0 : r.conversation) != null && s.appConversationID && (o = r.conversation.appConversationID, l.value = o);
969
- } catch (r) {
970
- console.error("[ai-assist-sdk] 创建会话失败:", r);
971
+ const s = await St(S);
972
+ (o = s == null ? void 0 : s.conversation) != null && o.appConversationID && (g = s.conversation.appConversationID, u.value = g);
973
+ } catch (s) {
974
+ console.error("[ai-assist-sdk] 创建会话失败:", s);
971
975
  return;
972
976
  }
973
- if (o)
977
+ if (g)
974
978
  try {
975
- const r = await dn(A, b.titleGenerateApp);
976
- if (!r) return;
977
- const f = w.length > 500 ? w.slice(0, 500) : w, D = `用户提问:${i}
978
- AI回答:${f}`, R = await St().post(A.chatQueryApi, {
979
- app: b.titleGenerateApp,
980
- data: { Query: D, AppConversationID: r }
981
- }), B = Tt(R.data.data);
982
- B && (await hn(A, o, B), E.value = !0, C == null || C(B));
983
- } catch (r) {
984
- console.error("[ai-assist-sdk] 生成对话标题失败:", r);
979
+ const s = await dn(S, C.titleGenerateApp);
980
+ if (!s) return;
981
+ const A = f.length > 500 ? f.slice(0, 500) : f, b = `用户提问:${i}
982
+ AI回答:${A}`, H = await xt().post(S.chatQueryApi, {
983
+ app: C.titleGenerateApp,
984
+ data: { Query: b, AppConversationID: s }
985
+ }), N = Et(H.data.data);
986
+ N && (await hn(S, g, N), D.value = !0, w == null || w(N));
987
+ } catch (s) {
988
+ console.error("[ai-assist-sdk] 生成对话标题失败:", s);
985
989
  }
986
990
  }
987
- async function _() {
991
+ async function R() {
988
992
  const i = y.value.trim();
989
- if (!i || h.value) return;
990
- if (!l.value && (await L(), !l.value)) {
993
+ if (!i || d.value) return;
994
+ if (!u.value && (await W(), !u.value)) {
991
995
  Le("创建会话失败,请重试");
992
996
  return;
993
997
  }
994
- const w = e.value.length === 0, o = [
998
+ const f = e.value.length === 0, g = [
995
999
  ...e.value,
996
1000
  { type: "user", content: i },
997
- { type: "ai", content: "", status: v.THINKING }
1001
+ { type: "ai", content: "", status: r.THINKING }
998
1002
  ];
999
- e.value = o, y.value = "", c();
1000
- const s = o.length - 1;
1001
- if (A.chatQueryStreamApi) {
1002
- if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", A.chatQueryStreamApi), await k(A.chatQueryStreamApi, {
1003
+ e.value = g, y.value = "", l();
1004
+ const o = g.length - 1;
1005
+ if (S.chatQueryStreamApi) {
1006
+ if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", S.chatQueryStreamApi), await k(S.chatQueryStreamApi, {
1003
1007
  Query: i,
1004
- AppConversationID: l.value,
1008
+ AppConversationID: u.value,
1005
1009
  ResponseMode: "streaming"
1006
- }, s, x.first.signal), w && !E.value) {
1007
- const r = e.value[s];
1008
- r && r.status !== v.ERROR && $(i, r.content);
1010
+ }, o, E.first.signal), f && !D.value) {
1011
+ const s = e.value[o];
1012
+ s && s.status !== r.ERROR && P(i, s.content);
1009
1013
  }
1010
1014
  return;
1011
1015
  }
1012
1016
  console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
1013
1017
  try {
1014
- const f = await St().post(A.chatQueryApi, {
1015
- app: b.app ?? 1,
1016
- data: { Query: i, AppConversationID: l.value }
1017
- }), D = Tt(f.data);
1018
- e.value = [...e.value.slice(0, -1), { type: "ai", content: D, status: v.COMPLETED }], w && !E.value && $(i, D);
1019
- } catch (r) {
1020
- e.value = [...e.value.slice(0, -1), { type: "ai", content: (r == null ? void 0 : r.message) || "服务连接失败,请稍后重试", status: v.ERROR }];
1018
+ const A = await xt().post(S.chatQueryApi, {
1019
+ app: C.app ?? 1,
1020
+ data: { Query: i, AppConversationID: u.value }
1021
+ }), b = Et(A.data);
1022
+ e.value = [...e.value.slice(0, -1), { type: "ai", content: b, status: r.COMPLETED }], f && !D.value && P(i, b);
1023
+ } catch (s) {
1024
+ e.value = [...e.value.slice(0, -1), { type: "ai", content: (s == null ? void 0 : s.message) || "服务连接失败,请稍后重试", status: r.ERROR }];
1021
1025
  }
1022
1026
  }
1023
- async function P() {
1024
- if (!g.value || h.value) return;
1025
- x.again.abort(), x.again = new AbortController();
1027
+ async function L() {
1028
+ if (!h.value || d.value) return;
1029
+ E.again.abort(), E.again = new AbortController();
1026
1030
  const i = [...e.value];
1027
- i.length > 0 && i[i.length - 1].type === "ai" && i.pop(), i.push({ type: "ai", content: "", status: v.RETHINKING }), e.value = i, c();
1028
- const w = e.value.length - 1, o = wo(A);
1029
- await k(o, {
1030
- MessageID: g.value,
1031
- AppConversationID: l.value,
1031
+ i.length > 0 && i[i.length - 1].type === "ai" && i.pop(), i.push({ type: "ai", content: "", status: r.RETHINKING }), e.value = i, l();
1032
+ const f = e.value.length - 1, g = po(S);
1033
+ await k(g, {
1034
+ MessageID: h.value,
1035
+ AppConversationID: u.value,
1032
1036
  ResponseMode: "streaming"
1033
- }, w, x.again.signal, !0);
1037
+ }, f, E.again.signal, !0);
1034
1038
  }
1035
1039
  async function n() {
1036
- if (!A.stopMessageApi || !h.value) return;
1040
+ if (!S.stopMessageApi || !d.value) return;
1037
1041
  const i = e.value.length - 1 - 1;
1038
1042
  try {
1039
- await vn(A, g.value);
1040
- const w = [...e.value];
1041
- w[i] && (w[i] = { ...w[i], content: w[i].content || "已停止回答", status: v.STOP }), e.value = w, h.value = !1, x.first.abort(), x.first = new AbortController(), x.again.abort(), x.again = new AbortController(), u.value = !0;
1042
- } catch (w) {
1043
- const o = [...e.value];
1044
- o[i] && (o[i] = { ...o[i], content: (w == null ? void 0 : w.message) || "系统繁忙,请稍后再试", status: v.ERROR }), e.value = o;
1043
+ await vn(S, h.value);
1044
+ const f = [...e.value];
1045
+ f[i] && (f[i] = { ...f[i], content: f[i].content || "已停止回答", status: r.STOP }), e.value = f, d.value = !1, E.first.abort(), E.first = new AbortController(), E.again.abort(), E.again = new AbortController(), c.value = !0;
1046
+ } catch (f) {
1047
+ const g = [...e.value];
1048
+ g[i] && (g[i] = { ...g[i], content: (f == null ? void 0 : f.message) || "系统繁忙,请稍后再试", status: r.ERROR }), e.value = g;
1045
1049
  }
1046
1050
  }
1047
- async function W(i) {
1048
- var w, o;
1049
- l.value = i, E.value = !0;
1051
+ async function B(i) {
1052
+ var f, g;
1053
+ u.value = i, D.value = !0;
1050
1054
  try {
1051
- const s = await rn(A, i), r = [];
1052
- if ((w = s == null ? void 0 : s.messages) != null && w.length)
1053
- for (const f of s.messages)
1054
- f.query && r.push({ type: "user", content: f.query }), (o = f.answerInfo) != null && o.answer && r.push({ type: "ai", content: f.answerInfo.answer, status: v.COMPLETED });
1055
- e.value = r, c();
1056
- } catch (s) {
1057
- Le((s == null ? void 0 : s.message) || "加载历史会话失败");
1055
+ const o = await rn(S, i), s = [];
1056
+ if ((f = o == null ? void 0 : o.messages) != null && f.length)
1057
+ for (const A of o.messages)
1058
+ A.query && s.push({ type: "user", content: A.query }), (g = A.answerInfo) != null && g.answer && s.push({ type: "ai", content: A.answerInfo.answer, status: r.COMPLETED });
1059
+ e.value = s, l();
1060
+ } catch (o) {
1061
+ Le((o == null ? void 0 : o.message) || "加载历史会话失败");
1058
1062
  }
1059
1063
  }
1060
- async function L() {
1064
+ async function W() {
1061
1065
  var i;
1062
- E.value = !1;
1066
+ D.value = !1;
1063
1067
  try {
1064
- const w = await At(A);
1065
- (i = w == null ? void 0 : w.conversation) != null && i.appConversationID && (l.value = w.conversation.appConversationID);
1066
- } catch (w) {
1067
- Le((w == null ? void 0 : w.message) || "创建会话失败");
1068
+ const f = await St(S);
1069
+ (i = f == null ? void 0 : f.conversation) != null && i.appConversationID && (u.value = f.conversation.appConversationID);
1070
+ } catch (f) {
1071
+ Le((f == null ? void 0 : f.message) || "创建会话失败");
1068
1072
  }
1069
1073
  }
1070
- function M() {
1071
- l.value = "", E.value = !1;
1074
+ function T() {
1075
+ u.value = "", D.value = !1;
1072
1076
  }
1073
- return { sendMessage: _, regenerateResponse: P, toggleStop: n, goHistoryMessage: W, initConversation: L, resetConversation: M, controllers: x };
1077
+ return { sendMessage: R, regenerateResponse: L, toggleStop: n, goHistoryMessage: B, initConversation: W, resetConversation: T, controllers: E };
1074
1078
  }
1075
- const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "message ai-message greet-message" }, So = { class: "ai-greet" }, xo = ["src"], To = {
1079
+ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "message ai-message greet-message" }, bo = { class: "ai-greet" }, Ao = ["src"], So = {
1076
1080
  key: 0,
1077
1081
  class: "message ai-message recommend-message"
1078
- }, Eo = { class: "ai-recommend" }, Mo = { class: "recommend-header" }, Do = ["src"], Ro = ["onClick"], _o = /* @__PURE__ */ xe({
1082
+ }, xo = { class: "ai-recommend" }, To = { class: "recommend-header" }, Eo = ["src"], Mo = ["onClick"], Do = /* @__PURE__ */ xe({
1079
1083
  __name: "Answer",
1080
1084
  props: {
1081
1085
  defaultSayhello: {},
1082
1086
  defaultRecommend: {}
1083
1087
  },
1084
1088
  emits: ["title-generated"],
1085
- setup(e, { expose: y, emit: h }) {
1086
- const g = {
1089
+ setup(e, { expose: y, emit: d }) {
1090
+ const h = {
1087
1091
  THINKING: "thinking",
1088
1092
  RETHINKING: "rethinking",
1089
1093
  ANSWERING: "answering",
@@ -1091,150 +1095,151 @@ const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "m
1091
1095
  COMPLETED: "completed",
1092
1096
  STOP: "stop",
1093
1097
  ERROR: "error"
1094
- }, l = e, k = h, u = Ge(), c = p([]), v = p(""), b = p(!1), C = p(""), A = p(""), x = p(null), E = te({ text1: "", text2: "" }), $ = p([]), _ = p(0), P = O(
1095
- () => $.value[_.value % ($.value.length || 1)]
1098
+ }, u = e, k = d, c = Qe(), l = p([]), r = p(""), C = p(!1), w = p(""), S = p(""), E = p(null), D = te({ text1: "", text2: "" }), P = p([]), R = p(0), L = O(
1099
+ () => P.value[R.value % (P.value.length || 1)]
1096
1100
  );
1097
1101
  function n() {
1098
- _.value++;
1102
+ R.value++;
1099
1103
  }
1100
- function W(X) {
1101
- v.value = X;
1104
+ function B(Y) {
1105
+ r.value = Y;
1102
1106
  }
1103
- const { isAtBottom: L, hasScroll: M, scrollToBottom: i, checkScrollStatus: w } = go(x), { enhanceCodeBlocks: o } = mo(), { batchMessagesUpdate: s, flushMessagesBatch: r } = fo(c), { displayedContent: f, streamingIndexRef: D, startTypewriter: N, stopTypewriter: R, getSegmentDisplayContent: B } = po(
1104
- c,
1107
+ const { isAtBottom: W, hasScroll: T, scrollToBottom: i, checkScrollStatus: f } = vo(E), { enhanceCodeBlocks: g } = ho(), { batchMessagesUpdate: o, flushMessagesBatch: s } = go(l), { displayedContent: A, streamingIndexRef: b, startTypewriter: _, stopTypewriter: H, getSegmentDisplayContent: N } = mo(
1108
+ l,
1105
1109
  i,
1106
- g.ANSWERING
1107
- ), { doStreamRequest: K, issTop: ue } = yo({
1108
- messages: c,
1109
- isGenerating: b,
1110
- lastUserMessage: C,
1111
- batchMessagesUpdate: s,
1112
- flushMessagesBatch: r,
1113
- STATUS: g,
1114
- cfg: u
1115
- }), { sendMessage: Re, regenerateResponse: ye, toggleStop: we, goHistoryMessage: We, resetConversation: _e } = ko({
1116
- messages: c,
1117
- userInput: v,
1118
- isGenerating: b,
1119
- lastUserMessage: C,
1120
- conversationId: A,
1121
- doStreamRequest: K,
1110
+ h
1111
+ ), { doStreamRequest: J, issTop: ue } = fo({
1112
+ messages: l,
1113
+ isGenerating: C,
1114
+ lastUserMessage: w,
1115
+ batchMessagesUpdate: o,
1116
+ flushMessagesBatch: s,
1117
+ STATUS: h,
1118
+ cfg: c
1119
+ }), { sendMessage: Re, regenerateResponse: ye, toggleStop: we, goHistoryMessage: Ne, resetConversation: He } = yo({
1120
+ messages: l,
1121
+ userInput: r,
1122
+ isGenerating: C,
1123
+ lastUserMessage: w,
1124
+ conversationId: S,
1125
+ doStreamRequest: J,
1122
1126
  issTop: ue,
1123
1127
  scrollToBottom: i,
1124
- STATUS: g,
1125
- cfg: u,
1126
- onTitleGenerated: (X) => k("title-generated", X)
1128
+ STATUS: h,
1129
+ cfg: c,
1130
+ onTitleGenerated: (Y) => k("title-generated", Y)
1127
1131
  });
1128
- function q() {
1129
- c.value = [], C.value = "", _e();
1132
+ function I() {
1133
+ l.value = [], w.value = "", He();
1130
1134
  }
1131
- const ke = O(() => c.value.length === 0);
1132
- y({ goHistoryMessage: We, createNewConversation: q, isEmptyConversation: ke });
1135
+ const ke = O(() => l.value.length === 0);
1136
+ y({ goHistoryMessage: Ne, createNewConversation: I, isEmptyConversation: ke });
1133
1137
  const Ce = p(/* @__PURE__ */ new Map());
1134
- function Te(X, V) {
1135
- X ? Ce.value.set(V, X) : Ce.value.delete(V);
1138
+ function Te(Y, V) {
1139
+ Y ? Ce.value.set(V, Y) : Ce.value.delete(V);
1136
1140
  }
1137
- ae(c, () => {
1141
+ ae(l, () => {
1138
1142
  ne(() => {
1139
- c.value.forEach((X, V) => {
1140
- X.type === "ai" && X.status !== g.ANSWERING && (f.set(V, X.content), D.value.set(V, X.content.length));
1141
- }), N(), Ce.value.forEach((X) => {
1142
- o(X);
1143
- }), w();
1143
+ l.value.forEach((Y, V) => {
1144
+ const U = Y.status === h.ANSWERING || Y.status === h.THINKING || Y.status === h.RETHINKING;
1145
+ Y.type === "ai" && !U && (A.set(V, Y.content), b.value.set(V, Y.content.length));
1146
+ }), _(), Ce.value.forEach((Y) => {
1147
+ g(Y);
1148
+ }), f();
1144
1149
  });
1145
1150
  }, { deep: !0 });
1146
1151
  let ce = null;
1147
1152
  pe(() => {
1148
- l.defaultSayhello && (E.text1 = l.defaultSayhello.text1, E.text2 = l.defaultSayhello.text2), l.defaultRecommend && ($.value = gn(l.defaultRecommend));
1153
+ u.defaultSayhello && (D.text1 = u.defaultSayhello.text1, D.text2 = u.defaultSayhello.text2), u.defaultRecommend && (P.value = gn(u.defaultRecommend));
1149
1154
  }), pe(() => {
1150
- x.value && (ce = () => w(), x.value.addEventListener("scroll", ce), w());
1155
+ E.value && (ce = () => f(), E.value.addEventListener("scroll", ce), f());
1151
1156
  });
1152
1157
  const re = p(null);
1153
1158
  let ve = !1, be = 0, Ee = 0;
1154
- function de(X) {
1155
- var ee;
1156
- const V = (ee = x.value) == null ? void 0 : ee.closest(".chat-wrap");
1157
- return parseFloat((V == null ? void 0 : V.style.getPropertyValue(X)) ?? "") || 0;
1159
+ function de(Y) {
1160
+ var U;
1161
+ const V = (U = E.value) == null ? void 0 : U.closest(".chat-wrap");
1162
+ return parseFloat((V == null ? void 0 : V.style.getPropertyValue(Y)) ?? "") || 0;
1158
1163
  }
1159
- function Be(X) {
1160
- return "touches" in X ? X.touches[0].clientY : X.clientY;
1164
+ function We(Y) {
1165
+ return "touches" in Y ? Y.touches[0].clientY : Y.clientY;
1161
1166
  }
1162
- function ie(X) {
1163
- const V = x.value;
1164
- V && (X.preventDefault(), ve = !0, be = Be(X), V.scrollTop, Ee = de("--ai-thumb-top"), window.addEventListener("mousemove", G), window.addEventListener("mouseup", Ae), window.addEventListener("touchmove", G, { passive: !1 }), window.addEventListener("touchend", Ae));
1167
+ function ie(Y) {
1168
+ const V = E.value;
1169
+ V && (Y.preventDefault(), ve = !0, be = We(Y), V.scrollTop, Ee = de("--ai-thumb-top"), window.addEventListener("mousemove", Q), window.addEventListener("mouseup", Ae), window.addEventListener("touchmove", Q, { passive: !1 }), window.addEventListener("touchend", Ae));
1165
1170
  }
1166
- function G(X) {
1167
- const V = x.value;
1171
+ function Q(Y) {
1172
+ const V = E.value;
1168
1173
  if (!ve || !V) return;
1169
- X.preventDefault();
1170
- const ee = Be(X) - be, j = V.clientHeight, he = V.scrollHeight, ge = de("--ai-thumb-height"), qe = j - ge, Je = Math.min(Math.max(Ee + ee, 0), qe);
1171
- V.scrollTop = Je / qe * (he - j);
1174
+ Y.preventDefault();
1175
+ const U = We(Y) - be, j = V.clientHeight, he = V.scrollHeight, ge = de("--ai-thumb-height"), Ie = j - ge, qe = Math.min(Math.max(Ee + U, 0), Ie);
1176
+ V.scrollTop = qe / Ie * (he - j);
1172
1177
  }
1173
1178
  function Ae() {
1174
- ve = !1, window.removeEventListener("mousemove", G), window.removeEventListener("mouseup", Ae), window.removeEventListener("touchmove", G), window.removeEventListener("touchend", Ae);
1179
+ ve = !1, window.removeEventListener("mousemove", Q), window.removeEventListener("mouseup", Ae), window.removeEventListener("touchmove", Q), window.removeEventListener("touchend", Ae);
1175
1180
  }
1176
- function Ue(X) {
1177
- const V = x.value, ee = re.value;
1178
- if (!V || !ee) return;
1179
- X.preventDefault();
1180
- const j = ee.getBoundingClientRect(), ge = (Be(X) - j.top) / j.height;
1181
+ function Ke(Y) {
1182
+ const V = E.value, U = re.value;
1183
+ if (!V || !U) return;
1184
+ Y.preventDefault();
1185
+ const j = U.getBoundingClientRect(), ge = (We(Y) - j.top) / j.height;
1181
1186
  V.scrollTop = ge * (V.scrollHeight - V.clientHeight);
1182
1187
  }
1183
1188
  return st(() => {
1184
- R(), x.value && ce && x.value.removeEventListener("scroll", ce), Ae();
1185
- }), (X, V) => {
1186
- var ee;
1187
- return m(), S("div", Co, [
1188
- a("div", bo, [
1189
+ H(), E.value && ce && E.value.removeEventListener("scroll", ce), Ae();
1190
+ }), (Y, V) => {
1191
+ var U;
1192
+ return m(), x("div", wo, [
1193
+ a("div", ko, [
1189
1194
  a("div", {
1190
1195
  class: "chat-box scrollWrap",
1191
1196
  ref_key: "chatBoxRef",
1192
- ref: x
1197
+ ref: E
1193
1198
  }, [
1194
- a("div", Ao, [
1195
- a("div", So, [
1196
- a("img", { src: H(Lt) }, null, 8, xo),
1197
- a("h1", null, Q(E.text1), 1),
1198
- a("p", null, Q(E.text2), 1)
1199
+ a("div", Co, [
1200
+ a("div", bo, [
1201
+ a("img", { src: $(Ot) }, null, 8, Ao),
1202
+ a("h1", null, G(D.text1), 1),
1203
+ a("p", null, G(D.text2), 1)
1199
1204
  ])
1200
1205
  ]),
1201
- (ee = P.value) != null && ee.length ? (m(), S("div", To, [
1202
- a("div", Eo, [
1203
- a("div", Mo, [
1206
+ (U = L.value) != null && U.length ? (m(), x("div", So, [
1207
+ a("div", xo, [
1208
+ a("div", To, [
1204
1209
  V[2] || (V[2] = a("span", null, "你可以尝试这样问我:", -1)),
1205
1210
  a("p", {
1206
1211
  class: "refresh-btn",
1207
1212
  onClick: n
1208
1213
  }, [
1209
- a("img", { src: H(Rn) }, null, 8, Do),
1214
+ a("img", { src: $(Rn) }, null, 8, Eo),
1210
1215
  V[1] || (V[1] = a("span", null, "换一换", -1))
1211
1216
  ])
1212
1217
  ]),
1213
1218
  a("ul", null, [
1214
- (m(!0), S(Se, null, Oe(P.value, (j, he) => (m(), S("li", {
1219
+ (m(!0), x(Se, null, Oe(L.value, (j, he) => (m(), x("li", {
1215
1220
  key: he,
1216
- onClick: (ge) => W(j)
1217
- }, Q(j), 9, Ro))), 128))
1221
+ onClick: (ge) => B(j)
1222
+ }, G(j), 9, Mo))), 128))
1218
1223
  ])
1219
1224
  ])
1220
- ])) : Y("", !0),
1221
- (m(!0), S(Se, null, Oe(c.value, (j, he) => (m(), oe(Zn, {
1225
+ ])) : X("", !0),
1226
+ (m(!0), x(Se, null, Oe(l.value, (j, he) => (m(), oe(Un, {
1222
1227
  key: he,
1223
1228
  msg: j,
1224
1229
  index: he,
1225
- STATUS: g,
1226
- displayedContent: H(f),
1227
- getSegmentDisplayContent: H(B),
1230
+ STATUS: h,
1231
+ displayedContent: $(A),
1232
+ getSegmentDisplayContent: $(N),
1228
1233
  setMessageRef: Te,
1229
- onRegenerate: H(ye)
1234
+ onRegenerate: $(ye)
1230
1235
  }, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent", "onRegenerate"]))), 128))
1231
1236
  ], 512),
1232
1237
  a("div", {
1233
1238
  ref_key: "scrollbarRef",
1234
1239
  ref: re,
1235
1240
  class: "chat-box__scrollbar",
1236
- onMousedown: se(Ue, ["prevent"]),
1237
- onTouchstart: se(Ue, ["prevent"])
1241
+ onMousedown: se(Ke, ["prevent"]),
1242
+ onTouchstart: se(Ke, ["prevent"])
1238
1243
  }, [
1239
1244
  a("div", {
1240
1245
  class: "chat-box__scrollbar-thumb",
@@ -1243,227 +1248,227 @@ const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "m
1243
1248
  }, null, 32)
1244
1249
  ], 544)
1245
1250
  ]),
1246
- U(ho, {
1247
- modelValue: v.value,
1248
- "onUpdate:modelValue": V[0] || (V[0] = (j) => v.value = j),
1249
- isGenerating: b.value,
1250
- lastUserMessage: C.value,
1251
- hasScroll: H(M),
1252
- isAtBottom: H(L),
1253
- onSend: H(Re),
1254
- onRegenerate: H(ye),
1255
- onStop: H(we),
1256
- onScrollToBottom: H(i)
1251
+ K(ro, {
1252
+ modelValue: r.value,
1253
+ "onUpdate:modelValue": V[0] || (V[0] = (j) => r.value = j),
1254
+ isGenerating: C.value,
1255
+ lastUserMessage: w.value,
1256
+ hasScroll: $(T),
1257
+ isAtBottom: $(W),
1258
+ onSend: $(Re),
1259
+ onRegenerate: $(ye),
1260
+ onStop: $(we),
1261
+ onScrollToBottom: $(i)
1257
1262
  }, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"]),
1258
1263
  V[3] || (V[3] = a("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
1259
1264
  ]);
1260
1265
  };
1261
1266
  }
1262
- }), Ho = { class: "ai-history" }, $o = { class: "content" }, Po = {
1267
+ }), Ro = { class: "ai-history" }, Ho = { class: "content" }, _o = {
1263
1268
  key: 0,
1264
1269
  class: "ai-history-loading"
1265
- }, Lo = { class: "ai-history-group-title" }, Oo = ["onClick"], Wo = { class: "ai-history-item-title" }, Bo = ["onClick"], No = {
1270
+ }, $o = { class: "ai-history-group-title" }, Po = ["onClick"], Lo = { class: "ai-history-item-title" }, Oo = ["onClick"], No = {
1266
1271
  key: 2,
1267
1272
  class: "ai-history-empty"
1268
- }, Yo = ["src"], Vo = { class: "ai-modal" }, Xo = { class: "ai-modal-footer" }, Fo = /* @__PURE__ */ xe({
1273
+ }, Wo = ["src"], Bo = { class: "ai-modal" }, Yo = { class: "ai-modal-footer" }, Vo = /* @__PURE__ */ xe({
1269
1274
  __name: "History",
1270
1275
  emits: ["history-detail", "new-conversation"],
1271
1276
  setup(e, { emit: y }) {
1272
- const g = Ge().apis, l = p([]), k = p(!0), u = p(!1), c = p(""), v = O(() => mn(l.value));
1273
- async function b() {
1277
+ const h = Qe().apis, u = p([]), k = p(!0), c = p(!1), l = p(""), r = O(() => mn(u.value));
1278
+ async function C() {
1274
1279
  try {
1275
- const x = await fn(g);
1276
- x != null && x.conversationList && (l.value = x.conversationList.filter((E) => E !== null).map((E) => ({ ...E, selected: !1 })));
1277
- } catch (x) {
1278
- Le((x == null ? void 0 : x.message) || "获取历史记录失败");
1280
+ const E = await fn(h);
1281
+ E != null && E.conversationList && (u.value = E.conversationList.filter((D) => D !== null).map((D) => ({ ...D, selected: !1 })));
1282
+ } catch (E) {
1283
+ Le((E == null ? void 0 : E.message) || "获取历史记录失败");
1279
1284
  } finally {
1280
1285
  k.value = !1;
1281
1286
  }
1282
1287
  }
1283
- function C(x) {
1284
- c.value = x, u.value = !0;
1288
+ function w(E) {
1289
+ l.value = E, c.value = !0;
1285
1290
  }
1286
- async function A() {
1287
- u.value = !1;
1291
+ async function S() {
1292
+ c.value = !1;
1288
1293
  try {
1289
- await pn(g, c.value), await b();
1290
- } catch (x) {
1291
- Le((x == null ? void 0 : x.message) || "删除失败"), await b();
1294
+ await pn(h, l.value), await C();
1295
+ } catch (E) {
1296
+ Le((E == null ? void 0 : E.message) || "删除失败"), await C();
1292
1297
  }
1293
1298
  }
1294
1299
  return pe(() => {
1295
- b();
1296
- }), (x, E) => (m(), S("div", Ho, [
1297
- a("div", $o, [
1298
- k.value ? (m(), S("div", Po, [...E[3] || (E[3] = [
1300
+ C();
1301
+ }), (E, D) => (m(), x("div", Ro, [
1302
+ a("div", Ho, [
1303
+ k.value ? (m(), x("div", _o, [...D[3] || (D[3] = [
1299
1304
  a("div", { class: "ai-history-spinner" }, null, -1)
1300
- ])])) : v.value.length > 0 ? (m(!0), S(Se, { key: 1 }, Oe(v.value, ($) => (m(), S("div", {
1301
- key: $.label,
1305
+ ])])) : r.value.length > 0 ? (m(!0), x(Se, { key: 1 }, Oe(r.value, (P) => (m(), x("div", {
1306
+ key: P.label,
1302
1307
  class: "ai-history-group"
1303
1308
  }, [
1304
- a("div", Lo, Q($.label), 1),
1305
- (m(!0), S(Se, null, Oe($.items, (_, P) => (m(), S("div", {
1306
- key: _.appConversationID,
1309
+ a("div", $o, G(P.label), 1),
1310
+ (m(!0), x(Se, null, Oe(P.items, (R, L) => (m(), x("div", {
1311
+ key: R.appConversationID,
1307
1312
  class: "ai-history-item",
1308
- style: ot({ "--i": P }),
1309
- onClick: (n) => x.$emit("history-detail", _.appConversationID)
1313
+ style: ot({ "--i": L }),
1314
+ onClick: (n) => E.$emit("history-detail", R.appConversationID)
1310
1315
  }, [
1311
- a("div", Wo, Q(_.conversationName), 1),
1316
+ a("div", Lo, G(R.conversationName), 1),
1312
1317
  a("div", {
1313
1318
  class: "ai-history-item-delete",
1314
- onClick: se((n) => C(_.appConversationID), ["stop"])
1315
- }, "删除", 8, Bo)
1316
- ], 12, Oo))), 128))
1317
- ]))), 128)) : (m(), S("div", No, "暂无历史记录"))
1319
+ onClick: se((n) => w(R.appConversationID), ["stop"])
1320
+ }, "删除", 8, Oo)
1321
+ ], 12, Po))), 128))
1322
+ ]))), 128)) : (m(), x("div", No, "暂无历史记录"))
1318
1323
  ]),
1319
1324
  a("div", {
1320
1325
  class: "ai-add",
1321
- onClick: E[0] || (E[0] = ($) => x.$emit("new-conversation"))
1326
+ onClick: D[0] || (D[0] = (P) => E.$emit("new-conversation"))
1322
1327
  }, [
1323
- a("img", { src: H(An) }, null, 8, Yo),
1324
- E[4] || (E[4] = a("span", null, "新建AI对话", -1))
1328
+ a("img", { src: $(An) }, null, 8, Wo),
1329
+ D[4] || (D[4] = a("span", null, "新建AI对话", -1))
1325
1330
  ]),
1326
1331
  (m(), oe(_t, { to: "#ai-assist-root" }, [
1327
- u.value ? (m(), S("div", {
1332
+ c.value ? (m(), x("div", {
1328
1333
  key: 0,
1329
1334
  class: "ai-modal-overlay",
1330
- onClick: E[2] || (E[2] = se(($) => u.value = !1, ["self"]))
1335
+ onClick: D[2] || (D[2] = se((P) => c.value = !1, ["self"]))
1331
1336
  }, [
1332
- a("div", Vo, [
1333
- E[5] || (E[5] = a("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
1334
- E[6] || (E[6] = a("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
1335
- a("div", Xo, [
1337
+ a("div", Bo, [
1338
+ D[5] || (D[5] = a("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
1339
+ D[6] || (D[6] = a("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
1340
+ a("div", Yo, [
1336
1341
  a("button", {
1337
1342
  class: "ai-modal-btn cancel",
1338
- onClick: E[1] || (E[1] = ($) => u.value = !1)
1343
+ onClick: D[1] || (D[1] = (P) => c.value = !1)
1339
1344
  }, "取消"),
1340
1345
  a("button", {
1341
1346
  class: "ai-modal-btn confirm",
1342
- onClick: A
1347
+ onClick: S
1343
1348
  }, "确定")
1344
1349
  ])
1345
1350
  ])
1346
- ])) : Y("", !0)
1351
+ ])) : X("", !0)
1347
1352
  ]))
1348
1353
  ]));
1349
1354
  }
1350
- }), Qo = { class: "container info" }, Go = { class: "info-item" }, Uo = { class: "basic-content" }, qo = { class: "basic-content-text" }, Jo = { class: "basic-content" }, Ko = { class: "basic-content-text" }, zo = { class: "info-item" }, jo = { class: "permission-content" }, Io = { class: "info-item" }, Zo = { class: "basic-content" }, es = { class: "basic-content-text" }, ts = { class: "basic-content" }, ns = { class: "basic-content-text" }, os = /* @__PURE__ */ xe({
1355
+ }), Xo = { class: "container info" }, Fo = { class: "info-item" }, Go = { class: "basic-content" }, Qo = { class: "basic-content-text" }, Ko = { class: "basic-content" }, Io = { class: "basic-content-text" }, qo = { class: "info-item" }, Jo = { class: "permission-content" }, zo = { class: "info-item" }, Uo = { class: "basic-content" }, jo = { class: "basic-content-text" }, Zo = { class: "basic-content" }, es = { class: "basic-content-text" }, ts = /* @__PURE__ */ xe({
1351
1356
  __name: "Info",
1352
1357
  setup(e) {
1353
- const y = Ge(), h = p(null);
1358
+ const y = Qe(), d = p(null);
1354
1359
  return pe(async () => {
1355
1360
  try {
1356
- h.value = await yn(y.apis);
1357
- } catch (g) {
1358
- Le((g == null ? void 0 : g.message) || "获取个人信息失败");
1361
+ d.value = await yn(y.apis);
1362
+ } catch (h) {
1363
+ Le((h == null ? void 0 : h.message) || "获取个人信息失败");
1359
1364
  }
1360
- }), (g, l) => {
1361
- var k, u, c, v, b;
1362
- return m(), S("div", Qo, [
1363
- a("div", Go, [
1364
- l[2] || (l[2] = a("div", { class: "heading" }, [
1365
+ }), (h, u) => {
1366
+ var k, c, l, r, C;
1367
+ return m(), x("div", Xo, [
1368
+ a("div", Fo, [
1369
+ u[2] || (u[2] = a("div", { class: "heading" }, [
1365
1370
  a("div", { class: "heading-column" }),
1366
1371
  a("div", { class: "heading-title" }, "基本信息")
1367
1372
  ], -1)),
1368
- a("div", Uo, [
1369
- l[0] || (l[0] = a("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
1370
- a("div", qo, Q(((k = h.value) == null ? void 0 : k.name) || ""), 1)
1373
+ a("div", Go, [
1374
+ u[0] || (u[0] = a("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
1375
+ a("div", Qo, G(((k = d.value) == null ? void 0 : k.name) || ""), 1)
1371
1376
  ]),
1372
- a("div", Jo, [
1373
- l[1] || (l[1] = a("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
1374
- a("div", Ko, Q(((u = h.value) == null ? void 0 : u.userName) || ""), 1)
1377
+ a("div", Ko, [
1378
+ u[1] || (u[1] = a("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
1379
+ a("div", Io, G(((c = d.value) == null ? void 0 : c.userName) || ""), 1)
1375
1380
  ])
1376
1381
  ]),
1377
- a("div", zo, [
1378
- l[3] || (l[3] = a("div", { class: "heading" }, [
1382
+ a("div", qo, [
1383
+ u[3] || (u[3] = a("div", { class: "heading" }, [
1379
1384
  a("div", { class: "heading-column" }),
1380
1385
  a("div", { class: "heading-title" }, "数据权限")
1381
1386
  ], -1)),
1382
- a("div", jo, [
1383
- (m(!0), S(Se, null, Oe((c = h.value) == null ? void 0 : c.ptnameList, (C, A) => (m(), S("div", {
1384
- key: A,
1387
+ a("div", Jo, [
1388
+ (m(!0), x(Se, null, Oe((l = d.value) == null ? void 0 : l.ptnameList, (w, S) => (m(), x("div", {
1389
+ key: S,
1385
1390
  class: "permission-content-text"
1386
- }, Q(C), 1))), 128))
1391
+ }, G(w), 1))), 128))
1387
1392
  ])
1388
1393
  ]),
1389
- a("div", Io, [
1390
- l[6] || (l[6] = a("div", { class: "heading" }, [
1394
+ a("div", zo, [
1395
+ u[6] || (u[6] = a("div", { class: "heading" }, [
1391
1396
  a("div", { class: "heading-column" }),
1392
1397
  a("div", { class: "heading-title" }, "帮助信息")
1393
1398
  ], -1)),
1394
- a("div", Zo, [
1395
- l[4] || (l[4] = a("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
1396
- a("div", es, Q(((v = h.value) == null ? void 0 : v.dept) || ""), 1)
1399
+ a("div", Uo, [
1400
+ u[4] || (u[4] = a("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
1401
+ a("div", jo, G(((r = d.value) == null ? void 0 : r.dept) || ""), 1)
1397
1402
  ]),
1398
- a("div", ts, [
1399
- l[5] || (l[5] = a("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
1400
- a("div", ns, Q(((b = h.value) == null ? void 0 : b.email) || ""), 1)
1403
+ a("div", Zo, [
1404
+ u[5] || (u[5] = a("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
1405
+ a("div", es, G(((C = d.value) == null ? void 0 : C.email) || ""), 1)
1401
1406
  ])
1402
1407
  ])
1403
1408
  ]);
1404
1409
  };
1405
1410
  }
1406
- }), ss = { key: 1 }, as = ["src"], is = { class: "header-title" }, ls = ["title"], us = { class: "ai-history-drawer-panel" }, cs = { class: "ai-history-drawer-header" }, rs = { class: "setTitle" }, vs = { class: "content" }, ds = { class: "main" }, hs = { class: "btn" }, gs = ["src"], ms = 78, Xe = 78, Z = 8, Fe = 26, Pe = 490, Et = "aiPanelPosition", Mt = "aiPanelDocked", Dt = "aiDockWidth", fs = 60, ps = 150, Rt = 400, ys = 320, Ot = /* @__PURE__ */ xe({
1411
+ }), ns = { key: 1 }, os = ["src"], ss = { class: "header-title" }, as = ["title"], is = { class: "ai-history-drawer-panel" }, ls = { class: "ai-history-drawer-header" }, us = { class: "setTitle" }, cs = { class: "content" }, rs = { class: "main" }, vs = { class: "btn" }, ds = ["src"], hs = 78, Xe = 78, ee = 8, Fe = 26, Pe = 490, Mt = "aiPanelPosition", Dt = "aiPanelDocked", Rt = "aiDockWidth", gs = 60, ms = 150, Ht = 400, fs = 320, Nt = /* @__PURE__ */ xe({
1407
1412
  __name: "AiAssist",
1408
1413
  setup(e) {
1409
- var Ct;
1410
- const y = ms / 2, h = Ge(), g = p(!1), l = p("idle"), k = p(!1), u = te({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), c = p(!1), v = p(window.innerWidth < 768), b = p(window.innerWidth < 768), C = p("answer"), A = p(!1), x = p(""), E = p(""), $ = p(""), _ = p(!1), P = p(!1), n = te({
1414
+ var bt;
1415
+ const y = hs / 2, d = Qe(), h = p(!1), u = p("idle"), k = p(!1), c = te({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), l = p(!1), r = p(window.innerWidth < 768), C = p(window.innerWidth < 768), w = p("answer"), S = p(!1), E = p(""), D = p(""), P = p(""), R = p(!1), L = p(!1), n = te({
1411
1416
  x: window.innerWidth - y,
1412
1417
  y: window.innerHeight / 2 - Xe / 2
1413
- }), W = p(!1), L = p(!1), M = p("right"), i = p("left"), w = p(null), o = te({ x: 0, y: 0 }), s = p(!1), r = p(!1), f = te({ x: 0, y: 0 }), D = p(!1), N = te({ x: 0, y: 0 }), R = p(!1), B = p(!1), K = p(!1), ue = te({ x: 0, width: 0 }), Re = p(!1);
1418
+ }), B = p(!1), W = p(!1), T = p("right"), i = p("left"), f = p(null), g = te({ x: 0, y: 0 }), o = p(!1), s = p(!1), A = te({ x: 0, y: 0 }), b = p(!1), _ = te({ x: 0, y: 0 }), H = p(!1), N = p(!1), J = p(!1), ue = te({ x: 0, width: 0 }), Re = p(!1);
1414
1419
  let ye = 0;
1415
- const we = p("idle"), We = p(!1), _e = p("none"), q = te({ x: 0, y: 0, w: Pe, h: 0, radius: "14px" });
1420
+ const we = p("idle"), Ne = p(!1), He = p("none"), I = te({ x: 0, y: 0, w: Pe, h: 0, radius: "14px" });
1416
1421
  let ke = null, Ce = !1, Te = !1;
1417
1422
  const ce = te({ x: 0, y: 0 }), re = p(!1), ve = p(null);
1418
1423
  let be = null, Ee = null;
1419
1424
  const de = O(() => {
1420
1425
  const t = window.innerWidth / 2;
1421
1426
  return n.x + y < t ? 5 : -5;
1422
- }), Be = O(() => b.value || R.value || we.value !== "idle" ? "" : `panel-${M.value}`), ie = O(() => {
1427
+ }), We = O(() => C.value || H.value || we.value !== "idle" ? "" : `panel-${T.value}`), ie = O(() => {
1423
1428
  var t;
1424
- return !!((t = h.dock) != null && t.containerId) && !v.value;
1425
- }), G = p(((Ct = h.dock) == null ? void 0 : Ct.width) || Pe), Ae = O(() => h.panelDraggable !== !1), Ue = O(() => {
1429
+ return !!((t = d.dock) != null && t.containerId) && !r.value;
1430
+ }), Q = p(((bt = d.dock) == null ? void 0 : bt.width) || Pe), Ae = O(() => d.panelDraggable !== !1), Ke = O(() => {
1426
1431
  var t;
1427
1432
  return !((t = ve.value) != null && t.isEmptyConversation);
1428
- }), X = O(() => ({
1433
+ }), Y = O(() => ({
1429
1434
  left: `${n.x}px`,
1430
1435
  top: `${n.y}px`,
1431
- transition: W.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
1436
+ transition: B.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
1432
1437
  "--direction": String(de.value)
1433
- })), V = O(() => h.characterImage || Sn), ee = O(() => l.value === "idle" ? {} : {
1434
- left: `${u.x}px`,
1435
- top: `${u.y}px`,
1436
- width: `${u.w}px`,
1437
- height: `${u.h}px`,
1438
- borderRadius: u.radius
1438
+ })), V = O(() => d.characterImage || Sn), U = O(() => u.value === "idle" ? {} : {
1439
+ left: `${c.x}px`,
1440
+ top: `${c.y}px`,
1441
+ width: `${c.w}px`,
1442
+ height: `${c.h}px`,
1443
+ borderRadius: c.radius
1439
1444
  }), j = O(() => {
1440
1445
  const t = {};
1441
- return s.value && !b.value && !v.value && !R.value && (t["--ai-panel-x"] = `${o.x}px`, t["--ai-panel-y"] = `${o.y}px`), R.value && (t["--ai-dock-width"] = `${G.value}px`), t;
1446
+ return o.value && !C.value && !r.value && !H.value && (t["--ai-panel-x"] = `${g.x}px`, t["--ai-panel-y"] = `${g.y}px`), H.value && (t["--ai-dock-width"] = `${Q.value}px`), t;
1442
1447
  }), he = O(() => we.value === "idle" ? {} : {
1443
- left: `${q.x}px`,
1444
- top: `${q.y}px`,
1445
- width: `${q.w}px`,
1446
- height: `${q.h}px`,
1447
- borderRadius: q.radius
1448
+ left: `${I.x}px`,
1449
+ top: `${I.y}px`,
1450
+ width: `${I.w}px`,
1451
+ height: `${I.h}px`,
1452
+ borderRadius: I.radius
1448
1453
  });
1449
1454
  function ge() {
1450
1455
  const t = window.innerWidth / 2;
1451
- n.x + y < t ? (M.value = "left", i.value = "right") : (M.value = "right", i.value = "left");
1456
+ n.x + y < t ? (T.value = "left", i.value = "right") : (T.value = "right", i.value = "left");
1452
1457
  }
1453
- function qe() {
1454
- const t = window.innerWidth, d = Math.max(0, Math.min(n.y, window.innerHeight - Xe));
1455
- return { x: n.x + y >= t / 2 ? t - y : -y, y: d };
1458
+ function Ie() {
1459
+ const t = window.innerWidth, v = Math.max(0, Math.min(n.y, window.innerHeight - Xe));
1460
+ return { x: n.x + y >= t / 2 ? t - y : -y, y: v };
1456
1461
  }
1457
- function Je() {
1458
- L.value = !0;
1459
- const t = qe();
1462
+ function qe() {
1463
+ W.value = !0;
1464
+ const t = Ie();
1460
1465
  n.x = t.x, n.y = t.y, setTimeout(() => {
1461
- L.value = !1, ge(), Wt();
1466
+ W.value = !1, ge(), Wt();
1462
1467
  }, 400);
1463
1468
  }
1464
1469
  function Wt() {
1465
1470
  try {
1466
- localStorage.setItem("characterPosition", JSON.stringify({ x: n.x, y: n.y })), localStorage.setItem("panelPosition", M.value), localStorage.setItem("backPosition", i.value);
1471
+ localStorage.setItem("characterPosition", JSON.stringify({ x: n.x, y: n.y })), localStorage.setItem("panelPosition", T.value), localStorage.setItem("backPosition", i.value);
1467
1472
  } catch {
1468
1473
  }
1469
1474
  }
@@ -1474,111 +1479,111 @@ const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "m
1474
1479
  n.x = F.x, n.y = Math.min(Math.max(F.y, 0), window.innerHeight - Xe);
1475
1480
  } else
1476
1481
  n.x = window.innerWidth - y, n.y = window.innerHeight / 2 - Xe / 2;
1477
- const d = localStorage.getItem("panelPosition"), T = localStorage.getItem("backPosition");
1478
- d && (M.value = d), T && (i.value = T);
1482
+ const v = localStorage.getItem("panelPosition"), M = localStorage.getItem("backPosition");
1483
+ v && (T.value = v), M && (i.value = M);
1479
1484
  }
1480
- function Ke(t) {
1481
- if (!W.value) return;
1482
- const d = "touches" in t ? t.touches[0].clientX : t.clientX, T = "touches" in t ? t.touches[0].clientY : t.clientY, F = d - ce.x, z = Math.max(0, Math.min(T - ce.y, window.innerHeight - Xe)), le = Math.abs(F - n.x), me = Math.abs(z - n.y);
1485
+ function Je(t) {
1486
+ if (!B.value) return;
1487
+ const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY, F = v - ce.x, z = Math.max(0, Math.min(M - ce.y, window.innerHeight - Xe)), le = Math.abs(F - n.x), me = Math.abs(z - n.y);
1483
1488
  le + me > 5 && (re.value = !0), n.x = F, n.y = z;
1484
1489
  }
1485
1490
  function ze() {
1486
- W.value && (W.value = !1, re.value && (Je(), re.value = !1));
1491
+ B.value && (B.value = !1, re.value && (qe(), re.value = !1));
1487
1492
  }
1488
- function vt(t) {
1489
- L.value = !1, W.value = !0, re.value = !1;
1490
- const d = "touches" in t ? t.touches[0].clientX : t.clientX, T = "touches" in t ? t.touches[0].clientY : t.clientY;
1491
- ce.x = d - n.x, ce.y = T - n.y;
1493
+ function dt(t) {
1494
+ W.value = !1, B.value = !0, re.value = !1;
1495
+ const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY;
1496
+ ce.x = v - n.x, ce.y = M - n.y;
1492
1497
  }
1493
- function Nt() {
1494
- const t = w.value, d = (t == null ? void 0 : t.offsetWidth) || Pe, T = (t == null ? void 0 : t.offsetHeight) || window.innerHeight - 78;
1498
+ function Yt() {
1499
+ const t = f.value, v = (t == null ? void 0 : t.offsetWidth) || Pe, M = (t == null ? void 0 : t.offsetHeight) || window.innerHeight - 78;
1495
1500
  return {
1496
- maxX: Math.max(Z, window.innerWidth - d - Z),
1497
- maxY: Math.max(Fe, window.innerHeight - T - Z)
1501
+ maxX: Math.max(ee, window.innerWidth - v - ee),
1502
+ maxY: Math.max(Fe, window.innerHeight - M - ee)
1498
1503
  };
1499
1504
  }
1500
- function je(t, d) {
1501
- const T = w.value, F = t ?? (T == null ? void 0 : T.offsetWidth) ?? Pe, z = d ?? (T == null ? void 0 : T.offsetHeight) ?? window.innerHeight - 78, le = Math.max(Z, window.innerWidth - F - Z), me = Math.max(Fe, window.innerHeight - z - Z);
1502
- o.x = Math.min(Math.max(o.x, Z), le), o.y = Math.min(Math.max(o.y, Fe), me);
1505
+ function Ue(t, v) {
1506
+ const M = f.value, F = t ?? (M == null ? void 0 : M.offsetWidth) ?? Pe, z = v ?? (M == null ? void 0 : M.offsetHeight) ?? window.innerHeight - 78, le = Math.max(ee, window.innerWidth - F - ee), me = Math.max(Fe, window.innerHeight - z - ee);
1507
+ g.x = Math.min(Math.max(g.x, ee), le), g.y = Math.min(Math.max(g.y, Fe), me);
1503
1508
  }
1504
- function dt(t) {
1505
- if (!Ae.value || b.value || v.value || R.value || l.value !== "idle") return;
1506
- if (Te = !1, r.value = !0, D.value = !1, !s.value) {
1507
- const F = w.value;
1509
+ function ht(t) {
1510
+ if (!Ae.value || C.value || r.value || H.value || u.value !== "idle") return;
1511
+ if (Te = !1, s.value = !0, b.value = !1, !o.value) {
1512
+ const F = f.value;
1508
1513
  if (F) {
1509
1514
  const z = F.getBoundingClientRect();
1510
- o.x = z.left, o.y = z.top, s.value = !0;
1515
+ g.x = z.left, g.y = z.top, o.value = !0;
1511
1516
  }
1512
1517
  }
1513
- const d = "touches" in t ? t.touches[0].clientX : t.clientX, T = "touches" in t ? t.touches[0].clientY : t.clientY;
1514
- N.x = d, N.y = T, f.x = d - o.x, f.y = T - o.y;
1515
- }
1516
- function Ie(t) {
1517
- var fe, bt;
1518
- if (!r.value) return;
1519
- const d = "touches" in t ? t.touches[0].clientX : t.clientX, T = "touches" in t ? t.touches[0].clientY : t.clientY;
1520
- if (!D.value) {
1521
- const tn = Math.abs(d - N.x), nn = Math.abs(T - N.y);
1522
- if (tn + nn <= 5) return;
1523
- D.value = !0;
1518
+ const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY;
1519
+ _.x = v, _.y = M, A.x = v - g.x, A.y = M - g.y;
1520
+ }
1521
+ function je(t) {
1522
+ var fe, At;
1523
+ if (!s.value) return;
1524
+ const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY;
1525
+ if (!b.value) {
1526
+ const nn = Math.abs(v - _.x), on = Math.abs(M - _.y);
1527
+ if (nn + on <= 5) return;
1528
+ b.value = !0;
1524
1529
  }
1525
- const { maxX: F, maxY: z } = Nt(), le = ie.value ? F + ps : F, me = Math.min(Math.max(d - f.x, Z), le), $e = Math.min(Math.max(T - f.y, Fe), z), Me = ie.value && me > F + fs;
1526
- Me !== Te && (Te = Me, (bt = (fe = h.dock) == null ? void 0 : fe.onDockChange) == null || bt.call(fe, Me)), B.value = Me, o.x = me, o.y = $e;
1530
+ const { maxX: F, maxY: z } = Yt(), le = ie.value ? F + ms : F, me = Math.min(Math.max(v - A.x, ee), le), $e = Math.min(Math.max(M - A.y, Fe), z), Me = ie.value && me > F + gs;
1531
+ Me !== Te && (Te = Me, (At = (fe = d.dock) == null ? void 0 : fe.onDockChange) == null || At.call(fe, Me)), N.value = Me, g.x = me, g.y = $e;
1527
1532
  }
1528
1533
  function Ze() {
1529
- var d, T;
1530
- if (!r.value) return;
1531
- r.value = !1;
1534
+ var v, M;
1535
+ if (!s.value) return;
1536
+ s.value = !1;
1532
1537
  let t = !1;
1533
- D.value && (D.value = !1, Ce = !0, setTimeout(() => {
1538
+ b.value && (b.value = !1, Ce = !0, setTimeout(() => {
1534
1539
  Ce = !1;
1535
- }, 0), B.value && ie.value ? (ft(), t = !0) : (je(), Yt())), Te && !t && (Te = !1, (T = (d = h.dock) == null ? void 0 : d.onDockChange) == null || T.call(d, !1)), B.value = !1;
1540
+ }, 0), N.value && ie.value ? (pt(), t = !0) : (Ue(), Vt())), Te && !t && (Te = !1, (M = (v = d.dock) == null ? void 0 : v.onDockChange) == null || M.call(v, !1)), N.value = !1;
1536
1541
  }
1537
- function ht(t) {
1542
+ function gt(t) {
1538
1543
  Ce && (t.preventDefault(), t.stopPropagation(), Ce = !1);
1539
1544
  }
1540
- function Yt() {
1545
+ function Vt() {
1541
1546
  try {
1542
- localStorage.setItem(Et, JSON.stringify({ x: o.x, y: o.y }));
1547
+ localStorage.setItem(Mt, JSON.stringify({ x: g.x, y: g.y }));
1543
1548
  } catch {
1544
1549
  }
1545
1550
  }
1546
- function Vt() {
1551
+ function Xt() {
1547
1552
  try {
1548
- const t = localStorage.getItem(Et);
1553
+ const t = localStorage.getItem(Mt);
1549
1554
  if (t) {
1550
- const d = JSON.parse(t);
1551
- typeof d.x == "number" && typeof d.y == "number" && (o.x = d.x, o.y = d.y, s.value = !0);
1555
+ const v = JSON.parse(t);
1556
+ typeof v.x == "number" && typeof v.y == "number" && (g.x = v.x, g.y = v.y, o.value = !0);
1552
1557
  }
1553
1558
  } catch {
1554
1559
  }
1555
1560
  }
1556
- function gt() {
1561
+ function mt() {
1557
1562
  try {
1558
- localStorage.setItem(Mt, R.value ? "1" : "0");
1563
+ localStorage.setItem(Dt, H.value ? "1" : "0");
1559
1564
  } catch {
1560
1565
  }
1561
1566
  }
1562
- function Xt() {
1567
+ function Ft() {
1563
1568
  var t;
1564
1569
  try {
1565
- if (localStorage.getItem(Mt) === "1" && ie.value) {
1566
- const T = (t = h.dock) == null ? void 0 : t.containerId;
1567
- T && document.getElementById(T) && (R.value = !0);
1570
+ if (localStorage.getItem(Dt) === "1" && ie.value) {
1571
+ const M = (t = d.dock) == null ? void 0 : t.containerId;
1572
+ M && document.getElementById(M) && (H.value = !0);
1568
1573
  }
1569
1574
  } catch {
1570
1575
  }
1571
1576
  }
1572
1577
  function et() {
1573
1578
  return {
1574
- x: window.innerWidth - G.value,
1579
+ x: window.innerWidth - Q.value,
1575
1580
  y: 0,
1576
- w: G.value,
1581
+ w: Q.value,
1577
1582
  h: window.innerHeight,
1578
1583
  radius: "0px"
1579
1584
  };
1580
1585
  }
1581
- function Ft() {
1586
+ function Gt() {
1582
1587
  return {
1583
1588
  x: Math.max(0, Math.min(window.innerWidth - 53, n.x + de.value * 3)),
1584
1589
  y: n.y,
@@ -1587,7 +1592,7 @@ const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "m
1587
1592
  radius: "50%"
1588
1593
  };
1589
1594
  }
1590
- function mt() {
1595
+ function ft() {
1591
1596
  const t = window.innerWidth * 0.8;
1592
1597
  return {
1593
1598
  x: (window.innerWidth - t) / 2,
@@ -1598,106 +1603,106 @@ const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "m
1598
1603
  };
1599
1604
  }
1600
1605
  function Qt() {
1601
- b.value ? (He(mt(), wt()), b.value = !1) : (He(Ne(), mt()), b.value = !0);
1606
+ C.value ? (_e(ft(), kt()), C.value = !1) : (_e(Be(), ft()), C.value = !0);
1602
1607
  }
1603
- function He(t, d, T, F = "none") {
1604
- ke && clearTimeout(ke), we.value = "switching", We.value = !0, _e.value = F, q.x = t.x, q.y = t.y, q.w = t.w, q.h = t.h, q.radius = t.radius, ne(() => {
1608
+ function _e(t, v, M, F = "none") {
1609
+ ke && clearTimeout(ke), we.value = "switching", Ne.value = !0, He.value = F, I.x = t.x, I.y = t.y, I.w = t.w, I.h = t.h, I.radius = t.radius, ne(() => {
1605
1610
  requestAnimationFrame(() => {
1606
- We.value = !1, q.x = d.x, q.y = d.y, q.w = d.w, q.h = d.h, q.radius = d.radius;
1611
+ Ne.value = !1, I.x = v.x, I.y = v.y, I.w = v.w, I.h = v.h, I.radius = v.radius;
1607
1612
  });
1608
1613
  }), ke = setTimeout(() => {
1609
- we.value = "idle", _e.value = "none", ke = null, T == null || T();
1614
+ we.value = "idle", He.value = "none", ke = null, M == null || M();
1610
1615
  }, 400);
1611
1616
  }
1612
- function ft() {
1617
+ function pt() {
1613
1618
  var z, le, me, $e, Me;
1614
- if (!ie.value || R.value) return;
1615
- b.value && (b.value = !1);
1616
- const t = (z = h.dock) == null ? void 0 : z.containerId;
1619
+ if (!ie.value || H.value) return;
1620
+ C.value && (C.value = !1);
1621
+ const t = (z = d.dock) == null ? void 0 : z.containerId;
1617
1622
  if (t && !document.getElementById(t)) {
1618
1623
  console.warn(`[ai-assist-sdk] dock container "#${t}" not found, dock feature disabled`);
1619
1624
  return;
1620
1625
  }
1621
- const d = w.value;
1622
- let T = Ne();
1623
- if (d) {
1624
- const fe = d.getBoundingClientRect();
1625
- T = { x: fe.left, y: fe.top, w: fe.width, h: fe.height, radius: getComputedStyle(d).borderRadius };
1626
+ const v = f.value;
1627
+ let M = Be();
1628
+ if (v) {
1629
+ const fe = v.getBoundingClientRect();
1630
+ M = { x: fe.left, y: fe.top, w: fe.width, h: fe.height, radius: getComputedStyle(v).borderRadius };
1626
1631
  }
1627
1632
  const F = et();
1628
- He(T, F), R.value = !0, l.value = "idle", B.value = !1, gt(), (me = (le = h.dock) == null ? void 0 : le.onDockChange) == null || me.call(le, !0), (Me = ($e = h.dock) == null ? void 0 : $e.onDockWidthChange) == null || Me.call($e, G.value);
1633
+ _e(M, F), H.value = !0, u.value = "idle", N.value = !1, mt(), (me = (le = d.dock) == null ? void 0 : le.onDockChange) == null || me.call(le, !0), (Me = ($e = d.dock) == null ? void 0 : $e.onDockWidthChange) == null || Me.call($e, Q.value);
1629
1634
  }
1630
- function Gt() {
1631
- return Math.max(Rt, window.innerWidth - ys);
1635
+ function Kt() {
1636
+ return Math.max(Ht, window.innerWidth - fs);
1632
1637
  }
1633
1638
  function it(t) {
1634
- return Math.min(Math.max(t, Rt), Gt());
1639
+ return Math.min(Math.max(t, Ht), Kt());
1635
1640
  }
1636
- function Ut() {
1641
+ function It() {
1637
1642
  try {
1638
- localStorage.setItem(Dt, String(G.value));
1643
+ localStorage.setItem(Rt, String(Q.value));
1639
1644
  } catch {
1640
1645
  }
1641
1646
  }
1642
1647
  function qt() {
1643
1648
  try {
1644
- const t = localStorage.getItem(Dt);
1649
+ const t = localStorage.getItem(Rt);
1645
1650
  if (t) {
1646
- const d = parseFloat(t);
1647
- Number.isFinite(d) && (G.value = it(d));
1651
+ const v = parseFloat(t);
1652
+ Number.isFinite(v) && (Q.value = it(v));
1648
1653
  }
1649
1654
  } catch {
1650
1655
  }
1651
1656
  }
1652
- function pt(t) {
1653
- if (!R.value) return;
1654
- K.value = !0, Re.value = !1;
1655
- const d = "touches" in t ? t.touches[0].clientX : t.clientX;
1656
- ue.x = d, ue.width = G.value;
1657
+ function yt(t) {
1658
+ if (!H.value) return;
1659
+ J.value = !0, Re.value = !1;
1660
+ const v = "touches" in t ? t.touches[0].clientX : t.clientX;
1661
+ ue.x = v, ue.width = Q.value;
1657
1662
  }
1658
1663
  function tt(t) {
1659
- if (!K.value) return;
1660
- const d = "touches" in t ? t.touches[0].clientX : t.clientX, T = it(ue.width + (ue.x - d));
1661
- Math.abs(T - ue.width) > 3 && (Re.value = !0), G.value = T, ye || (ye = requestAnimationFrame(() => {
1664
+ if (!J.value) return;
1665
+ const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = it(ue.width + (ue.x - v));
1666
+ Math.abs(M - ue.width) > 3 && (Re.value = !0), Q.value = M, ye || (ye = requestAnimationFrame(() => {
1662
1667
  var F, z;
1663
- ye = 0, (z = (F = h.dock) == null ? void 0 : F.onDockWidthChange) == null || z.call(F, G.value);
1668
+ ye = 0, (z = (F = d.dock) == null ? void 0 : F.onDockWidthChange) == null || z.call(F, Q.value);
1664
1669
  }));
1665
1670
  }
1666
1671
  function nt() {
1667
- var t, d;
1668
- K.value && (K.value = !1, Re.value && (Re.value = !1, Ut(), (d = (t = h.dock) == null ? void 0 : t.onDockWidthChange) == null || d.call(t, G.value)));
1672
+ var t, v;
1673
+ J.value && (J.value = !1, Re.value && (Re.value = !1, It(), (v = (t = d.dock) == null ? void 0 : t.onDockWidthChange) == null || v.call(t, Q.value)));
1669
1674
  }
1670
- function yt() {
1671
- var t, d;
1672
- R.value && (s.value ? je(Pe, window.innerHeight - 78) : ge(), He(et(), Ne()), R.value = !1, gt(), (d = (t = h.dock) == null ? void 0 : t.onDockChange) == null || d.call(t, !1));
1675
+ function wt() {
1676
+ var t, v;
1677
+ H.value && (o.value ? Ue(Pe, window.innerHeight - 78) : ge(), _e(et(), Be()), H.value = !1, mt(), (v = (t = d.dock) == null ? void 0 : t.onDockChange) == null || v.call(t, !1));
1673
1678
  }
1674
1679
  function Jt() {
1675
- var t, d;
1676
- if (!re.value && !L.value) {
1677
- if (R.value) {
1678
- He(
1679
- { x: window.innerWidth, y: 0, w: G.value, h: window.innerHeight, radius: "0px" },
1680
+ var t, v;
1681
+ if (!re.value && !W.value) {
1682
+ if (H.value) {
1683
+ _e(
1684
+ { x: window.innerWidth, y: 0, w: Q.value, h: window.innerHeight, radius: "0px" },
1680
1685
  et(),
1681
1686
  void 0,
1682
1687
  "in"
1683
- ), g.value = !0, l.value = "idle", (d = (t = h.dock) == null ? void 0 : t.onDockChange) == null || d.call(t, !0);
1688
+ ), h.value = !0, u.value = "idle", (v = (t = d.dock) == null ? void 0 : t.onDockChange) == null || v.call(t, !0);
1684
1689
  return;
1685
1690
  }
1686
1691
  ge();
1687
- const T = Ne();
1688
- u.x = Math.max(0, Math.min(window.innerWidth - 53, n.x + de.value * 3)), u.y = n.y - de.value * 2, u.w = 53, u.h = 53, u.radius = "50%", k.value = !0, l.value = "expanding", g.value = !0, ne(() => {
1692
+ const M = Be();
1693
+ c.x = Math.max(0, Math.min(window.innerWidth - 53, n.x + de.value * 3)), c.y = n.y - de.value * 2, c.w = 53, c.h = 53, c.radius = "50%", k.value = !0, u.value = "expanding", h.value = !0, ne(() => {
1689
1694
  requestAnimationFrame(() => {
1690
- k.value = !1, u.x = T.x, u.y = T.y, u.w = T.w, u.h = T.h, u.radius = T.radius;
1695
+ k.value = !1, c.x = M.x, c.y = M.y, c.w = M.w, c.h = M.h, c.radius = M.radius;
1691
1696
  });
1692
1697
  }), setTimeout(() => {
1693
- l.value = "idle";
1698
+ u.value = "idle";
1694
1699
  }, 400);
1695
1700
  } else
1696
1701
  re.value = !1;
1697
1702
  }
1698
- function Ne() {
1703
+ function Be() {
1699
1704
  if (window.innerWidth < 768)
1700
- return b.value ? {
1705
+ return C.value ? {
1701
1706
  x: 0,
1702
1707
  y: 0,
1703
1708
  w: window.innerWidth,
@@ -1710,290 +1715,290 @@ const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "m
1710
1715
  h: window.innerHeight - 16,
1711
1716
  radius: "14px"
1712
1717
  };
1713
- const d = window.innerHeight - 78;
1714
- let T = 54;
1715
- if (b.value) {
1718
+ const v = window.innerHeight - 78;
1719
+ let M = 54;
1720
+ if (C.value) {
1716
1721
  const F = window.innerWidth * 0.8;
1717
1722
  return {
1718
1723
  x: (window.innerWidth - F) / 2,
1719
- y: T,
1724
+ y: M,
1720
1725
  w: F,
1721
- h: d,
1726
+ h: v,
1722
1727
  radius: "14px"
1723
1728
  };
1724
1729
  }
1725
- return wt();
1730
+ return kt();
1726
1731
  }
1727
- function wt() {
1728
- const t = Pe, d = window.innerHeight - 78;
1729
- let T = 54, F;
1730
- return s.value ? (F = Math.min(Math.max(o.x, Z), Math.max(Z, window.innerWidth - t - Z)), T = Math.min(Math.max(o.y, Fe), Math.max(Z, d - Z))) : F = M.value === "left" ? 24 : window.innerWidth - t - 24, { x: F, y: T, w: t, h: d, radius: "14px" };
1731
- }
1732
- function Kt() {
1733
- var d, T;
1734
- if (R.value) {
1735
- He(et(), Ft(), () => {
1736
- g.value = !1, l.value = "idle", c.value = !0, setTimeout(() => {
1737
- c.value = !1;
1732
+ function kt() {
1733
+ const t = Pe, v = window.innerHeight - 78;
1734
+ let M = 54, F;
1735
+ return o.value ? (F = Math.min(Math.max(g.x, ee), Math.max(ee, window.innerWidth - t - ee)), M = Math.min(Math.max(g.y, Fe), Math.max(ee, v - ee))) : F = T.value === "left" ? 24 : window.innerWidth - t - 24, { x: F, y: M, w: t, h: v, radius: "14px" };
1736
+ }
1737
+ function zt() {
1738
+ var v, M;
1739
+ if (H.value) {
1740
+ _e(et(), Gt(), () => {
1741
+ h.value = !1, u.value = "idle", l.value = !0, setTimeout(() => {
1742
+ l.value = !1;
1738
1743
  }, 1400);
1739
- }, "out"), (T = (d = h.dock) == null ? void 0 : d.onDockChange) == null || T.call(d, !1);
1744
+ }, "out"), (M = (v = d.dock) == null ? void 0 : v.onDockChange) == null || M.call(v, !1);
1740
1745
  return;
1741
1746
  }
1742
- if (l.value !== "idle") return;
1743
- const t = Ne();
1744
- u.x = t.x, u.y = t.y, u.w = t.w, u.h = t.h, u.radius = t.radius, k.value = !0, l.value = "collapsing", ne(() => {
1747
+ if (u.value !== "idle") return;
1748
+ const t = Be();
1749
+ c.x = t.x, c.y = t.y, c.w = t.w, c.h = t.h, c.radius = t.radius, k.value = !0, u.value = "collapsing", ne(() => {
1745
1750
  requestAnimationFrame(() => {
1746
- k.value = !1, u.x = Math.max(0, Math.min(window.innerWidth - 53, n.x + de.value * 3)), u.y = n.y + Math.abs(de.value) * 2, u.w = 53, u.h = 53, u.radius = "50%";
1751
+ k.value = !1, c.x = Math.max(0, Math.min(window.innerWidth - 53, n.x + de.value * 3)), c.y = n.y + Math.abs(de.value) * 2, c.w = 53, c.h = 53, c.radius = "50%";
1747
1752
  });
1748
1753
  }), setTimeout(() => {
1749
- g.value = !1, l.value = "idle", c.value = !0;
1754
+ h.value = !1, u.value = "idle", l.value = !0;
1750
1755
  }, 400), setTimeout(() => {
1751
- c.value = !1;
1756
+ l.value = !1;
1752
1757
  }, 1400);
1753
1758
  }
1754
- function zt(t) {
1755
- Ye(), C.value = "answer", ne(() => {
1756
- var d;
1757
- (d = ve.value) == null || d.goHistoryMessage(t);
1759
+ function Ut(t) {
1760
+ Ye(), w.value = "answer", ne(() => {
1761
+ var v;
1762
+ (v = ve.value) == null || v.goHistoryMessage(t);
1758
1763
  });
1759
1764
  }
1760
1765
  function jt() {
1761
- $.value = "", C.value = "answer", ne(() => {
1766
+ P.value = "", w.value = "answer", ne(() => {
1762
1767
  var t;
1763
1768
  (t = ve.value) == null || t.createNewConversation();
1764
1769
  });
1765
1770
  }
1766
- function It() {
1767
- Ye(), $.value = "", ne(() => {
1771
+ function Zt() {
1772
+ Ye(), P.value = "", ne(() => {
1768
1773
  var t;
1769
1774
  (t = ve.value) == null || t.createNewConversation();
1770
1775
  });
1771
1776
  }
1772
- function Zt() {
1773
- P.value = !1, _.value = !0;
1777
+ function en() {
1778
+ L.value = !1, R.value = !0;
1774
1779
  }
1775
1780
  function Ye() {
1776
- P.value = !0, setTimeout(() => {
1777
- _.value = !1, P.value = !1;
1781
+ L.value = !0, setTimeout(() => {
1782
+ R.value = !1, L.value = !1;
1778
1783
  }, 300);
1779
1784
  }
1780
- function en() {
1781
- E.value = x.value, A.value = !1;
1785
+ function tn() {
1786
+ D.value = E.value, S.value = !1;
1782
1787
  }
1783
- ae(b, (t) => {
1784
- t ? M.value = "center" : ge();
1785
- }), ae(g, (t) => {
1786
- t && s.value && ne(() => je());
1788
+ ae(C, (t) => {
1789
+ t ? T.value = "center" : ge();
1790
+ }), ae(h, (t) => {
1791
+ t && o.value && ne(() => Ue());
1787
1792
  }), pe(() => {
1788
- Bt(), Vt(), Xt(), qt();
1789
- const t = h.theme || "light";
1790
- rt(t), t === "auto" && (Ee = wn(() => rt("auto")));
1793
+ Bt(), Xt(), Ft(), qt();
1794
+ const t = d.theme || "light";
1795
+ vt(t), t === "auto" && (Ee = wn(() => vt("auto")));
1791
1796
  });
1792
- function kt() {
1797
+ function Ct() {
1793
1798
  be && clearTimeout(be), be = setTimeout(() => {
1794
1799
  const t = window.innerWidth < 768;
1795
- v.value = t, t && (b.value = !0, R.value && yt()), Je(), s.value && je(), R.value && (G.value = it(G.value));
1800
+ r.value = t, t && (C.value = !0, H.value && wt()), qe(), o.value && Ue(), H.value && (Q.value = it(Q.value));
1796
1801
  }, 100);
1797
1802
  }
1798
1803
  return pe(() => {
1799
- window.addEventListener("resize", kt);
1804
+ window.addEventListener("resize", Ct);
1800
1805
  }), st(() => {
1801
- window.removeEventListener("resize", kt), be && clearTimeout(be), Ee == null || Ee();
1806
+ window.removeEventListener("resize", Ct), be && clearTimeout(be), Ee == null || Ee();
1802
1807
  }), pe(() => {
1803
- document.addEventListener("mousemove", Ke), document.addEventListener("touchmove", Ke, { passive: !0 }), document.addEventListener("mouseup", ze), document.addEventListener("touchend", ze), document.addEventListener("mousemove", Ie), document.addEventListener("touchmove", Ie, { passive: !0 }), document.addEventListener("mouseup", Ze), document.addEventListener("touchend", Ze), document.addEventListener("click", ht, !0), document.addEventListener("mousemove", tt), document.addEventListener("touchmove", tt, { passive: !0 }), document.addEventListener("mouseup", nt), document.addEventListener("touchend", nt);
1808
+ document.addEventListener("mousemove", Je), document.addEventListener("touchmove", Je, { passive: !0 }), document.addEventListener("mouseup", ze), document.addEventListener("touchend", ze), document.addEventListener("mousemove", je), document.addEventListener("touchmove", je, { passive: !0 }), document.addEventListener("mouseup", Ze), document.addEventListener("touchend", Ze), document.addEventListener("click", gt, !0), document.addEventListener("mousemove", tt), document.addEventListener("touchmove", tt, { passive: !0 }), document.addEventListener("mouseup", nt), document.addEventListener("touchend", nt);
1804
1809
  }), st(() => {
1805
- document.removeEventListener("mousemove", Ke), document.removeEventListener("touchmove", Ke), document.removeEventListener("mouseup", ze), document.removeEventListener("touchend", ze), document.removeEventListener("mousemove", Ie), document.removeEventListener("touchmove", Ie), document.removeEventListener("mouseup", Ze), document.removeEventListener("touchend", Ze), document.removeEventListener("click", ht, !0), document.removeEventListener("mousemove", tt), document.removeEventListener("touchmove", tt), document.removeEventListener("mouseup", nt), document.removeEventListener("touchend", nt), ke && clearTimeout(ke), ye && cancelAnimationFrame(ye);
1806
- }), (t, d) => (m(), S("div", null, [
1810
+ document.removeEventListener("mousemove", Je), document.removeEventListener("touchmove", Je), document.removeEventListener("mouseup", ze), document.removeEventListener("touchend", ze), document.removeEventListener("mousemove", je), document.removeEventListener("touchmove", je), document.removeEventListener("mouseup", Ze), document.removeEventListener("touchend", Ze), document.removeEventListener("click", gt, !0), document.removeEventListener("mousemove", tt), document.removeEventListener("touchmove", tt), document.removeEventListener("mouseup", nt), document.removeEventListener("touchend", nt), ke && clearTimeout(ke), ye && cancelAnimationFrame(ye);
1811
+ }), (t, v) => (m(), x("div", null, [
1807
1812
  De(a("div", {
1808
1813
  ref_key: "panelRef",
1809
- ref: w,
1810
- class: J([
1814
+ ref: f,
1815
+ class: q([
1811
1816
  "ai-panel",
1812
- b.value ? "maxWrap" : "minWrap",
1813
- Be.value,
1817
+ C.value ? "maxWrap" : "minWrap",
1818
+ We.value,
1814
1819
  {
1815
- "panel-custom": s.value && !b.value && !v.value && !R.value && we.value === "idle",
1816
- dragging: r.value,
1817
- "dock-preview": B.value,
1818
- docked: R.value,
1819
- "dock-resizing": K.value,
1820
+ "panel-custom": o.value && !C.value && !r.value && !H.value && we.value === "idle",
1821
+ dragging: s.value,
1822
+ "dock-preview": N.value,
1823
+ docked: H.value,
1824
+ "dock-resizing": J.value,
1820
1825
  "dock-switching": we.value !== "idle",
1821
- "dock-switch-instant": We.value,
1822
- "dock-switch-fade-in": _e.value === "in",
1823
- "dock-switch-fade-out": _e.value === "out",
1826
+ "dock-switch-instant": Ne.value,
1827
+ "dock-switch-fade-in": He.value === "in",
1828
+ "dock-switch-fade-out": He.value === "out",
1824
1829
  "no-drag": !Ae.value
1825
1830
  },
1826
- l.value !== "idle" ? l.value : "",
1827
- { morphing: l.value !== "idle", "morph-instant": k.value }
1831
+ u.value !== "idle" ? u.value : "",
1832
+ { morphing: u.value !== "idle", "morph-instant": k.value }
1828
1833
  ]),
1829
- style: ot([j.value, ee.value, he.value])
1834
+ style: ot([j.value, U.value, he.value])
1830
1835
  }, [
1831
- R.value ? (m(), S("div", {
1836
+ H.value ? (m(), x("div", {
1832
1837
  key: 0,
1833
1838
  class: "ai-dock-resizer",
1834
- onMousedown: se(pt, ["stop"]),
1835
- onTouchstart: se(pt, ["stop"])
1836
- }, null, 32)) : Y("", !0),
1839
+ onMousedown: se(yt, ["stop"]),
1840
+ onTouchstart: se(yt, ["stop"])
1841
+ }, null, 32)) : X("", !0),
1837
1842
  a("div", {
1838
1843
  class: "header",
1839
- onMousedown: dt,
1840
- onTouchstart: dt
1844
+ onMousedown: ht,
1845
+ onTouchstart: ht
1841
1846
  }, [
1842
- C.value === "info" ? (m(), S("span", {
1847
+ w.value === "info" ? (m(), x("span", {
1843
1848
  key: 0,
1844
- class: J(["back", i.value]),
1845
- onClick: d[0] || (d[0] = (T) => C.value = "answer")
1846
- }, [...d[5] || (d[5] = [
1849
+ class: q(["back", i.value]),
1850
+ onClick: v[0] || (v[0] = (M) => w.value = "answer")
1851
+ }, [...v[5] || (v[5] = [
1847
1852
  a("span", { style: { "font-size": "14px" } }, "←", -1)
1848
- ])], 2)) : (m(), S("p", ss, [
1853
+ ])], 2)) : (m(), x("p", ns, [
1849
1854
  a("img", {
1850
- src: H(Lt),
1855
+ src: $(Ot),
1851
1856
  draggable: "false"
1852
- }, null, 8, as)
1857
+ }, null, 8, os)
1853
1858
  ])),
1854
- a("div", is, [
1859
+ a("div", ss, [
1855
1860
  a("span", {
1856
- title: C.value === "info" ? "个人信息" : $.value || H(h).name
1857
- }, Q(C.value === "info" ? "个人信息" : $.value || H(h).name), 9, ls)
1861
+ title: w.value === "info" ? "个人信息" : P.value || $(d).name
1862
+ }, G(w.value === "info" ? "个人信息" : P.value || $(d).name), 9, as)
1858
1863
  ]),
1859
1864
  a("p", null, [
1860
- De(U(H(I), {
1865
+ De(K($(Z), {
1861
1866
  class: "op-icon",
1862
1867
  icon: "ic:round-add",
1863
1868
  onClick: jt
1864
1869
  }, null, 512), [
1865
- [Ve, Ue.value]
1870
+ [Ve, Ke.value]
1866
1871
  ]),
1867
- U(H(I), {
1868
- class: J(["mute", { active: _.value }]),
1872
+ K($(Z), {
1873
+ class: q(["mute", { active: R.value }]),
1869
1874
  icon: "ic:round-history",
1870
- onClick: d[1] || (d[1] = (T) => _.value ? Ye() : Zt())
1875
+ onClick: v[1] || (v[1] = (M) => R.value ? Ye() : en())
1871
1876
  }, null, 8, ["class"]),
1872
- !v.value && !R.value ? (m(), oe(H(I), {
1877
+ !r.value && !H.value ? (m(), oe($(Z), {
1873
1878
  key: 0,
1874
1879
  onClick: Qt,
1875
- icon: b.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
1876
- }, null, 8, ["icon"])) : Y("", !0),
1877
- R.value ? (m(), oe(H(I), {
1880
+ icon: C.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
1881
+ }, null, 8, ["icon"])) : X("", !0),
1882
+ H.value ? (m(), oe($(Z), {
1878
1883
  key: 1,
1879
1884
  icon: "material-symbols:float-landscape-2-outline-rounded",
1880
- onClick: yt
1881
- })) : Y("", !0),
1882
- ie.value && !R.value ? (m(), oe(H(I), {
1885
+ onClick: wt
1886
+ })) : X("", !0),
1887
+ ie.value && !H.value ? (m(), oe($(Z), {
1883
1888
  key: 2,
1884
1889
  icon: "boxicons:arrow-in-up-right-stroke-square",
1885
- onClick: ft,
1890
+ onClick: pt,
1886
1891
  class: "__minimize"
1887
- })) : Y("", !0),
1888
- U(H(I), {
1889
- onClick: Kt,
1892
+ })) : X("", !0),
1893
+ K($(Z), {
1894
+ onClick: zt,
1890
1895
  icon: "ic:round-close"
1891
1896
  })
1892
1897
  ])
1893
1898
  ], 32),
1894
- De(U(_o, {
1899
+ De(K(Do, {
1895
1900
  ref_key: "answerRef",
1896
1901
  ref: ve,
1897
- defaultSayhello: H(h).defaultSayhello,
1898
- defaultRecommend: H(h).defaultRecommend,
1899
- onTitleGenerated: d[2] || (d[2] = (T) => $.value = T)
1902
+ defaultSayhello: $(d).defaultSayhello,
1903
+ defaultRecommend: $(d).defaultRecommend,
1904
+ onTitleGenerated: v[2] || (v[2] = (M) => P.value = M)
1900
1905
  }, null, 8, ["defaultSayhello", "defaultRecommend"]), [
1901
- [Ve, C.value === "answer"]
1906
+ [Ve, w.value === "answer"]
1902
1907
  ]),
1903
- C.value === "info" ? (m(), oe(os, { key: 1 })) : Y("", !0),
1904
- _.value ? (m(), S("div", {
1908
+ w.value === "info" ? (m(), oe(ts, { key: 1 })) : X("", !0),
1909
+ R.value ? (m(), x("div", {
1905
1910
  key: 2,
1906
- class: J(["ai-history-drawer", { closing: P.value }])
1911
+ class: q(["ai-history-drawer", { closing: L.value }])
1907
1912
  }, [
1908
1913
  a("div", {
1909
1914
  class: "ai-history-backdrop",
1910
1915
  onClick: Ye
1911
1916
  }),
1912
- a("div", us, [
1913
- a("div", cs, [
1914
- d[6] || (d[6] = a("span", null, "对话记录", -1)),
1915
- U(H(I), {
1917
+ a("div", is, [
1918
+ a("div", ls, [
1919
+ v[6] || (v[6] = a("span", null, "对话记录", -1)),
1920
+ K($(Z), {
1916
1921
  icon: "ic:round-close",
1917
1922
  class: "ai-history-drawer-close",
1918
1923
  onClick: Ye
1919
1924
  })
1920
1925
  ]),
1921
- U(Fo, {
1922
- onHistoryDetail: zt,
1923
- onNewConversation: It
1926
+ K(Vo, {
1927
+ onHistoryDetail: Ut,
1928
+ onNewConversation: Zt
1924
1929
  })
1925
1930
  ])
1926
- ], 2)) : Y("", !0),
1927
- De(a("div", rs, [
1928
- a("div", vs, [
1929
- a("div", ds, [
1930
- d[7] || (d[7] = a("p", { class: "title" }, "修改标题", -1)),
1931
+ ], 2)) : X("", !0),
1932
+ De(a("div", us, [
1933
+ a("div", cs, [
1934
+ a("div", rs, [
1935
+ v[7] || (v[7] = a("p", { class: "title" }, "修改标题", -1)),
1931
1936
  De(a("textarea", {
1932
- "onUpdate:modelValue": d[3] || (d[3] = (T) => x.value = T),
1937
+ "onUpdate:modelValue": v[3] || (v[3] = (M) => E.value = M),
1933
1938
  placeholder: "请输入新标题"
1934
1939
  }, null, 512), [
1935
- [$t, x.value]
1940
+ [Pt, E.value]
1936
1941
  ]),
1937
- a("p", hs, [
1942
+ a("p", vs, [
1938
1943
  a("span", {
1939
- onClick: d[4] || (d[4] = (T) => A.value = !1)
1944
+ onClick: v[4] || (v[4] = (M) => S.value = !1)
1940
1945
  }, "取消"),
1941
- a("span", { onClick: en }, "确定")
1946
+ a("span", { onClick: tn }, "确定")
1942
1947
  ])
1943
1948
  ])
1944
1949
  ])
1945
1950
  ], 512), [
1946
- [Ve, A.value]
1951
+ [Ve, S.value]
1947
1952
  ])
1948
1953
  ], 6), [
1949
- [Ve, g.value || l.value !== "idle"]
1954
+ [Ve, h.value || u.value !== "idle"]
1950
1955
  ]),
1951
- B.value && ie.value ? (m(), S("div", {
1956
+ N.value && ie.value ? (m(), x("div", {
1952
1957
  key: 0,
1953
1958
  class: "ai-dock-preview",
1954
- style: ot({ width: G.value + "px" })
1955
- }, [...d[8] || (d[8] = [
1959
+ style: ot({ width: Q.value + "px" })
1960
+ }, [...v[8] || (v[8] = [
1956
1961
  a("span", { class: "ai-dock-preview__text" }, "松开以停靠到右侧", -1)
1957
- ])], 4)) : Y("", !0),
1962
+ ])], 4)) : X("", !0),
1958
1963
  De(a("div", {
1959
- class: J(["character", { dragging: W.value, recycling: L.value, "hover-preview": c.value }]),
1960
- style: ot(X.value),
1961
- onMousedown: vt,
1962
- onTouchstart: vt,
1964
+ class: q(["character", { dragging: B.value, recycling: W.value, "hover-preview": l.value }]),
1965
+ style: ot(Y.value),
1966
+ onMousedown: dt,
1967
+ onTouchstart: dt,
1963
1968
  onClick: Jt
1964
1969
  }, [
1965
- a("img", { src: V.value }, null, 8, gs)
1970
+ a("img", { src: V.value }, null, 8, ds)
1966
1971
  ], 38), [
1967
- [Ve, !g.value]
1972
+ [Ve, !h.value]
1968
1973
  ])
1969
1974
  ]));
1970
1975
  }
1971
- }), ws = ["data-theme"], ks = {
1976
+ }), ps = ["data-theme"], ys = {
1972
1977
  key: 0,
1973
1978
  class: "ai-voice-input-final"
1974
- }, Cs = {
1979
+ }, ws = {
1975
1980
  key: 1,
1976
1981
  class: "ai-voice-input-interim"
1977
- }, bs = {
1982
+ }, ks = {
1978
1983
  key: 2,
1979
1984
  class: "ai-voice-input-cursor"
1980
- }, As = {
1985
+ }, Cs = {
1981
1986
  key: 3,
1982
1987
  class: "ai-voice-input-placeholder"
1983
- }, Ss = ["disabled"], xs = {
1988
+ }, bs = ["disabled"], As = {
1984
1989
  key: 0,
1985
1990
  class: "ai-voice-input-pulse"
1986
- }, Ts = {
1991
+ }, Ss = {
1987
1992
  key: 1,
1988
1993
  class: "ai-voice-input-wave"
1989
- }, Es = {
1994
+ }, xs = {
1990
1995
  key: 2,
1991
1996
  class: "ai-voice-input-btn-icon",
1992
1997
  viewBox: "0 0 24 24",
1993
1998
  fill: "currentColor",
1994
1999
  width: "16",
1995
2000
  height: "16"
1996
- }, Ms = /* @__PURE__ */ xe({
2001
+ }, Ts = /* @__PURE__ */ xe({
1997
2002
  __name: "VoiceInput",
1998
2003
  props: {
1999
2004
  lang: {},
@@ -2008,138 +2013,138 @@ const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "m
2008
2013
  className: {}
2009
2014
  },
2010
2015
  emits: ["result", "final", "error", "statusChange", "complete"],
2011
- setup(e, { expose: y, emit: h }) {
2012
- const g = e, l = h, k = {
2016
+ setup(e, { expose: y, emit: d }) {
2017
+ const h = e, u = d, k = {
2013
2018
  idle: "开始录音",
2014
2019
  connecting: "启动中…",
2015
2020
  recording: "停止录音",
2016
2021
  stopping: "识别中…",
2017
2022
  error: "重试"
2018
- }, u = p(""), c = p(""), v = p("idle"), b = at.isSupported();
2019
- let C = null;
2020
- const A = O(() => kn(g.theme)), x = () => ({
2021
- lang: g.lang,
2022
- continuous: g.continuous,
2023
- interimResults: g.interimResults
2024
- }), E = () => {
2025
- b && (C = new at(x(), {
2023
+ }, c = p(""), l = p(""), r = p("idle"), C = at.isSupported();
2024
+ let w = null;
2025
+ const S = O(() => kn(h.theme)), E = () => ({
2026
+ lang: h.lang,
2027
+ continuous: h.continuous,
2028
+ interimResults: h.interimResults
2029
+ }), D = () => {
2030
+ C && (w = new at(E(), {
2026
2031
  onStatusChange: (i) => {
2027
- v.value = i, l("statusChange", i), i === "idle" && l("complete", u.value);
2032
+ r.value = i, u("statusChange", i), i === "idle" && u("complete", c.value);
2028
2033
  },
2029
2034
  onInterim: (i) => {
2030
- c.value = i;
2035
+ l.value = i;
2031
2036
  },
2032
- onFinal: (i, w) => {
2033
- u.value += i, c.value = "", l("final", i, w);
2037
+ onFinal: (i, f) => {
2038
+ c.value += i, l.value = "", u("final", i, f);
2034
2039
  },
2035
- onResult: (i) => l("result", i),
2036
- onError: (i) => l("error", i)
2040
+ onResult: (i) => u("result", i),
2041
+ onError: (i) => u("error", i)
2037
2042
  }));
2038
2043
  };
2039
- pe(E), Ht(() => {
2040
- C == null || C.destroy(), C = null;
2044
+ pe(D), $t(() => {
2045
+ w == null || w.destroy(), w = null;
2041
2046
  }), ae(
2042
- () => [g.lang, g.continuous, g.interimResults],
2047
+ () => [h.lang, h.continuous, h.interimResults],
2043
2048
  () => {
2044
- C == null || C.destroy(), E();
2049
+ w == null || w.destroy(), D();
2045
2050
  }
2046
2051
  );
2047
- const $ = async () => {
2048
- if (C)
2049
- if (v.value === "idle" || v.value === "error")
2052
+ const P = async () => {
2053
+ if (w)
2054
+ if (r.value === "idle" || r.value === "error")
2050
2055
  try {
2051
- await C.start();
2056
+ await w.start();
2052
2057
  } catch {
2053
2058
  }
2054
- else v.value === "recording" && C.stop();
2055
- }, _ = () => {
2056
- u.value = "", c.value = "";
2057
- }, P = O(() => !u.value && !c.value), n = O(
2058
- () => b ? g.placeholder || "点击按钮开始语音输入…" : "当前浏览器不支持语音识别"
2059
- ), W = O(() => b ? v.value === "connecting" ? g.connectingText || k.connecting : v.value === "recording" ? g.stopText || k.recording : v.value === "stopping" ? g.stoppingText || k.stopping : v.value === "error" ? k.error : g.startText || k.idle : "不支持"), L = O(() => {
2059
+ else r.value === "recording" && w.stop();
2060
+ }, R = () => {
2061
+ c.value = "", l.value = "";
2062
+ }, L = O(() => !c.value && !l.value), n = O(
2063
+ () => C ? h.placeholder || "点击按钮开始语音输入…" : "当前浏览器不支持语音识别"
2064
+ ), B = O(() => C ? r.value === "connecting" ? h.connectingText || k.connecting : r.value === "recording" ? h.stopText || k.recording : r.value === "stopping" ? h.stoppingText || k.stopping : r.value === "error" ? k.error : h.startText || k.idle : "不支持"), W = O(() => {
2060
2065
  const i = ["ai-voice-input-btn"];
2061
- return v.value === "recording" && i.push("is-recording"), v.value === "connecting" && i.push("is-connecting"), v.value === "stopping" && i.push("is-stopping"), i.join(" ");
2062
- }), M = O(
2063
- () => !b || v.value === "connecting" || v.value === "stopping"
2066
+ return r.value === "recording" && i.push("is-recording"), r.value === "connecting" && i.push("is-connecting"), r.value === "stopping" && i.push("is-stopping"), i.join(" ");
2067
+ }), T = O(
2068
+ () => !C || r.value === "connecting" || r.value === "stopping"
2064
2069
  );
2065
2070
  return y({
2066
2071
  start: async () => {
2067
- await (C == null ? void 0 : C.start());
2072
+ await (w == null ? void 0 : w.start());
2068
2073
  },
2069
- stop: () => C == null ? void 0 : C.stop(),
2070
- cancel: () => C == null ? void 0 : C.cancel(),
2071
- getText: () => u.value + c.value,
2074
+ stop: () => w == null ? void 0 : w.stop(),
2075
+ cancel: () => w == null ? void 0 : w.cancel(),
2076
+ getText: () => c.value + l.value,
2072
2077
  clear: () => {
2073
- u.value = "", c.value = "";
2078
+ c.value = "", l.value = "";
2074
2079
  },
2075
- getStatus: () => (C == null ? void 0 : C.getStatus()) ?? "idle"
2076
- }), (i, w) => (m(), S("div", {
2077
- class: J(["ai-voice-input", e.className]),
2078
- "data-theme": A.value
2080
+ getStatus: () => (w == null ? void 0 : w.getStatus()) ?? "idle"
2081
+ }), (i, f) => (m(), x("div", {
2082
+ class: q(["ai-voice-input", e.className]),
2083
+ "data-theme": S.value
2079
2084
  }, [
2080
2085
  a("div", {
2081
- class: J(["ai-voice-input-display", { "is-empty": P.value }])
2086
+ class: q(["ai-voice-input-display", { "is-empty": L.value }])
2082
2087
  }, [
2083
- u.value ? (m(), S("span", ks, Q(u.value), 1)) : Y("", !0),
2084
- c.value ? (m(), S("span", Cs, Q(c.value), 1)) : Y("", !0),
2085
- v.value === "recording" && !c.value ? (m(), S("span", bs)) : Y("", !0),
2086
- P.value ? (m(), S("span", As, Q(n.value), 1)) : Y("", !0)
2088
+ c.value ? (m(), x("span", ys, G(c.value), 1)) : X("", !0),
2089
+ l.value ? (m(), x("span", ws, G(l.value), 1)) : X("", !0),
2090
+ r.value === "recording" && !l.value ? (m(), x("span", ks)) : X("", !0),
2091
+ L.value ? (m(), x("span", Cs, G(n.value), 1)) : X("", !0)
2087
2092
  ], 2),
2088
2093
  a("button", {
2089
2094
  type: "button",
2090
- class: J(L.value),
2091
- disabled: M.value,
2092
- onClick: $
2095
+ class: q(W.value),
2096
+ disabled: T.value,
2097
+ onClick: P
2093
2098
  }, [
2094
- v.value === "recording" ? (m(), S("span", xs)) : v.value === "connecting" || v.value === "stopping" ? (m(), S("span", Ts, [...w[0] || (w[0] = [
2099
+ r.value === "recording" ? (m(), x("span", As)) : r.value === "connecting" || r.value === "stopping" ? (m(), x("span", Ss, [...f[0] || (f[0] = [
2095
2100
  a("span", null, null, -1),
2096
2101
  a("span", null, null, -1),
2097
2102
  a("span", null, null, -1),
2098
2103
  a("span", null, null, -1),
2099
2104
  a("span", null, null, -1)
2100
- ])])) : (m(), S("svg", Es, [...w[1] || (w[1] = [
2105
+ ])])) : (m(), x("svg", xs, [...f[1] || (f[1] = [
2101
2106
  a("path", { d: "M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3z" }, null, -1),
2102
2107
  a("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)
2103
2108
  ])])),
2104
- a("span", null, Q(W.value), 1)
2105
- ], 10, Ss),
2106
- P.value ? Y("", !0) : (m(), S("button", {
2109
+ a("span", null, G(B.value), 1)
2110
+ ], 10, bs),
2111
+ L.value ? X("", !0) : (m(), x("button", {
2107
2112
  key: 0,
2108
2113
  type: "button",
2109
2114
  class: "ai-voice-input-btn ai-voice-input-clear-btn",
2110
2115
  title: "清空",
2111
- onClick: _
2116
+ onClick: R
2112
2117
  }, " 清空 "))
2113
- ], 10, ws));
2118
+ ], 10, ps));
2114
2119
  }
2115
- }), Ds = (e, y) => {
2116
- const h = e.__vccOpts || e;
2117
- for (const [g, l] of y)
2118
- h[g] = l;
2119
- return h;
2120
- }, Rs = /* @__PURE__ */ Ds(Ms, [["__scopeId", "data-v-53d3cc6e"]]);
2121
- let Qe = null;
2122
- const Os = (e) => {
2123
- Pt(e);
2124
- }, Ws = (e) => {
2125
- const y = e || document.body, h = document.createElement("div");
2126
- h.id = "ai-assist-root";
2127
- const g = Ge();
2128
- rt(g.theme), Cn(), y.appendChild(h), Qe = ln(Ot), Qe.mount(h);
2129
- }, Bs = () => {
2130
- Qe && (Qe.unmount(), Qe = null);
2120
+ }), Es = (e, y) => {
2121
+ const d = e.__vccOpts || e;
2122
+ for (const [h, u] of y)
2123
+ d[h] = u;
2124
+ return d;
2125
+ }, Ms = /* @__PURE__ */ Es(Ts, [["__scopeId", "data-v-53d3cc6e"]]);
2126
+ let Ge = null;
2127
+ const Ps = (e) => {
2128
+ Lt(e);
2129
+ }, Ls = (e) => {
2130
+ const y = e || document.body, d = document.createElement("div");
2131
+ d.id = "ai-assist-root";
2132
+ const h = Qe();
2133
+ vt(h.theme), Cn(), y.appendChild(d), Ge = un(Nt), Ge.mount(d);
2134
+ }, Os = () => {
2135
+ Ge && (Ge.unmount(), Ge = null);
2131
2136
  const e = document.getElementById("ai-assist-root");
2132
2137
  e && e.remove();
2133
2138
  }, Ns = {
2134
2139
  install(e, y) {
2135
- Pt(y), e.component("AiAssist", Ot), e.component("VoiceInput", Rs);
2140
+ Lt(y), e.component("AiAssist", Nt), e.component("VoiceInput", Ms);
2136
2141
  }
2137
2142
  };
2138
2143
  export {
2139
- Ot as AiAssist,
2140
- Rs as VoiceInput,
2144
+ Nt as AiAssist,
2145
+ Ms as VoiceInput,
2141
2146
  Ns as default,
2142
- Os as initAiAssist,
2143
- Ws as mountAiAssist,
2144
- Bs as unmountAiAssist
2147
+ Ps as initAiAssist,
2148
+ Ls as mountAiAssist,
2149
+ Os as unmountAiAssist
2145
2150
  };