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