@somecat/ai-assist-sdk 1.3.1 → 1.3.3

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