@somecat/ai-assist-sdk 1.2.5 → 1.3.0

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