@somecat/ai-assist-sdk 1.3.1 → 1.3.2

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