@somecat/ai-assist-sdk 1.1.23 → 1.1.24
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/vue/index.mjs +447 -447
- package/package.json +1 -1
package/dist/vue/index.mjs
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { r as
|
|
3
|
-
import { f as
|
|
4
|
-
import { SearchOutlined as
|
|
1
|
+
import { defineComponent as nt, ref as C, watch as Ct, onUnmounted as At, openBlock as w, createElementBlock as S, normalizeClass as J, createElementVNode as s, toDisplayString as F, createVNode as X, Transition as Ft, withCtx as Vt, createTextVNode as Xt, createCommentVNode as V, reactive as I, Fragment as K, createStaticVNode as Gt, renderList as ut, unref as O, createBlock as tt, withKeys as Jt, nextTick as Z, computed as _, onMounted as et, normalizeStyle as Mt, withModifiers as Ht, Teleport as qt, withDirectives as rt, vShow as gt, vModelText as _t, createApp as Ut } from "vue";
|
|
2
|
+
import { r as Ot, p as $t, u as jt, c as Pt, g as Kt, s as zt, a as Nt, e as Zt, b as It, d as ft, f as te, h as ee, i as ne, j as se, k as oe, l as Tt, w as ae, m as ie, n as Lt } from "../chunks/index-CWRmx9Cv.mjs";
|
|
3
|
+
import { f as le, s as ct, a as xt, b as re, c as ce } from "../chunks/index-DBik4Gma.mjs";
|
|
4
|
+
import { SearchOutlined as ue, CheckOutlined as ve, CopyOutlined as de, RedoOutlined as ge } from "@ant-design/icons-vue";
|
|
5
5
|
import { Icon as j } from "@iconify/vue";
|
|
6
|
-
const
|
|
6
|
+
const he = "data:image/png;base64,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", me = { class: "thinking-block__title" }, fe = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "thinking-block__content"
|
|
9
|
-
},
|
|
9
|
+
}, pe = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "streaming-cursor"
|
|
12
|
-
},
|
|
12
|
+
}, ye = /* @__PURE__ */ nt({
|
|
13
13
|
__name: "ThinkingBlock",
|
|
14
14
|
props: {
|
|
15
15
|
content: {},
|
|
16
16
|
isStreaming: { type: Boolean }
|
|
17
17
|
},
|
|
18
|
-
setup(
|
|
19
|
-
const u =
|
|
18
|
+
setup(t) {
|
|
19
|
+
const u = t, r = C(!1);
|
|
20
20
|
function v() {
|
|
21
21
|
r.value = !r.value;
|
|
22
22
|
}
|
|
23
23
|
const o = C(u.content), c = C(u.content.length), a = C(0);
|
|
24
24
|
let n = 0, f = 0;
|
|
25
|
-
function
|
|
25
|
+
function M() {
|
|
26
26
|
if (n) return;
|
|
27
|
-
const
|
|
27
|
+
const h = 80, g = (E) => {
|
|
28
28
|
if (f === 0) {
|
|
29
29
|
f = E, n = requestAnimationFrame(g);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const b = Math.min(E - f, 100);
|
|
33
33
|
f = E;
|
|
34
|
-
const L = u.content,
|
|
35
|
-
if (
|
|
36
|
-
const x =
|
|
34
|
+
const L = u.content, e = L.length - c.value;
|
|
35
|
+
if (e > 0) {
|
|
36
|
+
const x = h + e;
|
|
37
37
|
a.value += x * b / 1e3;
|
|
38
38
|
const D = Math.floor(a.value);
|
|
39
39
|
D > 0 && (a.value -= D, c.value = Math.min(c.value + D, L.length), o.value = L.slice(0, c.value));
|
|
@@ -49,21 +49,21 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
49
49
|
function R() {
|
|
50
50
|
B(), o.value = u.content, c.value = u.content.length, a.value = 0;
|
|
51
51
|
}
|
|
52
|
-
return
|
|
52
|
+
return Ct(
|
|
53
53
|
() => u.content,
|
|
54
54
|
() => {
|
|
55
55
|
u.isStreaming || R();
|
|
56
56
|
}
|
|
57
|
-
),
|
|
57
|
+
), Ct(
|
|
58
58
|
() => u.isStreaming,
|
|
59
|
-
(
|
|
60
|
-
|
|
59
|
+
(h) => {
|
|
60
|
+
h ? M() : R();
|
|
61
61
|
},
|
|
62
62
|
{ immediate: !0 }
|
|
63
|
-
),
|
|
63
|
+
), At(B), (h, g) => (w(), S("div", {
|
|
64
64
|
class: J(["thinking-block", {
|
|
65
65
|
"thinking-block--expanded": r.value,
|
|
66
|
-
"thinking-block--active":
|
|
66
|
+
"thinking-block--active": t.isStreaming
|
|
67
67
|
}])
|
|
68
68
|
}, [
|
|
69
69
|
s("div", {
|
|
@@ -71,7 +71,7 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
71
71
|
onClick: v
|
|
72
72
|
}, [
|
|
73
73
|
g[1] || (g[1] = s("span", { class: "thinking-block__indicator" }, null, -1)),
|
|
74
|
-
s("span",
|
|
74
|
+
s("span", me, F(t.isStreaming ? "深度思考中" : "深度思考"), 1),
|
|
75
75
|
(w(), S("svg", {
|
|
76
76
|
class: J(["thinking-block__arrow", { "thinking-block__arrow--down": r.value }]),
|
|
77
77
|
viewBox: "0 0 24 24",
|
|
@@ -86,39 +86,39 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
86
86
|
s("polyline", { points: "6 9 12 15 18 9" }, null, -1)
|
|
87
87
|
])], 2))
|
|
88
88
|
]),
|
|
89
|
-
X(
|
|
90
|
-
default:
|
|
91
|
-
r.value ? (w(), S("div",
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
X(Ft, { name: "thinking-expand" }, {
|
|
90
|
+
default: Vt(() => [
|
|
91
|
+
r.value ? (w(), S("div", fe, [
|
|
92
|
+
Xt(F(o.value), 1),
|
|
93
|
+
t.isStreaming ? (w(), S("span", pe)) : V("", !0)
|
|
94
94
|
])) : V("", !0)
|
|
95
95
|
]),
|
|
96
96
|
_: 1
|
|
97
97
|
})
|
|
98
98
|
], 2));
|
|
99
99
|
}
|
|
100
|
-
}),
|
|
100
|
+
}), we = {
|
|
101
101
|
key: 0,
|
|
102
102
|
class: "message-content ba-markdown"
|
|
103
|
-
},
|
|
103
|
+
}, ke = { class: "agent-thought__spinner" }, Ce = { class: "agent-thought__text" }, Ae = { key: 2 }, Se = ["innerHTML"], be = {
|
|
104
104
|
key: 0,
|
|
105
105
|
class: "streaming-cursor"
|
|
106
|
-
},
|
|
106
|
+
}, Re = ["innerHTML"], Ee = {
|
|
107
107
|
key: 0,
|
|
108
108
|
class: "streaming-cursor"
|
|
109
|
-
},
|
|
109
|
+
}, Me = {
|
|
110
110
|
key: 3,
|
|
111
111
|
class: "message-error"
|
|
112
|
-
},
|
|
112
|
+
}, Te = {
|
|
113
113
|
key: 4,
|
|
114
114
|
class: "message-toolbar"
|
|
115
|
-
},
|
|
115
|
+
}, De = ["data-tooltip"], He = {
|
|
116
116
|
class: "tooltip-enhanced",
|
|
117
117
|
"data-tooltip": "重新回答"
|
|
118
|
-
},
|
|
118
|
+
}, Oe = {
|
|
119
119
|
key: 1,
|
|
120
120
|
class: "message-content"
|
|
121
|
-
}, $
|
|
121
|
+
}, $e = /* @__PURE__ */ nt({
|
|
122
122
|
__name: "MessageItem",
|
|
123
123
|
props: {
|
|
124
124
|
msg: {},
|
|
@@ -129,7 +129,7 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
129
129
|
setMessageRef: { type: Function }
|
|
130
130
|
},
|
|
131
131
|
emits: ["regenerate"],
|
|
132
|
-
setup(
|
|
132
|
+
setup(t, { emit: u }) {
|
|
133
133
|
const r = I(/* @__PURE__ */ new Map());
|
|
134
134
|
function v(o, c) {
|
|
135
135
|
var a;
|
|
@@ -137,7 +137,7 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
137
137
|
let n = o.content;
|
|
138
138
|
if (!n && ((a = o.segments) != null && a.length) && (n = o.segments.filter((f) => f.type !== "thinking" && f.type !== "agent_thought").map((f) => f.content).join(`
|
|
139
139
|
`)), n) {
|
|
140
|
-
const { copy: f } =
|
|
140
|
+
const { copy: f } = jt();
|
|
141
141
|
f(n), r.set(c, !0), setTimeout(() => r.set(c, !1), 2e3);
|
|
142
142
|
}
|
|
143
143
|
} catch {
|
|
@@ -146,83 +146,83 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
146
146
|
return (o, c) => {
|
|
147
147
|
var a;
|
|
148
148
|
return w(), S("div", {
|
|
149
|
-
class: J(["message", `${
|
|
149
|
+
class: J(["message", `${t.msg.type}-message`])
|
|
150
150
|
}, [
|
|
151
|
-
|
|
152
|
-
(
|
|
153
|
-
|
|
151
|
+
t.msg.type === "ai" ? (w(), S(K, { key: 0 }, [
|
|
152
|
+
(t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (w(), S("div", we, [...c[2] || (c[2] = [
|
|
153
|
+
Gt('<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)
|
|
154
154
|
])])) : V("", !0),
|
|
155
|
-
|
|
155
|
+
t.msg.segments && t.msg.segments.length ? (w(), S("div", {
|
|
156
156
|
key: 1,
|
|
157
157
|
class: "message-content ba-markdown",
|
|
158
|
-
ref: (n) =>
|
|
158
|
+
ref: (n) => t.setMessageRef(n, t.index)
|
|
159
159
|
}, [
|
|
160
|
-
(w(!0), S(K, null,
|
|
160
|
+
(w(!0), S(K, null, ut(t.msg.segments, (n, f) => (w(), S(K, { key: f }, [
|
|
161
161
|
n.type === "agent_thought" ? (w(), S("div", {
|
|
162
162
|
key: 0,
|
|
163
163
|
class: J(["agent-thought", { "agent-thought--done": n.duration != null }])
|
|
164
164
|
}, [
|
|
165
|
-
s("span",
|
|
166
|
-
X(O(
|
|
165
|
+
s("span", ke, [
|
|
166
|
+
X(O(ue))
|
|
167
167
|
]),
|
|
168
|
-
s("span",
|
|
169
|
-
], 2)) : n.type === "thinking" ? (w(),
|
|
168
|
+
s("span", Ce, F(n.duration != null ? "工具调用" : "工具调用中..."), 1)
|
|
169
|
+
], 2)) : n.type === "thinking" ? (w(), tt(ye, {
|
|
170
170
|
key: 1,
|
|
171
171
|
content: n.content,
|
|
172
|
-
"is-streaming": n.duration == null && (
|
|
173
|
-
}, null, 8, ["content", "is-streaming"])) : (w(), S("div",
|
|
172
|
+
"is-streaming": n.duration == null && (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING)
|
|
173
|
+
}, null, 8, ["content", "is-streaming"])) : (w(), S("div", Ae, [
|
|
174
174
|
s("div", {
|
|
175
|
-
innerHTML: O(
|
|
176
|
-
}, null, 8,
|
|
175
|
+
innerHTML: O(Ot)(O($t)(t.getSegmentDisplayContent(t.index, f, n, t.msg)))
|
|
176
|
+
}, null, 8, Se)
|
|
177
177
|
]))
|
|
178
178
|
], 64))), 128)),
|
|
179
|
-
|
|
179
|
+
t.msg.status === t.STATUS.ANSWERING ? (w(), S("span", be)) : V("", !0)
|
|
180
180
|
], 512)) : V("", !0),
|
|
181
|
-
!((a =
|
|
181
|
+
!((a = t.msg.segments) != null && a.length) && t.msg.content ? (w(), S("div", {
|
|
182
182
|
key: 2,
|
|
183
183
|
class: "message-content ba-markdown",
|
|
184
|
-
ref: (n) =>
|
|
184
|
+
ref: (n) => t.setMessageRef(n, t.index)
|
|
185
185
|
}, [
|
|
186
186
|
s("div", {
|
|
187
|
-
innerHTML: O(
|
|
188
|
-
}, null, 8,
|
|
189
|
-
|
|
187
|
+
innerHTML: O(Ot)(O($t)(t.displayedContent.get(t.index) ?? t.msg.content))
|
|
188
|
+
}, null, 8, Re),
|
|
189
|
+
t.msg.status === t.STATUS.ANSWERING ? (w(), S("span", Ee)) : V("", !0)
|
|
190
190
|
], 512)) : V("", !0),
|
|
191
|
-
|
|
191
|
+
t.msg.errorMessage ? (w(), S("div", Me, [
|
|
192
192
|
c[3] || (c[3] = s("span", { class: "message-error__icon" }, "⚠️", -1)),
|
|
193
|
-
s("span", null, F(
|
|
193
|
+
s("span", null, F(t.msg.errorMessage), 1)
|
|
194
194
|
])) : V("", !0),
|
|
195
|
-
|
|
195
|
+
t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (w(), S("div", Te, [
|
|
196
196
|
s("div", {
|
|
197
197
|
class: "tooltip-enhanced",
|
|
198
|
-
"data-tooltip": r.get(
|
|
198
|
+
"data-tooltip": r.get(t.index) ? "已复制" : "复制回答"
|
|
199
199
|
}, [
|
|
200
|
-
r.get(
|
|
200
|
+
r.get(t.index) ? (w(), tt(O(ve), {
|
|
201
201
|
key: 0,
|
|
202
202
|
class: "message-toolbar__check"
|
|
203
|
-
})) : (w(),
|
|
203
|
+
})) : (w(), tt(O(de), {
|
|
204
204
|
key: 1,
|
|
205
|
-
onClick: c[0] || (c[0] = (n) => v(
|
|
205
|
+
onClick: c[0] || (c[0] = (n) => v(t.msg, t.index))
|
|
206
206
|
}))
|
|
207
|
-
], 8,
|
|
208
|
-
s("div",
|
|
209
|
-
X(O(
|
|
207
|
+
], 8, De),
|
|
208
|
+
s("div", He, [
|
|
209
|
+
X(O(ge), {
|
|
210
210
|
onClick: c[1] || (c[1] = (n) => o.$emit("regenerate"))
|
|
211
211
|
})
|
|
212
212
|
])
|
|
213
213
|
])) : V("", !0)
|
|
214
|
-
], 64)) : (w(), S("div",
|
|
214
|
+
], 64)) : (w(), S("div", Oe, F(t.msg.content), 1))
|
|
215
215
|
], 2);
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
|
-
}),
|
|
218
|
+
}), Pe = { class: "input-container" }, Ne = ["value", "disabled"], Be = {
|
|
219
219
|
key: 0,
|
|
220
220
|
class: "tooltip-enhanced stop",
|
|
221
221
|
"data-tooltip": "停止生成"
|
|
222
|
-
},
|
|
222
|
+
}, Le = ["data-tooltip"], xe = {
|
|
223
223
|
key: 2,
|
|
224
224
|
class: "moveTB"
|
|
225
|
-
},
|
|
225
|
+
}, We = /* @__PURE__ */ nt({
|
|
226
226
|
__name: "ChatInput",
|
|
227
227
|
props: {
|
|
228
228
|
modelValue: {},
|
|
@@ -232,17 +232,17 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
232
232
|
isAtBottom: { type: Boolean }
|
|
233
233
|
},
|
|
234
234
|
emits: ["update:modelValue", "send", "stop", "scroll-to-bottom"],
|
|
235
|
-
setup(
|
|
236
|
-
return (u, r) => (w(), S("div",
|
|
235
|
+
setup(t) {
|
|
236
|
+
return (u, r) => (w(), S("div", Pe, [
|
|
237
237
|
s("input", {
|
|
238
|
-
value:
|
|
238
|
+
value: t.modelValue,
|
|
239
239
|
type: "text",
|
|
240
240
|
placeholder: "给AI助手发送消息...",
|
|
241
241
|
onInput: r[0] || (r[0] = (v) => u.$emit("update:modelValue", v.target.value)),
|
|
242
|
-
onKeyup: r[1] || (r[1] =
|
|
243
|
-
disabled:
|
|
244
|
-
}, null, 40,
|
|
245
|
-
|
|
242
|
+
onKeyup: r[1] || (r[1] = Jt((v) => t.modelValue.trim() && u.$emit("send"), ["enter"])),
|
|
243
|
+
disabled: t.isGenerating
|
|
244
|
+
}, null, 40, Ne),
|
|
245
|
+
t.isGenerating && t.lastUserMessage ? (w(), S("div", Be, [
|
|
246
246
|
X(O(j), {
|
|
247
247
|
class: "op-icon stop-icon",
|
|
248
248
|
icon: "heroicons-solid:stop",
|
|
@@ -250,16 +250,16 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
250
250
|
})
|
|
251
251
|
])) : (w(), S("div", {
|
|
252
252
|
key: 1,
|
|
253
|
-
class: J(["tooltip-enhanced send", { disabled: !
|
|
254
|
-
"data-tooltip":
|
|
253
|
+
class: J(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
|
|
254
|
+
"data-tooltip": t.modelValue.trim() ? "开始回答" : "请输入你的问题"
|
|
255
255
|
}, [
|
|
256
256
|
X(O(j), {
|
|
257
257
|
class: "op-icon",
|
|
258
258
|
icon: "fluent-color:send-16",
|
|
259
|
-
onClick: r[3] || (r[3] = (v) =>
|
|
259
|
+
onClick: r[3] || (r[3] = (v) => t.modelValue.trim() && u.$emit("send"))
|
|
260
260
|
})
|
|
261
|
-
], 10,
|
|
262
|
-
|
|
261
|
+
], 10, Le)),
|
|
262
|
+
t.hasScroll && !t.isAtBottom ? (w(), S("div", xe, [
|
|
263
263
|
X(O(j), {
|
|
264
264
|
class: "op-icon",
|
|
265
265
|
icon: "ep:bottom",
|
|
@@ -269,22 +269,22 @@ const mt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
269
269
|
]));
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
|
-
function
|
|
272
|
+
function Ye(t) {
|
|
273
273
|
const u = C(!0), r = C(!1);
|
|
274
274
|
function v() {
|
|
275
275
|
Z(() => {
|
|
276
|
-
|
|
276
|
+
t.value && (t.value.scrollTop = t.value.scrollHeight);
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
function o() {
|
|
280
|
-
if (!
|
|
281
|
-
const c =
|
|
280
|
+
if (!t.value) return;
|
|
281
|
+
const c = t.value, a = c.scrollTop + c.clientHeight >= c.scrollHeight - 1, n = c.scrollHeight > c.clientHeight;
|
|
282
282
|
u.value = a, r.value = n;
|
|
283
283
|
}
|
|
284
284
|
return { isAtBottom: u, hasScroll: r, scrollToBottom: v, checkScrollStatus: o };
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
function
|
|
286
|
+
function Qe() {
|
|
287
|
+
function t(u) {
|
|
288
288
|
u.querySelectorAll("pre").forEach((v) => {
|
|
289
289
|
if (v.querySelector(".copy-button")) return;
|
|
290
290
|
const o = v.querySelector("code");
|
|
@@ -304,48 +304,48 @@ function Qt() {
|
|
|
304
304
|
}, v.appendChild(n);
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
|
-
return { enhanceCodeBlocks:
|
|
307
|
+
return { enhanceCodeBlocks: t };
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function Fe(t) {
|
|
310
310
|
let u = null, r = 0;
|
|
311
311
|
function v(c) {
|
|
312
|
-
u = c(u || [...
|
|
313
|
-
r = 0, u && (
|
|
312
|
+
u = c(u || [...t.value]), r || (r = requestAnimationFrame(() => {
|
|
313
|
+
r = 0, u && (t.value = u, u = null);
|
|
314
314
|
}));
|
|
315
315
|
}
|
|
316
316
|
function o() {
|
|
317
|
-
r && (cancelAnimationFrame(r), r = 0), u && (
|
|
317
|
+
r && (cancelAnimationFrame(r), r = 0), u && (t.value = u, u = null);
|
|
318
318
|
}
|
|
319
319
|
return { batchMessagesUpdate: v, flushMessagesBatch: o };
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Ve(t, u, r) {
|
|
322
322
|
const v = I(/* @__PURE__ */ new Map()), o = C(/* @__PURE__ */ new Map()), c = C(/* @__PURE__ */ new Map());
|
|
323
323
|
let a = 0, n = 0;
|
|
324
324
|
function f() {
|
|
325
325
|
if (a) return;
|
|
326
|
-
const
|
|
326
|
+
const h = 50, g = 100, E = (b) => {
|
|
327
327
|
if (n === 0) {
|
|
328
328
|
n = b, a = requestAnimationFrame(E);
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
331
|
const L = Math.min(b - n, 100);
|
|
332
332
|
n = b;
|
|
333
|
-
let
|
|
334
|
-
if (
|
|
333
|
+
let e = !1;
|
|
334
|
+
if (t.value.forEach((D, H) => {
|
|
335
335
|
if (D.type !== "ai" || D.status !== r) return;
|
|
336
336
|
const l = D.content, p = o.value.get(H) ?? 0, A = l.length - p;
|
|
337
337
|
if (A > 0) {
|
|
338
|
-
|
|
339
|
-
const y = Math.min(
|
|
340
|
-
if (
|
|
341
|
-
c.value.set(H, i -
|
|
342
|
-
const k = Math.min(p +
|
|
338
|
+
e = !0;
|
|
339
|
+
const y = Math.min(h + A, g), i = (c.value.get(H) ?? 0) + y * L / 1e3, m = Math.floor(i);
|
|
340
|
+
if (m > 0) {
|
|
341
|
+
c.value.set(H, i - m);
|
|
342
|
+
const k = Math.min(p + m, l.length);
|
|
343
343
|
o.value.set(H, k), v.set(H, l.slice(0, k));
|
|
344
344
|
} else
|
|
345
345
|
c.value.set(H, i);
|
|
346
346
|
} else
|
|
347
347
|
c.value.set(H, 0);
|
|
348
|
-
}),
|
|
348
|
+
}), e && u(), !t.value.some((D) => D.type === "ai" && D.status === r)) {
|
|
349
349
|
a = 0;
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
@@ -353,19 +353,19 @@ function Vt(e, u, r) {
|
|
|
353
353
|
};
|
|
354
354
|
n = 0, a = requestAnimationFrame(E);
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
a && (cancelAnimationFrame(a), a = 0),
|
|
358
|
-
|
|
356
|
+
function M() {
|
|
357
|
+
a && (cancelAnimationFrame(a), a = 0), t.value.forEach((h, g) => {
|
|
358
|
+
h.type === "ai" && (v.set(g, h.content), o.value.set(g, h.content.length), c.value.set(g, 0));
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
function B() {
|
|
362
362
|
a && (cancelAnimationFrame(a), a = 0);
|
|
363
363
|
}
|
|
364
|
-
function R(
|
|
364
|
+
function R(h, g, E, b) {
|
|
365
365
|
if (E.type !== "answer" || b.status !== r) return E.content;
|
|
366
366
|
const L = b.segments || [];
|
|
367
367
|
if (L.slice(g + 1).some((l) => l.type === "answer")) return E.content;
|
|
368
|
-
const x = o.value.get(
|
|
368
|
+
const x = o.value.get(h);
|
|
369
369
|
if (x == null) return E.content;
|
|
370
370
|
let D = 0;
|
|
371
371
|
for (let l = 0; l < g; l++)
|
|
@@ -373,10 +373,10 @@ function Vt(e, u, r) {
|
|
|
373
373
|
const H = D + E.content.length;
|
|
374
374
|
return x >= H ? E.content : x <= D ? "" : E.content.slice(0, x - D);
|
|
375
375
|
}
|
|
376
|
-
return { displayedContent: v, streamingIndexRef: o, startTypewriter: f, flushTypewriter:
|
|
376
|
+
return { displayedContent: v, streamingIndexRef: o, startTypewriter: f, flushTypewriter: M, getSegmentDisplayContent: R, stopTypewriter: B };
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
messages:
|
|
378
|
+
function Xe({
|
|
379
|
+
messages: t,
|
|
380
380
|
isGenerating: u,
|
|
381
381
|
lastUserMessage: r,
|
|
382
382
|
batchMessagesUpdate: v,
|
|
@@ -384,23 +384,23 @@ function Xt({
|
|
|
384
384
|
STATUS: c,
|
|
385
385
|
cfg: a
|
|
386
386
|
}) {
|
|
387
|
-
const n = C(/* @__PURE__ */ new Map()), f = C(/* @__PURE__ */ new Map()),
|
|
388
|
-
function
|
|
387
|
+
const n = C(/* @__PURE__ */ new Map()), f = C(/* @__PURE__ */ new Map()), M = C(/* @__PURE__ */ new Map()), B = C(/* @__PURE__ */ new Map()), R = C(!1);
|
|
388
|
+
function h(b) {
|
|
389
389
|
const L = n.value.get(b) || [];
|
|
390
|
-
v((
|
|
391
|
-
if (
|
|
392
|
-
const x = [...
|
|
390
|
+
v((e) => {
|
|
391
|
+
if (e[b]) {
|
|
392
|
+
const x = [...e];
|
|
393
393
|
return x[b] = { ...x[b], segments: L.map((D) => ({ ...D })) }, x;
|
|
394
394
|
}
|
|
395
|
-
return
|
|
395
|
+
return e;
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
398
|
function g(b) {
|
|
399
|
-
const L = n.value.get(b) || [],
|
|
399
|
+
const L = n.value.get(b) || [], e = M.value.get(b);
|
|
400
400
|
let x = 0, D = !1;
|
|
401
401
|
L.forEach((H) => {
|
|
402
402
|
if (H.type === "thinking" && H.duration == null) {
|
|
403
|
-
const l =
|
|
403
|
+
const l = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
|
|
404
404
|
H.duration = l, x += l, D = !0;
|
|
405
405
|
}
|
|
406
406
|
}), D && (n.value.set(b, L), v((H) => {
|
|
@@ -415,11 +415,11 @@ function Xt({
|
|
|
415
415
|
return H;
|
|
416
416
|
}));
|
|
417
417
|
}
|
|
418
|
-
async function E(b, L,
|
|
419
|
-
R.value = !1, n.value.set(
|
|
418
|
+
async function E(b, L, e, x, D = !1) {
|
|
419
|
+
R.value = !1, n.value.set(e, []), u.value = !0;
|
|
420
420
|
try {
|
|
421
421
|
const H = a.baseUrl.replace(/\/+$/, "") + "/" + b.replace(/^\/+/, "");
|
|
422
|
-
await
|
|
422
|
+
await le(H, {
|
|
423
423
|
method: "POST",
|
|
424
424
|
headers: { "Content-Type": "application/json" },
|
|
425
425
|
body: JSON.stringify({ app: a.app ?? 1, data: L }),
|
|
@@ -443,23 +443,23 @@ function Xt({
|
|
|
443
443
|
}
|
|
444
444
|
switch (y.event) {
|
|
445
445
|
case "message_start":
|
|
446
|
-
D || (r.value = y.id), f.value.set(
|
|
446
|
+
D || (r.value = y.id), f.value.set(e, "answer");
|
|
447
447
|
break;
|
|
448
448
|
case "think_message_output_start": {
|
|
449
|
-
|
|
450
|
-
const i = n.value.get(
|
|
451
|
-
n.value.set(
|
|
449
|
+
M.value.set(e, Date.now()), f.value.set(e, "thinking");
|
|
450
|
+
const i = n.value.get(e) || [];
|
|
451
|
+
n.value.set(e, [...i, { type: "thinking", content: "" }]), h(e);
|
|
452
452
|
break;
|
|
453
453
|
}
|
|
454
454
|
case "agent_thought": {
|
|
455
|
-
const i = y.thought || y.thinking || "",
|
|
456
|
-
k && k.type === "agent_thought" ? k.content += i : (f.value.set(
|
|
457
|
-
if ($[
|
|
455
|
+
const i = y.thought || y.thinking || "", m = n.value.get(e) || [], k = m[m.length - 1];
|
|
456
|
+
k && k.type === "agent_thought" ? k.content += i : (f.value.set(e, "agent_thought"), m.push({ type: "agent_thought", content: i }), B.value.set(e, Date.now())), n.value.set(e, m), v(($) => {
|
|
457
|
+
if ($[e]) {
|
|
458
458
|
const P = [...$];
|
|
459
|
-
return P[
|
|
460
|
-
...P[
|
|
461
|
-
segments:
|
|
462
|
-
thinkingContent: (P[
|
|
459
|
+
return P[e] = {
|
|
460
|
+
...P[e],
|
|
461
|
+
segments: m.map((N) => ({ ...N })),
|
|
462
|
+
thinkingContent: (P[e].thinkingContent || "") + i,
|
|
463
463
|
status: c.THINKING
|
|
464
464
|
}, P;
|
|
465
465
|
}
|
|
@@ -468,14 +468,14 @@ function Xt({
|
|
|
468
468
|
break;
|
|
469
469
|
}
|
|
470
470
|
case "think_message": {
|
|
471
|
-
const i = y.thinking || y.answer || y.text || "",
|
|
472
|
-
k && k.type === "thinking" ? k.content += i : (
|
|
473
|
-
if ($[
|
|
471
|
+
const i = y.thinking || y.answer || y.text || "", m = n.value.get(e) || [], k = m[m.length - 1];
|
|
472
|
+
k && k.type === "thinking" ? k.content += i : (m.push({ type: "thinking", content: i }), M.value.set(e, Date.now())), n.value.set(e, m), v(($) => {
|
|
473
|
+
if ($[e]) {
|
|
474
474
|
const P = [...$];
|
|
475
|
-
return P[
|
|
476
|
-
...P[
|
|
477
|
-
segments:
|
|
478
|
-
thinkingContent: (P[
|
|
475
|
+
return P[e] = {
|
|
476
|
+
...P[e],
|
|
477
|
+
segments: m.map((N) => ({ ...N })),
|
|
478
|
+
thinkingContent: (P[e].thinkingContent || "") + i,
|
|
479
479
|
status: c.THINKING
|
|
480
480
|
}, P;
|
|
481
481
|
}
|
|
@@ -484,14 +484,14 @@ function Xt({
|
|
|
484
484
|
break;
|
|
485
485
|
}
|
|
486
486
|
case "agent_thought_end": {
|
|
487
|
-
const i = B.value.get(
|
|
488
|
-
$ && $.type === "agent_thought" && ($.duration =
|
|
489
|
-
if (P[
|
|
487
|
+
const i = B.value.get(e), m = i ? Math.round((Date.now() - i) / 1e3 * 10) / 10 : 0, k = n.value.get(e) || [], $ = k[k.length - 1];
|
|
488
|
+
$ && $.type === "agent_thought" && ($.duration = m), n.value.set(e, k), v((P) => {
|
|
489
|
+
if (P[e]) {
|
|
490
490
|
const N = [...P];
|
|
491
|
-
return N[
|
|
492
|
-
...N[
|
|
491
|
+
return N[e] = {
|
|
492
|
+
...N[e],
|
|
493
493
|
segments: k.map((G) => ({ ...G })),
|
|
494
|
-
thinkingDuration: (N[
|
|
494
|
+
thinkingDuration: (N[e].thinkingDuration || 0) + m
|
|
495
495
|
}, N;
|
|
496
496
|
}
|
|
497
497
|
return P;
|
|
@@ -499,14 +499,14 @@ function Xt({
|
|
|
499
499
|
break;
|
|
500
500
|
}
|
|
501
501
|
case "think_message_output_end": {
|
|
502
|
-
const i =
|
|
503
|
-
$ && $.type === "thinking" && ($.duration =
|
|
504
|
-
if (P[
|
|
502
|
+
const i = M.value.get(e), m = i ? Math.round((Date.now() - i) / 1e3 * 10) / 10 : 0, k = n.value.get(e) || [], $ = k[k.length - 1];
|
|
503
|
+
$ && $.type === "thinking" && ($.duration = m), n.value.set(e, k), v((P) => {
|
|
504
|
+
if (P[e]) {
|
|
505
505
|
const N = [...P];
|
|
506
|
-
return N[
|
|
507
|
-
...N[
|
|
506
|
+
return N[e] = {
|
|
507
|
+
...N[e],
|
|
508
508
|
segments: k.map((G) => ({ ...G })),
|
|
509
|
-
thinkingDuration: (N[
|
|
509
|
+
thinkingDuration: (N[e].thinkingDuration || 0) + m
|
|
510
510
|
}, N;
|
|
511
511
|
}
|
|
512
512
|
return P;
|
|
@@ -516,23 +516,23 @@ function Xt({
|
|
|
516
516
|
case "tool_message": {
|
|
517
517
|
const i = y.answer || y.text || y.content || "";
|
|
518
518
|
if (!i) break;
|
|
519
|
-
const
|
|
520
|
-
|
|
519
|
+
const m = n.value.get(e) || [];
|
|
520
|
+
m.push({ type: "answer", content: i }), n.value.set(e, m), h(e);
|
|
521
521
|
break;
|
|
522
522
|
}
|
|
523
523
|
case "message_output_start":
|
|
524
|
-
f.value.set(
|
|
524
|
+
f.value.set(e, "answer"), g(e);
|
|
525
525
|
break;
|
|
526
526
|
case "message": {
|
|
527
|
-
const i = y.answer || "",
|
|
528
|
-
|
|
527
|
+
const i = y.answer || "", m = f.value.get(e), k = n.value.get(e) || [], $ = k[k.length - 1];
|
|
528
|
+
m === "answer" && $ && $.type === "answer" ? $.content += i : (g(e), f.value.set(e, "answer"), k.push({ type: "answer", content: i })), n.value.set(e, k);
|
|
529
529
|
const P = k.filter((N) => N.type === "answer").map((N) => N.content).join("");
|
|
530
530
|
v((N) => {
|
|
531
|
-
if (N[
|
|
531
|
+
if (N[e]) {
|
|
532
532
|
const G = [...N];
|
|
533
|
-
return G[
|
|
534
|
-
...G[
|
|
535
|
-
segments: k.map((
|
|
533
|
+
return G[e] = {
|
|
534
|
+
...G[e],
|
|
535
|
+
segments: k.map((vt) => ({ ...vt })),
|
|
536
536
|
content: P,
|
|
537
537
|
status: R.value ? c.STOP : c.ANSWERING
|
|
538
538
|
}, G;
|
|
@@ -543,30 +543,30 @@ function Xt({
|
|
|
543
543
|
}
|
|
544
544
|
case "message_end": {
|
|
545
545
|
o();
|
|
546
|
-
const i = [...
|
|
547
|
-
i[
|
|
546
|
+
const i = [...t.value];
|
|
547
|
+
i[e] && (i[e] = { ...i[e], status: R.value ? c.STOP : c.COMPLETED }), t.value = i, u.value = !1;
|
|
548
548
|
break;
|
|
549
549
|
}
|
|
550
550
|
case "agent_error":
|
|
551
551
|
case "message_failed": {
|
|
552
552
|
o();
|
|
553
|
-
const i = [...
|
|
554
|
-
i[
|
|
555
|
-
...i[
|
|
553
|
+
const i = [...t.value];
|
|
554
|
+
i[e] && (i[e] = {
|
|
555
|
+
...i[e],
|
|
556
556
|
status: c.ERROR,
|
|
557
557
|
content: y.error_msg || y.message || "请求失败",
|
|
558
558
|
errorMessage: y.error_msg || y.message || "请求失败"
|
|
559
|
-
},
|
|
559
|
+
}, t.value = i), u.value = !1;
|
|
560
560
|
break;
|
|
561
561
|
}
|
|
562
562
|
case "message_replace": {
|
|
563
|
-
const i = y.answer || "",
|
|
564
|
-
k != null ?
|
|
565
|
-
if ($[
|
|
563
|
+
const i = y.answer || "", m = n.value.get(e) || [], k = (p = m.map(($, P) => ({ s: $, i: P })).reverse().find(($) => $.s.type === "answer")) == null ? void 0 : p.i;
|
|
564
|
+
k != null ? m[k] = { ...m[k], content: i } : m.push({ type: "answer", content: i }), n.value.set(e, m), v(($) => {
|
|
565
|
+
if ($[e]) {
|
|
566
566
|
const P = [...$];
|
|
567
|
-
return P[
|
|
568
|
-
...P[
|
|
569
|
-
segments:
|
|
567
|
+
return P[e] = {
|
|
568
|
+
...P[e],
|
|
569
|
+
segments: m.map((N) => ({ ...N })),
|
|
570
570
|
content: i
|
|
571
571
|
}, P;
|
|
572
572
|
}
|
|
@@ -581,12 +581,12 @@ function Xt({
|
|
|
581
581
|
latency: y.latency || 0,
|
|
582
582
|
latencyFirstResp: y.latency_first_resp
|
|
583
583
|
};
|
|
584
|
-
v((
|
|
585
|
-
if (
|
|
586
|
-
const k = [...
|
|
587
|
-
return k[
|
|
584
|
+
v((m) => {
|
|
585
|
+
if (m[e]) {
|
|
586
|
+
const k = [...m];
|
|
587
|
+
return k[e] = { ...k[e], cost: i }, k;
|
|
588
588
|
}
|
|
589
|
-
return
|
|
589
|
+
return m;
|
|
590
590
|
});
|
|
591
591
|
break;
|
|
592
592
|
}
|
|
@@ -597,35 +597,35 @@ function Xt({
|
|
|
597
597
|
}
|
|
598
598
|
},
|
|
599
599
|
onclose() {
|
|
600
|
-
o(), g(
|
|
601
|
-
const p = (n.value.get(
|
|
602
|
-
A[
|
|
603
|
-
...A[
|
|
600
|
+
o(), g(e), o();
|
|
601
|
+
const p = (n.value.get(e) || []).filter((y) => y.type === "answer").map((y) => y.content).join(""), A = [...t.value];
|
|
602
|
+
A[e] && A[e].status !== c.ERROR && (A[e] = {
|
|
603
|
+
...A[e],
|
|
604
604
|
content: R.value && !p ? "已停止回答" : p,
|
|
605
605
|
status: R.value ? c.STOP : c.COMPLETED
|
|
606
|
-
}),
|
|
606
|
+
}), t.value = A, u.value = !1;
|
|
607
607
|
},
|
|
608
608
|
onerror(l) {
|
|
609
609
|
console.error("[ai-assist-sdk] ❌ 连接错误:", l), o();
|
|
610
|
-
const p = [...
|
|
611
|
-
p[
|
|
612
|
-
⚠️ 请求异常,已终止`, status: c.ERROR }),
|
|
610
|
+
const p = [...t.value];
|
|
611
|
+
p[e] && (p[e] = { ...p[e], content: `
|
|
612
|
+
⚠️ 请求异常,已终止`, status: c.ERROR }), t.value = p, u.value = !1;
|
|
613
613
|
}
|
|
614
614
|
});
|
|
615
615
|
} catch (H) {
|
|
616
616
|
if (console.error("[ai-assist-sdk] doStreamRequest error:", H), !R.value) {
|
|
617
617
|
o();
|
|
618
|
-
const l = [...
|
|
619
|
-
l[
|
|
618
|
+
const l = [...t.value];
|
|
619
|
+
l[e] && (l[e] = { ...l[e], content: "服务连接失败,请稍后重试", status: c.ERROR }), t.value = l, u.value = !1;
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
return { doStreamRequest: E, issTop: R };
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function Bt(t) {
|
|
626
626
|
var u;
|
|
627
|
-
if (
|
|
628
|
-
const r =
|
|
627
|
+
if (t && typeof t == "object" && typeof t.data == "string" && (t = t.data), typeof t == "string") {
|
|
628
|
+
const r = t.split(`
|
|
629
629
|
`);
|
|
630
630
|
let v = "";
|
|
631
631
|
for (const o of r) {
|
|
@@ -637,15 +637,15 @@ function Be(e) {
|
|
|
637
637
|
} catch {
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
|
-
return v ||
|
|
640
|
+
return v || t;
|
|
641
641
|
}
|
|
642
|
-
return (
|
|
642
|
+
return (t == null ? void 0 : t.answer) || ((u = t == null ? void 0 : t.data) == null ? void 0 : u.answer) || String(t || "");
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
644
|
+
function Ge(t) {
|
|
645
|
+
return t.queryAgainStreamApi || t.queryAgainApi || t.chatQueryStreamApi || t.chatQueryApi;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
messages:
|
|
647
|
+
function Je({
|
|
648
|
+
messages: t,
|
|
649
649
|
userInput: u,
|
|
650
650
|
isGenerating: r,
|
|
651
651
|
lastUserMessage: v,
|
|
@@ -654,20 +654,20 @@ function Jt({
|
|
|
654
654
|
issTop: a,
|
|
655
655
|
scrollToBottom: n,
|
|
656
656
|
STATUS: f,
|
|
657
|
-
cfg:
|
|
657
|
+
cfg: M,
|
|
658
658
|
onTitleGenerated: B
|
|
659
659
|
}) {
|
|
660
|
-
const R =
|
|
660
|
+
const R = M.apis, h = I({
|
|
661
661
|
first: new AbortController(),
|
|
662
662
|
again: new AbortController()
|
|
663
663
|
}), g = C(!1);
|
|
664
664
|
async function E(l, p) {
|
|
665
665
|
var y;
|
|
666
|
-
if (!
|
|
666
|
+
if (!M.titleGenerateApp || !R.updateConversationApi || g.value) return;
|
|
667
667
|
let A = o.value;
|
|
668
668
|
if (!A)
|
|
669
669
|
try {
|
|
670
|
-
const i = await
|
|
670
|
+
const i = await Pt(R);
|
|
671
671
|
(y = i == null ? void 0 : i.conversation) != null && y.appConversationID && (A = i.conversation.appConversationID, o.value = A);
|
|
672
672
|
} catch (i) {
|
|
673
673
|
console.error("[ai-assist-sdk] 创建会话失败:", i);
|
|
@@ -675,14 +675,14 @@ function Jt({
|
|
|
675
675
|
}
|
|
676
676
|
if (A)
|
|
677
677
|
try {
|
|
678
|
-
const i = await
|
|
678
|
+
const i = await Zt(R, M.titleGenerateApp);
|
|
679
679
|
if (!i) return;
|
|
680
|
-
const
|
|
681
|
-
AI回答:${
|
|
682
|
-
app:
|
|
680
|
+
const m = p.length > 500 ? p.slice(0, 500) : p, k = `用户提问:${l}
|
|
681
|
+
AI回答:${m}`, P = await Nt().post(R.chatQueryApi, {
|
|
682
|
+
app: M.titleGenerateApp,
|
|
683
683
|
data: { Query: k, AppConversationID: i }
|
|
684
|
-
}), N =
|
|
685
|
-
N && (await
|
|
684
|
+
}), N = Bt(P.data.data);
|
|
685
|
+
N && (await It(R, A, N), g.value = !0, B == null || B(N));
|
|
686
686
|
} catch (i) {
|
|
687
687
|
console.error("[ai-assist-sdk] 生成对话标题失败:", i);
|
|
688
688
|
}
|
|
@@ -691,101 +691,101 @@ AI回答:${h}`, P = await Ne().post(R.chatQueryApi, {
|
|
|
691
691
|
const l = u.value.trim();
|
|
692
692
|
if (!l || r.value) return;
|
|
693
693
|
if (!o.value && (await D(), !o.value)) {
|
|
694
|
-
|
|
694
|
+
ct("创建会话失败,请重试");
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
|
-
const p =
|
|
698
|
-
...
|
|
697
|
+
const p = t.value.length === 0, A = [
|
|
698
|
+
...t.value,
|
|
699
699
|
{ type: "user", content: l },
|
|
700
700
|
{ type: "ai", content: "", status: f.THINKING }
|
|
701
701
|
];
|
|
702
|
-
|
|
702
|
+
t.value = A, u.value = "", n();
|
|
703
703
|
const y = A.length - 1;
|
|
704
704
|
if (R.chatQueryStreamApi) {
|
|
705
705
|
if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", R.chatQueryStreamApi), await c(R.chatQueryStreamApi, {
|
|
706
706
|
Query: l,
|
|
707
707
|
AppConversationID: o.value,
|
|
708
708
|
ResponseMode: "streaming"
|
|
709
|
-
}, y,
|
|
710
|
-
const i =
|
|
709
|
+
}, y, h.first.signal), p && !g.value) {
|
|
710
|
+
const i = t.value[y];
|
|
711
711
|
i && i.status !== f.ERROR && E(l, i.content);
|
|
712
712
|
}
|
|
713
713
|
return;
|
|
714
714
|
}
|
|
715
715
|
console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
|
|
716
716
|
try {
|
|
717
|
-
const
|
|
718
|
-
app:
|
|
717
|
+
const m = await Nt().post(R.chatQueryApi, {
|
|
718
|
+
app: M.app ?? 1,
|
|
719
719
|
data: { Query: l, AppConversationID: o.value }
|
|
720
|
-
}), k =
|
|
721
|
-
|
|
720
|
+
}), k = Bt(m.data);
|
|
721
|
+
t.value = [...t.value.slice(0, -1), { type: "ai", content: k, status: f.COMPLETED }], p && !g.value && E(l, k);
|
|
722
722
|
} catch (i) {
|
|
723
|
-
|
|
723
|
+
t.value = [...t.value.slice(0, -1), { type: "ai", content: (i == null ? void 0 : i.message) || "服务连接失败,请稍后重试", status: f.ERROR }];
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
726
|
async function L() {
|
|
727
727
|
if (!v.value || r.value) return;
|
|
728
|
-
|
|
729
|
-
const l = [...
|
|
730
|
-
l.length > 0 && l[l.length - 1].type === "ai" && l.pop(), l.push({ type: "ai", content: "", status: f.RETHINKING }),
|
|
731
|
-
const p =
|
|
728
|
+
h.again.abort(), h.again = new AbortController();
|
|
729
|
+
const l = [...t.value];
|
|
730
|
+
l.length > 0 && l[l.length - 1].type === "ai" && l.pop(), l.push({ type: "ai", content: "", status: f.RETHINKING }), t.value = l, n();
|
|
731
|
+
const p = t.value.length - 1, A = Ge(R);
|
|
732
732
|
await c(A, {
|
|
733
733
|
MessageID: v.value,
|
|
734
734
|
AppConversationID: o.value,
|
|
735
735
|
ResponseMode: "streaming"
|
|
736
|
-
}, p,
|
|
736
|
+
}, p, h.again.signal, !0);
|
|
737
737
|
}
|
|
738
|
-
async function
|
|
738
|
+
async function e() {
|
|
739
739
|
if (!R.stopMessageApi || !r.value) return;
|
|
740
|
-
const l =
|
|
740
|
+
const l = t.value.length - 1 - 1;
|
|
741
741
|
try {
|
|
742
|
-
await
|
|
743
|
-
const p = [...
|
|
744
|
-
p[l] && (p[l] = { ...p[l], content: p[l].content || "已停止回答", status: f.STOP }),
|
|
742
|
+
await zt(R, v.value);
|
|
743
|
+
const p = [...t.value];
|
|
744
|
+
p[l] && (p[l] = { ...p[l], content: p[l].content || "已停止回答", status: f.STOP }), t.value = p, r.value = !1, h.first.abort(), h.first = new AbortController(), h.again.abort(), h.again = new AbortController(), a.value = !0;
|
|
745
745
|
} catch (p) {
|
|
746
|
-
const A = [...
|
|
747
|
-
A[l] && (A[l] = { ...A[l], content: (p == null ? void 0 : p.message) || "系统繁忙,请稍后再试", status: f.ERROR }),
|
|
746
|
+
const A = [...t.value];
|
|
747
|
+
A[l] && (A[l] = { ...A[l], content: (p == null ? void 0 : p.message) || "系统繁忙,请稍后再试", status: f.ERROR }), t.value = A;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
750
|
async function x(l) {
|
|
751
751
|
var p, A;
|
|
752
752
|
o.value = l, g.value = !0;
|
|
753
753
|
try {
|
|
754
|
-
const y = await
|
|
754
|
+
const y = await Kt(R, l), i = [];
|
|
755
755
|
if ((p = y == null ? void 0 : y.messages) != null && p.length)
|
|
756
|
-
for (const
|
|
757
|
-
|
|
758
|
-
|
|
756
|
+
for (const m of y.messages)
|
|
757
|
+
m.query && i.push({ type: "user", content: m.query }), (A = m.answerInfo) != null && A.answer && i.push({ type: "ai", content: m.answerInfo.answer, status: f.COMPLETED });
|
|
758
|
+
t.value = i, n();
|
|
759
759
|
} catch (y) {
|
|
760
|
-
|
|
760
|
+
ct((y == null ? void 0 : y.message) || "加载历史会话失败");
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
async function D() {
|
|
764
764
|
var l;
|
|
765
765
|
g.value = !1;
|
|
766
766
|
try {
|
|
767
|
-
const p = await
|
|
767
|
+
const p = await Pt(R);
|
|
768
768
|
(l = p == null ? void 0 : p.conversation) != null && l.appConversationID && (o.value = p.conversation.appConversationID);
|
|
769
769
|
} catch (p) {
|
|
770
|
-
|
|
770
|
+
ct((p == null ? void 0 : p.message) || "创建会话失败");
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
function H() {
|
|
774
774
|
o.value = "", g.value = !1;
|
|
775
775
|
}
|
|
776
|
-
return { sendMessage: b, regenerateResponse: L, toggleStop:
|
|
776
|
+
return { sendMessage: b, regenerateResponse: L, toggleStop: e, goHistoryMessage: x, initConversation: D, resetConversation: H, controllers: h };
|
|
777
777
|
}
|
|
778
|
-
const
|
|
778
|
+
const qe = { class: "container" }, _e = { class: "message ai-message greet-message" }, Ue = { class: "ai-greet" }, je = ["src"], Ke = {
|
|
779
779
|
key: 0,
|
|
780
780
|
class: "message ai-message recommend-message"
|
|
781
|
-
},
|
|
781
|
+
}, ze = { class: "ai-recommend" }, Ze = { class: "recommend-header" }, Ie = ["src"], tn = ["onClick"], en = /* @__PURE__ */ nt({
|
|
782
782
|
__name: "Answer",
|
|
783
783
|
props: {
|
|
784
784
|
defaultSayhello: {},
|
|
785
785
|
defaultRecommend: {}
|
|
786
786
|
},
|
|
787
787
|
emits: ["title-generated"],
|
|
788
|
-
setup(
|
|
788
|
+
setup(t, { expose: u, emit: r }) {
|
|
789
789
|
const v = {
|
|
790
790
|
THINKING: "thinking",
|
|
791
791
|
RETHINKING: "rethinking",
|
|
@@ -794,121 +794,121 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
794
794
|
COMPLETED: "completed",
|
|
795
795
|
STOP: "stop",
|
|
796
796
|
ERROR: "error"
|
|
797
|
-
}, o =
|
|
797
|
+
}, o = t, c = r, a = ft(), n = C([]), f = C(""), M = C(!1), B = C(""), R = C(""), h = C(null), g = I({ text1: "", text2: "" }), E = C([]), b = C(0), L = _(
|
|
798
798
|
() => E.value[b.value % (E.value.length || 1)]
|
|
799
799
|
);
|
|
800
|
-
function
|
|
800
|
+
function e() {
|
|
801
801
|
b.value++;
|
|
802
802
|
}
|
|
803
803
|
function x(Y) {
|
|
804
804
|
f.value = Y;
|
|
805
805
|
}
|
|
806
|
-
const { isAtBottom: D, hasScroll: H, scrollToBottom: l, checkScrollStatus: p } =
|
|
806
|
+
const { isAtBottom: D, hasScroll: H, scrollToBottom: l, checkScrollStatus: p } = Ye(h), { enhanceCodeBlocks: A } = Qe(), { batchMessagesUpdate: y, flushMessagesBatch: i } = Fe(n), { displayedContent: m, streamingIndexRef: k, startTypewriter: $, stopTypewriter: P, getSegmentDisplayContent: N } = Ve(
|
|
807
807
|
n,
|
|
808
808
|
l,
|
|
809
809
|
v.ANSWERING
|
|
810
|
-
), { doStreamRequest: G, issTop:
|
|
810
|
+
), { doStreamRequest: G, issTop: vt } = Xe({
|
|
811
811
|
messages: n,
|
|
812
|
-
isGenerating:
|
|
812
|
+
isGenerating: M,
|
|
813
813
|
lastUserMessage: B,
|
|
814
814
|
batchMessagesUpdate: y,
|
|
815
815
|
flushMessagesBatch: i,
|
|
816
816
|
STATUS: v,
|
|
817
817
|
cfg: a
|
|
818
|
-
}), { sendMessage:
|
|
818
|
+
}), { sendMessage: dt, regenerateResponse: pt, toggleStop: yt, goHistoryMessage: St, resetConversation: bt } = Je({
|
|
819
819
|
messages: n,
|
|
820
820
|
userInput: f,
|
|
821
|
-
isGenerating:
|
|
821
|
+
isGenerating: M,
|
|
822
822
|
lastUserMessage: B,
|
|
823
823
|
conversationId: R,
|
|
824
824
|
doStreamRequest: G,
|
|
825
|
-
issTop:
|
|
825
|
+
issTop: vt,
|
|
826
826
|
scrollToBottom: l,
|
|
827
827
|
STATUS: v,
|
|
828
828
|
cfg: a,
|
|
829
829
|
onTitleGenerated: (Y) => c("title-generated", Y)
|
|
830
830
|
});
|
|
831
|
-
function
|
|
832
|
-
n.value = [], B.value = "",
|
|
831
|
+
function st() {
|
|
832
|
+
n.value = [], B.value = "", bt();
|
|
833
833
|
}
|
|
834
|
-
const
|
|
835
|
-
u({ goHistoryMessage:
|
|
836
|
-
const
|
|
837
|
-
function
|
|
838
|
-
Y ?
|
|
834
|
+
const ot = _(() => n.value.length === 0);
|
|
835
|
+
u({ goHistoryMessage: St, createNewConversation: st, isEmptyConversation: ot });
|
|
836
|
+
const at = C(/* @__PURE__ */ new Map());
|
|
837
|
+
function Rt(Y, Q) {
|
|
838
|
+
Y ? at.value.set(Q, Y) : at.value.delete(Q);
|
|
839
839
|
}
|
|
840
|
-
|
|
840
|
+
Ct(n, () => {
|
|
841
841
|
Z(() => {
|
|
842
842
|
n.value.forEach((Y, Q) => {
|
|
843
|
-
Y.type === "ai" && Y.status !== v.ANSWERING && (
|
|
844
|
-
}), $(),
|
|
843
|
+
Y.type === "ai" && Y.status !== v.ANSWERING && (m.set(Q, Y.content), k.value.set(Q, Y.content.length));
|
|
844
|
+
}), $(), at.value.forEach((Y) => {
|
|
845
845
|
A(Y);
|
|
846
846
|
});
|
|
847
847
|
});
|
|
848
848
|
}, { deep: !0 });
|
|
849
849
|
let z = null;
|
|
850
|
-
return
|
|
851
|
-
o.defaultSayhello && (g.text1 = o.defaultSayhello.text1, g.text2 = o.defaultSayhello.text2), o.defaultRecommend && (E.value =
|
|
852
|
-
}),
|
|
853
|
-
|
|
854
|
-
}),
|
|
855
|
-
P(),
|
|
850
|
+
return et(() => {
|
|
851
|
+
o.defaultSayhello && (g.text1 = o.defaultSayhello.text1, g.text2 = o.defaultSayhello.text2), o.defaultRecommend && (E.value = te(o.defaultRecommend));
|
|
852
|
+
}), et(() => {
|
|
853
|
+
h.value && (z = () => p(), h.value.addEventListener("scroll", z));
|
|
854
|
+
}), At(() => {
|
|
855
|
+
P(), h.value && z && h.value.removeEventListener("scroll", z);
|
|
856
856
|
}), (Y, Q) => {
|
|
857
|
-
var
|
|
858
|
-
return w(), S("div",
|
|
857
|
+
var wt;
|
|
858
|
+
return w(), S("div", qe, [
|
|
859
859
|
s("div", {
|
|
860
860
|
class: "chat-box scrollWrap",
|
|
861
861
|
ref_key: "chatBoxRef",
|
|
862
|
-
ref:
|
|
862
|
+
ref: h
|
|
863
863
|
}, [
|
|
864
|
-
s("div",
|
|
865
|
-
s("div",
|
|
866
|
-
s("img", { src: O(
|
|
864
|
+
s("div", _e, [
|
|
865
|
+
s("div", Ue, [
|
|
866
|
+
s("img", { src: O(xt) }, null, 8, je),
|
|
867
867
|
s("h1", null, F(g.text1), 1),
|
|
868
868
|
s("p", null, F(g.text2), 1)
|
|
869
869
|
])
|
|
870
870
|
]),
|
|
871
|
-
(
|
|
872
|
-
s("div",
|
|
873
|
-
s("div",
|
|
871
|
+
(wt = L.value) != null && wt.length ? (w(), S("div", Ke, [
|
|
872
|
+
s("div", ze, [
|
|
873
|
+
s("div", Ze, [
|
|
874
874
|
Q[2] || (Q[2] = s("span", null, "你可以尝试这样问我:", -1)),
|
|
875
875
|
s("p", {
|
|
876
876
|
class: "refresh-btn",
|
|
877
|
-
onClick:
|
|
877
|
+
onClick: e
|
|
878
878
|
}, [
|
|
879
|
-
s("img", { src: O(
|
|
879
|
+
s("img", { src: O(he) }, null, 8, Ie),
|
|
880
880
|
Q[1] || (Q[1] = s("span", null, "换一换", -1))
|
|
881
881
|
])
|
|
882
882
|
]),
|
|
883
883
|
s("ul", null, [
|
|
884
|
-
(w(!0), S(K, null,
|
|
885
|
-
key:
|
|
886
|
-
onClick: (
|
|
887
|
-
}, F(U), 9,
|
|
884
|
+
(w(!0), S(K, null, ut(L.value, (U, it) => (w(), S("li", {
|
|
885
|
+
key: it,
|
|
886
|
+
onClick: (lt) => x(U)
|
|
887
|
+
}, F(U), 9, tn))), 128))
|
|
888
888
|
])
|
|
889
889
|
])
|
|
890
890
|
])) : V("", !0),
|
|
891
|
-
(w(!0), S(K, null,
|
|
892
|
-
key:
|
|
891
|
+
(w(!0), S(K, null, ut(n.value, (U, it) => (w(), tt($e, {
|
|
892
|
+
key: it,
|
|
893
893
|
msg: U,
|
|
894
|
-
index:
|
|
894
|
+
index: it,
|
|
895
895
|
STATUS: v,
|
|
896
|
-
displayedContent: O(
|
|
896
|
+
displayedContent: O(m),
|
|
897
897
|
getSegmentDisplayContent: O(N),
|
|
898
|
-
setMessageRef:
|
|
899
|
-
onRegenerate: O(
|
|
898
|
+
setMessageRef: Rt,
|
|
899
|
+
onRegenerate: O(pt)
|
|
900
900
|
}, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent", "onRegenerate"]))), 128))
|
|
901
901
|
], 512),
|
|
902
|
-
X(
|
|
902
|
+
X(We, {
|
|
903
903
|
modelValue: f.value,
|
|
904
904
|
"onUpdate:modelValue": Q[0] || (Q[0] = (U) => f.value = U),
|
|
905
|
-
isGenerating:
|
|
905
|
+
isGenerating: M.value,
|
|
906
906
|
lastUserMessage: B.value,
|
|
907
907
|
hasScroll: O(H),
|
|
908
908
|
isAtBottom: O(D),
|
|
909
|
-
onSend: O(
|
|
910
|
-
onRegenerate: O(
|
|
911
|
-
onStop: O(
|
|
909
|
+
onSend: O(dt),
|
|
910
|
+
onRegenerate: O(pt),
|
|
911
|
+
onStop: O(yt),
|
|
912
912
|
onScrollToBottom: O(l)
|
|
913
913
|
}, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"]),
|
|
914
914
|
Q[3] || (Q[3] = s("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
|
|
@@ -921,69 +921,69 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
921
921
|
}, an = { class: "ai-history-group-title" }, ln = ["onClick"], rn = { class: "ai-history-item-title" }, cn = ["onClick"], un = {
|
|
922
922
|
key: 2,
|
|
923
923
|
class: "ai-history-empty"
|
|
924
|
-
}, vn = ["src"], dn = { class: "ai-modal" }, gn = { class: "ai-modal-footer" },
|
|
924
|
+
}, vn = ["src"], dn = { class: "ai-modal" }, gn = { class: "ai-modal-footer" }, hn = /* @__PURE__ */ nt({
|
|
925
925
|
__name: "History",
|
|
926
926
|
emits: ["history-detail", "new-conversation"],
|
|
927
|
-
setup(
|
|
928
|
-
const v =
|
|
929
|
-
async function
|
|
927
|
+
setup(t, { emit: u }) {
|
|
928
|
+
const v = ft().apis, o = C([]), c = C(!0), a = C(!1), n = C(""), f = _(() => ee(o.value));
|
|
929
|
+
async function M() {
|
|
930
930
|
try {
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
} catch (
|
|
934
|
-
|
|
931
|
+
const h = await ne(v);
|
|
932
|
+
h != null && h.conversationList && (o.value = h.conversationList.filter((g) => g !== null).map((g) => ({ ...g, selected: !1 })));
|
|
933
|
+
} catch (h) {
|
|
934
|
+
ct((h == null ? void 0 : h.message) || "获取历史记录失败");
|
|
935
935
|
} finally {
|
|
936
936
|
c.value = !1;
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
|
-
function B(
|
|
940
|
-
n.value =
|
|
939
|
+
function B(h) {
|
|
940
|
+
n.value = h, a.value = !0;
|
|
941
941
|
}
|
|
942
942
|
async function R() {
|
|
943
943
|
a.value = !1;
|
|
944
944
|
try {
|
|
945
|
-
await
|
|
946
|
-
} catch (
|
|
947
|
-
|
|
945
|
+
await se(v, n.value), await M();
|
|
946
|
+
} catch (h) {
|
|
947
|
+
ct((h == null ? void 0 : h.message) || "删除失败"), await M();
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
|
-
return
|
|
951
|
-
|
|
952
|
-
}), (
|
|
950
|
+
return et(() => {
|
|
951
|
+
M();
|
|
952
|
+
}), (h, g) => (w(), S("div", nn, [
|
|
953
953
|
s("div", sn, [
|
|
954
954
|
c.value ? (w(), S("div", on, [...g[3] || (g[3] = [
|
|
955
955
|
s("div", { class: "ai-history-spinner" }, null, -1)
|
|
956
|
-
])])) : f.value.length > 0 ? (w(!0), S(K, { key: 1 },
|
|
956
|
+
])])) : f.value.length > 0 ? (w(!0), S(K, { key: 1 }, ut(f.value, (E) => (w(), S("div", {
|
|
957
957
|
key: E.label,
|
|
958
958
|
class: "ai-history-group"
|
|
959
959
|
}, [
|
|
960
960
|
s("div", an, F(E.label), 1),
|
|
961
|
-
(w(!0), S(K, null,
|
|
961
|
+
(w(!0), S(K, null, ut(E.items, (b, L) => (w(), S("div", {
|
|
962
962
|
key: b.appConversationID,
|
|
963
963
|
class: "ai-history-item",
|
|
964
|
-
style:
|
|
965
|
-
onClick: (
|
|
964
|
+
style: Mt({ "--i": L }),
|
|
965
|
+
onClick: (e) => h.$emit("history-detail", b.appConversationID)
|
|
966
966
|
}, [
|
|
967
967
|
s("div", rn, F(b.conversationName), 1),
|
|
968
968
|
s("div", {
|
|
969
969
|
class: "ai-history-item-delete",
|
|
970
|
-
onClick:
|
|
970
|
+
onClick: Ht((e) => B(b.appConversationID), ["stop"])
|
|
971
971
|
}, "删除", 8, cn)
|
|
972
972
|
], 12, ln))), 128))
|
|
973
973
|
]))), 128)) : (w(), S("div", un, "暂无历史记录"))
|
|
974
974
|
]),
|
|
975
975
|
s("div", {
|
|
976
976
|
class: "ai-add",
|
|
977
|
-
onClick: g[0] || (g[0] = (E) =>
|
|
977
|
+
onClick: g[0] || (g[0] = (E) => h.$emit("new-conversation"))
|
|
978
978
|
}, [
|
|
979
|
-
s("img", { src: O(
|
|
979
|
+
s("img", { src: O(re) }, null, 8, vn),
|
|
980
980
|
g[4] || (g[4] = s("span", null, "新建AI对话", -1))
|
|
981
981
|
]),
|
|
982
|
-
(w(),
|
|
982
|
+
(w(), tt(qt, { to: "#ai-assist-root" }, [
|
|
983
983
|
a.value ? (w(), S("div", {
|
|
984
984
|
key: 0,
|
|
985
985
|
class: "ai-modal-overlay",
|
|
986
|
-
onClick: g[2] || (g[2] =
|
|
986
|
+
onClick: g[2] || (g[2] = Ht((E) => a.value = !1, ["self"]))
|
|
987
987
|
}, [
|
|
988
988
|
s("div", dn, [
|
|
989
989
|
g[5] || (g[5] = s("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
|
|
@@ -1003,19 +1003,19 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
1003
1003
|
]))
|
|
1004
1004
|
]));
|
|
1005
1005
|
}
|
|
1006
|
-
}),
|
|
1006
|
+
}), mn = { class: "container info" }, fn = { class: "info-item" }, pn = { class: "basic-content" }, yn = { class: "basic-content-text" }, wn = { class: "basic-content" }, kn = { class: "basic-content-text" }, Cn = { class: "info-item" }, An = { class: "permission-content" }, Sn = { class: "info-item" }, bn = { class: "basic-content" }, Rn = { class: "basic-content-text" }, En = { class: "basic-content" }, Mn = { class: "basic-content-text" }, Tn = /* @__PURE__ */ nt({
|
|
1007
1007
|
__name: "Info",
|
|
1008
|
-
setup(
|
|
1009
|
-
const u =
|
|
1010
|
-
return
|
|
1008
|
+
setup(t) {
|
|
1009
|
+
const u = ft(), r = C(null);
|
|
1010
|
+
return et(async () => {
|
|
1011
1011
|
try {
|
|
1012
|
-
r.value = await
|
|
1012
|
+
r.value = await oe(u.apis);
|
|
1013
1013
|
} catch (v) {
|
|
1014
|
-
|
|
1014
|
+
ct((v == null ? void 0 : v.message) || "获取个人信息失败");
|
|
1015
1015
|
}
|
|
1016
1016
|
}), (v, o) => {
|
|
1017
|
-
var c, a, n, f,
|
|
1018
|
-
return w(), S("div",
|
|
1017
|
+
var c, a, n, f, M;
|
|
1018
|
+
return w(), S("div", mn, [
|
|
1019
1019
|
s("div", fn, [
|
|
1020
1020
|
o[2] || (o[2] = s("div", { class: "heading" }, [
|
|
1021
1021
|
s("div", { class: "heading-column" }),
|
|
@@ -1036,7 +1036,7 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
1036
1036
|
s("div", { class: "heading-title" }, "数据权限")
|
|
1037
1037
|
], -1)),
|
|
1038
1038
|
s("div", An, [
|
|
1039
|
-
(w(!0), S(K, null,
|
|
1039
|
+
(w(!0), S(K, null, ut((n = r.value) == null ? void 0 : n.ptnameList, (B, R) => (w(), S("div", {
|
|
1040
1040
|
key: R,
|
|
1041
1041
|
class: "permission-content-text"
|
|
1042
1042
|
}, F(B), 1))), 128))
|
|
@@ -1053,87 +1053,87 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
1053
1053
|
]),
|
|
1054
1054
|
s("div", En, [
|
|
1055
1055
|
o[5] || (o[5] = s("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
|
|
1056
|
-
s("div",
|
|
1056
|
+
s("div", Mn, F(((M = r.value) == null ? void 0 : M.email) || ""), 1)
|
|
1057
1057
|
])
|
|
1058
1058
|
])
|
|
1059
1059
|
]);
|
|
1060
1060
|
};
|
|
1061
1061
|
}
|
|
1062
|
-
}), Dn = { class: "header" }, Hn = { key: 1 }, On = ["src"], $n = { class: "header-title" }, Pn = ["title"], Nn = { class: "ai-history-drawer-panel" }, Bn = { class: "ai-history-drawer-header" }, Ln = { class: "setTitle" }, xn = { class: "content" }, Wn = { class: "main" }, Yn = { class: "btn" }, Qn = ["src"], Fn = 78,
|
|
1062
|
+
}), Dn = { class: "header" }, Hn = { key: 1 }, On = ["src"], $n = { class: "header-title" }, Pn = ["title"], Nn = { class: "ai-history-drawer-panel" }, Bn = { class: "ai-history-drawer-header" }, Ln = { class: "setTitle" }, xn = { class: "content" }, Wn = { class: "main" }, Yn = { class: "btn" }, Qn = ["src"], Fn = 78, ht = 78, Wt = /* @__PURE__ */ nt({
|
|
1063
1063
|
__name: "AiAssist",
|
|
1064
|
-
setup(
|
|
1065
|
-
const u = Fn / 2, r =
|
|
1064
|
+
setup(t) {
|
|
1065
|
+
const u = Fn / 2, r = ft(), v = C(!1), o = C("idle"), c = C(!1), a = I({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), n = C(!1), f = C(window.innerWidth < 768), M = C(window.innerWidth < 768), B = C("answer"), R = C(!1), h = C(""), g = C(""), E = C(""), b = C(!1), L = C(!1), e = I({
|
|
1066
1066
|
x: window.innerWidth - u,
|
|
1067
|
-
y: window.innerHeight / 2 -
|
|
1067
|
+
y: window.innerHeight / 2 - ht / 2
|
|
1068
1068
|
}), x = C(!1), D = C(!1), H = C("right"), l = C("left"), p = I({ x: 0, y: 0 }), A = C(!1), y = C(null);
|
|
1069
|
-
let i = null,
|
|
1069
|
+
let i = null, m = null;
|
|
1070
1070
|
const k = _(() => {
|
|
1071
1071
|
const d = window.innerWidth / 2;
|
|
1072
|
-
return
|
|
1073
|
-
}), $ = _(() =>
|
|
1072
|
+
return e.x + u < d ? 5 : -5;
|
|
1073
|
+
}), $ = _(() => M.value ? "" : `panel-${H.value}`), P = _(() => {
|
|
1074
1074
|
var d;
|
|
1075
1075
|
return !((d = y.value) != null && d.isEmptyConversation);
|
|
1076
1076
|
}), N = _(() => ({
|
|
1077
|
-
left: `${
|
|
1078
|
-
top: `${
|
|
1077
|
+
left: `${e.x}px`,
|
|
1078
|
+
top: `${e.y}px`,
|
|
1079
1079
|
transition: x.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
|
|
1080
1080
|
"--direction": String(k.value)
|
|
1081
|
-
})), G = _(() => r.characterImage ||
|
|
1081
|
+
})), G = _(() => r.characterImage || ce), vt = _(() => o.value === "idle" ? {} : {
|
|
1082
1082
|
left: `${a.x}px`,
|
|
1083
1083
|
top: `${a.y}px`,
|
|
1084
1084
|
width: `${a.w}px`,
|
|
1085
1085
|
height: `${a.h}px`,
|
|
1086
1086
|
borderRadius: a.radius
|
|
1087
1087
|
});
|
|
1088
|
-
function
|
|
1088
|
+
function dt() {
|
|
1089
1089
|
const d = window.innerWidth / 2;
|
|
1090
|
-
|
|
1090
|
+
e.x + u < d ? (H.value = "left", l.value = "right") : (H.value = "right", l.value = "left");
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1093
|
-
const d = window.innerWidth,
|
|
1094
|
-
return { x:
|
|
1092
|
+
function pt() {
|
|
1093
|
+
const d = window.innerWidth, T = Math.max(0, Math.min(e.y, window.innerHeight - ht));
|
|
1094
|
+
return { x: e.x + u >= d / 2 ? d - u : -u, y: T };
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1096
|
+
function yt() {
|
|
1097
1097
|
D.value = !0;
|
|
1098
|
-
const d =
|
|
1099
|
-
|
|
1100
|
-
D.value = !1,
|
|
1098
|
+
const d = pt();
|
|
1099
|
+
e.x = d.x, e.y = d.y, setTimeout(() => {
|
|
1100
|
+
D.value = !1, dt(), St();
|
|
1101
1101
|
}, 400);
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1103
|
+
function St() {
|
|
1104
1104
|
try {
|
|
1105
|
-
localStorage.setItem("characterPosition", JSON.stringify({ x:
|
|
1105
|
+
localStorage.setItem("characterPosition", JSON.stringify({ x: e.x, y: e.y })), localStorage.setItem("panelPosition", H.value), localStorage.setItem("backPosition", l.value);
|
|
1106
1106
|
} catch {
|
|
1107
1107
|
}
|
|
1108
1108
|
}
|
|
1109
|
-
function
|
|
1109
|
+
function bt() {
|
|
1110
1110
|
const d = localStorage.getItem("characterPosition");
|
|
1111
1111
|
if (d) {
|
|
1112
1112
|
const q = JSON.parse(d);
|
|
1113
|
-
|
|
1113
|
+
e.x = q.x, e.y = Math.min(Math.max(q.y, 0), window.innerHeight - ht);
|
|
1114
1114
|
} else
|
|
1115
|
-
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1115
|
+
e.x = window.innerWidth - u, e.y = window.innerHeight / 2 - ht / 2;
|
|
1116
|
+
const T = localStorage.getItem("panelPosition"), W = localStorage.getItem("backPosition");
|
|
1117
|
+
T && (H.value = T), W && (l.value = W);
|
|
1118
1118
|
}
|
|
1119
|
-
function
|
|
1119
|
+
function st(d) {
|
|
1120
1120
|
if (!x.value) return;
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1121
|
+
const T = "touches" in d ? d.touches[0].clientX : d.clientX, W = "touches" in d ? d.touches[0].clientY : d.clientY, q = T - p.x, Et = Math.max(0, Math.min(W - p.y, window.innerHeight - ht)), kt = Math.abs(q - e.x), Qt = Math.abs(Et - e.y);
|
|
1122
|
+
kt + Qt > 5 && (A.value = !0), e.x = q, e.y = Et;
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
x.value && (x.value = !1, A.value && (
|
|
1124
|
+
function ot() {
|
|
1125
|
+
x.value && (x.value = !1, A.value && (yt(), A.value = !1));
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1127
|
+
function at(d) {
|
|
1128
1128
|
D.value = !1, x.value = !0, A.value = !1;
|
|
1129
|
-
const
|
|
1130
|
-
p.x =
|
|
1129
|
+
const T = "touches" in d ? d.touches[0].clientX : d.clientX, W = "touches" in d ? d.touches[0].clientY : d.clientY;
|
|
1130
|
+
p.x = T - e.x, p.y = W - e.y;
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function Rt() {
|
|
1133
1133
|
if (!A.value && !D.value) {
|
|
1134
|
-
|
|
1134
|
+
dt();
|
|
1135
1135
|
const d = z();
|
|
1136
|
-
a.x =
|
|
1136
|
+
a.x = Math.max(0, Math.min(window.innerWidth - 53, e.x + k.value * 3)), a.y = e.y - k.value * 2, a.w = 53, a.h = 53, a.radius = "50%", c.value = !0, o.value = "expanding", v.value = !0, Z(() => {
|
|
1137
1137
|
requestAnimationFrame(() => {
|
|
1138
1138
|
c.value = !1, a.x = d.x, a.y = d.y, a.w = d.w, a.h = d.h, a.radius = d.radius;
|
|
1139
1139
|
});
|
|
@@ -1145,7 +1145,7 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
1145
1145
|
}
|
|
1146
1146
|
function z() {
|
|
1147
1147
|
if (window.innerWidth < 768)
|
|
1148
|
-
return
|
|
1148
|
+
return M.value ? {
|
|
1149
1149
|
x: 0,
|
|
1150
1150
|
y: 0,
|
|
1151
1151
|
w: window.innerWidth,
|
|
@@ -1158,26 +1158,26 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
1158
1158
|
h: window.innerHeight - 16,
|
|
1159
1159
|
radius: "14px"
|
|
1160
1160
|
};
|
|
1161
|
-
const
|
|
1162
|
-
if (
|
|
1163
|
-
const
|
|
1161
|
+
const T = window.innerHeight - 78, W = 54;
|
|
1162
|
+
if (M.value) {
|
|
1163
|
+
const kt = window.innerWidth * 0.8;
|
|
1164
1164
|
return {
|
|
1165
|
-
x: (window.innerWidth -
|
|
1165
|
+
x: (window.innerWidth - kt) / 2,
|
|
1166
1166
|
y: W,
|
|
1167
|
-
w:
|
|
1168
|
-
h:
|
|
1167
|
+
w: kt,
|
|
1168
|
+
h: T,
|
|
1169
1169
|
radius: "14px"
|
|
1170
1170
|
};
|
|
1171
1171
|
}
|
|
1172
1172
|
const q = 490;
|
|
1173
|
-
return { x: H.value === "left" ? 24 : window.innerWidth - q - 24, y: W, w: q, h:
|
|
1173
|
+
return { x: H.value === "left" ? 24 : window.innerWidth - q - 24, y: W, w: q, h: T, radius: "14px" };
|
|
1174
1174
|
}
|
|
1175
1175
|
function Y() {
|
|
1176
1176
|
if (o.value !== "idle") return;
|
|
1177
1177
|
const d = z();
|
|
1178
1178
|
a.x = d.x, a.y = d.y, a.w = d.w, a.h = d.h, a.radius = d.radius, c.value = !0, o.value = "collapsing", Z(() => {
|
|
1179
1179
|
requestAnimationFrame(() => {
|
|
1180
|
-
c.value = !1, a.x =
|
|
1180
|
+
c.value = !1, a.x = Math.max(0, Math.min(window.innerWidth - 53, e.x + k.value * 3)), a.y = e.y + Math.abs(k.value) * 2, a.w = 53, a.h = 53, a.radius = "50%";
|
|
1181
1181
|
});
|
|
1182
1182
|
}), setTimeout(() => {
|
|
1183
1183
|
v.value = !1, o.value = "idle", n.value = !0;
|
|
@@ -1186,69 +1186,69 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
1186
1186
|
}, 1400);
|
|
1187
1187
|
}
|
|
1188
1188
|
function Q(d) {
|
|
1189
|
-
|
|
1190
|
-
var
|
|
1191
|
-
(
|
|
1189
|
+
lt(), B.value = "answer", Z(() => {
|
|
1190
|
+
var T;
|
|
1191
|
+
(T = y.value) == null || T.goHistoryMessage(d);
|
|
1192
1192
|
});
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1194
|
+
function wt() {
|
|
1195
1195
|
E.value = "", B.value = "answer", Z(() => {
|
|
1196
1196
|
var d;
|
|
1197
1197
|
(d = y.value) == null || d.createNewConversation();
|
|
1198
1198
|
});
|
|
1199
1199
|
}
|
|
1200
1200
|
function U() {
|
|
1201
|
-
|
|
1201
|
+
lt(), E.value = "", Z(() => {
|
|
1202
1202
|
var d;
|
|
1203
1203
|
(d = y.value) == null || d.createNewConversation();
|
|
1204
1204
|
});
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1206
|
+
function it() {
|
|
1207
1207
|
L.value = !1, b.value = !0;
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function lt() {
|
|
1210
1210
|
L.value = !0, setTimeout(() => {
|
|
1211
1211
|
b.value = !1, L.value = !1;
|
|
1212
1212
|
}, 300);
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1215
|
-
g.value =
|
|
1214
|
+
function Yt() {
|
|
1215
|
+
g.value = h.value, R.value = !1;
|
|
1216
1216
|
}
|
|
1217
|
-
|
|
1218
|
-
d ? H.value = "center" :
|
|
1219
|
-
}),
|
|
1220
|
-
|
|
1217
|
+
Ct(M, (d) => {
|
|
1218
|
+
d ? H.value = "center" : dt();
|
|
1219
|
+
}), et(() => {
|
|
1220
|
+
bt();
|
|
1221
1221
|
const d = r.theme || "light";
|
|
1222
|
-
|
|
1222
|
+
Tt(d), d === "auto" && (m = ae(() => Tt("auto")));
|
|
1223
1223
|
});
|
|
1224
|
-
function
|
|
1224
|
+
function Dt() {
|
|
1225
1225
|
i && clearTimeout(i), i = setTimeout(() => {
|
|
1226
1226
|
const d = window.innerWidth < 768;
|
|
1227
|
-
f.value = d, d && (
|
|
1227
|
+
f.value = d, d && (M.value = !0), yt();
|
|
1228
1228
|
}, 100);
|
|
1229
1229
|
}
|
|
1230
|
-
return
|
|
1231
|
-
window.addEventListener("resize",
|
|
1232
|
-
}),
|
|
1233
|
-
window.removeEventListener("resize",
|
|
1234
|
-
}),
|
|
1235
|
-
document.addEventListener("mousemove",
|
|
1236
|
-
}),
|
|
1237
|
-
document.removeEventListener("mousemove",
|
|
1238
|
-
}), (d,
|
|
1239
|
-
|
|
1240
|
-
class: J(["ai-panel",
|
|
1241
|
-
style:
|
|
1230
|
+
return et(() => {
|
|
1231
|
+
window.addEventListener("resize", Dt);
|
|
1232
|
+
}), At(() => {
|
|
1233
|
+
window.removeEventListener("resize", Dt), i && clearTimeout(i), m == null || m();
|
|
1234
|
+
}), et(() => {
|
|
1235
|
+
document.addEventListener("mousemove", st), document.addEventListener("touchmove", st, { passive: !0 }), document.addEventListener("mouseup", ot), document.addEventListener("touchend", ot);
|
|
1236
|
+
}), At(() => {
|
|
1237
|
+
document.removeEventListener("mousemove", st), document.removeEventListener("touchmove", st), document.removeEventListener("mouseup", ot), document.removeEventListener("touchend", ot);
|
|
1238
|
+
}), (d, T) => (w(), S("div", null, [
|
|
1239
|
+
rt(s("div", {
|
|
1240
|
+
class: J(["ai-panel", M.value ? "maxWrap" : "minWrap", $.value, o.value !== "idle" ? o.value : "", { morphing: o.value !== "idle", "morph-instant": c.value }]),
|
|
1241
|
+
style: Mt(vt.value)
|
|
1242
1242
|
}, [
|
|
1243
1243
|
s("div", Dn, [
|
|
1244
1244
|
B.value === "info" ? (w(), S("span", {
|
|
1245
1245
|
key: 0,
|
|
1246
1246
|
class: J(["back", l.value]),
|
|
1247
|
-
onClick:
|
|
1248
|
-
}, [...
|
|
1247
|
+
onClick: T[0] || (T[0] = (W) => B.value = "answer")
|
|
1248
|
+
}, [...T[6] || (T[6] = [
|
|
1249
1249
|
s("span", { style: { "font-size": "14px" } }, "←", -1)
|
|
1250
1250
|
])], 2)) : (w(), S("p", Hn, [
|
|
1251
|
-
s("img", { src: O(
|
|
1251
|
+
s("img", { src: O(xt) }, null, 8, On)
|
|
1252
1252
|
])),
|
|
1253
1253
|
s("div", $n, [
|
|
1254
1254
|
s("span", {
|
|
@@ -1256,22 +1256,22 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
1256
1256
|
}, F(B.value === "info" ? "个人信息" : E.value || O(r).name), 9, Pn)
|
|
1257
1257
|
]),
|
|
1258
1258
|
s("p", null, [
|
|
1259
|
-
|
|
1259
|
+
rt(X(O(j), {
|
|
1260
1260
|
class: "op-icon",
|
|
1261
1261
|
icon: "ic:round-add",
|
|
1262
|
-
onClick:
|
|
1262
|
+
onClick: wt
|
|
1263
1263
|
}, null, 512), [
|
|
1264
|
-
[
|
|
1264
|
+
[gt, P.value]
|
|
1265
1265
|
]),
|
|
1266
1266
|
X(O(j), {
|
|
1267
1267
|
class: J(["mute", { active: b.value }]),
|
|
1268
1268
|
icon: "ic:round-history",
|
|
1269
|
-
onClick:
|
|
1269
|
+
onClick: T[1] || (T[1] = (W) => b.value ? lt() : it())
|
|
1270
1270
|
}, null, 8, ["class"]),
|
|
1271
|
-
f.value ? V("", !0) : (w(),
|
|
1271
|
+
f.value ? V("", !0) : (w(), tt(O(j), {
|
|
1272
1272
|
key: 0,
|
|
1273
|
-
onClick:
|
|
1274
|
-
icon:
|
|
1273
|
+
onClick: T[2] || (T[2] = (W) => M.value = !M.value),
|
|
1274
|
+
icon: M.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
|
|
1275
1275
|
}, null, 8, ["icon"])),
|
|
1276
1276
|
X(O(j), {
|
|
1277
1277
|
onClick: Y,
|
|
@@ -1279,96 +1279,96 @@ const qt = { class: "container" }, _t = { class: "message ai-message greet-messa
|
|
|
1279
1279
|
})
|
|
1280
1280
|
])
|
|
1281
1281
|
]),
|
|
1282
|
-
|
|
1282
|
+
rt(X(en, {
|
|
1283
1283
|
ref_key: "answerRef",
|
|
1284
1284
|
ref: y,
|
|
1285
1285
|
defaultSayhello: O(r).defaultSayhello,
|
|
1286
1286
|
defaultRecommend: O(r).defaultRecommend,
|
|
1287
|
-
onTitleGenerated:
|
|
1287
|
+
onTitleGenerated: T[3] || (T[3] = (W) => E.value = W)
|
|
1288
1288
|
}, null, 8, ["defaultSayhello", "defaultRecommend"]), [
|
|
1289
|
-
[
|
|
1289
|
+
[gt, B.value === "answer"]
|
|
1290
1290
|
]),
|
|
1291
|
-
B.value === "info" ? (w(),
|
|
1291
|
+
B.value === "info" ? (w(), tt(Tn, { key: 0 })) : V("", !0),
|
|
1292
1292
|
b.value ? (w(), S("div", {
|
|
1293
1293
|
key: 1,
|
|
1294
1294
|
class: J(["ai-history-drawer", { closing: L.value }])
|
|
1295
1295
|
}, [
|
|
1296
1296
|
s("div", {
|
|
1297
1297
|
class: "ai-history-backdrop",
|
|
1298
|
-
onClick:
|
|
1298
|
+
onClick: lt
|
|
1299
1299
|
}),
|
|
1300
1300
|
s("div", Nn, [
|
|
1301
1301
|
s("div", Bn, [
|
|
1302
|
-
|
|
1302
|
+
T[7] || (T[7] = s("span", null, "对话记录", -1)),
|
|
1303
1303
|
X(O(j), {
|
|
1304
1304
|
icon: "ic:round-close",
|
|
1305
1305
|
class: "ai-history-drawer-close",
|
|
1306
|
-
onClick:
|
|
1306
|
+
onClick: lt
|
|
1307
1307
|
})
|
|
1308
1308
|
]),
|
|
1309
|
-
X(
|
|
1309
|
+
X(hn, {
|
|
1310
1310
|
onHistoryDetail: Q,
|
|
1311
1311
|
onNewConversation: U
|
|
1312
1312
|
})
|
|
1313
1313
|
])
|
|
1314
1314
|
], 2)) : V("", !0),
|
|
1315
|
-
|
|
1315
|
+
rt(s("div", Ln, [
|
|
1316
1316
|
s("div", xn, [
|
|
1317
1317
|
s("div", Wn, [
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
"onUpdate:modelValue":
|
|
1318
|
+
T[8] || (T[8] = s("p", { class: "title" }, "修改标题", -1)),
|
|
1319
|
+
rt(s("textarea", {
|
|
1320
|
+
"onUpdate:modelValue": T[4] || (T[4] = (W) => h.value = W),
|
|
1321
1321
|
placeholder: "请输入新标题"
|
|
1322
1322
|
}, null, 512), [
|
|
1323
|
-
[
|
|
1323
|
+
[_t, h.value]
|
|
1324
1324
|
]),
|
|
1325
1325
|
s("p", Yn, [
|
|
1326
1326
|
s("span", {
|
|
1327
|
-
onClick:
|
|
1327
|
+
onClick: T[5] || (T[5] = (W) => R.value = !1)
|
|
1328
1328
|
}, "取消"),
|
|
1329
|
-
s("span", { onClick:
|
|
1329
|
+
s("span", { onClick: Yt }, "确定")
|
|
1330
1330
|
])
|
|
1331
1331
|
])
|
|
1332
1332
|
])
|
|
1333
1333
|
], 512), [
|
|
1334
|
-
[
|
|
1334
|
+
[gt, R.value]
|
|
1335
1335
|
])
|
|
1336
1336
|
], 6), [
|
|
1337
|
-
[
|
|
1337
|
+
[gt, v.value || o.value !== "idle"]
|
|
1338
1338
|
]),
|
|
1339
|
-
|
|
1339
|
+
rt(s("div", {
|
|
1340
1340
|
class: J(["character", { dragging: x.value, recycling: D.value, "hover-preview": n.value }]),
|
|
1341
|
-
style:
|
|
1342
|
-
onMousedown:
|
|
1343
|
-
onTouchstart:
|
|
1344
|
-
onClick:
|
|
1341
|
+
style: Mt(N.value),
|
|
1342
|
+
onMousedown: at,
|
|
1343
|
+
onTouchstart: at,
|
|
1344
|
+
onClick: Rt
|
|
1345
1345
|
}, [
|
|
1346
1346
|
s("img", { src: G.value }, null, 8, Qn)
|
|
1347
1347
|
], 38), [
|
|
1348
|
-
[
|
|
1348
|
+
[gt, !v.value]
|
|
1349
1349
|
])
|
|
1350
1350
|
]));
|
|
1351
1351
|
}
|
|
1352
1352
|
});
|
|
1353
|
-
let
|
|
1354
|
-
const _n = (
|
|
1355
|
-
|
|
1356
|
-
}, Un = (
|
|
1357
|
-
const u =
|
|
1353
|
+
let mt = null;
|
|
1354
|
+
const _n = (t) => {
|
|
1355
|
+
Lt(t);
|
|
1356
|
+
}, Un = (t) => {
|
|
1357
|
+
const u = t || document.body, r = document.createElement("div");
|
|
1358
1358
|
r.id = "ai-assist-root";
|
|
1359
|
-
const v =
|
|
1360
|
-
|
|
1359
|
+
const v = ft();
|
|
1360
|
+
Tt(v.theme), ie(), u.appendChild(r), mt = Ut(Wt), mt.mount(r);
|
|
1361
1361
|
}, jn = () => {
|
|
1362
|
-
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1362
|
+
mt && (mt.unmount(), mt = null);
|
|
1363
|
+
const t = document.getElementById("ai-assist-root");
|
|
1364
|
+
t && t.remove();
|
|
1365
1365
|
}, Kn = {
|
|
1366
|
-
install(
|
|
1367
|
-
|
|
1366
|
+
install(t, u) {
|
|
1367
|
+
Lt(u), t.component("AiAssist", Wt);
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
1370
1370
|
export {
|
|
1371
|
-
|
|
1371
|
+
Wt as AiAssist,
|
|
1372
1372
|
Kn as default,
|
|
1373
1373
|
_n as initAiAssist,
|
|
1374
1374
|
Un as mountAiAssist,
|