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