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