@somecat/ai-assist-sdk 1.2.5 → 1.2.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-BtUB4IU0.mjs +196 -0
- package/dist/core/utils/aurora-physics.d.ts +13 -0
- package/dist/react/index.mjs +826 -823
- package/dist/vue/index.mjs +524 -524
- package/package.json +112 -113
- package/dist/chunks/index-DBik4Gma.mjs +0 -149
package/dist/vue/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { a as ut, r as ct, p as rt, u as
|
|
3
|
-
import { f as
|
|
4
|
-
import { BulbOutlined as
|
|
1
|
+
import { defineComponent as Se, ref as p, watch as ie, nextTick as oe, onUnmounted as ot, openBlock as f, createElementBlock as x, normalizeClass as q, createElementVNode as a, toDisplayString as G, createVNode as K, Transition as an, withCtx as ln, unref as $, createCommentVNode as X, computed as O, reactive as ne, Fragment as Ae, createStaticVNode as un, withModifiers as ae, createBlock as se, renderList as Ne, Teleport as $t, onMounted as fe, onBeforeUnmount as Pt, withDirectives as De, withKeys as lt, vModelText as Lt, normalizeStyle as nt, vShow as Xe, createApp as cn } from "vue";
|
|
2
|
+
import { a as ut, r as ct, p as rt, u as rn, V as st, c as xt, g as vn, s as dn, b as Tt, e as hn, d as gn, f as Ke, h as mn, i as fn, j as pn, k as yn, l as wn, m as vt, w as kn, n as Cn, o as bn, q as Ot } from "../chunks/index-DElfgKrt.mjs";
|
|
3
|
+
import { f as An, s as Oe, a as Nt, b as Sn, c as xn, m as Tn } from "../chunks/index-BtUB4IU0.mjs";
|
|
4
|
+
import { BulbOutlined as En, SearchOutlined as Et, CheckOutlined as Mn, CopyOutlined as Dn, RedoOutlined as Rn, CloseOutlined as Hn } from "@ant-design/icons-vue";
|
|
5
5
|
import { Icon as Z } from "@iconify/vue";
|
|
6
|
-
const
|
|
6
|
+
const _n = "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==", $n = { class: "thinking-block__title" }, Pn = ["innerHTML"], Ln = /* @__PURE__ */ Se({
|
|
7
7
|
__name: "ThinkingBlock",
|
|
8
8
|
props: {
|
|
9
9
|
content: {},
|
|
@@ -28,13 +28,13 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
28
28
|
let w = 0, S = 0;
|
|
29
29
|
function E() {
|
|
30
30
|
if (w) return;
|
|
31
|
-
const T = 80, i = (
|
|
31
|
+
const T = 80, i = (m) => {
|
|
32
32
|
if (S === 0) {
|
|
33
|
-
S =
|
|
33
|
+
S = m, w = requestAnimationFrame(i);
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
const g = Math.min(
|
|
37
|
-
S =
|
|
36
|
+
const g = Math.min(m - S, 100);
|
|
37
|
+
S = m;
|
|
38
38
|
const o = y.content;
|
|
39
39
|
if (o.length - r.value > 0) {
|
|
40
40
|
C.value += T * g / 1e3;
|
|
@@ -56,7 +56,7 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
56
56
|
function P() {
|
|
57
57
|
D(), l.value = y.content, r.value = y.content.length, C.value = 0;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
ie(
|
|
60
60
|
() => y.content,
|
|
61
61
|
() => {
|
|
62
62
|
if (y.messageDone) {
|
|
@@ -65,13 +65,13 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
65
65
|
}
|
|
66
66
|
y.isStreaming && r.value > y.content.length && (r.value = 0, C.value = 0, l.value = ""), y.content.length > r.value && E();
|
|
67
67
|
}
|
|
68
|
-
),
|
|
68
|
+
), ie(
|
|
69
69
|
() => y.isStreaming,
|
|
70
70
|
(T) => {
|
|
71
71
|
T ? (k(), d.value = !0, E()) : y.messageDone || u();
|
|
72
72
|
},
|
|
73
73
|
{ immediate: !0 }
|
|
74
|
-
),
|
|
74
|
+
), ie(
|
|
75
75
|
() => y.messageDone,
|
|
76
76
|
(T) => {
|
|
77
77
|
T && (k(), P(), d.value = !0);
|
|
@@ -92,11 +92,11 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
92
92
|
function W() {
|
|
93
93
|
y.isStreaming && B();
|
|
94
94
|
}
|
|
95
|
-
return
|
|
96
|
-
y.isStreaming &&
|
|
97
|
-
}),
|
|
95
|
+
return ie(l, () => {
|
|
96
|
+
y.isStreaming && oe(B);
|
|
97
|
+
}), ot(() => {
|
|
98
98
|
k(), D();
|
|
99
|
-
}), (T, i) => (
|
|
99
|
+
}), (T, i) => (f(), x("div", {
|
|
100
100
|
class: q(["thinking-block", {
|
|
101
101
|
"thinking-block--expanded": d.value,
|
|
102
102
|
"thinking-block--active": e.isStreaming
|
|
@@ -107,8 +107,8 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
107
107
|
onClick: c
|
|
108
108
|
}, [
|
|
109
109
|
i[1] || (i[1] = a("span", { class: "thinking-block__indicator" }, null, -1)),
|
|
110
|
-
a("span",
|
|
111
|
-
(
|
|
110
|
+
a("span", $n, G(e.isStreaming ? "深度思考中" : "深度思考"), 1),
|
|
111
|
+
(f(), x("svg", {
|
|
112
112
|
class: q(["thinking-block__arrow", { "thinking-block__arrow--down": d.value }]),
|
|
113
113
|
viewBox: "0 0 24 24",
|
|
114
114
|
width: "14",
|
|
@@ -122,12 +122,12 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
122
122
|
a("polyline", { points: "6 9 12 15 18 9" }, null, -1)
|
|
123
123
|
])], 2))
|
|
124
124
|
]),
|
|
125
|
-
K(
|
|
125
|
+
K(an, {
|
|
126
126
|
name: "thinking-expand",
|
|
127
127
|
onAfterEnter: W
|
|
128
128
|
}, {
|
|
129
|
-
default:
|
|
130
|
-
d.value ? (
|
|
129
|
+
default: ln(() => [
|
|
130
|
+
d.value ? (f(), x("div", {
|
|
131
131
|
key: 0,
|
|
132
132
|
ref_key: "contentRef",
|
|
133
133
|
ref: R,
|
|
@@ -137,38 +137,38 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
137
137
|
a("div", {
|
|
138
138
|
class: "thinking-block__markdown",
|
|
139
139
|
innerHTML: $(ut)($(ct)($(rt)(l.value)), e.isStreaming)
|
|
140
|
-
}, null, 8,
|
|
140
|
+
}, null, 8, Pn)
|
|
141
141
|
], 544)) : X("", !0)
|
|
142
142
|
]),
|
|
143
143
|
_: 1
|
|
144
144
|
})
|
|
145
145
|
], 2));
|
|
146
146
|
}
|
|
147
|
-
}),
|
|
147
|
+
}), On = {
|
|
148
148
|
key: 0,
|
|
149
149
|
class: "message-content ba-markdown"
|
|
150
|
-
},
|
|
150
|
+
}, Nn = { class: "thought-collapse-bar__text" }, Wn = {
|
|
151
151
|
key: 2,
|
|
152
152
|
class: "thought-collapse-bar__duration"
|
|
153
|
-
},
|
|
153
|
+
}, Bn = { class: "thought-collapse-bar__action" }, Yn = { class: "agent-thought__spinner" }, Vn = { class: "agent-thought__text" }, Xn = {
|
|
154
154
|
key: 0,
|
|
155
155
|
class: "agent-thought__duration"
|
|
156
|
-
},
|
|
156
|
+
}, Fn = {
|
|
157
157
|
key: 1,
|
|
158
158
|
class: "agent-thought__duration"
|
|
159
|
-
},
|
|
159
|
+
}, Gn = { key: 0 }, Qn = ["innerHTML"], Kn = ["innerHTML"], In = {
|
|
160
160
|
key: 3,
|
|
161
161
|
class: "message-error"
|
|
162
|
-
},
|
|
162
|
+
}, qn = {
|
|
163
163
|
key: 4,
|
|
164
164
|
class: "message-toolbar"
|
|
165
|
-
},
|
|
165
|
+
}, Jn = ["data-tooltip"], zn = {
|
|
166
166
|
class: "tooltip-enhanced",
|
|
167
167
|
"data-tooltip": "重新回答"
|
|
168
|
-
},
|
|
168
|
+
}, Un = {
|
|
169
169
|
key: 1,
|
|
170
170
|
class: "message-content"
|
|
171
|
-
},
|
|
171
|
+
}, jn = ["src"], Zn = /* @__PURE__ */ Se({
|
|
172
172
|
__name: "MessageItem",
|
|
173
173
|
props: {
|
|
174
174
|
msg: {},
|
|
@@ -183,7 +183,7 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
183
183
|
const d = e, h = O(
|
|
184
184
|
() => d.msg.status === d.STATUS.COMPLETED || d.msg.status === d.STATUS.STOP
|
|
185
185
|
), u = p(!1);
|
|
186
|
-
|
|
186
|
+
ie(h, (o) => {
|
|
187
187
|
o && (u.value = !1);
|
|
188
188
|
});
|
|
189
189
|
const k = O(() => {
|
|
@@ -211,12 +211,12 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
211
211
|
function B(o) {
|
|
212
212
|
return o == null || o <= 0 ? "" : o < 1 ? `${Math.round(o * 1e3)}ms` : o < 60 ? `${o.toFixed(1)}s` : `${Math.floor(o / 60)}m${Math.round(o % 60)}s`;
|
|
213
213
|
}
|
|
214
|
-
const W =
|
|
214
|
+
const W = ne(/* @__PURE__ */ new Map()), T = p("");
|
|
215
215
|
function i(o) {
|
|
216
216
|
const s = o.target;
|
|
217
217
|
s.tagName === "IMG" && (T.value = s.src);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function m() {
|
|
220
220
|
T.value = "";
|
|
221
221
|
}
|
|
222
222
|
function g(o, s) {
|
|
@@ -225,7 +225,7 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
225
225
|
let b = o.content;
|
|
226
226
|
if (!b && ((A = o.segments) != null && A.length) && (b = o.segments.filter((_) => _.type !== "thinking" && _.type !== "agent_thought").map((_) => _.content).join(`
|
|
227
227
|
`)), b) {
|
|
228
|
-
const { copy: _ } =
|
|
228
|
+
const { copy: _ } = rn();
|
|
229
229
|
_(b), W.set(s, !0), setTimeout(() => W.set(s, !1), 2e3);
|
|
230
230
|
}
|
|
231
231
|
} catch {
|
|
@@ -233,35 +233,35 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
233
233
|
}
|
|
234
234
|
return (o, s) => {
|
|
235
235
|
var A;
|
|
236
|
-
return
|
|
236
|
+
return f(), x("div", {
|
|
237
237
|
class: q(["message", `${e.msg.type}-message`])
|
|
238
238
|
}, [
|
|
239
|
-
e.msg.type === "ai" ? (
|
|
240
|
-
(e.msg.status === e.STATUS.THINKING || e.msg.status === e.STATUS.RETHINKING) && !e.msg.thinkingContent && !e.msg.content ? (
|
|
241
|
-
|
|
239
|
+
e.msg.type === "ai" ? (f(), x(Ae, { key: 0 }, [
|
|
240
|
+
(e.msg.status === e.STATUS.THINKING || e.msg.status === e.STATUS.RETHINKING) && !e.msg.thinkingContent && !e.msg.content ? (f(), x("div", On, [...s[4] || (s[4] = [
|
|
241
|
+
un('<div class="scale-animation-container"><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span></div>', 1)
|
|
242
242
|
])])) : X("", !0),
|
|
243
|
-
e.msg.segments && e.msg.segments.length ? (
|
|
243
|
+
e.msg.segments && e.msg.segments.length ? (f(), x("div", {
|
|
244
244
|
key: 1,
|
|
245
245
|
class: "message-content ba-markdown",
|
|
246
246
|
ref: (b) => e.setMessageRef(b, e.index),
|
|
247
247
|
onClick: i
|
|
248
248
|
}, [
|
|
249
|
-
h.value && D.value ? (
|
|
249
|
+
h.value && D.value ? (f(), x("div", {
|
|
250
250
|
key: 0,
|
|
251
251
|
class: q(["thought-collapse-bar", { "thought-collapse-bar--expanded": u.value }]),
|
|
252
|
-
onClick: s[0] || (s[0] =
|
|
252
|
+
onClick: s[0] || (s[0] = ae((b) => u.value = !u.value, ["stop"]))
|
|
253
253
|
}, [
|
|
254
|
-
P.value ? (
|
|
254
|
+
P.value ? (f(), se($(En), {
|
|
255
255
|
key: 0,
|
|
256
256
|
class: "thought-collapse-bar__icon"
|
|
257
|
-
})) : (
|
|
257
|
+
})) : (f(), se($(Et), {
|
|
258
258
|
key: 1,
|
|
259
259
|
class: "thought-collapse-bar__icon"
|
|
260
260
|
})),
|
|
261
|
-
a("span",
|
|
262
|
-
n.value > 0 ? (
|
|
263
|
-
a("span",
|
|
264
|
-
(
|
|
261
|
+
a("span", Nn, G(R.value), 1),
|
|
262
|
+
n.value > 0 ? (f(), x("span", Wn, G(B(n.value)), 1)) : X("", !0),
|
|
263
|
+
a("span", Bn, G(u.value ? "收起" : "查看"), 1),
|
|
264
|
+
(f(), x("svg", {
|
|
265
265
|
class: q(["thought-collapse-bar__arrow", { "thought-collapse-bar__arrow--down": u.value }]),
|
|
266
266
|
viewBox: "0 0 24 24",
|
|
267
267
|
width: "12",
|
|
@@ -275,35 +275,35 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
275
275
|
a("polyline", { points: "6 9 12 15 18 9" }, null, -1)
|
|
276
276
|
])], 2))
|
|
277
277
|
], 2)) : X("", !0),
|
|
278
|
-
P.value && L.value ? (
|
|
278
|
+
P.value && L.value ? (f(), se(Ln, {
|
|
279
279
|
key: 1,
|
|
280
280
|
content: c.value,
|
|
281
281
|
"is-streaming": l.value,
|
|
282
282
|
"message-done": h.value
|
|
283
283
|
}, null, 8, ["content", "is-streaming", "message-done"])) : X("", !0),
|
|
284
|
-
C.value.length && L.value ? (
|
|
284
|
+
C.value.length && L.value ? (f(), x("div", {
|
|
285
285
|
key: 2,
|
|
286
286
|
class: q(["agent-thought", { "agent-thought--done": !w.value }])
|
|
287
287
|
}, [
|
|
288
|
-
a("span",
|
|
289
|
-
K($(
|
|
288
|
+
a("span", Yn, [
|
|
289
|
+
K($(Et))
|
|
290
290
|
]),
|
|
291
|
-
a("span",
|
|
292
|
-
!w.value && C.value.length > 1 ? (
|
|
293
|
-
!w.value && S.value > 0 ? (
|
|
291
|
+
a("span", Vn, G(w.value ? "工具调用中" : "工具调用"), 1),
|
|
292
|
+
!w.value && C.value.length > 1 ? (f(), x("span", Xn, " 已调用 " + G(C.value.length) + " 次 ", 1)) : X("", !0),
|
|
293
|
+
!w.value && S.value > 0 ? (f(), x("span", Fn, G(B(S.value)), 1)) : X("", !0)
|
|
294
294
|
], 2)) : X("", !0),
|
|
295
|
-
(
|
|
296
|
-
b.type === "answer" ? (
|
|
295
|
+
(f(!0), x(Ae, null, Ne(e.msg.segments, (b, _) => (f(), x(Ae, { key: _ }, [
|
|
296
|
+
b.type === "answer" ? (f(), x("div", Gn, [
|
|
297
297
|
a("div", {
|
|
298
298
|
innerHTML: $(ut)(
|
|
299
299
|
$(ct)($(rt)(e.getSegmentDisplayContent(e.index, _, b, e.msg))),
|
|
300
300
|
e.msg.status === e.STATUS.ANSWERING && _ === r.value
|
|
301
301
|
)
|
|
302
|
-
}, null, 8,
|
|
302
|
+
}, null, 8, Qn)
|
|
303
303
|
])) : X("", !0)
|
|
304
304
|
], 64))), 128))
|
|
305
305
|
], 512)) : X("", !0),
|
|
306
|
-
!((A = e.msg.segments) != null && A.length) && e.msg.content ? (
|
|
306
|
+
!((A = e.msg.segments) != null && A.length) && e.msg.content ? (f(), x("div", {
|
|
307
307
|
key: 2,
|
|
308
308
|
class: "message-content ba-markdown",
|
|
309
309
|
ref: (b) => e.setMessageRef(b, e.index),
|
|
@@ -314,81 +314,81 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
314
314
|
$(ct)($(rt)(e.displayedContent.get(e.index) ?? e.msg.content)),
|
|
315
315
|
e.msg.status === e.STATUS.ANSWERING
|
|
316
316
|
)
|
|
317
|
-
}, null, 8,
|
|
317
|
+
}, null, 8, Kn)
|
|
318
318
|
], 512)) : X("", !0),
|
|
319
|
-
e.msg.errorMessage ? (
|
|
319
|
+
e.msg.errorMessage ? (f(), x("div", In, [
|
|
320
320
|
s[6] || (s[6] = a("span", { class: "message-error__icon" }, "⚠️", -1)),
|
|
321
321
|
a("span", null, G(e.msg.errorMessage), 1)
|
|
322
322
|
])) : X("", !0),
|
|
323
|
-
e.msg.status === e.STATUS.COMPLETED || e.msg.status === e.STATUS.STOP ? (
|
|
323
|
+
e.msg.status === e.STATUS.COMPLETED || e.msg.status === e.STATUS.STOP ? (f(), x("div", qn, [
|
|
324
324
|
a("div", {
|
|
325
325
|
class: "tooltip-enhanced",
|
|
326
326
|
"data-tooltip": W.get(e.index) ? "已复制" : "复制回答"
|
|
327
327
|
}, [
|
|
328
|
-
W.get(e.index) ? (
|
|
328
|
+
W.get(e.index) ? (f(), se($(Mn), {
|
|
329
329
|
key: 0,
|
|
330
330
|
class: "message-toolbar__check"
|
|
331
|
-
})) : (
|
|
331
|
+
})) : (f(), se($(Dn), {
|
|
332
332
|
key: 1,
|
|
333
333
|
onClick: s[1] || (s[1] = (b) => g(e.msg, e.index))
|
|
334
334
|
}))
|
|
335
|
-
], 8,
|
|
336
|
-
a("div",
|
|
337
|
-
K($(
|
|
335
|
+
], 8, Jn),
|
|
336
|
+
a("div", zn, [
|
|
337
|
+
K($(Rn), {
|
|
338
338
|
onClick: s[2] || (s[2] = (b) => o.$emit("regenerate"))
|
|
339
339
|
})
|
|
340
340
|
])
|
|
341
341
|
])) : X("", !0)
|
|
342
|
-
], 64)) : (
|
|
343
|
-
(
|
|
344
|
-
T.value ? (
|
|
342
|
+
], 64)) : (f(), x("div", Un, G(e.msg.content), 1)),
|
|
343
|
+
(f(), se($t, { to: "#ai-assist-root" }, [
|
|
344
|
+
T.value ? (f(), x("div", {
|
|
345
345
|
key: 0,
|
|
346
346
|
class: "ai-image-preview-overlay",
|
|
347
|
-
onClick:
|
|
347
|
+
onClick: m
|
|
348
348
|
}, [
|
|
349
349
|
a("img", {
|
|
350
350
|
src: T.value,
|
|
351
351
|
class: "ai-image-preview-overlay__img",
|
|
352
|
-
onClick: s[3] || (s[3] =
|
|
352
|
+
onClick: s[3] || (s[3] = ae(() => {
|
|
353
353
|
}, ["stop"]))
|
|
354
|
-
}, null, 8,
|
|
354
|
+
}, null, 8, jn),
|
|
355
355
|
a("button", {
|
|
356
356
|
class: "ai-image-preview-overlay__close",
|
|
357
|
-
onClick:
|
|
357
|
+
onClick: ae(m, ["stop"])
|
|
358
358
|
}, [
|
|
359
|
-
K($(
|
|
359
|
+
K($(Hn))
|
|
360
360
|
])
|
|
361
361
|
])) : X("", !0)
|
|
362
362
|
]))
|
|
363
363
|
], 2);
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
}),
|
|
366
|
+
}), eo = {
|
|
367
367
|
key: 0,
|
|
368
368
|
class: "input-container voice-mode"
|
|
369
|
-
},
|
|
369
|
+
}, to = {
|
|
370
370
|
key: 0,
|
|
371
371
|
class: "final"
|
|
372
|
-
},
|
|
372
|
+
}, no = {
|
|
373
373
|
key: 1,
|
|
374
374
|
class: "interim"
|
|
375
|
-
},
|
|
375
|
+
}, oo = {
|
|
376
376
|
key: 2,
|
|
377
377
|
class: "placeholder"
|
|
378
|
-
},
|
|
378
|
+
}, so = ["onKeydown"], ao = ["data-tooltip"], io = {
|
|
379
379
|
key: 2,
|
|
380
380
|
class: "moveTB"
|
|
381
|
-
},
|
|
381
|
+
}, lo = {
|
|
382
382
|
key: 1,
|
|
383
383
|
class: "input-container"
|
|
384
|
-
},
|
|
384
|
+
}, uo = ["value", "disabled"], co = {
|
|
385
385
|
key: 0,
|
|
386
386
|
class: "tooltip-enhanced stop",
|
|
387
387
|
"data-tooltip": "停止生成"
|
|
388
|
-
},
|
|
388
|
+
}, ro = ["data-tooltip"], vo = {
|
|
389
389
|
key: 3,
|
|
390
390
|
class: "moveTB"
|
|
391
|
-
},
|
|
391
|
+
}, ho = /* @__PURE__ */ Se({
|
|
392
392
|
__name: "ChatInput",
|
|
393
393
|
props: {
|
|
394
394
|
modelValue: {},
|
|
@@ -408,10 +408,10 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
408
408
|
), R = O(() => u.value && !P.value), L = O(
|
|
409
409
|
() => R.value ? !!r.value.trim() : !!(k.value.trim() || c.value.trim())
|
|
410
410
|
), n = O(
|
|
411
|
-
() =>
|
|
411
|
+
() => st.isSupported() && !d.modelValue.trim() && !d.isGenerating
|
|
412
412
|
);
|
|
413
413
|
function B() {
|
|
414
|
-
S = new
|
|
414
|
+
S = new st({}, {
|
|
415
415
|
onStatusChange: (g) => {
|
|
416
416
|
l.value = g;
|
|
417
417
|
},
|
|
@@ -426,14 +426,14 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
|
|
429
|
+
fe(B), Pt(() => {
|
|
430
430
|
S == null || S.destroy(), S = null;
|
|
431
|
-
}),
|
|
432
|
-
|
|
431
|
+
}), ie([k, c], () => {
|
|
432
|
+
oe(() => {
|
|
433
433
|
C.value && (C.value.scrollTop = C.value.scrollHeight);
|
|
434
434
|
});
|
|
435
|
-
}),
|
|
436
|
-
g === "idle" && u.value && (r.value = (k.value + c.value).trim(),
|
|
435
|
+
}), ie(l, (g) => {
|
|
436
|
+
g === "idle" && u.value && (r.value = (k.value + c.value).trim(), oe(() => {
|
|
437
437
|
var o;
|
|
438
438
|
return (o = w.value) == null ? void 0 : o.focus();
|
|
439
439
|
}));
|
|
@@ -454,25 +454,25 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
454
454
|
function i() {
|
|
455
455
|
S == null || S.cancel(), u.value = !1, k.value = "", c.value = "", r.value = "";
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function m() {
|
|
458
458
|
const g = (R.value ? r.value : k.value + c.value).trim();
|
|
459
459
|
g && (S == null || S.stop(), u.value = !1, h("update:modelValue", g), setTimeout(() => h("send"), 0));
|
|
460
460
|
}
|
|
461
|
-
return (g, o) => u.value ? (
|
|
461
|
+
return (g, o) => u.value ? (f(), x("div", eo, [
|
|
462
462
|
a("div", {
|
|
463
463
|
class: q(["voice-visual", { recording: D.value }])
|
|
464
464
|
}, null, 2),
|
|
465
|
-
P.value ? (
|
|
465
|
+
P.value ? (f(), x("div", {
|
|
466
466
|
key: 0,
|
|
467
467
|
class: "voice-text",
|
|
468
468
|
ref_key: "voiceTextEl",
|
|
469
469
|
ref: C,
|
|
470
470
|
onClick: W
|
|
471
471
|
}, [
|
|
472
|
-
k.value ? (
|
|
473
|
-
c.value ? (
|
|
474
|
-
!k.value && !c.value ? (
|
|
475
|
-
], 512)) : De((
|
|
472
|
+
k.value ? (f(), x("span", to, G(k.value), 1)) : X("", !0),
|
|
473
|
+
c.value ? (f(), x("span", no, G(c.value), 1)) : X("", !0),
|
|
474
|
+
!k.value && !c.value ? (f(), x("span", oo, G(E.value ? "启动中…" : "正在聆听…"), 1)) : X("", !0)
|
|
475
|
+
], 512)) : De((f(), x("input", {
|
|
476
476
|
key: 1,
|
|
477
477
|
ref_key: "editorEl",
|
|
478
478
|
ref: w,
|
|
@@ -480,10 +480,10 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
480
480
|
type: "text",
|
|
481
481
|
class: "voice-editor",
|
|
482
482
|
placeholder: "识别结果,可点击直接修改…",
|
|
483
|
-
onKeydown: lt(
|
|
484
|
-
onKeyup: o[1] || (o[1] = lt((s) => L.value &&
|
|
485
|
-
}, null, 40,
|
|
486
|
-
[
|
|
483
|
+
onKeydown: lt(ae(i, ["prevent"]), ["esc"]),
|
|
484
|
+
onKeyup: o[1] || (o[1] = lt((s) => L.value && m(), ["enter"]))
|
|
485
|
+
}, null, 40, so)), [
|
|
486
|
+
[Lt, r.value]
|
|
487
487
|
]),
|
|
488
488
|
a("div", {
|
|
489
489
|
class: "tooltip-enhanced voice-close",
|
|
@@ -498,21 +498,21 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
498
498
|
a("div", {
|
|
499
499
|
class: q(["tooltip-enhanced voice-send", { disabled: !L.value }]),
|
|
500
500
|
"data-tooltip": L.value ? "发送" : "未识别到文字",
|
|
501
|
-
onClick: o[2] || (o[2] = (s) => L.value &&
|
|
501
|
+
onClick: o[2] || (o[2] = (s) => L.value && m())
|
|
502
502
|
}, [
|
|
503
503
|
K($(Z), {
|
|
504
504
|
class: "op-icon",
|
|
505
505
|
icon: "fluent-color:send-16"
|
|
506
506
|
})
|
|
507
|
-
], 10,
|
|
508
|
-
e.hasScroll && !e.isAtBottom ? (
|
|
507
|
+
], 10, ao),
|
|
508
|
+
e.hasScroll && !e.isAtBottom ? (f(), x("div", io, [
|
|
509
509
|
K($(Z), {
|
|
510
510
|
class: "op-icon",
|
|
511
511
|
icon: "ep:bottom",
|
|
512
512
|
onClick: o[3] || (o[3] = (s) => g.$emit("scroll-to-bottom"))
|
|
513
513
|
})
|
|
514
514
|
])) : X("", !0)
|
|
515
|
-
])) : (
|
|
515
|
+
])) : (f(), x("div", lo, [
|
|
516
516
|
a("input", {
|
|
517
517
|
value: e.modelValue,
|
|
518
518
|
type: "text",
|
|
@@ -520,14 +520,14 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
520
520
|
onInput: o[4] || (o[4] = (s) => g.$emit("update:modelValue", s.target.value)),
|
|
521
521
|
onKeyup: o[5] || (o[5] = lt((s) => e.modelValue.trim() && g.$emit("send"), ["enter"])),
|
|
522
522
|
disabled: e.isGenerating
|
|
523
|
-
}, null, 40,
|
|
524
|
-
e.isGenerating && e.lastUserMessage ? (
|
|
523
|
+
}, null, 40, uo),
|
|
524
|
+
e.isGenerating && e.lastUserMessage ? (f(), x("div", co, [
|
|
525
525
|
K($(Z), {
|
|
526
526
|
class: "op-icon stop-icon",
|
|
527
527
|
icon: "heroicons-solid:stop",
|
|
528
528
|
onClick: o[6] || (o[6] = (s) => g.$emit("stop"))
|
|
529
529
|
})
|
|
530
|
-
])) : n.value ? (
|
|
530
|
+
])) : n.value ? (f(), x("div", {
|
|
531
531
|
key: 1,
|
|
532
532
|
class: "tooltip-enhanced send voice",
|
|
533
533
|
"data-tooltip": "语音输入",
|
|
@@ -537,7 +537,7 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
537
537
|
class: "op-icon",
|
|
538
538
|
icon: "mingcute:voice-line"
|
|
539
539
|
})
|
|
540
|
-
])) : (
|
|
540
|
+
])) : (f(), x("div", {
|
|
541
541
|
key: 2,
|
|
542
542
|
class: q(["tooltip-enhanced send", { disabled: !e.modelValue.trim() }]),
|
|
543
543
|
"data-tooltip": e.modelValue.trim() ? "开始回答" : "请输入你的问题"
|
|
@@ -547,8 +547,8 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
547
547
|
icon: "fluent-color:send-16",
|
|
548
548
|
onClick: o[7] || (o[7] = (s) => e.modelValue.trim() && g.$emit("send"))
|
|
549
549
|
})
|
|
550
|
-
], 10,
|
|
551
|
-
e.hasScroll && !e.isAtBottom ? (
|
|
550
|
+
], 10, ro)),
|
|
551
|
+
e.hasScroll && !e.isAtBottom ? (f(), x("div", vo, [
|
|
552
552
|
K($(Z), {
|
|
553
553
|
class: "op-icon",
|
|
554
554
|
icon: "ep:bottom",
|
|
@@ -558,7 +558,7 @@ const Rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
558
558
|
]));
|
|
559
559
|
}
|
|
560
560
|
});
|
|
561
|
-
function
|
|
561
|
+
function go(e) {
|
|
562
562
|
const y = p(!0), d = p(!1);
|
|
563
563
|
function h(c) {
|
|
564
564
|
const l = c.closest(".chat-wrap") || c, r = c.scrollHeight, C = c.clientHeight;
|
|
@@ -570,7 +570,7 @@ function vo(e) {
|
|
|
570
570
|
l.style.setProperty("--ai-thumb-height", `${w}px`), l.style.setProperty("--ai-thumb-top", `${E * S}px`);
|
|
571
571
|
}
|
|
572
572
|
function u() {
|
|
573
|
-
|
|
573
|
+
oe(() => {
|
|
574
574
|
e.value && (e.value.scrollTop = e.value.scrollHeight);
|
|
575
575
|
});
|
|
576
576
|
}
|
|
@@ -581,7 +581,7 @@ function vo(e) {
|
|
|
581
581
|
}
|
|
582
582
|
return { isAtBottom: y, hasScroll: d, scrollToBottom: u, checkScrollStatus: k };
|
|
583
583
|
}
|
|
584
|
-
function
|
|
584
|
+
function mo() {
|
|
585
585
|
function e(y) {
|
|
586
586
|
y.querySelectorAll("pre").forEach((h) => {
|
|
587
587
|
if (h.querySelector(".copy-button")) return;
|
|
@@ -604,7 +604,7 @@ function ho() {
|
|
|
604
604
|
}
|
|
605
605
|
return { enhanceCodeBlocks: e };
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function fo(e) {
|
|
608
608
|
let y = null, d = 0;
|
|
609
609
|
function h(k) {
|
|
610
610
|
y = k(y || [...e.value]), d || (d = requestAnimationFrame(() => {
|
|
@@ -616,8 +616,8 @@ function go(e) {
|
|
|
616
616
|
}
|
|
617
617
|
return { batchMessagesUpdate: h, flushMessagesBatch: u };
|
|
618
618
|
}
|
|
619
|
-
function
|
|
620
|
-
const h = /* @__PURE__ */ new Set([d.ANSWERING, d.THINKING, d.RETHINKING]), u =
|
|
619
|
+
function po(e, y, d) {
|
|
620
|
+
const h = /* @__PURE__ */ new Set([d.ANSWERING, d.THINKING, d.RETHINKING]), u = ne(/* @__PURE__ */ new Map()), k = p(/* @__PURE__ */ new Map()), c = p(/* @__PURE__ */ new Map());
|
|
621
621
|
let l = 0, r = 0;
|
|
622
622
|
function C() {
|
|
623
623
|
if (l) return;
|
|
@@ -631,14 +631,14 @@ function mo(e, y, d) {
|
|
|
631
631
|
let B = !1;
|
|
632
632
|
if (e.value.forEach((T, i) => {
|
|
633
633
|
if (T.type !== "ai" || !h.has(T.status)) return;
|
|
634
|
-
const
|
|
634
|
+
const m = T.content, g = k.value.get(i) ?? 0, o = m.length - g;
|
|
635
635
|
if (o > 0) {
|
|
636
636
|
B = !0;
|
|
637
637
|
const s = Math.min(D + o, P), A = (c.value.get(i) ?? 0) + s * n / 1e3, b = Math.floor(A);
|
|
638
638
|
if (b > 0) {
|
|
639
639
|
c.value.set(i, A - b);
|
|
640
|
-
const _ = Math.min(g + b,
|
|
641
|
-
k.value.set(i, _), u.set(i,
|
|
640
|
+
const _ = Math.min(g + b, m.length);
|
|
641
|
+
k.value.set(i, _), u.set(i, m.slice(0, _));
|
|
642
642
|
} else
|
|
643
643
|
c.value.set(i, A);
|
|
644
644
|
} else
|
|
@@ -673,7 +673,7 @@ function mo(e, y, d) {
|
|
|
673
673
|
}
|
|
674
674
|
return { displayedContent: u, streamingIndexRef: k, startTypewriter: C, flushTypewriter: w, getSegmentDisplayContent: E, stopTypewriter: S };
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function yo({
|
|
677
677
|
messages: e,
|
|
678
678
|
isGenerating: y,
|
|
679
679
|
lastUserMessage: d,
|
|
@@ -706,7 +706,7 @@ function fo({
|
|
|
706
706
|
const i = [...T];
|
|
707
707
|
return i[R] = {
|
|
708
708
|
...i[R],
|
|
709
|
-
segments: L.map((
|
|
709
|
+
segments: L.map((m) => ({ ...m })),
|
|
710
710
|
thinkingDuration: (i[R].thinkingDuration || 0) + B
|
|
711
711
|
}, i;
|
|
712
712
|
}
|
|
@@ -717,7 +717,7 @@ function fo({
|
|
|
717
717
|
S.value = !1, l.value.set(n, []), y.value = !0;
|
|
718
718
|
try {
|
|
719
719
|
const T = c.baseUrl.replace(/\/+$/, "") + "/" + R.replace(/^\/+/, "");
|
|
720
|
-
await
|
|
720
|
+
await An(T, {
|
|
721
721
|
method: "POST",
|
|
722
722
|
headers: {
|
|
723
723
|
"Content-Type": "application/json",
|
|
@@ -730,7 +730,7 @@ function fo({
|
|
|
730
730
|
i.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", i.status, i.statusText);
|
|
731
731
|
},
|
|
732
732
|
onmessage(i) {
|
|
733
|
-
var
|
|
733
|
+
var m;
|
|
734
734
|
try {
|
|
735
735
|
let g = i.data || "";
|
|
736
736
|
for (; g.startsWith("data:"); )
|
|
@@ -833,7 +833,7 @@ function fo({
|
|
|
833
833
|
const J = [...N];
|
|
834
834
|
return J[n] = {
|
|
835
835
|
...J[n],
|
|
836
|
-
segments: b.map((
|
|
836
|
+
segments: b.map((ce) => ({ ...ce })),
|
|
837
837
|
content: H,
|
|
838
838
|
status: S.value ? k.STOP : k.ANSWERING
|
|
839
839
|
}, J;
|
|
@@ -861,7 +861,7 @@ function fo({
|
|
|
861
861
|
break;
|
|
862
862
|
}
|
|
863
863
|
case "message_replace": {
|
|
864
|
-
const s = o.answer || "", A = l.value.get(n) || [], b = (
|
|
864
|
+
const s = o.answer || "", A = l.value.get(n) || [], b = (m = A.map((_, H) => ({ s: _, i: H })).reverse().find((_) => _.s.type === "answer")) == null ? void 0 : m.i;
|
|
865
865
|
b != null ? A[b] = { ...A[b], content: s } : A.push({ type: "answer", content: s }), l.value.set(n, A), h((_) => {
|
|
866
866
|
if (_[n]) {
|
|
867
867
|
const H = [..._];
|
|
@@ -899,18 +899,18 @@ function fo({
|
|
|
899
899
|
},
|
|
900
900
|
onclose() {
|
|
901
901
|
u(), D(n), u();
|
|
902
|
-
const
|
|
902
|
+
const m = (l.value.get(n) || []).filter((o) => o.type === "answer").map((o) => o.content).join(""), g = [...e.value];
|
|
903
903
|
g[n] && g[n].status !== k.ERROR && (g[n] = {
|
|
904
904
|
...g[n],
|
|
905
|
-
content: S.value && !
|
|
905
|
+
content: S.value && !m ? "已停止回答" : m,
|
|
906
906
|
status: S.value ? k.STOP : k.COMPLETED
|
|
907
907
|
}), e.value = g, y.value = !1;
|
|
908
908
|
},
|
|
909
909
|
onerror(i) {
|
|
910
910
|
console.error("[ai-assist-sdk] ❌ 连接错误:", i), u();
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
⚠️ 请求异常,已终止`, status: k.ERROR }), e.value =
|
|
911
|
+
const m = [...e.value];
|
|
912
|
+
m[n] && (m[n] = { ...m[n], content: `
|
|
913
|
+
⚠️ 请求异常,已终止`, status: k.ERROR }), e.value = m, y.value = !1;
|
|
914
914
|
}
|
|
915
915
|
});
|
|
916
916
|
} catch (T) {
|
|
@@ -923,7 +923,7 @@ function fo({
|
|
|
923
923
|
}
|
|
924
924
|
return { doStreamRequest: P, issTop: S };
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function Mt(e) {
|
|
927
927
|
var y;
|
|
928
928
|
if (e && typeof e == "object" && typeof e.data == "string" && (e = e.data), typeof e == "string") {
|
|
929
929
|
const d = e.split(`
|
|
@@ -942,10 +942,10 @@ function Et(e) {
|
|
|
942
942
|
}
|
|
943
943
|
return (e == null ? void 0 : e.answer) || ((y = e == null ? void 0 : e.data) == null ? void 0 : y.answer) || String(e || "");
|
|
944
944
|
}
|
|
945
|
-
function
|
|
945
|
+
function wo(e) {
|
|
946
946
|
return e.queryAgainStreamApi || e.queryAgainApi || e.chatQueryStreamApi || e.chatQueryApi;
|
|
947
947
|
}
|
|
948
|
-
function
|
|
948
|
+
function ko({
|
|
949
949
|
messages: e,
|
|
950
950
|
userInput: y,
|
|
951
951
|
isGenerating: d,
|
|
@@ -958,17 +958,17 @@ function yo({
|
|
|
958
958
|
cfg: C,
|
|
959
959
|
onTitleGenerated: w
|
|
960
960
|
}) {
|
|
961
|
-
const S = C.apis, E =
|
|
961
|
+
const S = C.apis, E = ne({
|
|
962
962
|
first: new AbortController(),
|
|
963
963
|
again: new AbortController()
|
|
964
964
|
}), D = p(!1);
|
|
965
|
-
async function P(i,
|
|
965
|
+
async function P(i, m) {
|
|
966
966
|
var o;
|
|
967
967
|
if (!C.titleGenerateApp || !S.updateConversationApi || D.value) return;
|
|
968
968
|
let g = u.value;
|
|
969
969
|
if (!g)
|
|
970
970
|
try {
|
|
971
|
-
const s = await
|
|
971
|
+
const s = await xt(S);
|
|
972
972
|
(o = s == null ? void 0 : s.conversation) != null && o.appConversationID && (g = s.conversation.appConversationID, u.value = g);
|
|
973
973
|
} catch (s) {
|
|
974
974
|
console.error("[ai-assist-sdk] 创建会话失败:", s);
|
|
@@ -976,14 +976,14 @@ function yo({
|
|
|
976
976
|
}
|
|
977
977
|
if (g)
|
|
978
978
|
try {
|
|
979
|
-
const s = await
|
|
979
|
+
const s = await hn(S, C.titleGenerateApp);
|
|
980
980
|
if (!s) return;
|
|
981
|
-
const A =
|
|
982
|
-
AI回答:${A}`, H = await
|
|
981
|
+
const A = m.length > 500 ? m.slice(0, 500) : m, b = `用户提问:${i}
|
|
982
|
+
AI回答:${A}`, H = await Tt().post(S.chatQueryApi, {
|
|
983
983
|
app: C.titleGenerateApp,
|
|
984
984
|
data: { Query: b, AppConversationID: s }
|
|
985
|
-
}), N =
|
|
986
|
-
N && (await
|
|
985
|
+
}), N = Mt(H.data.data);
|
|
986
|
+
N && (await gn(S, g, N), D.value = !0, w == null || w(N));
|
|
987
987
|
} catch (s) {
|
|
988
988
|
console.error("[ai-assist-sdk] 生成对话标题失败:", s);
|
|
989
989
|
}
|
|
@@ -992,10 +992,10 @@ AI回答:${A}`, H = await xt().post(S.chatQueryApi, {
|
|
|
992
992
|
const i = y.value.trim();
|
|
993
993
|
if (!i || d.value) return;
|
|
994
994
|
if (!u.value && (await W(), !u.value)) {
|
|
995
|
-
|
|
995
|
+
Oe("创建会话失败,请重试");
|
|
996
996
|
return;
|
|
997
997
|
}
|
|
998
|
-
const
|
|
998
|
+
const m = e.value.length === 0, g = [
|
|
999
999
|
...e.value,
|
|
1000
1000
|
{ type: "user", content: i },
|
|
1001
1001
|
{ type: "ai", content: "", status: r.THINKING }
|
|
@@ -1007,7 +1007,7 @@ AI回答:${A}`, H = await xt().post(S.chatQueryApi, {
|
|
|
1007
1007
|
Query: i,
|
|
1008
1008
|
AppConversationID: u.value,
|
|
1009
1009
|
ResponseMode: "streaming"
|
|
1010
|
-
}, o, E.first.signal),
|
|
1010
|
+
}, o, E.first.signal), m && !D.value) {
|
|
1011
1011
|
const s = e.value[o];
|
|
1012
1012
|
s && s.status !== r.ERROR && P(i, s.content);
|
|
1013
1013
|
}
|
|
@@ -1015,11 +1015,11 @@ AI回答:${A}`, H = await xt().post(S.chatQueryApi, {
|
|
|
1015
1015
|
}
|
|
1016
1016
|
console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
|
|
1017
1017
|
try {
|
|
1018
|
-
const A = await
|
|
1018
|
+
const A = await Tt().post(S.chatQueryApi, {
|
|
1019
1019
|
app: C.app ?? 1,
|
|
1020
1020
|
data: { Query: i, AppConversationID: u.value }
|
|
1021
|
-
}), b =
|
|
1022
|
-
e.value = [...e.value.slice(0, -1), { type: "ai", content: b, status: r.COMPLETED }],
|
|
1021
|
+
}), b = Mt(A.data);
|
|
1022
|
+
e.value = [...e.value.slice(0, -1), { type: "ai", content: b, status: r.COMPLETED }], m && !D.value && P(i, b);
|
|
1023
1023
|
} catch (s) {
|
|
1024
1024
|
e.value = [...e.value.slice(0, -1), { type: "ai", content: (s == null ? void 0 : s.message) || "服务连接失败,请稍后重试", status: r.ERROR }];
|
|
1025
1025
|
}
|
|
@@ -1029,46 +1029,46 @@ AI回答:${A}`, H = await xt().post(S.chatQueryApi, {
|
|
|
1029
1029
|
E.again.abort(), E.again = new AbortController();
|
|
1030
1030
|
const i = [...e.value];
|
|
1031
1031
|
i.length > 0 && i[i.length - 1].type === "ai" && i.pop(), i.push({ type: "ai", content: "", status: r.RETHINKING }), e.value = i, l();
|
|
1032
|
-
const
|
|
1032
|
+
const m = e.value.length - 1, g = wo(S);
|
|
1033
1033
|
await k(g, {
|
|
1034
1034
|
MessageID: h.value,
|
|
1035
1035
|
AppConversationID: u.value,
|
|
1036
1036
|
ResponseMode: "streaming"
|
|
1037
|
-
},
|
|
1037
|
+
}, m, E.again.signal, !0);
|
|
1038
1038
|
}
|
|
1039
1039
|
async function n() {
|
|
1040
1040
|
if (!S.stopMessageApi || !d.value) return;
|
|
1041
1041
|
const i = e.value.length - 1 - 1;
|
|
1042
1042
|
try {
|
|
1043
|
-
await
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
} catch (
|
|
1043
|
+
await dn(S, h.value);
|
|
1044
|
+
const m = [...e.value];
|
|
1045
|
+
m[i] && (m[i] = { ...m[i], content: m[i].content || "已停止回答", status: r.STOP }), e.value = m, d.value = !1, E.first.abort(), E.first = new AbortController(), E.again.abort(), E.again = new AbortController(), c.value = !0;
|
|
1046
|
+
} catch (m) {
|
|
1047
1047
|
const g = [...e.value];
|
|
1048
|
-
g[i] && (g[i] = { ...g[i], content: (
|
|
1048
|
+
g[i] && (g[i] = { ...g[i], content: (m == null ? void 0 : m.message) || "系统繁忙,请稍后再试", status: r.ERROR }), e.value = g;
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
async function B(i) {
|
|
1052
|
-
var
|
|
1052
|
+
var m, g;
|
|
1053
1053
|
u.value = i, D.value = !0;
|
|
1054
1054
|
try {
|
|
1055
|
-
const o = await
|
|
1056
|
-
if ((
|
|
1055
|
+
const o = await vn(S, i), s = [];
|
|
1056
|
+
if ((m = o == null ? void 0 : o.messages) != null && m.length)
|
|
1057
1057
|
for (const A of o.messages)
|
|
1058
1058
|
A.query && s.push({ type: "user", content: A.query }), (g = A.answerInfo) != null && g.answer && s.push({ type: "ai", content: A.answerInfo.answer, status: r.COMPLETED });
|
|
1059
1059
|
e.value = s, l();
|
|
1060
1060
|
} catch (o) {
|
|
1061
|
-
|
|
1061
|
+
Oe((o == null ? void 0 : o.message) || "加载历史会话失败");
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
1064
|
async function W() {
|
|
1065
1065
|
var i;
|
|
1066
1066
|
D.value = !1;
|
|
1067
1067
|
try {
|
|
1068
|
-
const
|
|
1069
|
-
(i =
|
|
1070
|
-
} catch (
|
|
1071
|
-
|
|
1068
|
+
const m = await xt(S);
|
|
1069
|
+
(i = m == null ? void 0 : m.conversation) != null && i.appConversationID && (u.value = m.conversation.appConversationID);
|
|
1070
|
+
} catch (m) {
|
|
1071
|
+
Oe((m == null ? void 0 : m.message) || "创建会话失败");
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
1074
|
function T() {
|
|
@@ -1076,10 +1076,10 @@ AI回答:${A}`, H = await xt().post(S.chatQueryApi, {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
return { sendMessage: R, regenerateResponse: L, toggleStop: n, goHistoryMessage: B, initConversation: W, resetConversation: T, controllers: E };
|
|
1078
1078
|
}
|
|
1079
|
-
const
|
|
1079
|
+
const Co = { class: "container" }, bo = { class: "chat-wrap" }, Ao = { class: "message ai-message greet-message" }, So = { class: "ai-greet" }, xo = ["src"], To = {
|
|
1080
1080
|
key: 0,
|
|
1081
1081
|
class: "message ai-message recommend-message"
|
|
1082
|
-
},
|
|
1082
|
+
}, Eo = { class: "ai-recommend" }, Mo = { class: "recommend-header" }, Do = ["src"], Ro = ["onClick"], Ho = /* @__PURE__ */ Se({
|
|
1083
1083
|
__name: "Answer",
|
|
1084
1084
|
props: {
|
|
1085
1085
|
defaultSayhello: {},
|
|
@@ -1095,7 +1095,7 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1095
1095
|
COMPLETED: "completed",
|
|
1096
1096
|
STOP: "stop",
|
|
1097
1097
|
ERROR: "error"
|
|
1098
|
-
}, u = e, k = d, c =
|
|
1098
|
+
}, u = e, k = d, c = Ke(), l = p([]), r = p(""), C = p(!1), w = p(""), S = p(""), E = p(null), D = ne({ text1: "", text2: "" }), P = p([]), R = p(0), L = O(
|
|
1099
1099
|
() => P.value[R.value % (P.value.length || 1)]
|
|
1100
1100
|
);
|
|
1101
1101
|
function n() {
|
|
@@ -1104,11 +1104,11 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1104
1104
|
function B(Y) {
|
|
1105
1105
|
r.value = Y;
|
|
1106
1106
|
}
|
|
1107
|
-
const { isAtBottom: W, hasScroll: T, scrollToBottom: i, checkScrollStatus:
|
|
1107
|
+
const { isAtBottom: W, hasScroll: T, scrollToBottom: i, checkScrollStatus: m } = go(E), { enhanceCodeBlocks: g } = mo(), { batchMessagesUpdate: o, flushMessagesBatch: s } = fo(l), { displayedContent: A, streamingIndexRef: b, startTypewriter: _, stopTypewriter: H, getSegmentDisplayContent: N } = po(
|
|
1108
1108
|
l,
|
|
1109
1109
|
i,
|
|
1110
1110
|
h
|
|
1111
|
-
), { doStreamRequest: J, issTop:
|
|
1111
|
+
), { doStreamRequest: J, issTop: ce } = yo({
|
|
1112
1112
|
messages: l,
|
|
1113
1113
|
isGenerating: C,
|
|
1114
1114
|
lastUserMessage: w,
|
|
@@ -1116,14 +1116,14 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1116
1116
|
flushMessagesBatch: s,
|
|
1117
1117
|
STATUS: h,
|
|
1118
1118
|
cfg: c
|
|
1119
|
-
}), { sendMessage: Re, regenerateResponse:
|
|
1119
|
+
}), { sendMessage: Re, regenerateResponse: pe, toggleStop: ye, goHistoryMessage: We, resetConversation: He } = ko({
|
|
1120
1120
|
messages: l,
|
|
1121
1121
|
userInput: r,
|
|
1122
1122
|
isGenerating: C,
|
|
1123
1123
|
lastUserMessage: w,
|
|
1124
1124
|
conversationId: S,
|
|
1125
1125
|
doStreamRequest: J,
|
|
1126
|
-
issTop:
|
|
1126
|
+
issTop: ce,
|
|
1127
1127
|
scrollToBottom: i,
|
|
1128
1128
|
STATUS: h,
|
|
1129
1129
|
cfg: c,
|
|
@@ -1132,123 +1132,123 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1132
1132
|
function I() {
|
|
1133
1133
|
l.value = [], w.value = "", He();
|
|
1134
1134
|
}
|
|
1135
|
-
const
|
|
1136
|
-
y({ goHistoryMessage:
|
|
1137
|
-
const
|
|
1138
|
-
function
|
|
1139
|
-
Y ?
|
|
1135
|
+
const we = O(() => l.value.length === 0);
|
|
1136
|
+
y({ goHistoryMessage: We, createNewConversation: I, isEmptyConversation: we });
|
|
1137
|
+
const ke = p(/* @__PURE__ */ new Map());
|
|
1138
|
+
function xe(Y, V) {
|
|
1139
|
+
Y ? ke.value.set(V, Y) : ke.value.delete(V);
|
|
1140
1140
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1141
|
+
ie(l, () => {
|
|
1142
|
+
oe(() => {
|
|
1143
1143
|
l.value.forEach((Y, V) => {
|
|
1144
1144
|
const U = Y.status === h.ANSWERING || Y.status === h.THINKING || Y.status === h.RETHINKING;
|
|
1145
1145
|
Y.type === "ai" && !U && (A.set(V, Y.content), b.value.set(V, Y.content.length));
|
|
1146
|
-
}), _(),
|
|
1146
|
+
}), _(), ke.value.forEach((Y) => {
|
|
1147
1147
|
g(Y);
|
|
1148
|
-
}),
|
|
1148
|
+
}), m();
|
|
1149
1149
|
});
|
|
1150
1150
|
}, { deep: !0 });
|
|
1151
|
-
let
|
|
1152
|
-
|
|
1153
|
-
u.defaultSayhello && (D.text1 = u.defaultSayhello.text1, D.text2 = u.defaultSayhello.text2), u.defaultRecommend && (P.value =
|
|
1154
|
-
}),
|
|
1155
|
-
E.value && (
|
|
1151
|
+
let re = null;
|
|
1152
|
+
fe(() => {
|
|
1153
|
+
u.defaultSayhello && (D.text1 = u.defaultSayhello.text1, D.text2 = u.defaultSayhello.text2), u.defaultRecommend && (P.value = mn(u.defaultRecommend));
|
|
1154
|
+
}), fe(() => {
|
|
1155
|
+
E.value && (re = () => m(), E.value.addEventListener("scroll", re), m());
|
|
1156
1156
|
});
|
|
1157
|
-
const
|
|
1158
|
-
let
|
|
1159
|
-
function
|
|
1157
|
+
const ve = p(null);
|
|
1158
|
+
let de = !1, Ce = 0, Te = 0;
|
|
1159
|
+
function be(Y) {
|
|
1160
1160
|
var U;
|
|
1161
1161
|
const V = (U = E.value) == null ? void 0 : U.closest(".chat-wrap");
|
|
1162
1162
|
return parseFloat((V == null ? void 0 : V.style.getPropertyValue(Y)) ?? "") || 0;
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1164
|
+
function le(Y) {
|
|
1165
1165
|
return "touches" in Y ? Y.touches[0].clientY : Y.clientY;
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function Ie(Y) {
|
|
1168
1168
|
const V = E.value;
|
|
1169
|
-
V && (Y.preventDefault(),
|
|
1169
|
+
V && (Y.preventDefault(), de = !0, Ce = le(Y), V.scrollTop, Te = be("--ai-thumb-top"), window.addEventListener("mousemove", te), window.addEventListener("mouseup", Q), window.addEventListener("touchmove", te, { passive: !1 }), window.addEventListener("touchend", Q));
|
|
1170
1170
|
}
|
|
1171
|
-
function
|
|
1171
|
+
function te(Y) {
|
|
1172
1172
|
const V = E.value;
|
|
1173
|
-
if (!
|
|
1173
|
+
if (!de || !V) return;
|
|
1174
1174
|
Y.preventDefault();
|
|
1175
|
-
const U =
|
|
1176
|
-
V.scrollTop =
|
|
1175
|
+
const U = le(Y) - Ce, j = V.clientHeight, he = V.scrollHeight, _e = be("--ai-thumb-height"), Ee = j - _e, at = Math.min(Math.max(Te + U, 0), Ee);
|
|
1176
|
+
V.scrollTop = at / Ee * (he - j);
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1179
|
-
|
|
1178
|
+
function Q() {
|
|
1179
|
+
de = !1, window.removeEventListener("mousemove", te), window.removeEventListener("mouseup", Q), window.removeEventListener("touchmove", te), window.removeEventListener("touchend", Q);
|
|
1180
1180
|
}
|
|
1181
|
-
function
|
|
1182
|
-
const V = E.value, U =
|
|
1181
|
+
function Be(Y) {
|
|
1182
|
+
const V = E.value, U = ve.value;
|
|
1183
1183
|
if (!V || !U) return;
|
|
1184
1184
|
Y.preventDefault();
|
|
1185
|
-
const j = U.getBoundingClientRect(),
|
|
1186
|
-
V.scrollTop =
|
|
1185
|
+
const j = U.getBoundingClientRect(), _e = (le(Y) - j.top) / j.height;
|
|
1186
|
+
V.scrollTop = _e * (V.scrollHeight - V.clientHeight);
|
|
1187
1187
|
}
|
|
1188
|
-
return
|
|
1189
|
-
H(), E.value &&
|
|
1188
|
+
return ot(() => {
|
|
1189
|
+
H(), E.value && re && E.value.removeEventListener("scroll", re), Q();
|
|
1190
1190
|
}), (Y, V) => {
|
|
1191
1191
|
var U;
|
|
1192
|
-
return
|
|
1193
|
-
a("div",
|
|
1192
|
+
return f(), x("div", Co, [
|
|
1193
|
+
a("div", bo, [
|
|
1194
1194
|
a("div", {
|
|
1195
1195
|
class: "chat-box scrollWrap",
|
|
1196
1196
|
ref_key: "chatBoxRef",
|
|
1197
1197
|
ref: E
|
|
1198
1198
|
}, [
|
|
1199
|
-
a("div",
|
|
1200
|
-
a("div",
|
|
1201
|
-
a("img", { src: $(
|
|
1199
|
+
a("div", Ao, [
|
|
1200
|
+
a("div", So, [
|
|
1201
|
+
a("img", { src: $(Nt) }, null, 8, xo),
|
|
1202
1202
|
a("h1", null, G(D.text1), 1),
|
|
1203
1203
|
a("p", null, G(D.text2), 1)
|
|
1204
1204
|
])
|
|
1205
1205
|
]),
|
|
1206
|
-
(U = L.value) != null && U.length ? (
|
|
1207
|
-
a("div",
|
|
1208
|
-
a("div",
|
|
1206
|
+
(U = L.value) != null && U.length ? (f(), x("div", To, [
|
|
1207
|
+
a("div", Eo, [
|
|
1208
|
+
a("div", Mo, [
|
|
1209
1209
|
V[2] || (V[2] = a("span", null, "你可以尝试这样问我:", -1)),
|
|
1210
1210
|
a("p", {
|
|
1211
1211
|
class: "refresh-btn",
|
|
1212
1212
|
onClick: n
|
|
1213
1213
|
}, [
|
|
1214
|
-
a("img", { src: $(
|
|
1214
|
+
a("img", { src: $(_n) }, null, 8, Do),
|
|
1215
1215
|
V[1] || (V[1] = a("span", null, "换一换", -1))
|
|
1216
1216
|
])
|
|
1217
1217
|
]),
|
|
1218
1218
|
a("ul", null, [
|
|
1219
|
-
(
|
|
1219
|
+
(f(!0), x(Ae, null, Ne(L.value, (j, he) => (f(), x("li", {
|
|
1220
1220
|
key: he,
|
|
1221
|
-
onClick: (
|
|
1222
|
-
}, G(j), 9,
|
|
1221
|
+
onClick: (_e) => B(j)
|
|
1222
|
+
}, G(j), 9, Ro))), 128))
|
|
1223
1223
|
])
|
|
1224
1224
|
])
|
|
1225
1225
|
])) : X("", !0),
|
|
1226
|
-
(
|
|
1226
|
+
(f(!0), x(Ae, null, Ne(l.value, (j, he) => (f(), se(Zn, {
|
|
1227
1227
|
key: he,
|
|
1228
1228
|
msg: j,
|
|
1229
1229
|
index: he,
|
|
1230
1230
|
STATUS: h,
|
|
1231
1231
|
displayedContent: $(A),
|
|
1232
1232
|
getSegmentDisplayContent: $(N),
|
|
1233
|
-
setMessageRef:
|
|
1234
|
-
onRegenerate: $(
|
|
1233
|
+
setMessageRef: xe,
|
|
1234
|
+
onRegenerate: $(pe)
|
|
1235
1235
|
}, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent", "onRegenerate"]))), 128))
|
|
1236
1236
|
], 512),
|
|
1237
1237
|
a("div", {
|
|
1238
1238
|
ref_key: "scrollbarRef",
|
|
1239
|
-
ref:
|
|
1239
|
+
ref: ve,
|
|
1240
1240
|
class: "chat-box__scrollbar",
|
|
1241
|
-
onMousedown:
|
|
1242
|
-
onTouchstart:
|
|
1241
|
+
onMousedown: ae(Be, ["prevent"]),
|
|
1242
|
+
onTouchstart: ae(Be, ["prevent"])
|
|
1243
1243
|
}, [
|
|
1244
1244
|
a("div", {
|
|
1245
1245
|
class: "chat-box__scrollbar-thumb",
|
|
1246
|
-
onMousedown:
|
|
1247
|
-
onTouchstart:
|
|
1246
|
+
onMousedown: ae(Ie, ["stop", "prevent"]),
|
|
1247
|
+
onTouchstart: ae(Ie, ["stop", "prevent"])
|
|
1248
1248
|
}, null, 32)
|
|
1249
1249
|
], 544)
|
|
1250
1250
|
]),
|
|
1251
|
-
K(
|
|
1251
|
+
K(ho, {
|
|
1252
1252
|
modelValue: r.value,
|
|
1253
1253
|
"onUpdate:modelValue": V[0] || (V[0] = (j) => r.value = j),
|
|
1254
1254
|
isGenerating: C.value,
|
|
@@ -1256,31 +1256,31 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1256
1256
|
hasScroll: $(T),
|
|
1257
1257
|
isAtBottom: $(W),
|
|
1258
1258
|
onSend: $(Re),
|
|
1259
|
-
onRegenerate: $(
|
|
1260
|
-
onStop: $(
|
|
1259
|
+
onRegenerate: $(pe),
|
|
1260
|
+
onStop: $(ye),
|
|
1261
1261
|
onScrollToBottom: $(i)
|
|
1262
1262
|
}, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"]),
|
|
1263
1263
|
V[3] || (V[3] = a("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
|
|
1264
1264
|
]);
|
|
1265
1265
|
};
|
|
1266
1266
|
}
|
|
1267
|
-
}),
|
|
1267
|
+
}), _o = { class: "ai-history" }, $o = { class: "content" }, Po = {
|
|
1268
1268
|
key: 0,
|
|
1269
1269
|
class: "ai-history-loading"
|
|
1270
|
-
},
|
|
1270
|
+
}, Lo = { class: "ai-history-group-title" }, Oo = ["onClick"], No = { class: "ai-history-item-title" }, Wo = ["onClick"], Bo = {
|
|
1271
1271
|
key: 2,
|
|
1272
1272
|
class: "ai-history-empty"
|
|
1273
|
-
},
|
|
1273
|
+
}, Yo = ["src"], Vo = { class: "ai-modal" }, Xo = { class: "ai-modal-footer" }, Fo = /* @__PURE__ */ Se({
|
|
1274
1274
|
__name: "History",
|
|
1275
1275
|
emits: ["history-detail", "new-conversation"],
|
|
1276
1276
|
setup(e, { emit: y }) {
|
|
1277
|
-
const h =
|
|
1277
|
+
const h = Ke().apis, u = p([]), k = p(!0), c = p(!1), l = p(""), r = O(() => fn(u.value));
|
|
1278
1278
|
async function C() {
|
|
1279
1279
|
try {
|
|
1280
|
-
const E = await
|
|
1280
|
+
const E = await pn(h);
|
|
1281
1281
|
E != null && E.conversationList && (u.value = E.conversationList.filter((D) => D !== null).map((D) => ({ ...D, selected: !1 })));
|
|
1282
1282
|
} catch (E) {
|
|
1283
|
-
|
|
1283
|
+
Oe((E == null ? void 0 : E.message) || "获取历史记录失败");
|
|
1284
1284
|
} finally {
|
|
1285
1285
|
k.value = !1;
|
|
1286
1286
|
}
|
|
@@ -1291,53 +1291,53 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1291
1291
|
async function S() {
|
|
1292
1292
|
c.value = !1;
|
|
1293
1293
|
try {
|
|
1294
|
-
await
|
|
1294
|
+
await yn(h, l.value), await C();
|
|
1295
1295
|
} catch (E) {
|
|
1296
|
-
|
|
1296
|
+
Oe((E == null ? void 0 : E.message) || "删除失败"), await C();
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
|
-
return
|
|
1299
|
+
return fe(() => {
|
|
1300
1300
|
C();
|
|
1301
|
-
}), (E, D) => (
|
|
1302
|
-
a("div",
|
|
1303
|
-
k.value ? (
|
|
1301
|
+
}), (E, D) => (f(), x("div", _o, [
|
|
1302
|
+
a("div", $o, [
|
|
1303
|
+
k.value ? (f(), x("div", Po, [...D[3] || (D[3] = [
|
|
1304
1304
|
a("div", { class: "ai-history-spinner" }, null, -1)
|
|
1305
|
-
])])) : r.value.length > 0 ? (
|
|
1305
|
+
])])) : r.value.length > 0 ? (f(!0), x(Ae, { key: 1 }, Ne(r.value, (P) => (f(), x("div", {
|
|
1306
1306
|
key: P.label,
|
|
1307
1307
|
class: "ai-history-group"
|
|
1308
1308
|
}, [
|
|
1309
|
-
a("div",
|
|
1310
|
-
(
|
|
1309
|
+
a("div", Lo, G(P.label), 1),
|
|
1310
|
+
(f(!0), x(Ae, null, Ne(P.items, (R, L) => (f(), x("div", {
|
|
1311
1311
|
key: R.appConversationID,
|
|
1312
1312
|
class: "ai-history-item",
|
|
1313
|
-
style:
|
|
1313
|
+
style: nt({ "--i": L }),
|
|
1314
1314
|
onClick: (n) => E.$emit("history-detail", R.appConversationID)
|
|
1315
1315
|
}, [
|
|
1316
|
-
a("div",
|
|
1316
|
+
a("div", No, G(R.conversationName), 1),
|
|
1317
1317
|
a("div", {
|
|
1318
1318
|
class: "ai-history-item-delete",
|
|
1319
|
-
onClick:
|
|
1320
|
-
}, "删除", 8,
|
|
1321
|
-
], 12,
|
|
1322
|
-
]))), 128)) : (
|
|
1319
|
+
onClick: ae((n) => w(R.appConversationID), ["stop"])
|
|
1320
|
+
}, "删除", 8, Wo)
|
|
1321
|
+
], 12, Oo))), 128))
|
|
1322
|
+
]))), 128)) : (f(), x("div", Bo, "暂无历史记录"))
|
|
1323
1323
|
]),
|
|
1324
1324
|
a("div", {
|
|
1325
1325
|
class: "ai-add",
|
|
1326
1326
|
onClick: D[0] || (D[0] = (P) => E.$emit("new-conversation"))
|
|
1327
1327
|
}, [
|
|
1328
|
-
a("img", { src: $(
|
|
1328
|
+
a("img", { src: $(Sn) }, null, 8, Yo),
|
|
1329
1329
|
D[4] || (D[4] = a("span", null, "新建AI对话", -1))
|
|
1330
1330
|
]),
|
|
1331
|
-
(
|
|
1332
|
-
c.value ? (
|
|
1331
|
+
(f(), se($t, { to: "#ai-assist-root" }, [
|
|
1332
|
+
c.value ? (f(), x("div", {
|
|
1333
1333
|
key: 0,
|
|
1334
1334
|
class: "ai-modal-overlay",
|
|
1335
|
-
onClick: D[2] || (D[2] =
|
|
1335
|
+
onClick: D[2] || (D[2] = ae((P) => c.value = !1, ["self"]))
|
|
1336
1336
|
}, [
|
|
1337
|
-
a("div",
|
|
1337
|
+
a("div", Vo, [
|
|
1338
1338
|
D[5] || (D[5] = a("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
|
|
1339
1339
|
D[6] || (D[6] = a("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
|
|
1340
|
-
a("div",
|
|
1340
|
+
a("div", Xo, [
|
|
1341
1341
|
a("button", {
|
|
1342
1342
|
class: "ai-modal-btn cancel",
|
|
1343
1343
|
onClick: D[1] || (D[1] = (P) => c.value = !1)
|
|
@@ -1352,164 +1352,164 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1352
1352
|
]))
|
|
1353
1353
|
]));
|
|
1354
1354
|
}
|
|
1355
|
-
}),
|
|
1355
|
+
}), Go = { class: "container info" }, Qo = { class: "info-item" }, Ko = { class: "basic-content" }, Io = { class: "basic-content-text" }, qo = { class: "basic-content" }, Jo = { class: "basic-content-text" }, zo = { class: "info-item" }, Uo = { class: "permission-content" }, jo = { class: "info-item" }, Zo = { class: "basic-content" }, es = { class: "basic-content-text" }, ts = { class: "basic-content" }, ns = { class: "basic-content-text" }, os = /* @__PURE__ */ Se({
|
|
1356
1356
|
__name: "Info",
|
|
1357
1357
|
setup(e) {
|
|
1358
|
-
const y =
|
|
1359
|
-
return
|
|
1358
|
+
const y = Ke(), d = p(null);
|
|
1359
|
+
return fe(async () => {
|
|
1360
1360
|
try {
|
|
1361
|
-
d.value = await
|
|
1361
|
+
d.value = await wn(y.apis);
|
|
1362
1362
|
} catch (h) {
|
|
1363
|
-
|
|
1363
|
+
Oe((h == null ? void 0 : h.message) || "获取个人信息失败");
|
|
1364
1364
|
}
|
|
1365
1365
|
}), (h, u) => {
|
|
1366
1366
|
var k, c, l, r, C;
|
|
1367
|
-
return
|
|
1368
|
-
a("div",
|
|
1367
|
+
return f(), x("div", Go, [
|
|
1368
|
+
a("div", Qo, [
|
|
1369
1369
|
u[2] || (u[2] = a("div", { class: "heading" }, [
|
|
1370
1370
|
a("div", { class: "heading-column" }),
|
|
1371
1371
|
a("div", { class: "heading-title" }, "基本信息")
|
|
1372
1372
|
], -1)),
|
|
1373
|
-
a("div",
|
|
1373
|
+
a("div", Ko, [
|
|
1374
1374
|
u[0] || (u[0] = a("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
|
|
1375
|
-
a("div",
|
|
1375
|
+
a("div", Io, G(((k = d.value) == null ? void 0 : k.name) || ""), 1)
|
|
1376
1376
|
]),
|
|
1377
|
-
a("div",
|
|
1377
|
+
a("div", qo, [
|
|
1378
1378
|
u[1] || (u[1] = a("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
|
|
1379
|
-
a("div",
|
|
1379
|
+
a("div", Jo, G(((c = d.value) == null ? void 0 : c.userName) || ""), 1)
|
|
1380
1380
|
])
|
|
1381
1381
|
]),
|
|
1382
|
-
a("div",
|
|
1382
|
+
a("div", zo, [
|
|
1383
1383
|
u[3] || (u[3] = a("div", { class: "heading" }, [
|
|
1384
1384
|
a("div", { class: "heading-column" }),
|
|
1385
1385
|
a("div", { class: "heading-title" }, "数据权限")
|
|
1386
1386
|
], -1)),
|
|
1387
|
-
a("div",
|
|
1388
|
-
(
|
|
1387
|
+
a("div", Uo, [
|
|
1388
|
+
(f(!0), x(Ae, null, Ne((l = d.value) == null ? void 0 : l.ptnameList, (w, S) => (f(), x("div", {
|
|
1389
1389
|
key: S,
|
|
1390
1390
|
class: "permission-content-text"
|
|
1391
1391
|
}, G(w), 1))), 128))
|
|
1392
1392
|
])
|
|
1393
1393
|
]),
|
|
1394
|
-
a("div",
|
|
1394
|
+
a("div", jo, [
|
|
1395
1395
|
u[6] || (u[6] = a("div", { class: "heading" }, [
|
|
1396
1396
|
a("div", { class: "heading-column" }),
|
|
1397
1397
|
a("div", { class: "heading-title" }, "帮助信息")
|
|
1398
1398
|
], -1)),
|
|
1399
|
-
a("div",
|
|
1399
|
+
a("div", Zo, [
|
|
1400
1400
|
u[4] || (u[4] = a("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
|
|
1401
|
-
a("div",
|
|
1401
|
+
a("div", es, G(((r = d.value) == null ? void 0 : r.dept) || ""), 1)
|
|
1402
1402
|
]),
|
|
1403
|
-
a("div",
|
|
1403
|
+
a("div", ts, [
|
|
1404
1404
|
u[5] || (u[5] = a("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
|
|
1405
|
-
a("div",
|
|
1405
|
+
a("div", ns, G(((C = d.value) == null ? void 0 : C.email) || ""), 1)
|
|
1406
1406
|
])
|
|
1407
1407
|
])
|
|
1408
1408
|
]);
|
|
1409
1409
|
};
|
|
1410
1410
|
}
|
|
1411
|
-
}),
|
|
1411
|
+
}), ss = { key: 1 }, as = ["src"], is = { class: "header-title" }, ls = ["title"], us = { class: "ai-history-drawer-panel" }, cs = { class: "ai-history-drawer-header" }, rs = { class: "setTitle" }, vs = { class: "content" }, ds = { class: "main" }, hs = { class: "btn" }, gs = ["src"], ms = 78, Fe = 78, ee = 8, Ge = 26, Le = 490, Dt = "aiPanelPosition", Rt = "aiPanelDocked", Ht = "aiDockWidth", fs = 60, ps = 150, _t = 400, ys = 320, Wt = /* @__PURE__ */ Se({
|
|
1412
1412
|
__name: "AiAssist",
|
|
1413
1413
|
setup(e) {
|
|
1414
|
-
var
|
|
1415
|
-
const y =
|
|
1414
|
+
var At;
|
|
1415
|
+
const y = ms / 2, d = Ke(), h = p(!1), u = p("idle"), k = p(!1), c = ne({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), l = p(!1), r = p(window.innerWidth < 768), C = p(window.innerWidth < 768), w = p("answer"), S = p(!1), E = p(""), D = p(""), P = p(""), R = p(!1), L = p(!1), n = ne({
|
|
1416
1416
|
x: window.innerWidth - y,
|
|
1417
|
-
y: window.innerHeight / 2 -
|
|
1418
|
-
}), B = p(!1), W = p(!1), T = p("right"), i = p("left"),
|
|
1419
|
-
let
|
|
1420
|
-
const
|
|
1421
|
-
let
|
|
1422
|
-
const
|
|
1423
|
-
let
|
|
1424
|
-
const
|
|
1417
|
+
y: window.innerHeight / 2 - Fe / 2
|
|
1418
|
+
}), B = p(!1), W = p(!1), T = p("right"), i = p("left"), m = p(null), g = ne({ x: 0, y: 0 }), o = p(!1), s = p(!1), A = ne({ x: 0, y: 0 }), b = p(!1), _ = ne({ x: 0, y: 0 }), H = p(!1), N = p(!1), J = p(!1), ce = ne({ x: 0, width: 0 }), Re = p(!1);
|
|
1419
|
+
let pe = 0;
|
|
1420
|
+
const ye = p("idle"), We = p(!1), He = p("none"), I = ne({ x: 0, y: 0, w: Le, h: 0, radius: "14px" });
|
|
1421
|
+
let we = null, ke = !1, xe = !1;
|
|
1422
|
+
const re = ne({ x: 0, y: 0 }), ve = p(!1), de = p(null);
|
|
1423
|
+
let Ce = null, Te = null, be = null;
|
|
1424
|
+
const le = O(() => {
|
|
1425
1425
|
const t = window.innerWidth / 2;
|
|
1426
1426
|
return n.x + y < t ? 5 : -5;
|
|
1427
|
-
}),
|
|
1427
|
+
}), Ie = O(() => C.value || H.value || ye.value !== "idle" ? "" : `panel-${T.value}`), te = O(() => {
|
|
1428
1428
|
var t;
|
|
1429
1429
|
return !!((t = d.dock) != null && t.containerId) && !r.value;
|
|
1430
|
-
}), Q = p(((
|
|
1430
|
+
}), Q = p(((At = d.dock) == null ? void 0 : At.width) || Le), Be = O(() => d.panelDraggable !== !1), Y = O(() => {
|
|
1431
1431
|
var t;
|
|
1432
|
-
return !((t =
|
|
1433
|
-
}),
|
|
1432
|
+
return !((t = de.value) != null && t.isEmptyConversation);
|
|
1433
|
+
}), V = O(() => ({
|
|
1434
1434
|
left: `${n.x}px`,
|
|
1435
1435
|
top: `${n.y}px`,
|
|
1436
1436
|
transition: B.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
|
|
1437
|
-
"--direction": String(
|
|
1438
|
-
})),
|
|
1437
|
+
"--direction": String(le.value)
|
|
1438
|
+
})), U = O(() => d.characterImage || xn), j = O(() => u.value === "idle" ? {} : {
|
|
1439
1439
|
left: `${c.x}px`,
|
|
1440
1440
|
top: `${c.y}px`,
|
|
1441
1441
|
width: `${c.w}px`,
|
|
1442
1442
|
height: `${c.h}px`,
|
|
1443
1443
|
borderRadius: c.radius
|
|
1444
|
-
}),
|
|
1444
|
+
}), he = O(() => {
|
|
1445
1445
|
const t = {};
|
|
1446
1446
|
return o.value && !C.value && !r.value && !H.value && (t["--ai-panel-x"] = `${g.x}px`, t["--ai-panel-y"] = `${g.y}px`), H.value && (t["--ai-dock-width"] = `${Q.value}px`), t;
|
|
1447
|
-
}),
|
|
1447
|
+
}), _e = O(() => ye.value === "idle" ? {} : {
|
|
1448
1448
|
left: `${I.x}px`,
|
|
1449
1449
|
top: `${I.y}px`,
|
|
1450
1450
|
width: `${I.w}px`,
|
|
1451
1451
|
height: `${I.h}px`,
|
|
1452
1452
|
borderRadius: I.radius
|
|
1453
1453
|
});
|
|
1454
|
-
function
|
|
1454
|
+
function Ee() {
|
|
1455
1455
|
const t = window.innerWidth / 2;
|
|
1456
1456
|
n.x + y < t ? (T.value = "left", i.value = "right") : (T.value = "right", i.value = "left");
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1459
|
-
const t = window.innerWidth, v = Math.max(0, Math.min(n.y, window.innerHeight -
|
|
1458
|
+
function at() {
|
|
1459
|
+
const t = window.innerWidth, v = Math.max(0, Math.min(n.y, window.innerHeight - Fe));
|
|
1460
1460
|
return { x: n.x + y >= t / 2 ? t - y : -y, y: v };
|
|
1461
1461
|
}
|
|
1462
|
-
function
|
|
1462
|
+
function dt() {
|
|
1463
1463
|
W.value = !0;
|
|
1464
|
-
const t =
|
|
1464
|
+
const t = at();
|
|
1465
1465
|
n.x = t.x, n.y = t.y, setTimeout(() => {
|
|
1466
|
-
W.value = !1,
|
|
1466
|
+
W.value = !1, Ee(), Bt();
|
|
1467
1467
|
}, 400);
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1469
|
+
function Bt() {
|
|
1470
1470
|
try {
|
|
1471
1471
|
localStorage.setItem("characterPosition", JSON.stringify({ x: n.x, y: n.y })), localStorage.setItem("panelPosition", T.value), localStorage.setItem("backPosition", i.value);
|
|
1472
1472
|
} catch {
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1475
|
+
function Yt() {
|
|
1476
1476
|
const t = localStorage.getItem("characterPosition");
|
|
1477
1477
|
if (t) {
|
|
1478
1478
|
const F = JSON.parse(t);
|
|
1479
|
-
n.x = F.x, n.y = Math.min(Math.max(F.y, 0), window.innerHeight -
|
|
1479
|
+
n.x = F.x, n.y = Math.min(Math.max(F.y, 0), window.innerHeight - Fe);
|
|
1480
1480
|
} else
|
|
1481
|
-
n.x = window.innerWidth - y, n.y = window.innerHeight / 2 -
|
|
1481
|
+
n.x = window.innerWidth - y, n.y = window.innerHeight / 2 - Fe / 2;
|
|
1482
1482
|
const v = localStorage.getItem("panelPosition"), M = localStorage.getItem("backPosition");
|
|
1483
1483
|
v && (T.value = v), M && (i.value = M);
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1485
|
+
function qe(t) {
|
|
1486
1486
|
if (!B.value) return;
|
|
1487
|
-
const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY, F = v -
|
|
1488
|
-
|
|
1487
|
+
const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY, F = v - re.x, z = Math.max(0, Math.min(M - re.y, window.innerHeight - Fe)), ue = Math.abs(F - n.x), ge = Math.abs(z - n.y);
|
|
1488
|
+
ue + ge > 5 && (ve.value = !0), n.x = F, n.y = z;
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1491
|
-
B.value && (B.value = !1,
|
|
1490
|
+
function Je() {
|
|
1491
|
+
B.value && (B.value = !1, ve.value && (dt(), ve.value = !1));
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1494
|
-
W.value = !1, B.value = !0,
|
|
1493
|
+
function ht(t) {
|
|
1494
|
+
W.value = !1, B.value = !0, ve.value = !1;
|
|
1495
1495
|
const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY;
|
|
1496
|
-
|
|
1496
|
+
re.x = v - n.x, re.y = M - n.y;
|
|
1497
1497
|
}
|
|
1498
|
-
function
|
|
1499
|
-
const t =
|
|
1498
|
+
function Vt() {
|
|
1499
|
+
const t = m.value, v = (t == null ? void 0 : t.offsetWidth) || Le, M = (t == null ? void 0 : t.offsetHeight) || window.innerHeight - 78;
|
|
1500
1500
|
return {
|
|
1501
1501
|
maxX: Math.max(ee, window.innerWidth - v - ee),
|
|
1502
|
-
maxY: Math.max(
|
|
1502
|
+
maxY: Math.max(Ge, window.innerHeight - M - ee)
|
|
1503
1503
|
};
|
|
1504
1504
|
}
|
|
1505
|
-
function
|
|
1506
|
-
const M =
|
|
1507
|
-
g.x = Math.min(Math.max(g.x, ee),
|
|
1505
|
+
function ze(t, v) {
|
|
1506
|
+
const M = m.value, F = t ?? (M == null ? void 0 : M.offsetWidth) ?? Le, z = v ?? (M == null ? void 0 : M.offsetHeight) ?? window.innerHeight - 78, ue = Math.max(ee, window.innerWidth - F - ee), ge = Math.max(Ge, window.innerHeight - z - ee);
|
|
1507
|
+
g.x = Math.min(Math.max(g.x, ee), ue), g.y = Math.min(Math.max(g.y, Ge), ge);
|
|
1508
1508
|
}
|
|
1509
|
-
function
|
|
1510
|
-
if (!
|
|
1511
|
-
if (
|
|
1512
|
-
const F =
|
|
1509
|
+
function gt(t) {
|
|
1510
|
+
if (!Be.value || C.value || r.value || H.value || u.value !== "idle") return;
|
|
1511
|
+
if (xe = !1, s.value = !0, b.value = !1, !o.value) {
|
|
1512
|
+
const F = m.value;
|
|
1513
1513
|
if (F) {
|
|
1514
1514
|
const z = F.getBoundingClientRect();
|
|
1515
1515
|
g.x = z.left, g.y = z.top, o.value = !0;
|
|
@@ -1518,39 +1518,39 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1518
1518
|
const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY;
|
|
1519
1519
|
_.x = v, _.y = M, A.x = v - g.x, A.y = M - g.y;
|
|
1520
1520
|
}
|
|
1521
|
-
function
|
|
1522
|
-
var
|
|
1521
|
+
function Ue(t) {
|
|
1522
|
+
var me, St;
|
|
1523
1523
|
if (!s.value) return;
|
|
1524
1524
|
const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = "touches" in t ? t.touches[0].clientY : t.clientY;
|
|
1525
1525
|
if (!b.value) {
|
|
1526
|
-
const
|
|
1527
|
-
if (
|
|
1526
|
+
const on = Math.abs(v - _.x), sn = Math.abs(M - _.y);
|
|
1527
|
+
if (on + sn <= 5) return;
|
|
1528
1528
|
b.value = !0;
|
|
1529
1529
|
}
|
|
1530
|
-
const { maxX: F, maxY: z } =
|
|
1531
|
-
Me !==
|
|
1530
|
+
const { maxX: F, maxY: z } = Vt(), ue = te.value ? F + ps : F, ge = Math.min(Math.max(v - A.x, ee), ue), Pe = Math.min(Math.max(M - A.y, Ge), z), Me = te.value && ge > F + fs;
|
|
1531
|
+
Me !== xe && (xe = Me, (St = (me = d.dock) == null ? void 0 : me.onDockChange) == null || St.call(me, Me)), N.value = Me, g.x = ge, g.y = Pe;
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1533
|
+
function je() {
|
|
1534
1534
|
var v, M;
|
|
1535
1535
|
if (!s.value) return;
|
|
1536
1536
|
s.value = !1;
|
|
1537
1537
|
let t = !1;
|
|
1538
|
-
b.value && (b.value = !1,
|
|
1539
|
-
|
|
1540
|
-
}, 0), N.value &&
|
|
1538
|
+
b.value && (b.value = !1, ke = !0, setTimeout(() => {
|
|
1539
|
+
ke = !1;
|
|
1540
|
+
}, 0), N.value && te.value ? (yt(), t = !0) : (ze(), Xt())), xe && !t && (xe = !1, (M = (v = d.dock) == null ? void 0 : v.onDockChange) == null || M.call(v, !1)), N.value = !1;
|
|
1541
1541
|
}
|
|
1542
|
-
function
|
|
1543
|
-
|
|
1542
|
+
function mt(t) {
|
|
1543
|
+
ke && (t.preventDefault(), t.stopPropagation(), ke = !1);
|
|
1544
1544
|
}
|
|
1545
|
-
function
|
|
1545
|
+
function Xt() {
|
|
1546
1546
|
try {
|
|
1547
|
-
localStorage.setItem(
|
|
1547
|
+
localStorage.setItem(Dt, JSON.stringify({ x: g.x, y: g.y }));
|
|
1548
1548
|
} catch {
|
|
1549
1549
|
}
|
|
1550
1550
|
}
|
|
1551
|
-
function
|
|
1551
|
+
function Ft() {
|
|
1552
1552
|
try {
|
|
1553
|
-
const t = localStorage.getItem(
|
|
1553
|
+
const t = localStorage.getItem(Dt);
|
|
1554
1554
|
if (t) {
|
|
1555
1555
|
const v = JSON.parse(t);
|
|
1556
1556
|
typeof v.x == "number" && typeof v.y == "number" && (g.x = v.x, g.y = v.y, o.value = !0);
|
|
@@ -1558,23 +1558,23 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1558
1558
|
} catch {
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
1561
|
-
function
|
|
1561
|
+
function ft() {
|
|
1562
1562
|
try {
|
|
1563
|
-
localStorage.setItem(
|
|
1563
|
+
localStorage.setItem(Rt, H.value ? "1" : "0");
|
|
1564
1564
|
} catch {
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
|
-
function
|
|
1567
|
+
function Gt() {
|
|
1568
1568
|
var t;
|
|
1569
1569
|
try {
|
|
1570
|
-
if (localStorage.getItem(
|
|
1570
|
+
if (localStorage.getItem(Rt) === "1" && te.value) {
|
|
1571
1571
|
const M = (t = d.dock) == null ? void 0 : t.containerId;
|
|
1572
1572
|
M && document.getElementById(M) && (H.value = !0);
|
|
1573
1573
|
}
|
|
1574
1574
|
} catch {
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1577
|
+
function Ze() {
|
|
1578
1578
|
return {
|
|
1579
1579
|
x: window.innerWidth - Q.value,
|
|
1580
1580
|
y: 0,
|
|
@@ -1583,16 +1583,16 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1583
1583
|
radius: "0px"
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1586
|
+
function Qt() {
|
|
1587
1587
|
return {
|
|
1588
|
-
x: Math.max(0, Math.min(window.innerWidth - 53, n.x +
|
|
1588
|
+
x: Math.max(0, Math.min(window.innerWidth - 53, n.x + le.value * 3)),
|
|
1589
1589
|
y: n.y,
|
|
1590
1590
|
w: 53,
|
|
1591
1591
|
h: 53,
|
|
1592
1592
|
radius: "50%"
|
|
1593
1593
|
};
|
|
1594
1594
|
}
|
|
1595
|
-
function
|
|
1595
|
+
function pt() {
|
|
1596
1596
|
const t = window.innerWidth * 0.8;
|
|
1597
1597
|
return {
|
|
1598
1598
|
x: (window.innerWidth - t) / 2,
|
|
@@ -1602,51 +1602,51 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1602
1602
|
radius: "14px"
|
|
1603
1603
|
};
|
|
1604
1604
|
}
|
|
1605
|
-
function
|
|
1606
|
-
C.value ? (
|
|
1605
|
+
function Kt() {
|
|
1606
|
+
C.value ? ($e(pt(), Ct()), C.value = !1) : ($e(Ye(), pt()), C.value = !0);
|
|
1607
1607
|
}
|
|
1608
|
-
function
|
|
1609
|
-
|
|
1608
|
+
function $e(t, v, M, F = "none") {
|
|
1609
|
+
we && clearTimeout(we), ye.value = "switching", We.value = !0, He.value = F, I.x = t.x, I.y = t.y, I.w = t.w, I.h = t.h, I.radius = t.radius, oe(() => {
|
|
1610
1610
|
requestAnimationFrame(() => {
|
|
1611
|
-
|
|
1611
|
+
We.value = !1, I.x = v.x, I.y = v.y, I.w = v.w, I.h = v.h, I.radius = v.radius;
|
|
1612
1612
|
});
|
|
1613
|
-
}),
|
|
1614
|
-
|
|
1613
|
+
}), we = setTimeout(() => {
|
|
1614
|
+
ye.value = "idle", He.value = "none", we = null, M == null || M();
|
|
1615
1615
|
}, 400);
|
|
1616
1616
|
}
|
|
1617
|
-
function
|
|
1618
|
-
var z,
|
|
1619
|
-
if (!
|
|
1617
|
+
function yt() {
|
|
1618
|
+
var z, ue, ge, Pe, Me;
|
|
1619
|
+
if (!te.value || H.value) return;
|
|
1620
1620
|
C.value && (C.value = !1);
|
|
1621
1621
|
const t = (z = d.dock) == null ? void 0 : z.containerId;
|
|
1622
1622
|
if (t && !document.getElementById(t)) {
|
|
1623
1623
|
console.warn(`[ai-assist-sdk] dock container "#${t}" not found, dock feature disabled`);
|
|
1624
1624
|
return;
|
|
1625
1625
|
}
|
|
1626
|
-
const v =
|
|
1627
|
-
let M =
|
|
1626
|
+
const v = m.value;
|
|
1627
|
+
let M = Ye();
|
|
1628
1628
|
if (v) {
|
|
1629
|
-
const
|
|
1630
|
-
M = { x:
|
|
1629
|
+
const me = v.getBoundingClientRect();
|
|
1630
|
+
M = { x: me.left, y: me.top, w: me.width, h: me.height, radius: getComputedStyle(v).borderRadius };
|
|
1631
1631
|
}
|
|
1632
|
-
const F =
|
|
1633
|
-
|
|
1632
|
+
const F = Ze();
|
|
1633
|
+
$e(M, F), H.value = !0, u.value = "idle", N.value = !1, ft(), (ge = (ue = d.dock) == null ? void 0 : ue.onDockChange) == null || ge.call(ue, !0), (Me = (Pe = d.dock) == null ? void 0 : Pe.onDockWidthChange) == null || Me.call(Pe, Q.value);
|
|
1634
1634
|
}
|
|
1635
|
-
function
|
|
1636
|
-
return Math.max(
|
|
1635
|
+
function It() {
|
|
1636
|
+
return Math.max(_t, window.innerWidth - ys);
|
|
1637
1637
|
}
|
|
1638
1638
|
function it(t) {
|
|
1639
|
-
return Math.min(Math.max(t,
|
|
1639
|
+
return Math.min(Math.max(t, _t), It());
|
|
1640
1640
|
}
|
|
1641
|
-
function
|
|
1641
|
+
function qt() {
|
|
1642
1642
|
try {
|
|
1643
|
-
localStorage.setItem(
|
|
1643
|
+
localStorage.setItem(Ht, String(Q.value));
|
|
1644
1644
|
} catch {
|
|
1645
1645
|
}
|
|
1646
1646
|
}
|
|
1647
|
-
function
|
|
1647
|
+
function Jt() {
|
|
1648
1648
|
try {
|
|
1649
|
-
const t = localStorage.getItem(
|
|
1649
|
+
const t = localStorage.getItem(Ht);
|
|
1650
1650
|
if (t) {
|
|
1651
1651
|
const v = parseFloat(t);
|
|
1652
1652
|
Number.isFinite(v) && (Q.value = it(v));
|
|
@@ -1654,43 +1654,43 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1654
1654
|
} catch {
|
|
1655
1655
|
}
|
|
1656
1656
|
}
|
|
1657
|
-
function
|
|
1657
|
+
function wt(t) {
|
|
1658
1658
|
if (!H.value) return;
|
|
1659
1659
|
J.value = !0, Re.value = !1;
|
|
1660
1660
|
const v = "touches" in t ? t.touches[0].clientX : t.clientX;
|
|
1661
|
-
|
|
1661
|
+
ce.x = v, ce.width = Q.value;
|
|
1662
1662
|
}
|
|
1663
|
-
function
|
|
1663
|
+
function et(t) {
|
|
1664
1664
|
if (!J.value) return;
|
|
1665
|
-
const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = it(
|
|
1666
|
-
Math.abs(M -
|
|
1665
|
+
const v = "touches" in t ? t.touches[0].clientX : t.clientX, M = it(ce.width + (ce.x - v));
|
|
1666
|
+
Math.abs(M - ce.width) > 3 && (Re.value = !0), Q.value = M, pe || (pe = requestAnimationFrame(() => {
|
|
1667
1667
|
var F, z;
|
|
1668
|
-
|
|
1668
|
+
pe = 0, (z = (F = d.dock) == null ? void 0 : F.onDockWidthChange) == null || z.call(F, Q.value);
|
|
1669
1669
|
}));
|
|
1670
1670
|
}
|
|
1671
|
-
function
|
|
1671
|
+
function tt() {
|
|
1672
1672
|
var t, v;
|
|
1673
|
-
J.value && (J.value = !1, Re.value && (Re.value = !1,
|
|
1673
|
+
J.value && (J.value = !1, Re.value && (Re.value = !1, qt(), (v = (t = d.dock) == null ? void 0 : t.onDockWidthChange) == null || v.call(t, Q.value)));
|
|
1674
1674
|
}
|
|
1675
|
-
function
|
|
1675
|
+
function kt() {
|
|
1676
1676
|
var t, v;
|
|
1677
|
-
H.value && (o.value ?
|
|
1677
|
+
H.value && (o.value ? ze(Le, window.innerHeight - 78) : Ee(), $e(Ze(), Ye()), H.value = !1, ft(), (v = (t = d.dock) == null ? void 0 : t.onDockChange) == null || v.call(t, !1));
|
|
1678
1678
|
}
|
|
1679
|
-
function
|
|
1679
|
+
function zt() {
|
|
1680
1680
|
var t, v;
|
|
1681
|
-
if (!
|
|
1681
|
+
if (!ve.value && !W.value) {
|
|
1682
1682
|
if (H.value) {
|
|
1683
|
-
|
|
1683
|
+
$e(
|
|
1684
1684
|
{ x: window.innerWidth, y: 0, w: Q.value, h: window.innerHeight, radius: "0px" },
|
|
1685
|
-
|
|
1685
|
+
Ze(),
|
|
1686
1686
|
void 0,
|
|
1687
1687
|
"in"
|
|
1688
1688
|
), h.value = !0, u.value = "idle", (v = (t = d.dock) == null ? void 0 : t.onDockChange) == null || v.call(t, !0);
|
|
1689
1689
|
return;
|
|
1690
1690
|
}
|
|
1691
|
-
|
|
1692
|
-
const M =
|
|
1693
|
-
c.x = Math.max(0, Math.min(window.innerWidth - 53, n.x +
|
|
1691
|
+
Ee();
|
|
1692
|
+
const M = Ye();
|
|
1693
|
+
c.x = Math.max(0, Math.min(window.innerWidth - 53, n.x + le.value * 3)), c.y = n.y - le.value * 2, c.w = 53, c.h = 53, c.radius = "50%", k.value = !0, u.value = "expanding", h.value = !0, oe(() => {
|
|
1694
1694
|
requestAnimationFrame(() => {
|
|
1695
1695
|
k.value = !1, c.x = M.x, c.y = M.y, c.w = M.w, c.h = M.h, c.radius = M.radius;
|
|
1696
1696
|
});
|
|
@@ -1698,9 +1698,9 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1698
1698
|
u.value = "idle";
|
|
1699
1699
|
}, 400);
|
|
1700
1700
|
} else
|
|
1701
|
-
|
|
1701
|
+
ve.value = !1;
|
|
1702
1702
|
}
|
|
1703
|
-
function
|
|
1703
|
+
function Ye() {
|
|
1704
1704
|
if (window.innerWidth < 768)
|
|
1705
1705
|
return C.value ? {
|
|
1706
1706
|
x: 0,
|
|
@@ -1727,17 +1727,17 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1727
1727
|
radius: "14px"
|
|
1728
1728
|
};
|
|
1729
1729
|
}
|
|
1730
|
-
return
|
|
1730
|
+
return Ct();
|
|
1731
1731
|
}
|
|
1732
|
-
function
|
|
1733
|
-
const t =
|
|
1732
|
+
function Ct() {
|
|
1733
|
+
const t = Le, v = window.innerHeight - 78;
|
|
1734
1734
|
let M = 54, F;
|
|
1735
|
-
return o.value ? (F = Math.min(Math.max(g.x, ee), Math.max(ee, window.innerWidth - t - ee)), M = Math.min(Math.max(g.y,
|
|
1735
|
+
return o.value ? (F = Math.min(Math.max(g.x, ee), Math.max(ee, window.innerWidth - t - ee)), M = Math.min(Math.max(g.y, Ge), Math.max(ee, v - ee))) : F = T.value === "left" ? 24 : window.innerWidth - t - 24, { x: F, y: M, w: t, h: v, radius: "14px" };
|
|
1736
1736
|
}
|
|
1737
|
-
function
|
|
1737
|
+
function Ut() {
|
|
1738
1738
|
var v, M;
|
|
1739
1739
|
if (H.value) {
|
|
1740
|
-
|
|
1740
|
+
$e(Ze(), Qt(), () => {
|
|
1741
1741
|
h.value = !1, u.value = "idle", l.value = !0, setTimeout(() => {
|
|
1742
1742
|
l.value = !1;
|
|
1743
1743
|
}, 1400);
|
|
@@ -1745,10 +1745,10 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1745
1745
|
return;
|
|
1746
1746
|
}
|
|
1747
1747
|
if (u.value !== "idle") return;
|
|
1748
|
-
const t =
|
|
1749
|
-
c.x = t.x, c.y = t.y, c.w = t.w, c.h = t.h, c.radius = t.radius, k.value = !0, u.value = "collapsing",
|
|
1748
|
+
const t = Ye();
|
|
1749
|
+
c.x = t.x, c.y = t.y, c.w = t.w, c.h = t.h, c.radius = t.radius, k.value = !0, u.value = "collapsing", oe(() => {
|
|
1750
1750
|
requestAnimationFrame(() => {
|
|
1751
|
-
k.value = !1, c.x = Math.max(0, Math.min(window.innerWidth - 53, n.x +
|
|
1751
|
+
k.value = !1, c.x = Math.max(0, Math.min(window.innerWidth - 53, n.x + le.value * 3)), c.y = n.y + Math.abs(le.value) * 2, c.w = 53, c.h = 53, c.radius = "50%";
|
|
1752
1752
|
});
|
|
1753
1753
|
}), setTimeout(() => {
|
|
1754
1754
|
h.value = !1, u.value = "idle", l.value = !0;
|
|
@@ -1756,249 +1756,249 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
1756
1756
|
l.value = !1;
|
|
1757
1757
|
}, 1400);
|
|
1758
1758
|
}
|
|
1759
|
-
function
|
|
1760
|
-
|
|
1759
|
+
function jt(t) {
|
|
1760
|
+
Ve(), w.value = "answer", oe(() => {
|
|
1761
1761
|
var v;
|
|
1762
|
-
(v =
|
|
1762
|
+
(v = de.value) == null || v.goHistoryMessage(t);
|
|
1763
1763
|
});
|
|
1764
1764
|
}
|
|
1765
|
-
function
|
|
1766
|
-
P.value = "", w.value = "answer",
|
|
1765
|
+
function Zt() {
|
|
1766
|
+
P.value = "", w.value = "answer", oe(() => {
|
|
1767
1767
|
var t;
|
|
1768
|
-
(t =
|
|
1768
|
+
(t = de.value) == null || t.createNewConversation();
|
|
1769
1769
|
});
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1772
|
-
|
|
1771
|
+
function en() {
|
|
1772
|
+
Ve(), P.value = "", oe(() => {
|
|
1773
1773
|
var t;
|
|
1774
|
-
(t =
|
|
1774
|
+
(t = de.value) == null || t.createNewConversation();
|
|
1775
1775
|
});
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1777
|
+
function tn() {
|
|
1778
1778
|
L.value = !1, R.value = !0;
|
|
1779
1779
|
}
|
|
1780
|
-
function
|
|
1780
|
+
function Ve() {
|
|
1781
1781
|
L.value = !0, setTimeout(() => {
|
|
1782
1782
|
R.value = !1, L.value = !1;
|
|
1783
1783
|
}, 300);
|
|
1784
1784
|
}
|
|
1785
|
-
function
|
|
1785
|
+
function nn() {
|
|
1786
1786
|
D.value = E.value, S.value = !1;
|
|
1787
1787
|
}
|
|
1788
|
-
|
|
1789
|
-
t ? T.value = "center" :
|
|
1790
|
-
}),
|
|
1791
|
-
t && o.value &&
|
|
1792
|
-
}),
|
|
1793
|
-
|
|
1788
|
+
ie(C, (t) => {
|
|
1789
|
+
t ? T.value = "center" : Ee();
|
|
1790
|
+
}), ie(h, (t) => {
|
|
1791
|
+
t && o.value && oe(() => ze());
|
|
1792
|
+
}), fe(() => {
|
|
1793
|
+
Yt(), Ft(), Gt(), Jt();
|
|
1794
1794
|
const t = d.theme || "light";
|
|
1795
|
-
vt(t), t === "auto" && (
|
|
1795
|
+
vt(t), t === "auto" && (Te = kn(() => vt("auto"))), be = Tn(() => m.value);
|
|
1796
1796
|
});
|
|
1797
|
-
function
|
|
1798
|
-
|
|
1797
|
+
function bt() {
|
|
1798
|
+
Ce && clearTimeout(Ce), Ce = setTimeout(() => {
|
|
1799
1799
|
const t = window.innerWidth < 768;
|
|
1800
|
-
r.value = t, t && (C.value = !0, H.value &&
|
|
1800
|
+
r.value = t, t && (C.value = !0, H.value && kt()), dt(), o.value && ze(), H.value && (Q.value = it(Q.value));
|
|
1801
1801
|
}, 100);
|
|
1802
1802
|
}
|
|
1803
|
-
return
|
|
1804
|
-
window.addEventListener("resize",
|
|
1805
|
-
}),
|
|
1806
|
-
window.removeEventListener("resize",
|
|
1807
|
-
}),
|
|
1808
|
-
document.addEventListener("mousemove",
|
|
1809
|
-
}),
|
|
1810
|
-
document.removeEventListener("mousemove",
|
|
1811
|
-
}), (t, v) => (
|
|
1803
|
+
return fe(() => {
|
|
1804
|
+
window.addEventListener("resize", bt);
|
|
1805
|
+
}), ot(() => {
|
|
1806
|
+
window.removeEventListener("resize", bt), Ce && clearTimeout(Ce), Te == null || Te(), be == null || be(), be = null;
|
|
1807
|
+
}), fe(() => {
|
|
1808
|
+
document.addEventListener("mousemove", qe), document.addEventListener("touchmove", qe, { passive: !0 }), document.addEventListener("mouseup", Je), document.addEventListener("touchend", Je), document.addEventListener("mousemove", Ue), document.addEventListener("touchmove", Ue, { passive: !0 }), document.addEventListener("mouseup", je), document.addEventListener("touchend", je), document.addEventListener("click", mt, !0), document.addEventListener("mousemove", et), document.addEventListener("touchmove", et, { passive: !0 }), document.addEventListener("mouseup", tt), document.addEventListener("touchend", tt);
|
|
1809
|
+
}), ot(() => {
|
|
1810
|
+
document.removeEventListener("mousemove", qe), document.removeEventListener("touchmove", qe), document.removeEventListener("mouseup", Je), document.removeEventListener("touchend", Je), document.removeEventListener("mousemove", Ue), document.removeEventListener("touchmove", Ue), document.removeEventListener("mouseup", je), document.removeEventListener("touchend", je), document.removeEventListener("click", mt, !0), document.removeEventListener("mousemove", et), document.removeEventListener("touchmove", et), document.removeEventListener("mouseup", tt), document.removeEventListener("touchend", tt), we && clearTimeout(we), pe && cancelAnimationFrame(pe);
|
|
1811
|
+
}), (t, v) => (f(), x("div", null, [
|
|
1812
1812
|
De(a("div", {
|
|
1813
1813
|
ref_key: "panelRef",
|
|
1814
|
-
ref:
|
|
1814
|
+
ref: m,
|
|
1815
1815
|
class: q([
|
|
1816
1816
|
"ai-panel",
|
|
1817
1817
|
C.value ? "maxWrap" : "minWrap",
|
|
1818
|
-
|
|
1818
|
+
Ie.value,
|
|
1819
1819
|
{
|
|
1820
|
-
"panel-custom": o.value && !C.value && !r.value && !H.value &&
|
|
1820
|
+
"panel-custom": o.value && !C.value && !r.value && !H.value && ye.value === "idle",
|
|
1821
1821
|
dragging: s.value,
|
|
1822
1822
|
"dock-preview": N.value,
|
|
1823
1823
|
docked: H.value,
|
|
1824
1824
|
"dock-resizing": J.value,
|
|
1825
|
-
"dock-switching":
|
|
1826
|
-
"dock-switch-instant":
|
|
1825
|
+
"dock-switching": ye.value !== "idle",
|
|
1826
|
+
"dock-switch-instant": We.value,
|
|
1827
1827
|
"dock-switch-fade-in": He.value === "in",
|
|
1828
1828
|
"dock-switch-fade-out": He.value === "out",
|
|
1829
|
-
"no-drag": !
|
|
1829
|
+
"no-drag": !Be.value
|
|
1830
1830
|
},
|
|
1831
1831
|
u.value !== "idle" ? u.value : "",
|
|
1832
1832
|
{ morphing: u.value !== "idle", "morph-instant": k.value }
|
|
1833
1833
|
]),
|
|
1834
|
-
style:
|
|
1834
|
+
style: nt([he.value, j.value, _e.value])
|
|
1835
1835
|
}, [
|
|
1836
|
-
H.value ? (
|
|
1836
|
+
H.value ? (f(), x("div", {
|
|
1837
1837
|
key: 0,
|
|
1838
1838
|
class: "ai-dock-resizer",
|
|
1839
|
-
onMousedown:
|
|
1840
|
-
onTouchstart:
|
|
1839
|
+
onMousedown: ae(wt, ["stop"]),
|
|
1840
|
+
onTouchstart: ae(wt, ["stop"])
|
|
1841
1841
|
}, null, 32)) : X("", !0),
|
|
1842
1842
|
a("div", {
|
|
1843
1843
|
class: "header",
|
|
1844
|
-
onMousedown:
|
|
1845
|
-
onTouchstart:
|
|
1844
|
+
onMousedown: gt,
|
|
1845
|
+
onTouchstart: gt
|
|
1846
1846
|
}, [
|
|
1847
|
-
w.value === "info" ? (
|
|
1847
|
+
w.value === "info" ? (f(), x("span", {
|
|
1848
1848
|
key: 0,
|
|
1849
1849
|
class: q(["back", i.value]),
|
|
1850
1850
|
onClick: v[0] || (v[0] = (M) => w.value = "answer")
|
|
1851
1851
|
}, [...v[5] || (v[5] = [
|
|
1852
1852
|
a("span", { style: { "font-size": "14px" } }, "←", -1)
|
|
1853
|
-
])], 2)) : (
|
|
1853
|
+
])], 2)) : (f(), x("p", ss, [
|
|
1854
1854
|
a("img", {
|
|
1855
|
-
src: $(
|
|
1855
|
+
src: $(Nt),
|
|
1856
1856
|
draggable: "false"
|
|
1857
|
-
}, null, 8,
|
|
1857
|
+
}, null, 8, as)
|
|
1858
1858
|
])),
|
|
1859
|
-
a("div",
|
|
1859
|
+
a("div", is, [
|
|
1860
1860
|
a("span", {
|
|
1861
1861
|
title: w.value === "info" ? "个人信息" : P.value || $(d).name
|
|
1862
|
-
}, G(w.value === "info" ? "个人信息" : P.value || $(d).name), 9,
|
|
1862
|
+
}, G(w.value === "info" ? "个人信息" : P.value || $(d).name), 9, ls)
|
|
1863
1863
|
]),
|
|
1864
1864
|
a("p", null, [
|
|
1865
1865
|
De(K($(Z), {
|
|
1866
1866
|
class: "op-icon",
|
|
1867
1867
|
icon: "ic:round-add",
|
|
1868
|
-
onClick:
|
|
1868
|
+
onClick: Zt
|
|
1869
1869
|
}, null, 512), [
|
|
1870
|
-
[
|
|
1870
|
+
[Xe, Y.value]
|
|
1871
1871
|
]),
|
|
1872
1872
|
K($(Z), {
|
|
1873
1873
|
class: q(["mute", { active: R.value }]),
|
|
1874
1874
|
icon: "ic:round-history",
|
|
1875
|
-
onClick: v[1] || (v[1] = (M) => R.value ?
|
|
1875
|
+
onClick: v[1] || (v[1] = (M) => R.value ? Ve() : tn())
|
|
1876
1876
|
}, null, 8, ["class"]),
|
|
1877
|
-
!r.value && !H.value ? (
|
|
1877
|
+
!r.value && !H.value ? (f(), se($(Z), {
|
|
1878
1878
|
key: 0,
|
|
1879
|
-
onClick:
|
|
1879
|
+
onClick: Kt,
|
|
1880
1880
|
icon: C.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
|
|
1881
1881
|
}, null, 8, ["icon"])) : X("", !0),
|
|
1882
|
-
H.value ? (
|
|
1882
|
+
H.value ? (f(), se($(Z), {
|
|
1883
1883
|
key: 1,
|
|
1884
1884
|
icon: "material-symbols:float-landscape-2-outline-rounded",
|
|
1885
|
-
onClick:
|
|
1885
|
+
onClick: kt
|
|
1886
1886
|
})) : X("", !0),
|
|
1887
|
-
|
|
1887
|
+
te.value && !H.value ? (f(), se($(Z), {
|
|
1888
1888
|
key: 2,
|
|
1889
1889
|
icon: "boxicons:arrow-in-up-right-stroke-square",
|
|
1890
|
-
onClick:
|
|
1890
|
+
onClick: yt,
|
|
1891
1891
|
class: "__minimize"
|
|
1892
1892
|
})) : X("", !0),
|
|
1893
1893
|
K($(Z), {
|
|
1894
|
-
onClick:
|
|
1894
|
+
onClick: Ut,
|
|
1895
1895
|
icon: "ic:round-close"
|
|
1896
1896
|
})
|
|
1897
1897
|
])
|
|
1898
1898
|
], 32),
|
|
1899
|
-
De(K(
|
|
1899
|
+
De(K(Ho, {
|
|
1900
1900
|
ref_key: "answerRef",
|
|
1901
|
-
ref:
|
|
1901
|
+
ref: de,
|
|
1902
1902
|
defaultSayhello: $(d).defaultSayhello,
|
|
1903
1903
|
defaultRecommend: $(d).defaultRecommend,
|
|
1904
1904
|
onTitleGenerated: v[2] || (v[2] = (M) => P.value = M)
|
|
1905
1905
|
}, null, 8, ["defaultSayhello", "defaultRecommend"]), [
|
|
1906
|
-
[
|
|
1906
|
+
[Xe, w.value === "answer"]
|
|
1907
1907
|
]),
|
|
1908
|
-
w.value === "info" ? (
|
|
1909
|
-
R.value ? (
|
|
1908
|
+
w.value === "info" ? (f(), se(os, { key: 1 })) : X("", !0),
|
|
1909
|
+
R.value ? (f(), x("div", {
|
|
1910
1910
|
key: 2,
|
|
1911
1911
|
class: q(["ai-history-drawer", { closing: L.value }])
|
|
1912
1912
|
}, [
|
|
1913
1913
|
a("div", {
|
|
1914
1914
|
class: "ai-history-backdrop",
|
|
1915
|
-
onClick:
|
|
1915
|
+
onClick: Ve
|
|
1916
1916
|
}),
|
|
1917
|
-
a("div",
|
|
1918
|
-
a("div",
|
|
1917
|
+
a("div", us, [
|
|
1918
|
+
a("div", cs, [
|
|
1919
1919
|
v[6] || (v[6] = a("span", null, "对话记录", -1)),
|
|
1920
1920
|
K($(Z), {
|
|
1921
1921
|
icon: "ic:round-close",
|
|
1922
1922
|
class: "ai-history-drawer-close",
|
|
1923
|
-
onClick:
|
|
1923
|
+
onClick: Ve
|
|
1924
1924
|
})
|
|
1925
1925
|
]),
|
|
1926
|
-
K(
|
|
1927
|
-
onHistoryDetail:
|
|
1928
|
-
onNewConversation:
|
|
1926
|
+
K(Fo, {
|
|
1927
|
+
onHistoryDetail: jt,
|
|
1928
|
+
onNewConversation: en
|
|
1929
1929
|
})
|
|
1930
1930
|
])
|
|
1931
1931
|
], 2)) : X("", !0),
|
|
1932
|
-
De(a("div",
|
|
1933
|
-
a("div",
|
|
1934
|
-
a("div",
|
|
1932
|
+
De(a("div", rs, [
|
|
1933
|
+
a("div", vs, [
|
|
1934
|
+
a("div", ds, [
|
|
1935
1935
|
v[7] || (v[7] = a("p", { class: "title" }, "修改标题", -1)),
|
|
1936
1936
|
De(a("textarea", {
|
|
1937
1937
|
"onUpdate:modelValue": v[3] || (v[3] = (M) => E.value = M),
|
|
1938
1938
|
placeholder: "请输入新标题"
|
|
1939
1939
|
}, null, 512), [
|
|
1940
|
-
[
|
|
1940
|
+
[Lt, E.value]
|
|
1941
1941
|
]),
|
|
1942
|
-
a("p",
|
|
1942
|
+
a("p", hs, [
|
|
1943
1943
|
a("span", {
|
|
1944
1944
|
onClick: v[4] || (v[4] = (M) => S.value = !1)
|
|
1945
1945
|
}, "取消"),
|
|
1946
|
-
a("span", { onClick:
|
|
1946
|
+
a("span", { onClick: nn }, "确定")
|
|
1947
1947
|
])
|
|
1948
1948
|
])
|
|
1949
1949
|
])
|
|
1950
1950
|
], 512), [
|
|
1951
|
-
[
|
|
1951
|
+
[Xe, S.value]
|
|
1952
1952
|
])
|
|
1953
1953
|
], 6), [
|
|
1954
|
-
[
|
|
1954
|
+
[Xe, h.value || u.value !== "idle"]
|
|
1955
1955
|
]),
|
|
1956
|
-
N.value &&
|
|
1956
|
+
N.value && te.value ? (f(), x("div", {
|
|
1957
1957
|
key: 0,
|
|
1958
1958
|
class: "ai-dock-preview",
|
|
1959
|
-
style:
|
|
1959
|
+
style: nt({ width: Q.value + "px" })
|
|
1960
1960
|
}, [...v[8] || (v[8] = [
|
|
1961
1961
|
a("span", { class: "ai-dock-preview__text" }, "松开以停靠到右侧", -1)
|
|
1962
1962
|
])], 4)) : X("", !0),
|
|
1963
1963
|
De(a("div", {
|
|
1964
1964
|
class: q(["character", { dragging: B.value, recycling: W.value, "hover-preview": l.value }]),
|
|
1965
|
-
style:
|
|
1966
|
-
onMousedown:
|
|
1967
|
-
onTouchstart:
|
|
1968
|
-
onClick:
|
|
1965
|
+
style: nt(V.value),
|
|
1966
|
+
onMousedown: ht,
|
|
1967
|
+
onTouchstart: ht,
|
|
1968
|
+
onClick: zt
|
|
1969
1969
|
}, [
|
|
1970
|
-
a("img", { src:
|
|
1970
|
+
a("img", { src: U.value }, null, 8, gs)
|
|
1971
1971
|
], 38), [
|
|
1972
|
-
[
|
|
1972
|
+
[Xe, !h.value]
|
|
1973
1973
|
])
|
|
1974
1974
|
]));
|
|
1975
1975
|
}
|
|
1976
|
-
}),
|
|
1976
|
+
}), ws = ["data-theme"], ks = {
|
|
1977
1977
|
key: 0,
|
|
1978
1978
|
class: "ai-voice-input-final"
|
|
1979
|
-
},
|
|
1979
|
+
}, Cs = {
|
|
1980
1980
|
key: 1,
|
|
1981
1981
|
class: "ai-voice-input-interim"
|
|
1982
|
-
},
|
|
1982
|
+
}, bs = {
|
|
1983
1983
|
key: 2,
|
|
1984
1984
|
class: "ai-voice-input-cursor"
|
|
1985
|
-
},
|
|
1985
|
+
}, As = {
|
|
1986
1986
|
key: 3,
|
|
1987
1987
|
class: "ai-voice-input-placeholder"
|
|
1988
|
-
},
|
|
1988
|
+
}, Ss = ["disabled"], xs = {
|
|
1989
1989
|
key: 0,
|
|
1990
1990
|
class: "ai-voice-input-pulse"
|
|
1991
|
-
},
|
|
1991
|
+
}, Ts = {
|
|
1992
1992
|
key: 1,
|
|
1993
1993
|
class: "ai-voice-input-wave"
|
|
1994
|
-
},
|
|
1994
|
+
}, Es = {
|
|
1995
1995
|
key: 2,
|
|
1996
1996
|
class: "ai-voice-input-btn-icon",
|
|
1997
1997
|
viewBox: "0 0 24 24",
|
|
1998
1998
|
fill: "currentColor",
|
|
1999
1999
|
width: "16",
|
|
2000
2000
|
height: "16"
|
|
2001
|
-
},
|
|
2001
|
+
}, Ms = /* @__PURE__ */ Se({
|
|
2002
2002
|
__name: "VoiceInput",
|
|
2003
2003
|
props: {
|
|
2004
2004
|
lang: {},
|
|
@@ -2020,30 +2020,30 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
2020
2020
|
recording: "停止录音",
|
|
2021
2021
|
stopping: "识别中…",
|
|
2022
2022
|
error: "重试"
|
|
2023
|
-
}, c = p(""), l = p(""), r = p("idle"), C =
|
|
2023
|
+
}, c = p(""), l = p(""), r = p("idle"), C = st.isSupported();
|
|
2024
2024
|
let w = null;
|
|
2025
|
-
const S = O(() =>
|
|
2025
|
+
const S = O(() => Cn(h.theme)), E = () => ({
|
|
2026
2026
|
lang: h.lang,
|
|
2027
2027
|
continuous: h.continuous,
|
|
2028
2028
|
interimResults: h.interimResults
|
|
2029
2029
|
}), D = () => {
|
|
2030
|
-
C && (w = new
|
|
2030
|
+
C && (w = new st(E(), {
|
|
2031
2031
|
onStatusChange: (i) => {
|
|
2032
2032
|
r.value = i, u("statusChange", i), i === "idle" && u("complete", c.value);
|
|
2033
2033
|
},
|
|
2034
2034
|
onInterim: (i) => {
|
|
2035
2035
|
l.value = i;
|
|
2036
2036
|
},
|
|
2037
|
-
onFinal: (i,
|
|
2038
|
-
c.value += i, l.value = "", u("final", i,
|
|
2037
|
+
onFinal: (i, m) => {
|
|
2038
|
+
c.value += i, l.value = "", u("final", i, m);
|
|
2039
2039
|
},
|
|
2040
2040
|
onResult: (i) => u("result", i),
|
|
2041
2041
|
onError: (i) => u("error", i)
|
|
2042
2042
|
}));
|
|
2043
2043
|
};
|
|
2044
|
-
|
|
2044
|
+
fe(D), Pt(() => {
|
|
2045
2045
|
w == null || w.destroy(), w = null;
|
|
2046
|
-
}),
|
|
2046
|
+
}), ie(
|
|
2047
2047
|
() => [h.lang, h.continuous, h.interimResults],
|
|
2048
2048
|
() => {
|
|
2049
2049
|
w == null || w.destroy(), D();
|
|
@@ -2078,17 +2078,17 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
2078
2078
|
c.value = "", l.value = "";
|
|
2079
2079
|
},
|
|
2080
2080
|
getStatus: () => (w == null ? void 0 : w.getStatus()) ?? "idle"
|
|
2081
|
-
}), (i,
|
|
2081
|
+
}), (i, m) => (f(), x("div", {
|
|
2082
2082
|
class: q(["ai-voice-input", e.className]),
|
|
2083
2083
|
"data-theme": S.value
|
|
2084
2084
|
}, [
|
|
2085
2085
|
a("div", {
|
|
2086
2086
|
class: q(["ai-voice-input-display", { "is-empty": L.value }])
|
|
2087
2087
|
}, [
|
|
2088
|
-
c.value ? (
|
|
2089
|
-
l.value ? (
|
|
2090
|
-
r.value === "recording" && !l.value ? (
|
|
2091
|
-
L.value ? (
|
|
2088
|
+
c.value ? (f(), x("span", ks, G(c.value), 1)) : X("", !0),
|
|
2089
|
+
l.value ? (f(), x("span", Cs, G(l.value), 1)) : X("", !0),
|
|
2090
|
+
r.value === "recording" && !l.value ? (f(), x("span", bs)) : X("", !0),
|
|
2091
|
+
L.value ? (f(), x("span", As, G(n.value), 1)) : X("", !0)
|
|
2092
2092
|
], 2),
|
|
2093
2093
|
a("button", {
|
|
2094
2094
|
type: "button",
|
|
@@ -2096,55 +2096,55 @@ const wo = { class: "container" }, ko = { class: "chat-wrap" }, Co = { class: "m
|
|
|
2096
2096
|
disabled: T.value,
|
|
2097
2097
|
onClick: P
|
|
2098
2098
|
}, [
|
|
2099
|
-
r.value === "recording" ? (
|
|
2099
|
+
r.value === "recording" ? (f(), x("span", xs)) : r.value === "connecting" || r.value === "stopping" ? (f(), x("span", Ts, [...m[0] || (m[0] = [
|
|
2100
2100
|
a("span", null, null, -1),
|
|
2101
2101
|
a("span", null, null, -1),
|
|
2102
2102
|
a("span", null, null, -1),
|
|
2103
2103
|
a("span", null, null, -1),
|
|
2104
2104
|
a("span", null, null, -1)
|
|
2105
|
-
])])) : (
|
|
2105
|
+
])])) : (f(), x("svg", Es, [...m[1] || (m[1] = [
|
|
2106
2106
|
a("path", { d: "M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3z" }, null, -1),
|
|
2107
2107
|
a("path", { d: "M19 11a7 7 0 0 1-14 0H3a9 9 0 0 0 8 8.94V23h2v-3.06A9 9 0 0 0 21 11h-2z" }, null, -1)
|
|
2108
2108
|
])])),
|
|
2109
2109
|
a("span", null, G(B.value), 1)
|
|
2110
|
-
], 10,
|
|
2111
|
-
L.value ? X("", !0) : (
|
|
2110
|
+
], 10, Ss),
|
|
2111
|
+
L.value ? X("", !0) : (f(), x("button", {
|
|
2112
2112
|
key: 0,
|
|
2113
2113
|
type: "button",
|
|
2114
2114
|
class: "ai-voice-input-btn ai-voice-input-clear-btn",
|
|
2115
2115
|
title: "清空",
|
|
2116
2116
|
onClick: R
|
|
2117
2117
|
}, " 清空 "))
|
|
2118
|
-
], 10,
|
|
2118
|
+
], 10, ws));
|
|
2119
2119
|
}
|
|
2120
|
-
}),
|
|
2120
|
+
}), Ds = (e, y) => {
|
|
2121
2121
|
const d = e.__vccOpts || e;
|
|
2122
2122
|
for (const [h, u] of y)
|
|
2123
2123
|
d[h] = u;
|
|
2124
2124
|
return d;
|
|
2125
|
-
},
|
|
2126
|
-
let
|
|
2127
|
-
const
|
|
2128
|
-
|
|
2129
|
-
},
|
|
2125
|
+
}, Rs = /* @__PURE__ */ Ds(Ms, [["__scopeId", "data-v-53d3cc6e"]]);
|
|
2126
|
+
let Qe = null;
|
|
2127
|
+
const Os = (e) => {
|
|
2128
|
+
Ot(e);
|
|
2129
|
+
}, Ns = (e) => {
|
|
2130
2130
|
const y = e || document.body, d = document.createElement("div");
|
|
2131
2131
|
d.id = "ai-assist-root";
|
|
2132
|
-
const h =
|
|
2133
|
-
vt(h.theme),
|
|
2134
|
-
},
|
|
2135
|
-
|
|
2132
|
+
const h = Ke();
|
|
2133
|
+
vt(h.theme), bn(), y.appendChild(d), Qe = cn(Wt), Qe.mount(d);
|
|
2134
|
+
}, Ws = () => {
|
|
2135
|
+
Qe && (Qe.unmount(), Qe = null);
|
|
2136
2136
|
const e = document.getElementById("ai-assist-root");
|
|
2137
2137
|
e && e.remove();
|
|
2138
|
-
},
|
|
2138
|
+
}, Bs = {
|
|
2139
2139
|
install(e, y) {
|
|
2140
|
-
|
|
2140
|
+
Ot(y), e.component("AiAssist", Wt), e.component("VoiceInput", Rs);
|
|
2141
2141
|
}
|
|
2142
2142
|
};
|
|
2143
2143
|
export {
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2144
|
+
Wt as AiAssist,
|
|
2145
|
+
Rs as VoiceInput,
|
|
2146
|
+
Bs as default,
|
|
2147
|
+
Os as initAiAssist,
|
|
2148
|
+
Ns as mountAiAssist,
|
|
2149
|
+
Ws as unmountAiAssist
|
|
2150
2150
|
};
|