@somecat/ai-assist-sdk 1.0.1 → 1.1.0
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-CGfAEdrA.mjs → index-BGsRRqdb.mjs} +4386 -4364
- package/dist/chunks/index-C_RXhcQu.mjs +156 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/toast.d.ts +9 -0
- package/dist/index.mjs +1 -1
- package/dist/react/index.mjs +7236 -7192
- package/dist/vue/components/answer/composables/useChatActions.d.ts +65 -0
- package/dist/vue/components/answer/composables/useCodeBlocks.d.ts +6 -0
- package/dist/vue/components/answer/composables/useMessagesBatch.d.ts +12 -0
- package/dist/vue/components/answer/composables/useSSEStream.d.ts +27 -0
- package/dist/vue/components/answer/composables/useScrollManager.d.ts +12 -0
- package/dist/vue/components/answer/composables/useTypewriter.d.ts +21 -0
- package/dist/vue/index.mjs +977 -810
- package/package.json +4 -3
- package/dist/chunks/index-Dlj6re41.mjs +0 -142
package/dist/vue/index.mjs
CHANGED
|
@@ -1,962 +1,1129 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class: "message ai-message recommend-message"
|
|
7
|
-
}, $e = { class: "ai-recommend" }, Ae = { class: "recommend-header" }, Ee = ["src"], Re = ["onClick"], Me = {
|
|
1
|
+
import { defineComponent as U, reactive as x, openBlock as g, createElementBlock as p, normalizeClass as z, Fragment as Y, createStaticVNode as St, createCommentVNode as X, renderList as st, createElementVNode as n, createVNode as ct, unref as R, toDisplayString as B, Transition as _t, withCtx as bt, withKeys as Tt, ref as T, nextTick as rt, computed as Z, watch as wt, onMounted as Q, onUnmounted as gt, createBlock as et, withModifiers as ht, Teleport as At, withDirectives as dt, vShow as pt, vModelText as Et, normalizeStyle as Mt, createApp as Rt } from "vue";
|
|
2
|
+
import { r as yt, p as kt, s as Dt, u as Nt, c as Ht, g as Pt, a as Lt, b as Ot, d as Bt, e as Wt, f as ut, h as Xt, i as Gt, j as Vt, k as Ft, l as Ct } from "../chunks/index-BGsRRqdb.mjs";
|
|
3
|
+
import { r as mt, s as Kt, a as qt, b as Qt, f as zt, c as ot, d as Yt, e as jt, g as Jt, h as Zt, i as xt, j as Ut } from "../chunks/index-C_RXhcQu.mjs";
|
|
4
|
+
import { SearchOutlined as It, PlusOutlined as te } from "@ant-design/icons-vue";
|
|
5
|
+
const ee = {
|
|
8
6
|
key: 0,
|
|
9
7
|
class: "message-content ba-markdown"
|
|
10
|
-
},
|
|
11
|
-
key: 0,
|
|
12
|
-
class: "agent-thought"
|
|
13
|
-
}, De = { class: "agent-thought__text" }, He = ["onClick"], Pe = { class: "thinking-block__title" }, Le = {
|
|
8
|
+
}, ne = { class: "agent-thought__spinner" }, se = { class: "agent-thought__text" }, oe = ["onClick"], ae = { class: "thinking-block__title" }, ie = {
|
|
14
9
|
key: 0,
|
|
15
10
|
class: "thinking-block__content"
|
|
16
|
-
},
|
|
11
|
+
}, le = { key: 2 }, ce = ["innerHTML"], re = {
|
|
17
12
|
key: 0,
|
|
18
13
|
class: "streaming-cursor"
|
|
19
|
-
},
|
|
14
|
+
}, ue = ["innerHTML"], ve = {
|
|
20
15
|
key: 0,
|
|
21
16
|
class: "streaming-cursor"
|
|
22
|
-
},
|
|
17
|
+
}, de = {
|
|
23
18
|
key: 3,
|
|
24
19
|
class: "message-error"
|
|
25
|
-
},
|
|
20
|
+
}, ge = {
|
|
26
21
|
key: 4,
|
|
27
22
|
class: "message-cost"
|
|
28
|
-
},
|
|
23
|
+
}, me = { class: "status-indicator" }, fe = {
|
|
29
24
|
key: 1,
|
|
30
25
|
class: "message-content"
|
|
31
|
-
},
|
|
26
|
+
}, he = /* @__PURE__ */ U({
|
|
27
|
+
__name: "MessageItem",
|
|
28
|
+
props: {
|
|
29
|
+
msg: {},
|
|
30
|
+
index: {},
|
|
31
|
+
STATUS: {},
|
|
32
|
+
displayedContent: {},
|
|
33
|
+
getSegmentDisplayContent: { type: Function },
|
|
34
|
+
setMessageRef: { type: Function }
|
|
35
|
+
},
|
|
36
|
+
setup(t) {
|
|
37
|
+
const a = x(/* @__PURE__ */ new Map());
|
|
38
|
+
function o(s) {
|
|
39
|
+
a.set(s, a.get(s) !== !0);
|
|
40
|
+
}
|
|
41
|
+
function l(s) {
|
|
42
|
+
const m = [];
|
|
43
|
+
s.inputTokens > 0 && m.push(`输入 ${s.inputTokens} tokens`), s.outputTokens > 0 && m.push(`输出 ${s.outputTokens} tokens`);
|
|
44
|
+
const c = s.latency >= 1 ? `${s.latency.toFixed(1)}s` : `${Math.round(s.latency * 1e3)}ms`;
|
|
45
|
+
return m.push(`耗时 ${c}`), m.join(" · ");
|
|
46
|
+
}
|
|
47
|
+
function i(s) {
|
|
48
|
+
try {
|
|
49
|
+
const { copy: m } = Nt();
|
|
50
|
+
m(s.content);
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return (s, m) => {
|
|
55
|
+
var c;
|
|
56
|
+
return g(), p("div", {
|
|
57
|
+
class: z(["message", `${t.msg.type}-message`])
|
|
58
|
+
}, [
|
|
59
|
+
t.msg.type === "ai" ? (g(), p(Y, { key: 0 }, [
|
|
60
|
+
(t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (g(), p("div", ee, [...m[1] || (m[1] = [
|
|
61
|
+
St('<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)
|
|
62
|
+
])])) : X("", !0),
|
|
63
|
+
t.msg.segments && t.msg.segments.length ? (g(), p("div", {
|
|
64
|
+
key: 1,
|
|
65
|
+
class: "message-content ba-markdown",
|
|
66
|
+
ref: (d) => t.setMessageRef(d, t.index)
|
|
67
|
+
}, [
|
|
68
|
+
(g(!0), p(Y, null, st(t.msg.segments, (d, f) => (g(), p(Y, { key: f }, [
|
|
69
|
+
d.type === "agent_thought" ? (g(), p("div", {
|
|
70
|
+
key: 0,
|
|
71
|
+
class: z(["agent-thought", { "agent-thought--done": d.duration != null }])
|
|
72
|
+
}, [
|
|
73
|
+
n("span", ne, [
|
|
74
|
+
ct(R(It))
|
|
75
|
+
]),
|
|
76
|
+
n("span", se, B(d.duration != null ? "工具调用" : "工具调用中..."), 1)
|
|
77
|
+
], 2)) : d.type === "thinking" ? (g(), p("div", {
|
|
78
|
+
key: 1,
|
|
79
|
+
class: z(["thinking-block", {
|
|
80
|
+
"thinking-block--expanded": a.get(f) === !0,
|
|
81
|
+
"thinking-block--active": d.duration == null
|
|
82
|
+
}])
|
|
83
|
+
}, [
|
|
84
|
+
n("div", {
|
|
85
|
+
class: "thinking-block__header",
|
|
86
|
+
onClick: (v) => o(f)
|
|
87
|
+
}, [
|
|
88
|
+
m[3] || (m[3] = n("span", { class: "thinking-block__indicator" }, null, -1)),
|
|
89
|
+
n("span", ae, B(d.duration != null ? "深度思考" : "深度思考中"), 1),
|
|
90
|
+
(g(), p("svg", {
|
|
91
|
+
class: z(["thinking-block__arrow", { "thinking-block__arrow--down": a.get(f) === !0 }]),
|
|
92
|
+
viewBox: "0 0 24 24",
|
|
93
|
+
width: "14",
|
|
94
|
+
height: "14",
|
|
95
|
+
fill: "none",
|
|
96
|
+
stroke: "currentColor",
|
|
97
|
+
"stroke-width": "2.5",
|
|
98
|
+
"stroke-linecap": "round",
|
|
99
|
+
"stroke-linejoin": "round"
|
|
100
|
+
}, [...m[2] || (m[2] = [
|
|
101
|
+
n("polyline", { points: "6 9 12 15 18 9" }, null, -1)
|
|
102
|
+
])], 2))
|
|
103
|
+
], 8, oe),
|
|
104
|
+
ct(_t, { name: "thinking-expand" }, {
|
|
105
|
+
default: bt(() => [
|
|
106
|
+
a.get(f) === !0 ? (g(), p("div", ie, B(d.content), 1)) : X("", !0)
|
|
107
|
+
]),
|
|
108
|
+
_: 2
|
|
109
|
+
}, 1024)
|
|
110
|
+
], 2)) : (g(), p("div", le, [
|
|
111
|
+
n("div", {
|
|
112
|
+
innerHTML: R(yt)(R(kt)(t.getSegmentDisplayContent(t.index, f, d, t.msg)))
|
|
113
|
+
}, null, 8, ce)
|
|
114
|
+
]))
|
|
115
|
+
], 64))), 128)),
|
|
116
|
+
t.msg.status === t.STATUS.ANSWERING ? (g(), p("span", re)) : X("", !0)
|
|
117
|
+
], 512)) : X("", !0),
|
|
118
|
+
!((c = t.msg.segments) != null && c.length) && t.msg.content ? (g(), p("div", {
|
|
119
|
+
key: 2,
|
|
120
|
+
class: "message-content ba-markdown",
|
|
121
|
+
ref: (d) => t.setMessageRef(d, t.index)
|
|
122
|
+
}, [
|
|
123
|
+
n("div", {
|
|
124
|
+
innerHTML: R(yt)(R(kt)(t.displayedContent.get(t.index) ?? t.msg.content))
|
|
125
|
+
}, null, 8, ue),
|
|
126
|
+
t.msg.status === t.STATUS.ANSWERING ? (g(), p("span", ve)) : X("", !0)
|
|
127
|
+
], 512)) : X("", !0),
|
|
128
|
+
t.msg.errorMessage ? (g(), p("div", de, [
|
|
129
|
+
m[4] || (m[4] = n("span", { class: "message-error__icon" }, "⚠️", -1)),
|
|
130
|
+
n("span", null, B(t.msg.errorMessage), 1)
|
|
131
|
+
])) : X("", !0),
|
|
132
|
+
t.msg.cost && t.msg.status !== t.STATUS.ANSWERING && t.msg.status !== t.STATUS.THINKING ? (g(), p("div", ge, B(l(t.msg.cost)), 1)) : X("", !0),
|
|
133
|
+
n("div", me, [
|
|
134
|
+
n("span", {
|
|
135
|
+
onClick: m[0] || (m[0] = (d) => i(t.msg))
|
|
136
|
+
}, B(R(Dt)(t.msg.status)), 1)
|
|
137
|
+
])
|
|
138
|
+
], 64)) : (g(), p("div", fe, B(t.msg.content), 1))
|
|
139
|
+
], 2);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}), pe = { class: "input-container" }, ye = {
|
|
32
143
|
key: 0,
|
|
33
144
|
class: "tooltip-enhanced",
|
|
34
145
|
"data-tooltip": "重新回答"
|
|
35
|
-
},
|
|
146
|
+
}, ke = ["src"], we = ["src"], Ce = ["value", "disabled"], $e = {
|
|
36
147
|
key: 2,
|
|
37
148
|
class: "tooltip-enhanced stop",
|
|
38
149
|
"data-tooltip": "停止回答"
|
|
39
|
-
},
|
|
150
|
+
}, Se = ["src"], _e = {
|
|
40
151
|
key: 3,
|
|
41
152
|
class: "tooltip-enhanced send",
|
|
42
153
|
"data-tooltip": "开始回答"
|
|
43
|
-
},
|
|
154
|
+
}, be = ["src"], Te = {
|
|
44
155
|
key: 4,
|
|
45
156
|
class: "moveTB"
|
|
46
|
-
},
|
|
47
|
-
__name: "
|
|
157
|
+
}, Ae = ["src"], Ee = /* @__PURE__ */ U({
|
|
158
|
+
__name: "ChatInput",
|
|
48
159
|
props: {
|
|
49
|
-
|
|
50
|
-
|
|
160
|
+
modelValue: {},
|
|
161
|
+
isGenerating: { type: Boolean },
|
|
162
|
+
lastUserMessage: {},
|
|
163
|
+
hasScroll: { type: Boolean },
|
|
164
|
+
isAtBottom: { type: Boolean }
|
|
51
165
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
166
|
+
emits: ["update:modelValue", "send", "regenerate", "stop", "scroll-to-bottom"],
|
|
167
|
+
setup(t) {
|
|
168
|
+
return (a, o) => (g(), p("div", pe, [
|
|
169
|
+
t.lastUserMessage ? (g(), p("div", ye, [
|
|
170
|
+
n("img", {
|
|
171
|
+
class: "refresh",
|
|
172
|
+
onClick: o[0] || (o[0] = (l) => a.$emit("regenerate")),
|
|
173
|
+
src: R(mt)
|
|
174
|
+
}, null, 8, ke)
|
|
175
|
+
])) : (g(), p("img", {
|
|
176
|
+
key: 1,
|
|
177
|
+
class: "refresh",
|
|
178
|
+
src: R(mt)
|
|
179
|
+
}, null, 8, we)),
|
|
180
|
+
n("input", {
|
|
181
|
+
value: t.modelValue,
|
|
182
|
+
type: "text",
|
|
183
|
+
placeholder: "输入消息...",
|
|
184
|
+
onInput: o[1] || (o[1] = (l) => a.$emit("update:modelValue", l.target.value)),
|
|
185
|
+
onKeyup: o[2] || (o[2] = Tt((l) => a.$emit("send"), ["enter"])),
|
|
186
|
+
disabled: t.isGenerating
|
|
187
|
+
}, null, 40, Ce),
|
|
188
|
+
t.isGenerating && t.lastUserMessage ? (g(), p("div", $e, [
|
|
189
|
+
n("img", {
|
|
190
|
+
src: R(Kt),
|
|
191
|
+
onClick: o[3] || (o[3] = (l) => a.$emit("stop"))
|
|
192
|
+
}, null, 8, Se)
|
|
193
|
+
])) : (g(), p("div", _e, [
|
|
194
|
+
n("img", {
|
|
195
|
+
src: R(qt),
|
|
196
|
+
onClick: o[4] || (o[4] = (l) => a.$emit("send"))
|
|
197
|
+
}, null, 8, be)
|
|
198
|
+
])),
|
|
199
|
+
t.hasScroll && !t.isAtBottom ? (g(), p("div", Te, [
|
|
200
|
+
n("img", {
|
|
201
|
+
onClick: o[5] || (o[5] = (l) => a.$emit("scroll-to-bottom")),
|
|
202
|
+
src: R(Qt)
|
|
203
|
+
}, null, 8, Ae)
|
|
204
|
+
])) : X("", !0)
|
|
205
|
+
]));
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
function Me(t) {
|
|
209
|
+
const a = T(!0), o = T(!1);
|
|
210
|
+
function l() {
|
|
211
|
+
rt(() => {
|
|
212
|
+
t.value && (t.value.scrollTop = t.value.scrollHeight);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function i() {
|
|
216
|
+
if (!t.value) return;
|
|
217
|
+
const s = t.value, m = s.scrollTop + s.clientHeight >= s.scrollHeight - 1, c = s.scrollHeight > s.clientHeight;
|
|
218
|
+
a.value = m, o.value = c;
|
|
219
|
+
}
|
|
220
|
+
return { isAtBottom: a, hasScroll: o, scrollToBottom: l, checkScrollStatus: i };
|
|
221
|
+
}
|
|
222
|
+
function Re() {
|
|
223
|
+
function t(a) {
|
|
224
|
+
a.querySelectorAll("pre").forEach((l) => {
|
|
225
|
+
if (l.querySelector(".copy-button")) return;
|
|
226
|
+
const i = l.querySelector("code");
|
|
227
|
+
if (!i) return;
|
|
228
|
+
const m = (Array.from(i.classList).find((d) => d.startsWith("language-")) || "").replace("language-", "");
|
|
229
|
+
if (m) {
|
|
230
|
+
const d = document.createElement("span");
|
|
231
|
+
d.className = "code-lang", d.textContent = m, l.appendChild(d);
|
|
232
|
+
}
|
|
233
|
+
const c = document.createElement("button");
|
|
234
|
+
c.className = "copy-button", c.textContent = "复制", c.onclick = () => {
|
|
235
|
+
navigator.clipboard.writeText(i.textContent || "").then(() => {
|
|
236
|
+
c.textContent = "已复制", setTimeout(() => {
|
|
237
|
+
c.textContent = "复制";
|
|
238
|
+
}, 2e3);
|
|
239
|
+
});
|
|
240
|
+
}, l.appendChild(c);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return { enhanceCodeBlocks: t };
|
|
244
|
+
}
|
|
245
|
+
function De(t) {
|
|
246
|
+
let a = null, o = 0;
|
|
247
|
+
function l(s) {
|
|
248
|
+
a = s(a || [...t.value]), o || (o = requestAnimationFrame(() => {
|
|
249
|
+
o = 0, a && (t.value = a, a = null);
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
function i() {
|
|
253
|
+
o && (cancelAnimationFrame(o), o = 0), a && (t.value = a, a = null);
|
|
254
|
+
}
|
|
255
|
+
return { batchMessagesUpdate: l, flushMessagesBatch: i };
|
|
256
|
+
}
|
|
257
|
+
function Ne(t, a, o) {
|
|
258
|
+
const l = x(/* @__PURE__ */ new Map()), i = T(/* @__PURE__ */ new Map());
|
|
259
|
+
let s = 0, m = 0;
|
|
260
|
+
function c() {
|
|
261
|
+
if (s) return;
|
|
262
|
+
const r = 16, b = 1, P = 40, W = (A) => {
|
|
263
|
+
if (A - m >= r) {
|
|
264
|
+
m = A;
|
|
265
|
+
let L = !1;
|
|
266
|
+
if (t.value.forEach((u, D) => {
|
|
267
|
+
if (u.type !== "ai" || u.status !== o) return;
|
|
268
|
+
const $ = u.content, C = i.value.get(D) ?? 0, N = $.length - C;
|
|
269
|
+
if (N > 0) {
|
|
270
|
+
L = !0;
|
|
271
|
+
const O = N > 15 ? Math.min(Math.ceil(N * 0.3), P) : b, S = Math.min(C + O, $.length);
|
|
272
|
+
i.value.set(D, S), l.set(D, $.slice(0, S));
|
|
83
273
|
}
|
|
274
|
+
}), L && a(), !t.value.some((u) => u.type === "ai" && u.status === o)) {
|
|
275
|
+
s = 0;
|
|
276
|
+
return;
|
|
84
277
|
}
|
|
85
|
-
q = requestAnimationFrame(o);
|
|
86
|
-
};
|
|
87
|
-
q = requestAnimationFrame(o);
|
|
88
|
-
}
|
|
89
|
-
function _t(s, n, t, o) {
|
|
90
|
-
if (t.type !== "answer" || o.status !== a.ANSWERING) return t.content;
|
|
91
|
-
const C = o.segments || [];
|
|
92
|
-
if (C.slice(n + 1).some((p) => p.type === "answer")) return t.content;
|
|
93
|
-
const h = Y.value.get(s);
|
|
94
|
-
if (h == null) return t.content;
|
|
95
|
-
let f = 0;
|
|
96
|
-
for (let p = 0; p < n; p++)
|
|
97
|
-
C[p].type === "answer" && (f += C[p].content.length);
|
|
98
|
-
const M = f + t.content.length;
|
|
99
|
-
return h >= M ? t.content : h <= f ? "" : t.content.slice(0, h - f);
|
|
100
|
-
}
|
|
101
|
-
let F = null, j = 0;
|
|
102
|
-
function c(s) {
|
|
103
|
-
F = s(F || [...i.value]), j || (j = requestAnimationFrame(() => {
|
|
104
|
-
j = 0, F && (i.value = F, F = null);
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
function r() {
|
|
108
|
-
j && (cancelAnimationFrame(j), j = 0), F && (i.value = F, F = null);
|
|
109
|
-
}
|
|
110
|
-
const D = ht(
|
|
111
|
-
() => Q.value[Z.value % (Q.value.length || 1)]
|
|
112
|
-
);
|
|
113
|
-
function x() {
|
|
114
|
-
return g.queryAgainStreamApi || g.queryAgainApi || g.chatQueryStreamApi || g.chatQueryApi;
|
|
115
|
-
}
|
|
116
|
-
function tt() {
|
|
117
|
-
St(() => {
|
|
118
|
-
O.value && (O.value.scrollTop = O.value.scrollHeight);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
function kt() {
|
|
122
|
-
if (!O.value) return;
|
|
123
|
-
const s = O.value, n = s.scrollTop + s.clientHeight >= s.scrollHeight - 1, t = s.scrollHeight > s.clientHeight;
|
|
124
|
-
A.value = n, S.value = t;
|
|
125
|
-
}
|
|
126
|
-
function wt() {
|
|
127
|
-
Z.value++;
|
|
128
|
-
}
|
|
129
|
-
function Wt(s) {
|
|
130
|
-
X.value = s;
|
|
131
|
-
}
|
|
132
|
-
function Gt(s) {
|
|
133
|
-
try {
|
|
134
|
-
const { copy: n } = se();
|
|
135
|
-
n(s.content);
|
|
136
|
-
} catch {
|
|
137
278
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
279
|
+
s = requestAnimationFrame(W);
|
|
280
|
+
};
|
|
281
|
+
s = requestAnimationFrame(W);
|
|
282
|
+
}
|
|
283
|
+
function d() {
|
|
284
|
+
s && (cancelAnimationFrame(s), s = 0), t.value.forEach((r, b) => {
|
|
285
|
+
r.type === "ai" && (l.set(b, r.content), i.value.set(b, r.content.length));
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function f() {
|
|
289
|
+
s && (cancelAnimationFrame(s), s = 0);
|
|
290
|
+
}
|
|
291
|
+
function v(r, b, P, W) {
|
|
292
|
+
if (P.type !== "answer" || W.status !== o) return P.content;
|
|
293
|
+
const A = W.segments || [];
|
|
294
|
+
if (A.slice(b + 1).some(($) => $.type === "answer")) return P.content;
|
|
295
|
+
const e = i.value.get(r);
|
|
296
|
+
if (e == null) return P.content;
|
|
297
|
+
let u = 0;
|
|
298
|
+
for (let $ = 0; $ < b; $++)
|
|
299
|
+
A[$].type === "answer" && (u += A[$].content.length);
|
|
300
|
+
const D = u + P.content.length;
|
|
301
|
+
return e >= D ? P.content : e <= u ? "" : P.content.slice(0, e - u);
|
|
302
|
+
}
|
|
303
|
+
return { displayedContent: l, streamingIndexRef: i, startTypewriter: c, flushTypewriter: d, getSegmentDisplayContent: v, stopTypewriter: f };
|
|
304
|
+
}
|
|
305
|
+
function He({
|
|
306
|
+
messages: t,
|
|
307
|
+
isGenerating: a,
|
|
308
|
+
lastUserMessage: o,
|
|
309
|
+
batchMessagesUpdate: l,
|
|
310
|
+
flushMessagesBatch: i,
|
|
311
|
+
STATUS: s,
|
|
312
|
+
cfg: m
|
|
313
|
+
}) {
|
|
314
|
+
const c = T(/* @__PURE__ */ new Map()), d = T(/* @__PURE__ */ new Map()), f = T(/* @__PURE__ */ new Map()), v = T(/* @__PURE__ */ new Map()), r = T(!1);
|
|
315
|
+
function b(A) {
|
|
316
|
+
const L = c.value.get(A) || [];
|
|
317
|
+
l((e) => {
|
|
318
|
+
if (e[A]) {
|
|
319
|
+
const u = [...e];
|
|
320
|
+
return u[A] = { ...u[A], segments: L.map((D) => ({ ...D })) }, u;
|
|
167
321
|
}
|
|
168
|
-
return
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
322
|
+
return e;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function P(A) {
|
|
326
|
+
const L = c.value.get(A) || [], e = f.value.get(A);
|
|
327
|
+
let u = 0, D = !1;
|
|
328
|
+
L.forEach(($) => {
|
|
329
|
+
if ($.type === "thinking" && $.duration == null) {
|
|
330
|
+
const C = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
|
|
331
|
+
$.duration = C, u += C, D = !0;
|
|
332
|
+
}
|
|
333
|
+
}), D && (c.value.set(A, L), l(($) => {
|
|
334
|
+
if ($[A]) {
|
|
335
|
+
const C = [...$];
|
|
336
|
+
return C[A] = {
|
|
337
|
+
...C[A],
|
|
338
|
+
segments: L.map((N) => ({ ...N })),
|
|
339
|
+
thinkingDuration: (C[A].thinkingDuration || 0) + u
|
|
340
|
+
}, C;
|
|
341
|
+
}
|
|
342
|
+
return $;
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
345
|
+
async function W(A, L, e, u, D = !1) {
|
|
346
|
+
r.value = !1, c.value.set(e, []), a.value = !0;
|
|
347
|
+
try {
|
|
348
|
+
const $ = m.baseUrl.replace(/\/+$/, "") + "/" + A.replace(/^\/+/, "");
|
|
349
|
+
await zt($, {
|
|
350
|
+
method: "POST",
|
|
351
|
+
headers: { "Content-Type": "application/json" },
|
|
352
|
+
body: JSON.stringify({ app: m.app ?? 1, data: L }),
|
|
353
|
+
signal: u,
|
|
354
|
+
openWhenHidden: !0,
|
|
355
|
+
async onopen(C) {
|
|
356
|
+
},
|
|
357
|
+
onmessage(C) {
|
|
358
|
+
var N;
|
|
359
|
+
try {
|
|
360
|
+
let O = C.data || "";
|
|
361
|
+
if (O.startsWith("data:") && (O = O.replace(/^data:\s*/, "")), !O) return;
|
|
362
|
+
let S;
|
|
204
363
|
try {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
364
|
+
S = JSON.parse(O);
|
|
365
|
+
} catch {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
switch (S.event) {
|
|
369
|
+
case "message_start":
|
|
370
|
+
D || (o.value = S.id), d.value.set(e, "answer");
|
|
371
|
+
break;
|
|
372
|
+
case "think_message_output_start": {
|
|
373
|
+
f.value.set(e, Date.now()), d.value.set(e, "thinking");
|
|
374
|
+
const h = c.value.get(e) || [];
|
|
375
|
+
c.value.set(e, [...h, { type: "thinking", content: "" }]), b(e);
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
case "agent_thought": {
|
|
379
|
+
const h = S.thought || S.thinking || "", w = c.value.get(e) || [], k = w[w.length - 1];
|
|
380
|
+
k && k.type === "agent_thought" ? k.content += h : (d.value.set(e, "agent_thought"), w.push({ type: "agent_thought", content: h }), v.value.set(e, Date.now())), c.value.set(e, w), l((_) => {
|
|
381
|
+
if (_[e]) {
|
|
382
|
+
const M = [..._];
|
|
383
|
+
return M[e] = {
|
|
384
|
+
...M[e],
|
|
385
|
+
segments: w.map((H) => ({ ...H })),
|
|
386
|
+
thinkingContent: (M[e].thinkingContent || "") + h,
|
|
387
|
+
status: s.THINKING
|
|
388
|
+
}, M;
|
|
389
|
+
}
|
|
390
|
+
return _;
|
|
391
|
+
});
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
case "think_message": {
|
|
395
|
+
const h = S.thinking || S.answer || S.text || "", w = c.value.get(e) || [], k = w[w.length - 1];
|
|
396
|
+
k && k.type === "thinking" ? k.content += h : (w.push({ type: "thinking", content: h }), f.value.set(e, Date.now())), c.value.set(e, w), l((_) => {
|
|
397
|
+
if (_[e]) {
|
|
398
|
+
const M = [..._];
|
|
399
|
+
return M[e] = {
|
|
400
|
+
...M[e],
|
|
401
|
+
segments: w.map((H) => ({ ...H })),
|
|
402
|
+
thinkingContent: (M[e].thinkingContent || "") + h,
|
|
403
|
+
status: s.THINKING
|
|
404
|
+
}, M;
|
|
405
|
+
}
|
|
406
|
+
return _;
|
|
407
|
+
});
|
|
408
|
+
break;
|
|
212
409
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const b = [...w];
|
|
228
|
-
return b[t] = {
|
|
229
|
-
...b[t],
|
|
230
|
-
segments: d.map((T) => ({ ...T })),
|
|
231
|
-
thinkingContent: (b[t].thinkingContent || "") + u,
|
|
232
|
-
status: a.THINKING
|
|
233
|
-
}, b;
|
|
234
|
-
}
|
|
235
|
-
return w;
|
|
236
|
-
});
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
case "think_message": {
|
|
240
|
-
const u = p.thinking || p.answer || p.text || "", d = $.value.get(t) || [], m = d[d.length - 1];
|
|
241
|
-
m && m.type === "thinking" ? m.content += u : (d.push({ type: "thinking", content: u }), at.value.set(t, Date.now())), $.value.set(t, d), c((w) => {
|
|
242
|
-
if (w[t]) {
|
|
243
|
-
const b = [...w];
|
|
244
|
-
return b[t] = {
|
|
245
|
-
...b[t],
|
|
246
|
-
segments: d.map((T) => ({ ...T })),
|
|
247
|
-
thinkingContent: (b[t].thinkingContent || "") + u,
|
|
248
|
-
status: a.THINKING
|
|
249
|
-
}, b;
|
|
250
|
-
}
|
|
251
|
-
return w;
|
|
252
|
-
});
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
case "agent_thought_end": {
|
|
256
|
-
const u = dt.value.get(t), d = u ? Math.round((Date.now() - u) / 1e3 * 10) / 10 : 0, m = $.value.get(t) || [], w = m[m.length - 1];
|
|
257
|
-
w && w.type === "agent_thought" && (w.duration = d), $.value.set(t, m), c((b) => {
|
|
258
|
-
if (b[t]) {
|
|
259
|
-
const T = [...b];
|
|
260
|
-
return T[t] = {
|
|
261
|
-
...T[t],
|
|
262
|
-
segments: m.map((et) => ({ ...et })),
|
|
263
|
-
thinkingDuration: (T[t].thinkingDuration || 0) + d
|
|
264
|
-
}, T;
|
|
265
|
-
}
|
|
266
|
-
return b;
|
|
267
|
-
});
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
case "think_message_output_end": {
|
|
271
|
-
const u = at.value.get(t), d = u ? Math.round((Date.now() - u) / 1e3 * 10) / 10 : 0, m = $.value.get(t) || [], w = m[m.length - 1];
|
|
272
|
-
w && w.type === "thinking" && (w.duration = d), $.value.set(t, m), c((b) => {
|
|
273
|
-
if (b[t]) {
|
|
274
|
-
const T = [...b];
|
|
275
|
-
return T[t] = {
|
|
276
|
-
...T[t],
|
|
277
|
-
segments: m.map((et) => ({ ...et })),
|
|
278
|
-
thinkingDuration: (T[t].thinkingDuration || 0) + d
|
|
279
|
-
}, T;
|
|
280
|
-
}
|
|
281
|
-
return b;
|
|
282
|
-
});
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
case "tool_message": {
|
|
286
|
-
const u = p.answer || p.text || p.content || "";
|
|
287
|
-
if (!u) break;
|
|
288
|
-
const d = $.value.get(t) || [];
|
|
289
|
-
d.push({ type: "answer", content: u }), $.value.set(t, d), At(t);
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
case "message_output_start":
|
|
293
|
-
K.value.set(t, "answer");
|
|
294
|
-
break;
|
|
295
|
-
case "message": {
|
|
296
|
-
const u = p.answer || "", d = K.value.get(t), m = $.value.get(t) || [], w = m[m.length - 1];
|
|
297
|
-
d === "answer" && w && w.type === "answer" ? w.content += u : (K.value.set(t, "answer"), m.push({ type: "answer", content: u })), $.value.set(t, m);
|
|
298
|
-
const b = m.filter((T) => T.type === "answer").map((T) => T.content).join("");
|
|
299
|
-
c((T) => {
|
|
300
|
-
if (T[t]) {
|
|
301
|
-
const et = [...T];
|
|
302
|
-
return et[t] = {
|
|
303
|
-
...et[t],
|
|
304
|
-
segments: m.map((zt) => ({ ...zt })),
|
|
305
|
-
content: b,
|
|
306
|
-
status: z.value ? a.STOP : a.ANSWERING
|
|
307
|
-
}, et;
|
|
308
|
-
}
|
|
309
|
-
return T;
|
|
310
|
-
});
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
case "message_end": {
|
|
314
|
-
r();
|
|
315
|
-
const u = [...i.value];
|
|
316
|
-
u[t] && (u[t] = { ...u[t], status: z.value ? a.STOP : a.COMPLETED }), i.value = u, N.value = !1;
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
case "agent_error":
|
|
320
|
-
case "message_failed": {
|
|
321
|
-
r();
|
|
322
|
-
const u = [...i.value];
|
|
323
|
-
u[t] && (u[t] = {
|
|
324
|
-
...u[t],
|
|
325
|
-
status: a.ERROR,
|
|
326
|
-
content: p.error_msg || p.message || "请求失败",
|
|
327
|
-
errorMessage: p.error_msg || p.message || "请求失败"
|
|
328
|
-
}, i.value = u), N.value = !1;
|
|
329
|
-
break;
|
|
330
|
-
}
|
|
331
|
-
case "message_replace": {
|
|
332
|
-
const u = p.answer || "", d = $.value.get(t) || [], m = (f = d.map((w, b) => ({ s: w, i: b })).reverse().find((w) => w.s.type === "answer")) == null ? void 0 : f.i;
|
|
333
|
-
m != null ? d[m] = { ...d[m], content: u } : d.push({ type: "answer", content: u }), $.value.set(t, d), c((w) => {
|
|
334
|
-
if (w[t]) {
|
|
335
|
-
const b = [...w];
|
|
336
|
-
return b[t] = {
|
|
337
|
-
...b[t],
|
|
338
|
-
segments: d.map((T) => ({ ...T })),
|
|
339
|
-
content: u
|
|
340
|
-
}, b;
|
|
341
|
-
}
|
|
342
|
-
return w;
|
|
343
|
-
});
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
case "message_cost": {
|
|
347
|
-
const u = {
|
|
348
|
-
inputTokens: p.input_tokens || 0,
|
|
349
|
-
outputTokens: p.output_tokens || 0,
|
|
350
|
-
latency: p.latency || 0,
|
|
351
|
-
latencyFirstResp: p.latency_first_resp
|
|
352
|
-
};
|
|
353
|
-
c((d) => {
|
|
354
|
-
if (d[t]) {
|
|
355
|
-
const m = [...d];
|
|
356
|
-
return m[t] = { ...m[t], cost: u }, m;
|
|
357
|
-
}
|
|
358
|
-
return d;
|
|
359
|
-
});
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
default:
|
|
410
|
+
case "agent_thought_end": {
|
|
411
|
+
const h = v.value.get(e), w = h ? Math.round((Date.now() - h) / 1e3 * 10) / 10 : 0, k = c.value.get(e) || [], _ = k[k.length - 1];
|
|
412
|
+
_ && _.type === "agent_thought" && (_.duration = w), c.value.set(e, k), l((M) => {
|
|
413
|
+
if (M[e]) {
|
|
414
|
+
const H = [...M];
|
|
415
|
+
return H[e] = {
|
|
416
|
+
...H[e],
|
|
417
|
+
segments: k.map((K) => ({ ...K })),
|
|
418
|
+
thinkingDuration: (H[e].thinkingDuration || 0) + w
|
|
419
|
+
}, H;
|
|
420
|
+
}
|
|
421
|
+
return M;
|
|
422
|
+
});
|
|
423
|
+
break;
|
|
363
424
|
}
|
|
364
|
-
|
|
365
|
-
|
|
425
|
+
case "think_message_output_end": {
|
|
426
|
+
const h = f.value.get(e), w = h ? Math.round((Date.now() - h) / 1e3 * 10) / 10 : 0, k = c.value.get(e) || [], _ = k[k.length - 1];
|
|
427
|
+
_ && _.type === "thinking" && (_.duration = w), c.value.set(e, k), l((M) => {
|
|
428
|
+
if (M[e]) {
|
|
429
|
+
const H = [...M];
|
|
430
|
+
return H[e] = {
|
|
431
|
+
...H[e],
|
|
432
|
+
segments: k.map((K) => ({ ...K })),
|
|
433
|
+
thinkingDuration: (H[e].thinkingDuration || 0) + w
|
|
434
|
+
}, H;
|
|
435
|
+
}
|
|
436
|
+
return M;
|
|
437
|
+
});
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
case "tool_message": {
|
|
441
|
+
const h = S.answer || S.text || S.content || "";
|
|
442
|
+
if (!h) break;
|
|
443
|
+
const w = c.value.get(e) || [];
|
|
444
|
+
w.push({ type: "answer", content: h }), c.value.set(e, w), b(e);
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
case "message_output_start":
|
|
448
|
+
d.value.set(e, "answer"), P(e);
|
|
449
|
+
break;
|
|
450
|
+
case "message": {
|
|
451
|
+
const h = S.answer || "", w = d.value.get(e), k = c.value.get(e) || [], _ = k[k.length - 1];
|
|
452
|
+
w === "answer" && _ && _.type === "answer" ? _.content += h : (P(e), d.value.set(e, "answer"), k.push({ type: "answer", content: h })), c.value.set(e, k);
|
|
453
|
+
const M = k.filter((H) => H.type === "answer").map((H) => H.content).join("");
|
|
454
|
+
l((H) => {
|
|
455
|
+
if (H[e]) {
|
|
456
|
+
const K = [...H];
|
|
457
|
+
return K[e] = {
|
|
458
|
+
...K[e],
|
|
459
|
+
segments: k.map((I) => ({ ...I })),
|
|
460
|
+
content: M,
|
|
461
|
+
status: r.value ? s.STOP : s.ANSWERING
|
|
462
|
+
}, K;
|
|
463
|
+
}
|
|
464
|
+
return H;
|
|
465
|
+
});
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
case "message_end": {
|
|
469
|
+
i();
|
|
470
|
+
const h = [...t.value];
|
|
471
|
+
h[e] && (h[e] = { ...h[e], status: r.value ? s.STOP : s.COMPLETED }), t.value = h, a.value = !1;
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
case "agent_error":
|
|
475
|
+
case "message_failed": {
|
|
476
|
+
i();
|
|
477
|
+
const h = [...t.value];
|
|
478
|
+
h[e] && (h[e] = {
|
|
479
|
+
...h[e],
|
|
480
|
+
status: s.ERROR,
|
|
481
|
+
content: S.error_msg || S.message || "请求失败",
|
|
482
|
+
errorMessage: S.error_msg || S.message || "请求失败"
|
|
483
|
+
}, t.value = h), a.value = !1;
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
case "message_replace": {
|
|
487
|
+
const h = S.answer || "", w = c.value.get(e) || [], k = (N = w.map((_, M) => ({ s: _, i: M })).reverse().find((_) => _.s.type === "answer")) == null ? void 0 : N.i;
|
|
488
|
+
k != null ? w[k] = { ...w[k], content: h } : w.push({ type: "answer", content: h }), c.value.set(e, w), l((_) => {
|
|
489
|
+
if (_[e]) {
|
|
490
|
+
const M = [..._];
|
|
491
|
+
return M[e] = {
|
|
492
|
+
...M[e],
|
|
493
|
+
segments: w.map((H) => ({ ...H })),
|
|
494
|
+
content: h
|
|
495
|
+
}, M;
|
|
496
|
+
}
|
|
497
|
+
return _;
|
|
498
|
+
});
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
case "message_cost": {
|
|
502
|
+
const h = {
|
|
503
|
+
inputTokens: S.input_tokens || 0,
|
|
504
|
+
outputTokens: S.output_tokens || 0,
|
|
505
|
+
latency: S.latency || 0,
|
|
506
|
+
latencyFirstResp: S.latency_first_resp
|
|
507
|
+
};
|
|
508
|
+
l((w) => {
|
|
509
|
+
if (w[e]) {
|
|
510
|
+
const k = [...w];
|
|
511
|
+
return k[e] = { ...k[e], cost: h }, k;
|
|
512
|
+
}
|
|
513
|
+
return w;
|
|
514
|
+
});
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
default:
|
|
366
518
|
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
r();
|
|
370
|
-
const f = ($.value.get(t) || []).filter((p) => p.type === "answer").map((p) => p.content).join(""), M = [...i.value];
|
|
371
|
-
M[t] && M[t].status !== a.ERROR && (M[t] = {
|
|
372
|
-
...M[t],
|
|
373
|
-
content: z.value && !f ? "已停止回答" : f,
|
|
374
|
-
status: z.value ? a.STOP : a.COMPLETED
|
|
375
|
-
}), i.value = M, N.value = !1;
|
|
376
|
-
},
|
|
377
|
-
onerror(h) {
|
|
378
|
-
console.error("[ai-assist-sdk] ❌ 连接错误:", h), r();
|
|
379
|
-
const f = [...i.value];
|
|
380
|
-
f[t] && (f[t] = { ...f[t], content: `
|
|
381
|
-
⚠️ 请求异常,已终止`, status: a.ERROR }), i.value = f, N.value = !1;
|
|
519
|
+
} catch (O) {
|
|
520
|
+
console.error("[ai-assist-sdk] onmessage 解析失败:", O);
|
|
382
521
|
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
522
|
+
},
|
|
523
|
+
onclose() {
|
|
524
|
+
i(), P(e), i();
|
|
525
|
+
const N = (c.value.get(e) || []).filter((S) => S.type === "answer").map((S) => S.content).join(""), O = [...t.value];
|
|
526
|
+
O[e] && O[e].status !== s.ERROR && (O[e] = {
|
|
527
|
+
...O[e],
|
|
528
|
+
content: r.value && !N ? "已停止回答" : N,
|
|
529
|
+
status: r.value ? s.STOP : s.COMPLETED
|
|
530
|
+
}), t.value = O, a.value = !1;
|
|
531
|
+
},
|
|
532
|
+
onerror(C) {
|
|
533
|
+
console.error("[ai-assist-sdk] ❌ 连接错误:", C), i();
|
|
534
|
+
const N = [...t.value];
|
|
535
|
+
N[e] && (N[e] = { ...N[e], content: `
|
|
536
|
+
⚠️ 请求异常,已终止`, status: s.ERROR }), t.value = N, a.value = !1;
|
|
389
537
|
}
|
|
538
|
+
});
|
|
539
|
+
} catch ($) {
|
|
540
|
+
if (console.error("[ai-assist-sdk] doStreamRequest error:", $), !r.value) {
|
|
541
|
+
i();
|
|
542
|
+
const C = [...t.value];
|
|
543
|
+
C[e] && (C[e] = { ...C[e], content: "服务连接失败,请稍后重试", status: s.ERROR }), t.value = C, a.value = !1;
|
|
390
544
|
}
|
|
391
545
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
546
|
+
}
|
|
547
|
+
return { doStreamRequest: W, issTop: r };
|
|
548
|
+
}
|
|
549
|
+
function Pe(t) {
|
|
550
|
+
var a;
|
|
551
|
+
if (typeof t == "string") {
|
|
552
|
+
const o = Bt(t);
|
|
553
|
+
return Wt(o) || t;
|
|
554
|
+
}
|
|
555
|
+
return (t == null ? void 0 : t.answer) || ((a = t == null ? void 0 : t.data) == null ? void 0 : a.answer) || String(t || "");
|
|
556
|
+
}
|
|
557
|
+
function Le(t) {
|
|
558
|
+
return t.queryAgainStreamApi || t.queryAgainApi || t.chatQueryStreamApi || t.chatQueryApi;
|
|
559
|
+
}
|
|
560
|
+
function Oe({
|
|
561
|
+
messages: t,
|
|
562
|
+
userInput: a,
|
|
563
|
+
isGenerating: o,
|
|
564
|
+
lastUserMessage: l,
|
|
565
|
+
conversationId: i,
|
|
566
|
+
doStreamRequest: s,
|
|
567
|
+
issTop: m,
|
|
568
|
+
scrollToBottom: c,
|
|
569
|
+
STATUS: d,
|
|
570
|
+
cfg: f
|
|
571
|
+
}) {
|
|
572
|
+
const v = f.apis, r = x({
|
|
573
|
+
first: new AbortController(),
|
|
574
|
+
again: new AbortController()
|
|
575
|
+
});
|
|
576
|
+
async function b() {
|
|
577
|
+
const e = a.value.trim();
|
|
578
|
+
if (!e || o.value) return;
|
|
579
|
+
const u = [
|
|
580
|
+
...t.value,
|
|
581
|
+
{ type: "user", content: e },
|
|
582
|
+
{ type: "ai", content: "", status: d.THINKING }
|
|
583
|
+
];
|
|
584
|
+
t.value = u, a.value = "", c();
|
|
585
|
+
const D = u.length - 1;
|
|
586
|
+
if (v.chatQueryStreamApi) {
|
|
587
|
+
console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", v.chatQueryStreamApi), await s(v.chatQueryStreamApi, {
|
|
588
|
+
Query: e,
|
|
589
|
+
AppConversationID: i.value,
|
|
429
590
|
ResponseMode: "streaming"
|
|
430
|
-
},
|
|
591
|
+
}, D, r.first.signal);
|
|
592
|
+
return;
|
|
431
593
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
594
|
+
console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
|
|
595
|
+
try {
|
|
596
|
+
const C = await Ot().post(v.chatQueryApi, {
|
|
597
|
+
app: f.app ?? 1,
|
|
598
|
+
data: { Query: e, AppConversationID: i.value }
|
|
599
|
+
}), N = Pe(C.data);
|
|
600
|
+
t.value = [...t.value.slice(0, -1), { type: "ai", content: N, status: d.COMPLETED }];
|
|
601
|
+
} catch ($) {
|
|
602
|
+
t.value = [...t.value.slice(0, -1), { type: "ai", content: ($ == null ? void 0 : $.message) || "服务连接失败,请稍后重试", status: d.ERROR }];
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
async function P() {
|
|
606
|
+
if (!l.value || o.value) return;
|
|
607
|
+
const e = [...t.value];
|
|
608
|
+
e.length > 0 && e[e.length - 1].type === "ai" && e.pop(), e.push({ type: "ai", content: "", status: d.RETHINKING }), t.value = e, c();
|
|
609
|
+
const u = t.value.length;
|
|
610
|
+
await s(Le(v), {
|
|
611
|
+
MessageID: l.value,
|
|
612
|
+
AppConversationID: i.value,
|
|
613
|
+
ResponseMode: "streaming"
|
|
614
|
+
}, u, r.again.signal, !0);
|
|
615
|
+
}
|
|
616
|
+
async function W() {
|
|
617
|
+
if (!v.stopMessageApi || !o.value) return;
|
|
618
|
+
const e = t.value.length - 1;
|
|
619
|
+
try {
|
|
620
|
+
await Lt(v, l.value);
|
|
621
|
+
const u = [...t.value];
|
|
622
|
+
u[e] && (u[e] = { ...u[e], content: u[e].content || "已停止回答", status: d.STOP }), t.value = u, o.value = !1, r.first.abort(), r.first = new AbortController(), r.again.abort(), r.again = new AbortController(), m.value = !0;
|
|
623
|
+
} catch (u) {
|
|
624
|
+
const D = [...t.value];
|
|
625
|
+
D[e] && (D[e] = { ...D[e], content: (u == null ? void 0 : u.message) || "系统繁忙,请稍后再试", status: d.ERROR }), t.value = D;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
async function A(e) {
|
|
629
|
+
var u, D, $;
|
|
630
|
+
i.value = e;
|
|
631
|
+
try {
|
|
632
|
+
const C = await Pt(v, e), N = ($ = (D = (u = C == null ? void 0 : C.messages) == null ? void 0 : u[0]) == null ? void 0 : D.answerInfo) == null ? void 0 : $.answer;
|
|
633
|
+
N && (t.value = [...t.value, { type: "ai", content: N, status: d.COMPLETED }]);
|
|
634
|
+
} catch (C) {
|
|
635
|
+
ot((C == null ? void 0 : C.message) || "加载历史会话失败");
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
async function L() {
|
|
639
|
+
var e;
|
|
640
|
+
try {
|
|
641
|
+
const u = await Ht(v);
|
|
642
|
+
(e = u == null ? void 0 : u.conversation) != null && e.appConversationID && (i.value = u.conversation.appConversationID);
|
|
643
|
+
} catch (u) {
|
|
644
|
+
ot((u == null ? void 0 : u.message) || "创建会话失败");
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
return { sendMessage: b, regenerateResponse: P, toggleStop: W, goHistoryMessage: A, initConversation: L, controllers: r };
|
|
648
|
+
}
|
|
649
|
+
const Be = { class: "container" }, We = { class: "message ai-message greet-message" }, Xe = { class: "ai-greet" }, Ge = {
|
|
650
|
+
key: 0,
|
|
651
|
+
class: "message ai-message recommend-message"
|
|
652
|
+
}, Ve = { class: "ai-recommend" }, Fe = { class: "recommend-header" }, Ke = ["src"], qe = ["onClick"], Qe = /* @__PURE__ */ U({
|
|
653
|
+
__name: "Answer",
|
|
654
|
+
props: {
|
|
655
|
+
defaultSayhello: {},
|
|
656
|
+
defaultRecommend: {}
|
|
657
|
+
},
|
|
658
|
+
setup(t, { expose: a }) {
|
|
659
|
+
const o = {
|
|
660
|
+
THINKING: "thinking",
|
|
661
|
+
RETHINKING: "rethinking",
|
|
662
|
+
ANSWERING: "answering",
|
|
663
|
+
PAUSED: "paused",
|
|
664
|
+
COMPLETED: "completed",
|
|
665
|
+
STOP: "stop",
|
|
666
|
+
ERROR: "error"
|
|
667
|
+
}, l = t, i = ut(), s = T([]), m = T(""), c = T(!1), d = T(""), f = T(""), v = T(null), r = x({ text1: "", text2: "" }), b = T([]), P = T(0), W = Z(
|
|
668
|
+
() => b.value[P.value % (b.value.length || 1)]
|
|
669
|
+
);
|
|
670
|
+
function A() {
|
|
671
|
+
P.value++;
|
|
672
|
+
}
|
|
673
|
+
function L(V) {
|
|
674
|
+
m.value = V;
|
|
675
|
+
}
|
|
676
|
+
const { isAtBottom: e, hasScroll: u, scrollToBottom: D, checkScrollStatus: $ } = Me(v), { enhanceCodeBlocks: C } = Re(), { batchMessagesUpdate: N, flushMessagesBatch: O } = De(s), { displayedContent: S, streamingIndexRef: h, startTypewriter: w, stopTypewriter: k, getSegmentDisplayContent: _ } = Ne(
|
|
677
|
+
s,
|
|
678
|
+
D,
|
|
679
|
+
o.ANSWERING
|
|
680
|
+
), { doStreamRequest: M, issTop: H } = He({
|
|
681
|
+
messages: s,
|
|
682
|
+
isGenerating: c,
|
|
683
|
+
lastUserMessage: d,
|
|
684
|
+
batchMessagesUpdate: N,
|
|
685
|
+
flushMessagesBatch: O,
|
|
686
|
+
STATUS: o,
|
|
687
|
+
cfg: i
|
|
688
|
+
}), { sendMessage: K, regenerateResponse: I, toggleStop: vt, goHistoryMessage: at, initConversation: y } = Oe({
|
|
689
|
+
messages: s,
|
|
690
|
+
userInput: m,
|
|
691
|
+
isGenerating: c,
|
|
692
|
+
lastUserMessage: d,
|
|
693
|
+
conversationId: f,
|
|
694
|
+
doStreamRequest: M,
|
|
695
|
+
issTop: H,
|
|
696
|
+
scrollToBottom: D,
|
|
697
|
+
STATUS: o,
|
|
698
|
+
cfg: i
|
|
699
|
+
});
|
|
700
|
+
function E() {
|
|
701
|
+
s.value = [], d.value = "", y();
|
|
443
702
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
703
|
+
const G = Z(() => !!f.value && s.value.length === 0);
|
|
704
|
+
a({ goHistoryMessage: at, createNewConversation: E, isEmptyConversation: G });
|
|
705
|
+
const q = T(/* @__PURE__ */ new Map());
|
|
706
|
+
function it(V, F) {
|
|
707
|
+
V ? q.value.set(F, V) : q.value.delete(F);
|
|
449
708
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}),
|
|
455
|
-
|
|
709
|
+
wt(s, () => {
|
|
710
|
+
rt(() => {
|
|
711
|
+
s.value.forEach((V, F) => {
|
|
712
|
+
V.type === "ai" && V.status !== o.ANSWERING && (S.set(F, V.content), h.value.set(F, V.content.length));
|
|
713
|
+
}), w(), q.value.forEach((V) => {
|
|
714
|
+
C(V);
|
|
456
715
|
});
|
|
457
716
|
});
|
|
458
|
-
}, { deep: !0 })
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}),
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
(
|
|
466
|
-
})
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
return l(), v("div", Ce, [
|
|
473
|
-
e("div", {
|
|
717
|
+
}, { deep: !0 });
|
|
718
|
+
let j = null;
|
|
719
|
+
return Q(() => {
|
|
720
|
+
l.defaultSayhello && (r.text1 = l.defaultSayhello.text1, r.text2 = l.defaultSayhello.text2), l.defaultRecommend && (b.value = Xt(l.defaultRecommend));
|
|
721
|
+
}), Q(() => {
|
|
722
|
+
y();
|
|
723
|
+
}), Q(() => {
|
|
724
|
+
v.value && (j = () => $(), v.value.addEventListener("scroll", j));
|
|
725
|
+
}), gt(() => {
|
|
726
|
+
k(), v.value && j && v.value.removeEventListener("scroll", j);
|
|
727
|
+
}), (V, F) => {
|
|
728
|
+
var ft;
|
|
729
|
+
return g(), p("div", Be, [
|
|
730
|
+
n("div", {
|
|
474
731
|
class: "chat-box scrollWrap",
|
|
475
732
|
ref_key: "chatBoxRef",
|
|
476
|
-
ref:
|
|
733
|
+
ref: v
|
|
477
734
|
}, [
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
735
|
+
n("div", We, [
|
|
736
|
+
n("div", Xe, [
|
|
737
|
+
n("h1", null, B(r.text1), 1),
|
|
738
|
+
n("p", null, B(r.text2), 1)
|
|
482
739
|
])
|
|
483
740
|
]),
|
|
484
|
-
(
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
741
|
+
(ft = W.value) != null && ft.length ? (g(), p("div", Ge, [
|
|
742
|
+
n("div", Ve, [
|
|
743
|
+
n("div", Fe, [
|
|
744
|
+
F[2] || (F[2] = n("span", null, "你可以尝试这样问我:", -1)),
|
|
745
|
+
n("p", {
|
|
489
746
|
class: "refresh-btn",
|
|
490
|
-
onClick:
|
|
747
|
+
onClick: A
|
|
491
748
|
}, [
|
|
492
|
-
|
|
493
|
-
|
|
749
|
+
n("img", { src: R(mt) }, null, 8, Ke),
|
|
750
|
+
F[1] || (F[1] = n("span", null, "换一换", -1))
|
|
494
751
|
])
|
|
495
752
|
]),
|
|
496
|
-
|
|
497
|
-
(
|
|
498
|
-
key:
|
|
499
|
-
onClick: (
|
|
500
|
-
},
|
|
753
|
+
n("ul", null, [
|
|
754
|
+
(g(!0), p(Y, null, st(W.value, (J, lt) => (g(), p("li", {
|
|
755
|
+
key: lt,
|
|
756
|
+
onClick: (Hn) => L(J)
|
|
757
|
+
}, B(J), 9, qe))), 128))
|
|
501
758
|
])
|
|
502
759
|
])
|
|
503
|
-
])) :
|
|
504
|
-
(
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
])])) : W("", !0),
|
|
514
|
-
o.segments && o.segments.length ? (l(), v("div", {
|
|
515
|
-
key: 1,
|
|
516
|
-
class: "message-content ba-markdown",
|
|
517
|
-
ref_for: !0,
|
|
518
|
-
ref: (h) => $t(h, C)
|
|
519
|
-
}, [
|
|
520
|
-
(l(!0), v(st, null, ut(o.segments, (h, f) => (l(), v(st, { key: f }, [
|
|
521
|
-
h.type === "agent_thought" ? (l(), v("div", Ne, [
|
|
522
|
-
n[4] || (n[4] = e("svg", {
|
|
523
|
-
class: "agent-thought__icon",
|
|
524
|
-
viewBox: "0 0 24 24",
|
|
525
|
-
width: "14",
|
|
526
|
-
height: "14",
|
|
527
|
-
fill: "none",
|
|
528
|
-
stroke: "currentColor",
|
|
529
|
-
"stroke-width": "2"
|
|
530
|
-
}, [
|
|
531
|
-
e("circle", {
|
|
532
|
-
cx: "11",
|
|
533
|
-
cy: "11",
|
|
534
|
-
r: "7"
|
|
535
|
-
}),
|
|
536
|
-
e("line", {
|
|
537
|
-
x1: "16.5",
|
|
538
|
-
y1: "16.5",
|
|
539
|
-
x2: "21",
|
|
540
|
-
y2: "21"
|
|
541
|
-
})
|
|
542
|
-
], -1)),
|
|
543
|
-
e("span", De, P(h.duration != null ? "搜索信息完成" : "搜索信息中…"), 1)
|
|
544
|
-
])) : h.type === "thinking" ? (l(), v("div", {
|
|
545
|
-
key: 1,
|
|
546
|
-
class: ot(["thinking-block", { "thinking-block--expanded": I.get(`${C}-${f}`) === !0 }])
|
|
547
|
-
}, [
|
|
548
|
-
e("div", {
|
|
549
|
-
class: "thinking-block__header",
|
|
550
|
-
onClick: (M) => qt(C, f)
|
|
551
|
-
}, [
|
|
552
|
-
e("span", Pe, P(h.duration != null ? "深度思考" : "深度思考中"), 1),
|
|
553
|
-
(l(), v("svg", {
|
|
554
|
-
class: ot(["thinking-block__arrow", { "thinking-block__arrow--down": I.get(`${C}-${f}`) === !0 }]),
|
|
555
|
-
viewBox: "0 0 24 24",
|
|
556
|
-
width: "14",
|
|
557
|
-
height: "14",
|
|
558
|
-
fill: "none",
|
|
559
|
-
stroke: "currentColor",
|
|
560
|
-
"stroke-width": "2"
|
|
561
|
-
}, [...n[5] || (n[5] = [
|
|
562
|
-
e("polyline", { points: "6 9 12 15 18 9" }, null, -1)
|
|
563
|
-
])], 2))
|
|
564
|
-
], 8, He),
|
|
565
|
-
I.get(`${C}-${f}`) === !0 ? (l(), v("div", Le, P(h.content), 1)) : W("", !0)
|
|
566
|
-
], 2)) : (l(), v("div", Oe, [
|
|
567
|
-
e("div", {
|
|
568
|
-
innerHTML: R(Nt)(R(Dt)(_t(C, f, h, o)))
|
|
569
|
-
}, null, 8, We)
|
|
570
|
-
]))
|
|
571
|
-
], 64))), 128)),
|
|
572
|
-
o.status === a.ANSWERING ? (l(), v("span", Ge)) : W("", !0)
|
|
573
|
-
], 512)) : W("", !0),
|
|
574
|
-
!((H = o.segments) != null && H.length) && o.content ? (l(), v("div", {
|
|
575
|
-
key: 2,
|
|
576
|
-
class: "message-content ba-markdown",
|
|
577
|
-
ref_for: !0,
|
|
578
|
-
ref: (h) => $t(h, C)
|
|
579
|
-
}, [
|
|
580
|
-
e("div", {
|
|
581
|
-
innerHTML: R(Nt)(R(Dt)(lt.get(C) ?? o.content))
|
|
582
|
-
}, null, 8, Be),
|
|
583
|
-
o.status === a.ANSWERING ? (l(), v("span", Xe)) : W("", !0)
|
|
584
|
-
], 512)) : W("", !0),
|
|
585
|
-
o.errorMessage ? (l(), v("div", Ke, [
|
|
586
|
-
n[6] || (n[6] = e("span", { class: "message-error__icon" }, "⚠️", -1)),
|
|
587
|
-
e("span", null, P(o.errorMessage), 1)
|
|
588
|
-
])) : W("", !0),
|
|
589
|
-
o.cost && o.status !== a.ANSWERING && o.status !== a.THINKING ? (l(), v("div", qe, P(Kt(o.cost)), 1)) : W("", !0),
|
|
590
|
-
e("div", Qe, [
|
|
591
|
-
e("span", {
|
|
592
|
-
onClick: (h) => Gt(o)
|
|
593
|
-
}, P(R(ee)(o.status)), 9, Ue)
|
|
594
|
-
])
|
|
595
|
-
], 64)) : (l(), v("div", Fe, P(o.content), 1))
|
|
596
|
-
], 2);
|
|
597
|
-
}), 128))
|
|
760
|
+
])) : X("", !0),
|
|
761
|
+
(g(!0), p(Y, null, st(s.value, (J, lt) => (g(), et(he, {
|
|
762
|
+
key: lt,
|
|
763
|
+
msg: J,
|
|
764
|
+
index: lt,
|
|
765
|
+
STATUS: o,
|
|
766
|
+
displayedContent: R(S),
|
|
767
|
+
getSegmentDisplayContent: R(_),
|
|
768
|
+
setMessageRef: it
|
|
769
|
+
}, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent"]))), 128))
|
|
598
770
|
], 512),
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
Tt(e("input", {
|
|
612
|
-
"onUpdate:modelValue": n[0] || (n[0] = (o) => X.value = o),
|
|
613
|
-
type: "text",
|
|
614
|
-
placeholder: "输入消息...",
|
|
615
|
-
onKeyup: jt(Rt, ["enter"]),
|
|
616
|
-
disabled: N.value
|
|
617
|
-
}, null, 40, xe), [
|
|
618
|
-
[Pt, X.value]
|
|
619
|
-
]),
|
|
620
|
-
N.value && k.value ? (l(), v("div", Je, [
|
|
621
|
-
e("img", {
|
|
622
|
-
src: R(ve),
|
|
623
|
-
onClick: Ut
|
|
624
|
-
}, null, 8, Ze)
|
|
625
|
-
])) : (l(), v("div", Ie, [
|
|
626
|
-
e("img", {
|
|
627
|
-
src: R(de),
|
|
628
|
-
onClick: Rt
|
|
629
|
-
}, null, 8, ts)
|
|
630
|
-
])),
|
|
631
|
-
S.value && !A.value ? (l(), v("div", es, [
|
|
632
|
-
e("img", {
|
|
633
|
-
onClick: tt,
|
|
634
|
-
src: R(pe)
|
|
635
|
-
}, null, 8, ss)
|
|
636
|
-
])) : W("", !0)
|
|
637
|
-
])
|
|
771
|
+
ct(Ee, {
|
|
772
|
+
modelValue: m.value,
|
|
773
|
+
"onUpdate:modelValue": F[0] || (F[0] = (J) => m.value = J),
|
|
774
|
+
isGenerating: c.value,
|
|
775
|
+
lastUserMessage: d.value,
|
|
776
|
+
hasScroll: R(u),
|
|
777
|
+
isAtBottom: R(e),
|
|
778
|
+
onSend: R(K),
|
|
779
|
+
onRegenerate: R(I),
|
|
780
|
+
onStop: R(vt),
|
|
781
|
+
onScrollToBottom: R(D)
|
|
782
|
+
}, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"])
|
|
638
783
|
]);
|
|
639
784
|
};
|
|
640
785
|
}
|
|
641
|
-
}),
|
|
786
|
+
}), ze = { class: "ai-history" }, Ye = { class: "content" }, je = { key: 0 }, Je = ["onClick"], Ze = { class: "info-pic" }, xe = { class: "info-content" }, Ue = { class: "info-content-title" }, Ie = { class: "info-content-time" }, tn = ["onClick"], en = ["src"], nn = { class: "ai-modal" }, sn = { class: "ai-modal-footer" }, on = /* @__PURE__ */ U({
|
|
642
787
|
__name: "History",
|
|
643
788
|
emits: ["history-detail", "new-answer"],
|
|
644
|
-
setup(
|
|
645
|
-
const
|
|
646
|
-
async function
|
|
647
|
-
|
|
648
|
-
|
|
789
|
+
setup(t, { emit: a }) {
|
|
790
|
+
const l = ut().apis, i = T([]), s = T(!1), m = T("");
|
|
791
|
+
async function c() {
|
|
792
|
+
try {
|
|
793
|
+
const v = await Gt(l);
|
|
794
|
+
v != null && v.conversationList && (i.value = v.conversationList.filter((r) => r !== null).map((r) => ({ ...r, selected: !1 })));
|
|
795
|
+
} catch (v) {
|
|
796
|
+
ot((v == null ? void 0 : v.message) || "获取历史记录失败");
|
|
797
|
+
}
|
|
649
798
|
}
|
|
650
|
-
function
|
|
651
|
-
|
|
799
|
+
function d(v) {
|
|
800
|
+
m.value = v, s.value = !0;
|
|
652
801
|
}
|
|
653
|
-
async function
|
|
654
|
-
|
|
802
|
+
async function f() {
|
|
803
|
+
s.value = !1;
|
|
804
|
+
try {
|
|
805
|
+
await Vt(l, m.value), await c();
|
|
806
|
+
} catch (v) {
|
|
807
|
+
ot((v == null ? void 0 : v.message) || "删除失败"), await c();
|
|
808
|
+
}
|
|
655
809
|
}
|
|
656
|
-
return
|
|
657
|
-
|
|
658
|
-
}), (
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
(
|
|
662
|
-
key:
|
|
810
|
+
return Q(() => {
|
|
811
|
+
c();
|
|
812
|
+
}), (v, r) => (g(), p("div", ze, [
|
|
813
|
+
n("div", Ye, [
|
|
814
|
+
i.value.length > 0 ? (g(), p("div", je, [
|
|
815
|
+
(g(!0), p(Y, null, st(i.value, (b) => (g(), p("div", {
|
|
816
|
+
key: b.appConversationID,
|
|
663
817
|
class: "info",
|
|
664
|
-
onClick: (
|
|
818
|
+
onClick: (P) => v.$emit("history-detail", b.appConversationID)
|
|
665
819
|
}, [
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
820
|
+
n("div", Ze, B(b.conversationName.slice(0, 1)), 1),
|
|
821
|
+
n("div", xe, [
|
|
822
|
+
n("div", Ue, B(b.conversationName), 1),
|
|
823
|
+
n("div", Ie, B(b.createTime), 1)
|
|
670
824
|
]),
|
|
671
|
-
|
|
825
|
+
n("div", {
|
|
672
826
|
class: "clear-history",
|
|
673
|
-
onClick:
|
|
674
|
-
}, "删除", 8,
|
|
675
|
-
], 8,
|
|
676
|
-
])) :
|
|
827
|
+
onClick: ht((P) => d(b.appConversationID), ["stop"])
|
|
828
|
+
}, "删除", 8, tn)
|
|
829
|
+
], 8, Je))), 128))
|
|
830
|
+
])) : X("", !0)
|
|
677
831
|
]),
|
|
678
|
-
|
|
832
|
+
n("div", {
|
|
679
833
|
class: "ai-add",
|
|
680
|
-
onClick:
|
|
834
|
+
onClick: r[0] || (r[0] = (b) => v.$emit("new-answer"))
|
|
681
835
|
}, [
|
|
682
|
-
|
|
683
|
-
|
|
836
|
+
n("img", { src: R(Yt) }, null, 8, en),
|
|
837
|
+
r[3] || (r[3] = n("span", { style: { color: "#333333" } }, "新建AI对话", -1))
|
|
684
838
|
]),
|
|
685
|
-
(
|
|
686
|
-
|
|
839
|
+
(g(), et(At, { to: "body" }, [
|
|
840
|
+
s.value ? (g(), p("div", {
|
|
687
841
|
key: 0,
|
|
688
842
|
class: "ai-modal-overlay",
|
|
689
|
-
onClick:
|
|
843
|
+
onClick: r[2] || (r[2] = ht((b) => s.value = !1, ["self"]))
|
|
690
844
|
}, [
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
845
|
+
n("div", nn, [
|
|
846
|
+
r[4] || (r[4] = n("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
|
|
847
|
+
r[5] || (r[5] = n("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
|
|
848
|
+
n("div", sn, [
|
|
849
|
+
n("button", {
|
|
696
850
|
class: "ai-modal-btn cancel",
|
|
697
|
-
onClick:
|
|
851
|
+
onClick: r[1] || (r[1] = (b) => s.value = !1)
|
|
698
852
|
}, "取消"),
|
|
699
|
-
|
|
853
|
+
n("button", {
|
|
700
854
|
class: "ai-modal-btn confirm",
|
|
701
|
-
onClick:
|
|
855
|
+
onClick: f
|
|
702
856
|
}, "确定")
|
|
703
857
|
])
|
|
704
858
|
])
|
|
705
|
-
])) :
|
|
859
|
+
])) : X("", !0)
|
|
706
860
|
]))
|
|
707
861
|
]));
|
|
708
862
|
}
|
|
709
|
-
}),
|
|
710
|
-
const
|
|
711
|
-
for (const [
|
|
712
|
-
|
|
713
|
-
return
|
|
714
|
-
},
|
|
863
|
+
}), an = (t, a) => {
|
|
864
|
+
const o = t.__vccOpts || t;
|
|
865
|
+
for (const [l, i] of a)
|
|
866
|
+
o[l] = i;
|
|
867
|
+
return o;
|
|
868
|
+
}, ln = /* @__PURE__ */ an(on, [["__scopeId", "data-v-9267d81a"]]), cn = { class: "container info" }, rn = { class: "info-item" }, un = { class: "basic-content" }, vn = { class: "basic-content-text" }, dn = { class: "basic-content" }, gn = { class: "basic-content-text" }, mn = { class: "info-item" }, fn = { class: "permission-content" }, hn = { class: "info-item" }, pn = { class: "basic-content" }, yn = { class: "basic-content-text" }, kn = { class: "basic-content" }, wn = { class: "basic-content-text" }, Cn = /* @__PURE__ */ U({
|
|
715
869
|
__name: "Info",
|
|
716
|
-
setup(
|
|
717
|
-
const
|
|
718
|
-
return
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
870
|
+
setup(t) {
|
|
871
|
+
const a = ut(), o = T(null);
|
|
872
|
+
return Q(async () => {
|
|
873
|
+
try {
|
|
874
|
+
o.value = await Ft(a.apis);
|
|
875
|
+
} catch (l) {
|
|
876
|
+
ot((l == null ? void 0 : l.message) || "获取个人信息失败");
|
|
877
|
+
}
|
|
878
|
+
}), (l, i) => {
|
|
879
|
+
var s, m, c, d, f;
|
|
880
|
+
return g(), p("div", cn, [
|
|
881
|
+
n("div", rn, [
|
|
882
|
+
i[2] || (i[2] = n("div", { class: "heading" }, [
|
|
883
|
+
n("div", { class: "heading-column" }),
|
|
884
|
+
n("div", { class: "heading-title" }, "基本信息")
|
|
727
885
|
], -1)),
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
886
|
+
n("div", un, [
|
|
887
|
+
i[0] || (i[0] = n("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
|
|
888
|
+
n("div", vn, B(((s = o.value) == null ? void 0 : s.name) || ""), 1)
|
|
731
889
|
]),
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
890
|
+
n("div", dn, [
|
|
891
|
+
i[1] || (i[1] = n("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
|
|
892
|
+
n("div", gn, B(((m = o.value) == null ? void 0 : m.userName) || ""), 1)
|
|
735
893
|
])
|
|
736
894
|
]),
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
895
|
+
n("div", mn, [
|
|
896
|
+
i[3] || (i[3] = n("div", { class: "heading" }, [
|
|
897
|
+
n("div", { class: "heading-column" }),
|
|
898
|
+
n("div", { class: "heading-title" }, "数据权限")
|
|
741
899
|
], -1)),
|
|
742
|
-
|
|
743
|
-
(
|
|
744
|
-
key:
|
|
900
|
+
n("div", fn, [
|
|
901
|
+
(g(!0), p(Y, null, st((c = o.value) == null ? void 0 : c.ptnameList, (v, r) => (g(), p("div", {
|
|
902
|
+
key: r,
|
|
745
903
|
class: "permission-content-text"
|
|
746
|
-
},
|
|
904
|
+
}, B(v), 1))), 128))
|
|
747
905
|
])
|
|
748
906
|
]),
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
907
|
+
n("div", hn, [
|
|
908
|
+
i[6] || (i[6] = n("div", { class: "heading" }, [
|
|
909
|
+
n("div", { class: "heading-column" }),
|
|
910
|
+
n("div", { class: "heading-title" }, "帮助信息")
|
|
753
911
|
], -1)),
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
912
|
+
n("div", pn, [
|
|
913
|
+
i[4] || (i[4] = n("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
|
|
914
|
+
n("div", yn, B(((d = o.value) == null ? void 0 : d.dept) || ""), 1)
|
|
757
915
|
]),
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
916
|
+
n("div", kn, [
|
|
917
|
+
i[5] || (i[5] = n("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
|
|
918
|
+
n("div", wn, B(((f = o.value) == null ? void 0 : f.email) || ""), 1)
|
|
761
919
|
])
|
|
762
920
|
])
|
|
763
921
|
]);
|
|
764
922
|
};
|
|
765
923
|
}
|
|
766
|
-
}),
|
|
924
|
+
}), $n = { class: "header" }, Sn = ["src"], _n = { class: "header-title" }, bn = ["src"], Tn = ["src"], An = { class: "setTitle" }, En = { class: "content" }, Mn = { class: "main" }, Rn = { class: "btn" }, Dn = ["src"], Nn = 117, tt = 118, $t = /* @__PURE__ */ U({
|
|
767
925
|
__name: "AiAssist",
|
|
768
|
-
setup(
|
|
769
|
-
const
|
|
770
|
-
x: window.innerWidth -
|
|
771
|
-
y: window.innerHeight / 2 -
|
|
772
|
-
}),
|
|
773
|
-
let
|
|
774
|
-
const
|
|
775
|
-
const
|
|
776
|
-
return
|
|
777
|
-
}),
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
926
|
+
setup(t) {
|
|
927
|
+
const a = Nn / 2, o = ut(), l = T(!1), i = T(!1), s = T("answer"), m = T(!1), c = T(""), d = T(""), f = x({
|
|
928
|
+
x: window.innerWidth - a,
|
|
929
|
+
y: window.innerHeight / 2 - tt / 2
|
|
930
|
+
}), v = T(!1), r = T(!1), b = T("right"), P = T("left"), W = x({ x: 0, y: 0 }), A = T(!1), L = T(null);
|
|
931
|
+
let e = null;
|
|
932
|
+
const u = Z(() => {
|
|
933
|
+
const y = window.innerWidth / 2;
|
|
934
|
+
return f.x + a < y ? 5 : -5;
|
|
935
|
+
}), D = Z(() => i.value ? "" : `panel-${b.value}`), $ = Z(() => {
|
|
936
|
+
var y;
|
|
937
|
+
return !((y = L.value) != null && y.isEmptyConversation);
|
|
938
|
+
}), C = Z(() => ({
|
|
939
|
+
left: `${f.x}px`,
|
|
940
|
+
top: `${f.y}px`,
|
|
941
|
+
transition: v.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
|
|
942
|
+
"--direction": String(u.value)
|
|
782
943
|
}));
|
|
783
|
-
function
|
|
784
|
-
const
|
|
785
|
-
|
|
944
|
+
function N() {
|
|
945
|
+
const y = window.innerWidth / 2;
|
|
946
|
+
f.x + a < y ? (b.value = "left", P.value = "right") : (b.value = "right", P.value = "left");
|
|
786
947
|
}
|
|
787
|
-
function
|
|
788
|
-
const
|
|
789
|
-
return { x:
|
|
948
|
+
function O() {
|
|
949
|
+
const y = window.innerWidth, E = Math.max(0, Math.min(f.y, window.innerHeight - tt));
|
|
950
|
+
return { x: f.x + a >= y / 2 ? y - a : -a, y: E };
|
|
790
951
|
}
|
|
791
|
-
function
|
|
792
|
-
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
952
|
+
function S() {
|
|
953
|
+
r.value = !0;
|
|
954
|
+
const y = O();
|
|
955
|
+
f.x = y.x, f.y = y.y, setTimeout(() => {
|
|
956
|
+
r.value = !1, N(), h();
|
|
796
957
|
}, 400);
|
|
797
958
|
}
|
|
798
|
-
function
|
|
959
|
+
function h() {
|
|
799
960
|
try {
|
|
800
|
-
localStorage.setItem("characterPosition", JSON.stringify({ x:
|
|
961
|
+
localStorage.setItem("characterPosition", JSON.stringify({ x: f.x, y: f.y })), localStorage.setItem("panelPosition", b.value), localStorage.setItem("backPosition", P.value);
|
|
801
962
|
} catch {
|
|
802
963
|
}
|
|
803
964
|
}
|
|
804
|
-
function
|
|
805
|
-
const
|
|
806
|
-
if (
|
|
807
|
-
const
|
|
808
|
-
|
|
965
|
+
function w() {
|
|
966
|
+
const y = localStorage.getItem("characterPosition");
|
|
967
|
+
if (y) {
|
|
968
|
+
const q = JSON.parse(y);
|
|
969
|
+
f.x = q.x, f.y = Math.min(Math.max(q.y, 0), window.innerHeight - tt);
|
|
809
970
|
} else
|
|
810
|
-
|
|
811
|
-
const
|
|
812
|
-
|
|
971
|
+
f.x = window.innerWidth - a, f.y = window.innerHeight / 2 - tt / 2;
|
|
972
|
+
const E = localStorage.getItem("panelPosition"), G = localStorage.getItem("backPosition");
|
|
973
|
+
E && (b.value = E), G && (P.value = G);
|
|
813
974
|
}
|
|
814
|
-
function
|
|
815
|
-
if (!
|
|
816
|
-
const
|
|
817
|
-
|
|
975
|
+
function k(y) {
|
|
976
|
+
if (!v.value) return;
|
|
977
|
+
const E = "touches" in y ? y.touches[0].clientX : y.clientX, G = "touches" in y ? y.touches[0].clientY : y.clientY, q = E - W.x, it = Math.max(0, Math.min(G - W.y, window.innerHeight - tt)), j = Math.abs(q - f.x), V = Math.abs(it - f.y);
|
|
978
|
+
j + V > 5 && (A.value = !0), f.x = q, f.y = it;
|
|
818
979
|
}
|
|
819
|
-
function
|
|
820
|
-
|
|
980
|
+
function _() {
|
|
981
|
+
v.value && (v.value = !1, A.value && (S(), A.value = !1));
|
|
821
982
|
}
|
|
822
|
-
function
|
|
823
|
-
|
|
824
|
-
const
|
|
825
|
-
|
|
983
|
+
function M(y) {
|
|
984
|
+
r.value = !1, v.value = !0, A.value = !1;
|
|
985
|
+
const E = "touches" in y ? y.touches[0].clientX : y.clientX, G = "touches" in y ? y.touches[0].clientY : y.clientY;
|
|
986
|
+
W.x = E - f.x, W.y = G - f.y;
|
|
826
987
|
}
|
|
827
|
-
function
|
|
828
|
-
!
|
|
988
|
+
function H() {
|
|
989
|
+
!A.value && !r.value ? (N(), l.value = !0) : A.value = !1;
|
|
829
990
|
}
|
|
830
|
-
function
|
|
831
|
-
|
|
832
|
-
var
|
|
833
|
-
(
|
|
991
|
+
function K(y) {
|
|
992
|
+
s.value = "answer", rt(() => {
|
|
993
|
+
var E;
|
|
994
|
+
(E = L.value) == null || E.goHistoryMessage(y);
|
|
834
995
|
});
|
|
835
996
|
}
|
|
836
|
-
function
|
|
837
|
-
|
|
997
|
+
function I() {
|
|
998
|
+
s.value = "answer", rt(() => {
|
|
999
|
+
var y;
|
|
1000
|
+
(y = L.value) == null || y.createNewConversation();
|
|
1001
|
+
});
|
|
838
1002
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}
|
|
842
|
-
|
|
1003
|
+
function vt() {
|
|
1004
|
+
d.value = c.value, m.value = !1;
|
|
1005
|
+
}
|
|
1006
|
+
wt(i, (y) => {
|
|
1007
|
+
y ? b.value = "center" : N();
|
|
1008
|
+
}), Q(() => {
|
|
1009
|
+
w();
|
|
843
1010
|
});
|
|
844
|
-
function
|
|
845
|
-
|
|
1011
|
+
function at() {
|
|
1012
|
+
e && clearTimeout(e), e = setTimeout(() => S(), 100);
|
|
846
1013
|
}
|
|
847
|
-
return
|
|
848
|
-
window.addEventListener("resize",
|
|
849
|
-
}),
|
|
850
|
-
window.removeEventListener("resize",
|
|
851
|
-
}),
|
|
852
|
-
document.addEventListener("mousemove",
|
|
853
|
-
}),
|
|
854
|
-
document.removeEventListener("mousemove",
|
|
855
|
-
}), (
|
|
856
|
-
|
|
1014
|
+
return Q(() => {
|
|
1015
|
+
window.addEventListener("resize", at);
|
|
1016
|
+
}), gt(() => {
|
|
1017
|
+
window.removeEventListener("resize", at), e && clearTimeout(e);
|
|
1018
|
+
}), Q(() => {
|
|
1019
|
+
document.addEventListener("mousemove", k), document.addEventListener("touchmove", k, { passive: !0 }), document.addEventListener("mouseup", _), document.addEventListener("touchend", _);
|
|
1020
|
+
}), gt(() => {
|
|
1021
|
+
document.removeEventListener("mousemove", k), document.removeEventListener("touchmove", k), document.removeEventListener("mouseup", _), document.removeEventListener("touchend", _);
|
|
1022
|
+
}), (y, E) => (g(), p("div", null, [
|
|
1023
|
+
l.value ? (g(), p("div", {
|
|
857
1024
|
key: 0,
|
|
858
|
-
class:
|
|
1025
|
+
class: z(["ai-panel", i.value ? "maxWrap" : "minWrap", D.value])
|
|
859
1026
|
}, [
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
1027
|
+
n("div", $n, [
|
|
1028
|
+
n("p", null, [
|
|
1029
|
+
s.value === "info" || s.value === "history" ? (g(), p("span", {
|
|
863
1030
|
key: 0,
|
|
864
|
-
class:
|
|
865
|
-
onClick:
|
|
866
|
-
}, [...
|
|
867
|
-
|
|
868
|
-
])], 2)) : (
|
|
1031
|
+
class: z(["back", P.value]),
|
|
1032
|
+
onClick: E[0] || (E[0] = (G) => s.value = "answer")
|
|
1033
|
+
}, [...E[6] || (E[6] = [
|
|
1034
|
+
n("span", { style: { "font-size": "18px" } }, "←", -1)
|
|
1035
|
+
])], 2)) : (g(), p("img", {
|
|
869
1036
|
key: 1,
|
|
870
|
-
src: R(
|
|
871
|
-
|
|
872
|
-
}, null, 8, Ps))
|
|
1037
|
+
src: R(jt)
|
|
1038
|
+
}, null, 8, Sn))
|
|
873
1039
|
]),
|
|
874
|
-
|
|
875
|
-
|
|
1040
|
+
n("div", _n, [
|
|
1041
|
+
n("span", null, B(s.value === "info" ? "个人信息" : s.value === "history" ? "历史信息" : R(o).name), 1)
|
|
876
1042
|
]),
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1043
|
+
n("p", null, [
|
|
1044
|
+
dt(ct(R(te), {
|
|
1045
|
+
class: "op-icon",
|
|
1046
|
+
onClick: I
|
|
1047
|
+
}, null, 512), [
|
|
1048
|
+
[pt, $.value]
|
|
1049
|
+
]),
|
|
1050
|
+
n("img", {
|
|
1051
|
+
onClick: E[1] || (E[1] = (G) => i.value = !i.value),
|
|
1052
|
+
src: i.value ? R(Jt) : R(Zt)
|
|
1053
|
+
}, null, 8, bn),
|
|
1054
|
+
n("img", {
|
|
1055
|
+
onClick: E[2] || (E[2] = (G) => l.value = !1),
|
|
1056
|
+
src: R(xt)
|
|
1057
|
+
}, null, 8, Tn)
|
|
891
1058
|
])
|
|
892
1059
|
]),
|
|
893
|
-
|
|
1060
|
+
s.value === "answer" ? (g(), et(Qe, {
|
|
894
1061
|
key: 0,
|
|
895
1062
|
ref_key: "answerRef",
|
|
896
|
-
ref:
|
|
897
|
-
defaultSayhello: R(
|
|
898
|
-
defaultRecommend: R(
|
|
899
|
-
}, null, 8, ["defaultSayhello", "defaultRecommend"])) :
|
|
900
|
-
|
|
1063
|
+
ref: L,
|
|
1064
|
+
defaultSayhello: R(o).defaultSayhello,
|
|
1065
|
+
defaultRecommend: R(o).defaultRecommend
|
|
1066
|
+
}, null, 8, ["defaultSayhello", "defaultRecommend"])) : X("", !0),
|
|
1067
|
+
s.value === "history" ? (g(), et(ln, {
|
|
901
1068
|
key: 1,
|
|
902
|
-
onHistoryDetail:
|
|
903
|
-
onNewAnswer:
|
|
904
|
-
})) :
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
"onUpdate:modelValue":
|
|
1069
|
+
onHistoryDetail: K,
|
|
1070
|
+
onNewAnswer: E[3] || (E[3] = (G) => s.value = "answer")
|
|
1071
|
+
})) : X("", !0),
|
|
1072
|
+
s.value === "info" ? (g(), et(Cn, { key: 2 })) : X("", !0),
|
|
1073
|
+
dt(n("div", An, [
|
|
1074
|
+
n("div", En, [
|
|
1075
|
+
n("div", Mn, [
|
|
1076
|
+
E[7] || (E[7] = n("p", { class: "title" }, "修改标题", -1)),
|
|
1077
|
+
dt(n("textarea", {
|
|
1078
|
+
"onUpdate:modelValue": E[4] || (E[4] = (G) => c.value = G),
|
|
912
1079
|
placeholder: "请输入新标题"
|
|
913
1080
|
}, null, 512), [
|
|
914
|
-
[
|
|
1081
|
+
[Et, c.value]
|
|
915
1082
|
]),
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
onClick:
|
|
1083
|
+
n("p", Rn, [
|
|
1084
|
+
n("span", {
|
|
1085
|
+
onClick: E[5] || (E[5] = (G) => m.value = !1)
|
|
919
1086
|
}, "取消"),
|
|
920
|
-
|
|
1087
|
+
n("span", { onClick: vt }, "确定")
|
|
921
1088
|
])
|
|
922
1089
|
])
|
|
923
1090
|
])
|
|
924
1091
|
], 512), [
|
|
925
|
-
[
|
|
1092
|
+
[pt, m.value]
|
|
926
1093
|
])
|
|
927
|
-
], 2)) :
|
|
928
|
-
|
|
1094
|
+
], 2)) : X("", !0),
|
|
1095
|
+
l.value ? X("", !0) : (g(), p("div", {
|
|
929
1096
|
key: 1,
|
|
930
|
-
class:
|
|
931
|
-
style:
|
|
932
|
-
onMousedown:
|
|
933
|
-
onTouchstart:
|
|
934
|
-
onClick:
|
|
1097
|
+
class: z(["character", { dragging: v.value, recycling: r.value }]),
|
|
1098
|
+
style: Mt(C.value),
|
|
1099
|
+
onMousedown: M,
|
|
1100
|
+
onTouchstart: M,
|
|
1101
|
+
onClick: H
|
|
935
1102
|
}, [
|
|
936
|
-
|
|
1103
|
+
n("img", { src: R(Ut) }, null, 8, Dn)
|
|
937
1104
|
], 38))
|
|
938
1105
|
]));
|
|
939
1106
|
}
|
|
940
1107
|
});
|
|
941
|
-
let
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
},
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
},
|
|
948
|
-
|
|
949
|
-
const
|
|
950
|
-
|
|
951
|
-
},
|
|
952
|
-
install(
|
|
953
|
-
|
|
1108
|
+
let nt = null;
|
|
1109
|
+
const Wn = (t) => {
|
|
1110
|
+
Ct(t);
|
|
1111
|
+
}, Xn = (t) => {
|
|
1112
|
+
const a = t || document.body, o = document.createElement("div");
|
|
1113
|
+
o.id = "ai-assist-root", a.appendChild(o), nt = Rt($t), nt.mount(o);
|
|
1114
|
+
}, Gn = () => {
|
|
1115
|
+
nt && (nt.unmount(), nt = null);
|
|
1116
|
+
const t = document.getElementById("ai-assist-root");
|
|
1117
|
+
t && t.remove();
|
|
1118
|
+
}, Vn = {
|
|
1119
|
+
install(t, a) {
|
|
1120
|
+
Ct(a), t.component("AiAssist", $t);
|
|
954
1121
|
}
|
|
955
1122
|
};
|
|
956
1123
|
export {
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1124
|
+
$t as AiAssist,
|
|
1125
|
+
Vn as default,
|
|
1126
|
+
Wn as initAiAssist,
|
|
1127
|
+
Xn as mountAiAssist,
|
|
1128
|
+
Gn as unmountAiAssist
|
|
962
1129
|
};
|