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