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