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