super-agent-sdk 1.0.9 → 1.0.11
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/README.md +170 -6
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +40 -0
- package/dist/index.mjs +204 -170
- package/dist/{mammoth.browser-DiAPPO3x.cjs → mammoth.browser-BX8glWVC.cjs} +24 -24
- package/dist/{mammoth.browser-COPV53yV.js → mammoth.browser-Czw2m8xL.js} +133 -139
- package/dist/nosUploader-C94D61NK.js +4712 -0
- package/dist/nosUploader-KkzFK5EW.cjs +13 -0
- package/dist/widget.cjs +52 -28
- package/dist/widget.d.ts +126 -8
- package/dist/widget.mjs +1678 -1401
- package/package.json +5 -1
package/dist/widget.mjs
CHANGED
|
@@ -1,299 +1,304 @@
|
|
|
1
|
-
import Q, { useState as
|
|
2
|
-
import { createRoot as
|
|
3
|
-
import { jsx as e, jsxs as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import Q, { useState as _, useRef as F, useCallback as T, useEffect as Y, createContext as Ve, useMemo as re, useContext as qe, isValidElement as Ze, cloneElement as Je, createElement as Qe } from "react";
|
|
2
|
+
import { createRoot as et } from "react-dom/client";
|
|
3
|
+
import { jsx as e, jsxs as p, Fragment as V } from "react/jsx-runtime";
|
|
4
|
+
import { c as tt } from "./nosUploader-C94D61NK.js";
|
|
5
|
+
function at(t) {
|
|
6
|
+
const { sdk: a, sessionId: n, onSessionCreated: s, onStreamStart: r, onStreamEnd: i, onError: l, onMessageSend: d } = t, [o, c] = _([]), [g, f] = _("ready"), [y, b] = _(null), M = F(null), m = F(!1), I = F(null), h = F(n), v = F(!0);
|
|
7
|
+
h.current = n, v.current = o.length === 0;
|
|
8
|
+
const z = T((w, D) => {
|
|
9
|
+
if (m.current) return;
|
|
10
|
+
m.current = !0, d == null || d(w);
|
|
11
|
+
const P = {
|
|
11
12
|
id: `user_${Date.now()}`,
|
|
12
13
|
role: "user",
|
|
13
|
-
parts: [
|
|
14
|
+
parts: [
|
|
15
|
+
...(D ?? []).map((N) => ({ type: "attachment", attachment: N })),
|
|
16
|
+
{ type: "text", content: w }
|
|
17
|
+
],
|
|
14
18
|
timestamp: Date.now()
|
|
15
|
-
},
|
|
16
|
-
id:
|
|
19
|
+
}, u = `assistant_${Date.now()}`, S = {
|
|
20
|
+
id: u,
|
|
17
21
|
role: "assistant",
|
|
18
22
|
parts: [],
|
|
19
23
|
timestamp: Date.now()
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
|
|
24
|
+
}, H = v.current;
|
|
25
|
+
c((N) => [...N, P, S]), f("submitted"), b(null);
|
|
26
|
+
const O = (N) => {
|
|
27
|
+
let x = "", L = "", k = [], R = !1;
|
|
28
|
+
const j = () => {
|
|
29
|
+
const C = [...k];
|
|
30
|
+
if (x) {
|
|
31
|
+
const W = C.findIndex((G) => G.type === "thinking");
|
|
32
|
+
W >= 0 ? C[W] = { type: "thinking", content: x } : C.unshift({ type: "thinking", content: x });
|
|
29
33
|
}
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
(
|
|
34
|
+
if (L) {
|
|
35
|
+
const W = C[C.length - 1];
|
|
36
|
+
(W == null ? void 0 : W.type) === "text" ? C[C.length - 1] = { type: "text", content: L } : C.push({ type: "text", content: L });
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
(
|
|
38
|
+
c(
|
|
39
|
+
(W) => W.map((G) => G.id === u ? { ...G, parts: C } : G)
|
|
36
40
|
);
|
|
37
41
|
};
|
|
38
|
-
|
|
39
|
-
sessionId:
|
|
42
|
+
M.current = a.chat({
|
|
43
|
+
sessionId: N,
|
|
40
44
|
message: w,
|
|
45
|
+
attachments: D && D.length > 0 ? D : void 0,
|
|
41
46
|
stream: !0,
|
|
42
|
-
onMessage: (
|
|
43
|
-
switch (
|
|
47
|
+
onMessage: (C) => {
|
|
48
|
+
switch (R || (R = !0, f("streaming")), C.type) {
|
|
44
49
|
case "thinking":
|
|
45
|
-
|
|
50
|
+
x += C.content;
|
|
46
51
|
break;
|
|
47
52
|
case "ai":
|
|
48
|
-
|
|
53
|
+
L += C.content;
|
|
49
54
|
break;
|
|
50
55
|
case "tool_call":
|
|
51
|
-
|
|
56
|
+
L && (k.push({ type: "text", content: L }), L = ""), k.push({
|
|
52
57
|
type: "tool_call",
|
|
53
|
-
toolName:
|
|
54
|
-
toolCallId:
|
|
55
|
-
args:
|
|
58
|
+
toolName: C.toolName,
|
|
59
|
+
toolCallId: C.toolCallId,
|
|
60
|
+
args: C.args ?? "{}"
|
|
56
61
|
});
|
|
57
62
|
break;
|
|
58
63
|
case "tool_result":
|
|
59
|
-
|
|
64
|
+
L && (k.push({ type: "text", content: L }), L = ""), k.push({
|
|
60
65
|
type: "tool_result",
|
|
61
|
-
toolName:
|
|
62
|
-
toolCallId:
|
|
63
|
-
content:
|
|
64
|
-
artifacts:
|
|
65
|
-
renderMode:
|
|
66
|
-
html:
|
|
66
|
+
toolName: C.toolName ?? "",
|
|
67
|
+
toolCallId: C.toolCallId,
|
|
68
|
+
content: C.content,
|
|
69
|
+
artifacts: C.artifacts,
|
|
70
|
+
renderMode: C.renderMode,
|
|
71
|
+
html: C.html
|
|
67
72
|
});
|
|
68
73
|
break;
|
|
69
74
|
case "interrupt":
|
|
70
|
-
|
|
75
|
+
L && (k.push({ type: "text", content: L }), L = ""), C.interrupt && k.push({
|
|
71
76
|
type: "interrupt",
|
|
72
|
-
interrupt:
|
|
77
|
+
interrupt: C.interrupt,
|
|
73
78
|
resolved: !1
|
|
74
79
|
});
|
|
75
80
|
break;
|
|
76
81
|
case "stop":
|
|
77
|
-
|
|
82
|
+
C.content && (L = C.content), j();
|
|
78
83
|
return;
|
|
79
84
|
}
|
|
80
|
-
|
|
85
|
+
j();
|
|
81
86
|
},
|
|
82
|
-
onDone: (
|
|
83
|
-
(
|
|
84
|
-
const
|
|
85
|
-
|
|
87
|
+
onDone: (C) => {
|
|
88
|
+
(L || k.length > 0 || x) && j(), C.sessionId && C.sessionId !== h.current && (s == null || s(C.sessionId));
|
|
89
|
+
const W = () => {
|
|
90
|
+
I.current && (clearTimeout(I.current), I.current = null), i == null || i(C.sessionId || N), f("ready"), m.current = !1, M.current = null;
|
|
86
91
|
};
|
|
87
|
-
if (
|
|
88
|
-
const
|
|
89
|
-
a.renameConversation(
|
|
90
|
-
}).finally(
|
|
92
|
+
if (H) {
|
|
93
|
+
const G = w.slice(0, 30), ne = C.sessionId || N;
|
|
94
|
+
a.renameConversation(ne, G).catch(() => {
|
|
95
|
+
}).finally(W);
|
|
91
96
|
} else
|
|
92
|
-
|
|
97
|
+
W();
|
|
93
98
|
},
|
|
94
|
-
onError: (
|
|
95
|
-
|
|
99
|
+
onError: (C) => {
|
|
100
|
+
k.push({ type: "error", content: C.message }), j(), I.current && (clearTimeout(I.current), I.current = null), b(C), f("error"), l == null || l(C), m.current = !1, M.current = null;
|
|
96
101
|
}
|
|
97
|
-
}), r == null || r(
|
|
102
|
+
}), r == null || r(N);
|
|
98
103
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}).catch((
|
|
102
|
-
|
|
104
|
+
h.current ? O(h.current) : a.createSession().then((N) => {
|
|
105
|
+
h.current = N, s == null || s(N), O(N);
|
|
106
|
+
}).catch((N) => {
|
|
107
|
+
b(N instanceof Error ? N : new Error(String(N))), f("error"), l == null || l(N instanceof Error ? N : new Error(String(N))), m.current = !1;
|
|
103
108
|
});
|
|
104
|
-
}, [a, s, r, i,
|
|
105
|
-
const w =
|
|
106
|
-
w && (
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
+
}, [a, s, r, i, l, d]), E = T(() => {
|
|
110
|
+
const w = h.current;
|
|
111
|
+
w && (I.current && clearTimeout(I.current), I.current = setTimeout(() => {
|
|
112
|
+
var D;
|
|
113
|
+
I.current = null, (D = M.current) == null || D.abort(), M.current = null, m.current = !1, f("ready");
|
|
109
114
|
}, 8e3), a.stopGeneration(w).catch(() => {
|
|
110
115
|
}));
|
|
111
|
-
}, [a]),
|
|
112
|
-
if (
|
|
113
|
-
const w =
|
|
116
|
+
}, [a]), $ = T(() => {
|
|
117
|
+
if (m.current) return;
|
|
118
|
+
const w = o.findLastIndex((u) => u.role === "user");
|
|
114
119
|
if (w < 0) return;
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
}, [
|
|
118
|
-
|
|
119
|
-
(
|
|
120
|
-
...
|
|
121
|
-
parts:
|
|
122
|
-
(
|
|
120
|
+
const D = o[w].parts.filter((u) => u.type === "text").map((u) => u.content).join(""), P = o[w].parts.filter((u) => u.type === "attachment").map((u) => u.attachment);
|
|
121
|
+
c((u) => u.slice(0, w)), z(D, P.length > 0 ? P : void 0);
|
|
122
|
+
}, [o, z]), A = T((w, D) => {
|
|
123
|
+
c(
|
|
124
|
+
(x) => x.map((L) => ({
|
|
125
|
+
...L,
|
|
126
|
+
parts: L.parts.map(
|
|
127
|
+
(k) => k.type === "interrupt" && k.interrupt.interruptId === w ? { ...k, resolved: !0, response: D } : k
|
|
123
128
|
)
|
|
124
129
|
}))
|
|
125
130
|
);
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
let
|
|
129
|
-
|
|
130
|
-
let
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
|
|
131
|
+
const P = h.current;
|
|
132
|
+
if (!P) return;
|
|
133
|
+
let u = 0;
|
|
134
|
+
c((x) => x.length > 0 && x[x.length - 1].role === "assistant" ? (u = x[x.length - 1].parts.length, x) : (u = 0, [...x, { id: `assistant_${Date.now()}`, role: "assistant", parts: [], timestamp: Date.now() }])), f("streaming");
|
|
135
|
+
let S = "", H = "", O = [];
|
|
136
|
+
const N = () => {
|
|
137
|
+
const x = [...O];
|
|
138
|
+
if (S) {
|
|
139
|
+
const L = x.findIndex((k) => k.type === "thinking");
|
|
140
|
+
L >= 0 ? x[L] = { type: "thinking", content: S } : x.unshift({ type: "thinking", content: S });
|
|
136
141
|
}
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
139
|
-
(
|
|
142
|
+
if (H) {
|
|
143
|
+
const L = x[x.length - 1];
|
|
144
|
+
(L == null ? void 0 : L.type) === "text" ? x[x.length - 1] = { type: "text", content: H } : x.push({ type: "text", content: H });
|
|
140
145
|
}
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
return
|
|
144
|
-
(
|
|
146
|
+
c((L) => {
|
|
147
|
+
const k = L.findLastIndex((R) => R.role === "assistant");
|
|
148
|
+
return k < 0 ? L : L.map(
|
|
149
|
+
(R, j) => j === k ? { ...R, parts: [...R.parts.slice(0, u), ...x] } : R
|
|
145
150
|
);
|
|
146
151
|
});
|
|
147
152
|
};
|
|
148
153
|
a.respondInterrupt(
|
|
149
154
|
w,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
(
|
|
153
|
-
switch (
|
|
155
|
+
P,
|
|
156
|
+
D,
|
|
157
|
+
(x) => {
|
|
158
|
+
switch (x.type) {
|
|
154
159
|
case "thinking":
|
|
155
|
-
|
|
160
|
+
S += x.content;
|
|
156
161
|
break;
|
|
157
162
|
case "ai":
|
|
158
|
-
|
|
163
|
+
H += x.content;
|
|
159
164
|
break;
|
|
160
165
|
case "tool_call":
|
|
161
|
-
|
|
166
|
+
H && (O.push({ type: "text", content: H }), H = ""), O.push({
|
|
162
167
|
type: "tool_call",
|
|
163
|
-
toolName:
|
|
164
|
-
toolCallId:
|
|
165
|
-
args:
|
|
168
|
+
toolName: x.toolName,
|
|
169
|
+
toolCallId: x.toolCallId,
|
|
170
|
+
args: x.args ?? "{}"
|
|
166
171
|
});
|
|
167
172
|
break;
|
|
168
173
|
case "tool_result":
|
|
169
|
-
|
|
174
|
+
H && (O.push({ type: "text", content: H }), H = ""), O.push({
|
|
170
175
|
type: "tool_result",
|
|
171
|
-
toolName:
|
|
172
|
-
toolCallId:
|
|
173
|
-
content:
|
|
174
|
-
artifacts:
|
|
175
|
-
renderMode:
|
|
176
|
-
html:
|
|
176
|
+
toolName: x.toolName ?? "",
|
|
177
|
+
toolCallId: x.toolCallId,
|
|
178
|
+
content: x.content,
|
|
179
|
+
artifacts: x.artifacts,
|
|
180
|
+
renderMode: x.renderMode,
|
|
181
|
+
html: x.html
|
|
177
182
|
});
|
|
178
183
|
break;
|
|
179
184
|
case "interrupt":
|
|
180
|
-
|
|
185
|
+
H && (O.push({ type: "text", content: H }), H = ""), x.interrupt && O.push({ type: "interrupt", interrupt: x.interrupt, resolved: !1 });
|
|
181
186
|
break;
|
|
182
187
|
case "done":
|
|
183
|
-
i == null || i(
|
|
188
|
+
i == null || i(P), f("ready");
|
|
184
189
|
break;
|
|
185
190
|
}
|
|
186
|
-
|
|
191
|
+
N();
|
|
187
192
|
},
|
|
188
|
-
(
|
|
189
|
-
|
|
193
|
+
(x) => {
|
|
194
|
+
O.push({ type: "error", content: x.message }), N(), b(x), f("error"), l == null || l(x);
|
|
190
195
|
}
|
|
191
|
-
).catch((
|
|
192
|
-
|
|
196
|
+
).catch((x) => {
|
|
197
|
+
l == null || l(x instanceof Error ? x : new Error(String(x))), f("error");
|
|
193
198
|
});
|
|
194
|
-
}, [a,
|
|
195
|
-
return { messages:
|
|
199
|
+
}, [a, l, i]);
|
|
200
|
+
return { messages: o, status: g, error: y, sendMessage: z, stop: E, regenerate: $, setMessages: c, respondToInterrupt: A };
|
|
196
201
|
}
|
|
197
|
-
const
|
|
198
|
-
function
|
|
202
|
+
const $e = "sa_active_conversation", ge = 20;
|
|
203
|
+
function ze(t) {
|
|
199
204
|
try {
|
|
200
|
-
return localStorage.getItem(`${
|
|
205
|
+
return localStorage.getItem(`${$e}_${t}`);
|
|
201
206
|
} catch {
|
|
202
207
|
return null;
|
|
203
208
|
}
|
|
204
209
|
}
|
|
205
|
-
function
|
|
210
|
+
function rt(t, a) {
|
|
206
211
|
try {
|
|
207
|
-
const n = `${
|
|
212
|
+
const n = `${$e}_${t}`;
|
|
208
213
|
a ? localStorage.setItem(n, a) : localStorage.removeItem(n);
|
|
209
214
|
} catch {
|
|
210
215
|
}
|
|
211
216
|
}
|
|
212
|
-
function
|
|
213
|
-
const { sdk: a, onConversationChange: n } = t, s = a.botId, [r, i] =
|
|
214
|
-
() =>
|
|
215
|
-
), [
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
function nt(t) {
|
|
218
|
+
const { sdk: a, onConversationChange: n } = t, s = a.botId, [r, i] = _([]), [l, d] = _(
|
|
219
|
+
() => ze(s)
|
|
220
|
+
), [o, c] = _(!1), [g, f] = _(!0), y = F(!0), b = F(1), M = F(!1);
|
|
221
|
+
Y(() => () => {
|
|
222
|
+
y.current = !1;
|
|
218
223
|
}, []);
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
}, [s, n]),
|
|
222
|
-
if (!
|
|
223
|
-
|
|
224
|
+
const m = T((w) => {
|
|
225
|
+
d(w), rt(s, w), w && (n == null || n(w));
|
|
226
|
+
}, [s, n]), I = T(async () => {
|
|
227
|
+
if (!M.current) {
|
|
228
|
+
M.current = !0, c(!0);
|
|
224
229
|
try {
|
|
225
|
-
|
|
226
|
-
const w = await a.listConversations({ page: 1, size:
|
|
227
|
-
if (!
|
|
228
|
-
i(w.items),
|
|
229
|
-
const
|
|
230
|
-
|
|
230
|
+
b.current = 1;
|
|
231
|
+
const w = await a.listConversations({ page: 1, size: ge });
|
|
232
|
+
if (!y.current) return;
|
|
233
|
+
i(w.items), f(w.items.length < w.total);
|
|
234
|
+
const D = ze(s);
|
|
235
|
+
D && !w.items.find((P) => P.sessionId === D) && m(null);
|
|
231
236
|
} catch {
|
|
232
237
|
} finally {
|
|
233
|
-
|
|
238
|
+
M.current = !1, y.current && c(!1);
|
|
234
239
|
}
|
|
235
240
|
}
|
|
236
|
-
}, [a,
|
|
237
|
-
if (!(
|
|
238
|
-
|
|
241
|
+
}, [a, m]), h = T(async () => {
|
|
242
|
+
if (!(M.current || !g)) {
|
|
243
|
+
M.current = !0, c(!0);
|
|
239
244
|
try {
|
|
240
|
-
const w =
|
|
241
|
-
if (!
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
return [...
|
|
245
|
+
const w = b.current + 1, D = await a.listConversations({ page: w, size: ge });
|
|
246
|
+
if (!y.current) return;
|
|
247
|
+
b.current = w, i((u) => {
|
|
248
|
+
const S = new Set(u.map((O) => O.sessionId)), H = D.items.filter((O) => !S.has(O.sessionId));
|
|
249
|
+
return [...u, ...H];
|
|
245
250
|
});
|
|
246
|
-
const
|
|
247
|
-
|
|
251
|
+
const P = b.current * ge;
|
|
252
|
+
f(P < D.total);
|
|
248
253
|
} catch {
|
|
249
254
|
} finally {
|
|
250
|
-
|
|
255
|
+
M.current = !1, y.current && c(!1);
|
|
251
256
|
}
|
|
252
257
|
}
|
|
253
|
-
}, [a,
|
|
258
|
+
}, [a, g]), v = T(async (w) => (m(w), await a.getMessages(w)), [a, m]), z = T(async () => {
|
|
254
259
|
try {
|
|
255
|
-
const w = await a.createSession(),
|
|
256
|
-
i((
|
|
257
|
-
{ sessionId: w, botId: 0, title: "新对话", createTime:
|
|
258
|
-
|
|
259
|
-
]),
|
|
260
|
+
const w = await a.createSession(), D = (/* @__PURE__ */ new Date()).toISOString();
|
|
261
|
+
i((P) => [
|
|
262
|
+
{ sessionId: w, botId: 0, title: "新对话", createTime: D, updateTime: D },
|
|
263
|
+
...P
|
|
264
|
+
]), m(w);
|
|
260
265
|
} catch {
|
|
261
|
-
|
|
266
|
+
m(null);
|
|
262
267
|
}
|
|
263
|
-
}, [a,
|
|
264
|
-
i((
|
|
268
|
+
}, [a, m]), E = T(async (w) => {
|
|
269
|
+
i((D) => D.filter((P) => P.sessionId !== w)), l === w && m(null);
|
|
265
270
|
try {
|
|
266
271
|
await a.deleteConversation(w);
|
|
267
272
|
} catch {
|
|
268
273
|
}
|
|
269
|
-
}, [a,
|
|
270
|
-
await a.renameConversation(w,
|
|
271
|
-
(
|
|
274
|
+
}, [a, l, m]), $ = T(async (w, D) => {
|
|
275
|
+
await a.renameConversation(w, D), i(
|
|
276
|
+
(P) => P.map((u) => u.sessionId === w ? { ...u, title: D } : u)
|
|
272
277
|
);
|
|
273
|
-
}, [a]), { enabled:
|
|
274
|
-
return
|
|
275
|
-
|
|
276
|
-
}, [
|
|
278
|
+
}, [a]), { enabled: A = !0 } = t;
|
|
279
|
+
return Y(() => {
|
|
280
|
+
A && I();
|
|
281
|
+
}, [A, I]), {
|
|
277
282
|
conversations: r,
|
|
278
|
-
activeConversationId:
|
|
279
|
-
loading:
|
|
280
|
-
hasMore:
|
|
281
|
-
loadConversations:
|
|
282
|
-
loadMore:
|
|
283
|
-
switchConversation:
|
|
284
|
-
newConversation:
|
|
285
|
-
deleteConversation:
|
|
286
|
-
renameConversation:
|
|
287
|
-
setActiveConversationId:
|
|
283
|
+
activeConversationId: l,
|
|
284
|
+
loading: o,
|
|
285
|
+
hasMore: g,
|
|
286
|
+
loadConversations: I,
|
|
287
|
+
loadMore: h,
|
|
288
|
+
switchConversation: v,
|
|
289
|
+
newConversation: z,
|
|
290
|
+
deleteConversation: E,
|
|
291
|
+
renameConversation: $,
|
|
292
|
+
setActiveConversationId: m
|
|
288
293
|
};
|
|
289
294
|
}
|
|
290
|
-
function
|
|
295
|
+
function De(t) {
|
|
291
296
|
return !t && t !== 0 ? "" : t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / 1024 / 1024).toFixed(1)} MB`;
|
|
292
297
|
}
|
|
293
|
-
function
|
|
298
|
+
function Le(t) {
|
|
294
299
|
return t === "pdf" ? "PDF" : t === "docx" ? "DOC" : t === "html" ? "HTM" : t.slice(0, 3).toUpperCase() || "FILE";
|
|
295
300
|
}
|
|
296
|
-
function
|
|
301
|
+
function _e(t) {
|
|
297
302
|
if (!t) return [];
|
|
298
303
|
const a = [];
|
|
299
304
|
for (const n of t)
|
|
@@ -308,7 +313,7 @@ function Se(t) {
|
|
|
308
313
|
});
|
|
309
314
|
return a;
|
|
310
315
|
}
|
|
311
|
-
async function
|
|
316
|
+
async function ce(t) {
|
|
312
317
|
try {
|
|
313
318
|
const a = await fetch(t.url);
|
|
314
319
|
if (!a.ok) throw new Error(`HTTP ${a.status}`);
|
|
@@ -319,187 +324,203 @@ async function ie(t) {
|
|
|
319
324
|
a.href = t.url, a.download = t.filename, a.target = "_blank", document.body.appendChild(a), a.click(), a.remove();
|
|
320
325
|
}
|
|
321
326
|
}
|
|
322
|
-
const
|
|
323
|
-
function
|
|
324
|
-
const t =
|
|
327
|
+
const Re = Ve(null);
|
|
328
|
+
function J() {
|
|
329
|
+
const t = qe(Re);
|
|
325
330
|
if (!t) throw new Error("useChatContext must be used within ChatProvider");
|
|
326
331
|
return t;
|
|
327
332
|
}
|
|
328
|
-
function
|
|
329
|
-
const [
|
|
330
|
-
|
|
333
|
+
function Te({ sdk: t, hooks: a, attachmentUploader: n, nosUpload: s, children: r }) {
|
|
334
|
+
const [i, l] = _(!1), [d, o] = _(!1), [c, g] = _(null), [f, y] = _(null), [b, M] = _(!1), [m, I] = _(!1);
|
|
335
|
+
Y(() => {
|
|
331
336
|
t.getToken().then(() => {
|
|
332
|
-
|
|
337
|
+
M(!0);
|
|
333
338
|
}).catch(() => {
|
|
334
|
-
|
|
339
|
+
M(!0);
|
|
335
340
|
});
|
|
336
341
|
}, [t]);
|
|
337
|
-
const
|
|
342
|
+
const h = nt({
|
|
338
343
|
sdk: t,
|
|
339
344
|
onConversationChange: a == null ? void 0 : a.onConversationChange,
|
|
340
|
-
enabled:
|
|
341
|
-
}),
|
|
345
|
+
enabled: b
|
|
346
|
+
}), v = at({
|
|
342
347
|
sdk: t,
|
|
343
|
-
sessionId:
|
|
344
|
-
onSessionCreated: (
|
|
345
|
-
|
|
348
|
+
sessionId: h.activeConversationId,
|
|
349
|
+
onSessionCreated: (k) => {
|
|
350
|
+
h.setActiveConversationId(k);
|
|
346
351
|
},
|
|
347
352
|
onStreamStart: a == null ? void 0 : a.onStreamStart,
|
|
348
|
-
onStreamEnd: (
|
|
349
|
-
var
|
|
350
|
-
(
|
|
353
|
+
onStreamEnd: (k) => {
|
|
354
|
+
var R;
|
|
355
|
+
(R = a == null ? void 0 : a.onStreamEnd) == null || R.call(a, k), h.loadConversations();
|
|
351
356
|
},
|
|
352
357
|
onError: a == null ? void 0 : a.onError,
|
|
353
358
|
onMessageSend: a == null ? void 0 : a.onMessageSend
|
|
354
|
-
}),
|
|
355
|
-
|
|
359
|
+
}), z = T((k) => {
|
|
360
|
+
if (k.type === "link") {
|
|
361
|
+
window.open(k.url, k.target ?? "_blank", "noopener");
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
y(k);
|
|
365
|
+
}, []), E = T(() => y(null), []), $ = T(async (k) => {
|
|
366
|
+
I(!0);
|
|
356
367
|
try {
|
|
357
|
-
const
|
|
358
|
-
|
|
368
|
+
const R = await h.switchConversation(k);
|
|
369
|
+
v.setMessages(R);
|
|
359
370
|
} finally {
|
|
360
|
-
|
|
371
|
+
I(!1);
|
|
361
372
|
}
|
|
362
|
-
}, [
|
|
363
|
-
|
|
364
|
-
}, [
|
|
365
|
-
|
|
366
|
-
}, [
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
373
|
+
}, [h, v]), A = T(async () => {
|
|
374
|
+
v.setMessages([]), await h.newConversation();
|
|
375
|
+
}, [h, v]), w = T(async (k) => {
|
|
376
|
+
h.activeConversationId === k && v.setMessages([]), await h.deleteConversation(k);
|
|
377
|
+
}, [h, v]);
|
|
378
|
+
Y(() => {
|
|
379
|
+
h.activeConversationId && v.messages.length === 0 && (I(!0), t.getMessages(h.activeConversationId).then((k) => {
|
|
380
|
+
v.setMessages(k);
|
|
370
381
|
}).catch(() => {
|
|
371
|
-
}).finally(() =>
|
|
382
|
+
}).finally(() => I(!1)));
|
|
372
383
|
}, []);
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
}, []),
|
|
376
|
-
|
|
377
|
-
}, []),
|
|
378
|
-
o((
|
|
379
|
-
}, []), S =
|
|
380
|
-
|
|
381
|
-
}, []),
|
|
382
|
-
const
|
|
383
|
-
for (const
|
|
384
|
-
for (const
|
|
385
|
-
if (
|
|
386
|
-
for (const
|
|
387
|
-
const
|
|
388
|
-
|
|
384
|
+
const D = T(() => {
|
|
385
|
+
l((k) => !k);
|
|
386
|
+
}, []), P = T((k) => {
|
|
387
|
+
l(k);
|
|
388
|
+
}, []), u = T(() => {
|
|
389
|
+
o((k) => !k), g((k) => null);
|
|
390
|
+
}, []), S = T((k) => {
|
|
391
|
+
g(k), o(!0);
|
|
392
|
+
}, []), H = re(() => {
|
|
393
|
+
const k = /* @__PURE__ */ new Set(), R = [];
|
|
394
|
+
for (const j of v.messages)
|
|
395
|
+
for (const C of j.parts)
|
|
396
|
+
if (C.type === "tool_result" && C.artifacts)
|
|
397
|
+
for (const W of _e(C.artifacts)) {
|
|
398
|
+
const G = W.id || `${W.url}:${W.filename}`;
|
|
399
|
+
k.has(G) || (k.add(G), R.push(W));
|
|
389
400
|
}
|
|
390
|
-
return
|
|
391
|
-
}, [
|
|
392
|
-
const
|
|
393
|
-
if (!
|
|
401
|
+
return R;
|
|
402
|
+
}, [v.messages]), O = T(async () => {
|
|
403
|
+
const k = h.activeConversationId;
|
|
404
|
+
if (!k) return null;
|
|
394
405
|
try {
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
return (
|
|
406
|
+
const R = await t.getMessages(k);
|
|
407
|
+
v.setMessages(R);
|
|
408
|
+
const j = R.findLast((C) => C.role === "assistant");
|
|
409
|
+
return (j == null ? void 0 : j.id) ?? null;
|
|
399
410
|
} catch {
|
|
400
411
|
return null;
|
|
401
412
|
}
|
|
402
|
-
}, [t,
|
|
403
|
-
if (/^\d+$/.test(
|
|
404
|
-
t.feedback(
|
|
413
|
+
}, [t, h.activeConversationId, v]), N = T((k, R, j) => {
|
|
414
|
+
if (/^\d+$/.test(k)) {
|
|
415
|
+
t.feedback(k, R, j).catch(() => {
|
|
405
416
|
});
|
|
406
417
|
return;
|
|
407
418
|
}
|
|
408
|
-
|
|
409
|
-
|
|
419
|
+
O().then((C) => {
|
|
420
|
+
C && t.feedback(C, R, j).catch(() => {
|
|
410
421
|
});
|
|
411
422
|
});
|
|
412
|
-
}, [t,
|
|
413
|
-
if (/^\d+$/.test(
|
|
414
|
-
t.cancelFeedback(
|
|
423
|
+
}, [t, O]), x = T((k) => {
|
|
424
|
+
if (/^\d+$/.test(k)) {
|
|
425
|
+
t.cancelFeedback(k).catch(() => {
|
|
415
426
|
});
|
|
416
427
|
return;
|
|
417
428
|
}
|
|
418
|
-
|
|
419
|
-
|
|
429
|
+
O().then((R) => {
|
|
430
|
+
R && t.cancelFeedback(R).catch(() => {
|
|
420
431
|
});
|
|
421
432
|
});
|
|
422
|
-
}, [t,
|
|
433
|
+
}, [t, O]), L = re(() => ({
|
|
423
434
|
sdk: t,
|
|
424
|
-
status:
|
|
425
|
-
error:
|
|
426
|
-
messages:
|
|
427
|
-
conversations:
|
|
428
|
-
activeConversationId:
|
|
429
|
-
isThreadListOpen:
|
|
430
|
-
isArtifactDrawerOpen:
|
|
431
|
-
allArtifacts:
|
|
432
|
-
activePreviewArtifact:
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
435
|
+
status: v.status,
|
|
436
|
+
error: v.error,
|
|
437
|
+
messages: v.messages,
|
|
438
|
+
conversations: h.conversations,
|
|
439
|
+
activeConversationId: h.activeConversationId,
|
|
440
|
+
isThreadListOpen: i,
|
|
441
|
+
isArtifactDrawerOpen: d,
|
|
442
|
+
allArtifacts: H,
|
|
443
|
+
activePreviewArtifact: c,
|
|
444
|
+
activePanel: f,
|
|
445
|
+
hasMore: h.hasMore,
|
|
446
|
+
conversationsLoading: h.loading,
|
|
447
|
+
messagesLoading: m,
|
|
448
|
+
sendMessage: v.sendMessage,
|
|
449
|
+
attachmentUploader: n ?? null,
|
|
450
|
+
nosUpload: s ?? null,
|
|
451
|
+
stop: v.stop,
|
|
452
|
+
regenerate: v.regenerate,
|
|
453
|
+
switchConversation: $,
|
|
454
|
+
newConversation: A,
|
|
455
|
+
deleteConversation: w,
|
|
456
|
+
renameConversation: h.renameConversation,
|
|
457
|
+
loadMoreConversations: h.loadMore,
|
|
458
|
+
toggleThreadList: D,
|
|
459
|
+
setThreadListOpen: P,
|
|
460
|
+
toggleArtifactDrawer: u,
|
|
447
461
|
openArtifactPreview: S,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
462
|
+
openPanel: z,
|
|
463
|
+
closePanel: E,
|
|
464
|
+
feedback: N,
|
|
465
|
+
cancelFeedback: x,
|
|
466
|
+
respondToInterrupt: v.respondToInterrupt
|
|
451
467
|
}), [
|
|
452
468
|
t,
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
m.activeConversationId,
|
|
462
|
-
m.renameConversation,
|
|
463
|
-
m.hasMore,
|
|
464
|
-
m.loadMore,
|
|
465
|
-
m.loading,
|
|
469
|
+
v.status,
|
|
470
|
+
v.error,
|
|
471
|
+
v.messages,
|
|
472
|
+
v.sendMessage,
|
|
473
|
+
v.stop,
|
|
474
|
+
v.regenerate,
|
|
475
|
+
v.respondToInterrupt,
|
|
476
|
+
n,
|
|
466
477
|
s,
|
|
478
|
+
h.conversations,
|
|
479
|
+
h.activeConversationId,
|
|
480
|
+
h.renameConversation,
|
|
481
|
+
h.hasMore,
|
|
482
|
+
h.loadMore,
|
|
483
|
+
h.loading,
|
|
467
484
|
i,
|
|
468
|
-
|
|
469
|
-
l,
|
|
470
|
-
g,
|
|
471
|
-
f,
|
|
472
|
-
y,
|
|
473
|
-
z,
|
|
485
|
+
d,
|
|
474
486
|
H,
|
|
475
|
-
|
|
476
|
-
|
|
487
|
+
c,
|
|
488
|
+
f,
|
|
489
|
+
m,
|
|
490
|
+
$,
|
|
491
|
+
A,
|
|
492
|
+
w,
|
|
493
|
+
D,
|
|
494
|
+
P,
|
|
495
|
+
u,
|
|
477
496
|
S,
|
|
478
|
-
|
|
479
|
-
|
|
497
|
+
z,
|
|
498
|
+
E,
|
|
499
|
+
N,
|
|
500
|
+
x
|
|
480
501
|
]);
|
|
481
|
-
return /* @__PURE__ */ e(
|
|
482
|
-
}
|
|
483
|
-
const
|
|
484
|
-
recently: `${
|
|
485
|
-
home: `${
|
|
486
|
-
mergeWindow: `${
|
|
487
|
-
spiltWindow: `${
|
|
488
|
-
close: `${
|
|
489
|
-
message: `${
|
|
490
|
-
messageCreate: `${
|
|
491
|
-
customerService: `${
|
|
492
|
-
sendSolid: `${
|
|
502
|
+
return /* @__PURE__ */ e(Re.Provider, { value: L, children: r });
|
|
503
|
+
}
|
|
504
|
+
const U = "https://ehr-web.netease.com/ehr-web/erh-super-agent", K = {
|
|
505
|
+
recently: `${U}/recently.svg`,
|
|
506
|
+
home: `${U}/home.svg`,
|
|
507
|
+
mergeWindow: `${U}/merge_window.svg`,
|
|
508
|
+
spiltWindow: `${U}/spilt_window.svg`,
|
|
509
|
+
close: `${U}/close.svg`,
|
|
510
|
+
message: `${U}/message.svg`,
|
|
511
|
+
messageCreate: `${U}/message_create.svg`,
|
|
512
|
+
customerService: `${U}/customer_service.svg`,
|
|
513
|
+
sendSolid: `${U}/send_solid.svg`,
|
|
493
514
|
capabilityIcons: [
|
|
494
|
-
`${
|
|
495
|
-
`${
|
|
496
|
-
`${
|
|
515
|
+
`${U}/icon1.png`,
|
|
516
|
+
`${U}/icon2.png`,
|
|
517
|
+
`${U}/icon3.png`
|
|
497
518
|
],
|
|
498
|
-
triggerLogo: `${
|
|
499
|
-
logo: `${
|
|
500
|
-
assistantAvatarGenerating: `${
|
|
501
|
-
assistantAvatar: `${
|
|
502
|
-
},
|
|
519
|
+
triggerLogo: `${U}/HRlogo.png`,
|
|
520
|
+
logo: `${U}/HRlogo2.png`,
|
|
521
|
+
assistantAvatarGenerating: `${U}/profile0.gif`,
|
|
522
|
+
assistantAvatar: `${U}/profile1.png`
|
|
523
|
+
}, X = {
|
|
503
524
|
TRIGGER_SIZE: 56,
|
|
504
525
|
TRIGGER_RIGHT: 20,
|
|
505
526
|
TRIGGER_BOTTOM: 80,
|
|
@@ -510,123 +531,156 @@ const G = "https://ehr-web.netease.com/ehr-web/erh-super-agent", X = {
|
|
|
510
531
|
/** 高度上限占视口比例(渲染钳制与默认定位统一使用) */
|
|
511
532
|
MAX_HEIGHT_RATIO: 0.95
|
|
512
533
|
};
|
|
513
|
-
function
|
|
514
|
-
const [s, r] =
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
return window.addEventListener("resize",
|
|
518
|
-
}, []),
|
|
519
|
-
var
|
|
520
|
-
(
|
|
534
|
+
function st({ defaultWidth: t = X.DEFAULT_WIDTH, defaultHeight: a = X.DEFAULT_HEIGHT, sidebarWidth: n = 0 } = {}) {
|
|
535
|
+
const [s, r] = _(t), [i, l] = _({ x: 0, y: 0 }), [d, o] = _(!1), [c, g] = _(!1), [f, y] = _(null), [b, M] = _(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), m = F(!1), I = F(0), h = F(s), v = F(!1), z = F({ x: 0, y: 0 }), E = F({ x: 0, y: 0 }), $ = F(!1), A = F(null);
|
|
536
|
+
Y(() => {
|
|
537
|
+
const N = () => M({ width: window.innerWidth, height: window.innerHeight });
|
|
538
|
+
return window.addEventListener("resize", N), () => window.removeEventListener("resize", N);
|
|
539
|
+
}, []), Y(() => () => {
|
|
540
|
+
var N;
|
|
541
|
+
(N = A.current) == null || N.call(A);
|
|
521
542
|
}, []);
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
if (!
|
|
525
|
-
const
|
|
526
|
-
|
|
543
|
+
const w = Math.floor(b.height * X.MAX_HEIGHT_RATIO), D = Math.min(f || a, w), P = s + n;
|
|
544
|
+
Y(() => {
|
|
545
|
+
if (!d) {
|
|
546
|
+
const N = b.width - P - 20, x = b.height - D - 20;
|
|
547
|
+
l((L) => L.x === N && L.y === x ? L : { x: N, y: x });
|
|
527
548
|
}
|
|
528
|
-
}, [
|
|
529
|
-
const
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
if (!
|
|
534
|
-
const
|
|
535
|
-
(Math.abs(
|
|
536
|
-
x: Math.max(-200, Math.min(
|
|
537
|
-
y: Math.max(0, Math.min(
|
|
549
|
+
}, [d, P, D, b]);
|
|
550
|
+
const u = T((N) => {
|
|
551
|
+
if (c || N.target.closest("button, input, textarea")) return;
|
|
552
|
+
v.current = !0, $.current = !1, z.current = { x: N.clientX, y: N.clientY }, E.current = { ...i };
|
|
553
|
+
const x = (R) => {
|
|
554
|
+
if (!v.current) return;
|
|
555
|
+
const j = R.clientX - z.current.x, C = R.clientY - z.current.y;
|
|
556
|
+
(Math.abs(j) > 3 || Math.abs(C) > 3) && ($.current = !0), $.current && (o(!0), l({
|
|
557
|
+
x: Math.max(-200, Math.min(E.current.x + j, window.innerWidth - 100)),
|
|
558
|
+
y: Math.max(0, Math.min(E.current.y + C, window.innerHeight - 48))
|
|
538
559
|
}));
|
|
539
|
-
},
|
|
540
|
-
|
|
541
|
-
},
|
|
542
|
-
document.removeEventListener("mousemove",
|
|
560
|
+
}, L = () => {
|
|
561
|
+
v.current = !1, k();
|
|
562
|
+
}, k = () => {
|
|
563
|
+
document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", L), A.current = null;
|
|
543
564
|
};
|
|
544
|
-
document.addEventListener("mousemove",
|
|
545
|
-
}, [
|
|
546
|
-
|
|
547
|
-
const
|
|
548
|
-
if (!
|
|
549
|
-
const
|
|
550
|
-
let
|
|
551
|
-
if (
|
|
552
|
-
|
|
565
|
+
document.addEventListener("mousemove", x), document.addEventListener("mouseup", L), A.current = k;
|
|
566
|
+
}, [c, i]), S = T((N) => {
|
|
567
|
+
N.preventDefault(), N.stopPropagation(), m.current = !0, I.current = N.clientX, h.current = s;
|
|
568
|
+
const x = i.x + s, L = i.y, k = (C) => {
|
|
569
|
+
if (!m.current) return;
|
|
570
|
+
const W = C.clientX - I.current;
|
|
571
|
+
let G = h.current - W;
|
|
572
|
+
if (G > X.MAX_WIDTH) {
|
|
573
|
+
m.current = !1, g(!0), j();
|
|
553
574
|
return;
|
|
554
575
|
}
|
|
555
|
-
|
|
556
|
-
},
|
|
557
|
-
|
|
558
|
-
},
|
|
559
|
-
document.removeEventListener("mousemove",
|
|
576
|
+
G = Math.max(X.MIN_WIDTH, G), r(G), l({ x: x - G, y: L });
|
|
577
|
+
}, R = () => {
|
|
578
|
+
m.current = !1, j();
|
|
579
|
+
}, j = () => {
|
|
580
|
+
document.removeEventListener("mousemove", k), document.removeEventListener("mouseup", R), A.current = null;
|
|
560
581
|
};
|
|
561
|
-
document.addEventListener("mousemove",
|
|
562
|
-
}, [s]),
|
|
563
|
-
|
|
564
|
-
}, [
|
|
565
|
-
|
|
582
|
+
document.addEventListener("mousemove", k), document.addEventListener("mouseup", R), A.current = j;
|
|
583
|
+
}, [s, i]), H = T(() => {
|
|
584
|
+
c && r(t), g((N) => !N);
|
|
585
|
+
}, [c, t]), O = T(() => {
|
|
586
|
+
g(!1), r(t), o(!1), y(null);
|
|
566
587
|
}, [t]);
|
|
567
588
|
return {
|
|
568
589
|
// 状态
|
|
569
590
|
width: s,
|
|
570
591
|
position: i,
|
|
571
|
-
hasCustomPosition:
|
|
572
|
-
isMaximized:
|
|
573
|
-
lockedHeight:
|
|
574
|
-
viewport:
|
|
592
|
+
hasCustomPosition: d,
|
|
593
|
+
isMaximized: c,
|
|
594
|
+
lockedHeight: f,
|
|
595
|
+
viewport: b,
|
|
575
596
|
defaultHeight: a,
|
|
576
597
|
/** 真实渲染几何(含侧边栏宽度 / 自适应高度,统一在 hook 内钳制) */
|
|
577
|
-
totalWidth:
|
|
578
|
-
windowHeight:
|
|
598
|
+
totalWidth: P,
|
|
599
|
+
windowHeight: D,
|
|
579
600
|
// 交互
|
|
580
|
-
startWindowDrag:
|
|
581
|
-
startResize:
|
|
582
|
-
toggleMaximize:
|
|
583
|
-
setIsMaximized:
|
|
584
|
-
setLockedHeight:
|
|
585
|
-
setHasCustomPosition:
|
|
586
|
-
reset:
|
|
601
|
+
startWindowDrag: u,
|
|
602
|
+
startResize: S,
|
|
603
|
+
toggleMaximize: H,
|
|
604
|
+
setIsMaximized: g,
|
|
605
|
+
setLockedHeight: y,
|
|
606
|
+
setHasCustomPosition: o,
|
|
607
|
+
reset: O
|
|
587
608
|
};
|
|
588
609
|
}
|
|
589
|
-
function
|
|
590
|
-
const { enabled: a, contentSelector: n, defaultHeight: s, onHeightChange: r } = t, i =
|
|
591
|
-
return
|
|
610
|
+
function it(t) {
|
|
611
|
+
const { enabled: a, contentSelector: n, defaultHeight: s, onHeightChange: r } = t, i = F(null);
|
|
612
|
+
return Y(() => {
|
|
592
613
|
if (!a || !i.current) return;
|
|
593
|
-
const
|
|
594
|
-
if (!
|
|
595
|
-
const
|
|
596
|
-
const
|
|
597
|
-
if (!
|
|
598
|
-
const
|
|
599
|
-
if (!
|
|
600
|
-
const
|
|
601
|
-
r((
|
|
614
|
+
const d = i.current.querySelector(n);
|
|
615
|
+
if (!d) return;
|
|
616
|
+
const o = () => {
|
|
617
|
+
const f = i.current;
|
|
618
|
+
if (!f) return;
|
|
619
|
+
const y = f.querySelector(n);
|
|
620
|
+
if (!y) return;
|
|
621
|
+
const b = f.offsetHeight - y.clientHeight, M = y.scrollHeight + b, m = Math.floor(window.innerHeight * X.MAX_HEIGHT_RATIO), I = Math.max(s, Math.min(M, m));
|
|
622
|
+
r((h) => h === I ? h : I);
|
|
602
623
|
};
|
|
603
|
-
|
|
604
|
-
const
|
|
605
|
-
Array.from(
|
|
606
|
-
const
|
|
607
|
-
Array.from(
|
|
624
|
+
o();
|
|
625
|
+
const c = new ResizeObserver(() => o());
|
|
626
|
+
Array.from(d.children).forEach((f) => c.observe(f));
|
|
627
|
+
const g = new MutationObserver(() => {
|
|
628
|
+
Array.from(d.children).forEach((f) => c.observe(f)), o();
|
|
608
629
|
});
|
|
609
|
-
return
|
|
610
|
-
|
|
630
|
+
return g.observe(d, { childList: !0, subtree: !0, characterData: !0 }), () => {
|
|
631
|
+
c.disconnect(), g.disconnect();
|
|
611
632
|
};
|
|
612
633
|
}, [a, n, s, r]), i;
|
|
613
634
|
}
|
|
614
|
-
function
|
|
635
|
+
function ot(t, a) {
|
|
636
|
+
const n = X.TRIGGER_SIZE;
|
|
637
|
+
return {
|
|
638
|
+
x: Math.max(8, Math.min(t, window.innerWidth - n - 8)),
|
|
639
|
+
y: Math.max(8, Math.min(a, window.innerHeight - n - 8))
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
function lt({ isOpen: t, onClick: a, triggerLogo: n }) {
|
|
643
|
+
const [s, r] = _(null), i = F(!1), l = F(!1), d = F({ x: 0, y: 0 }), o = F({ x: 0, y: 0 }), c = F(null);
|
|
644
|
+
Y(() => () => {
|
|
645
|
+
var b;
|
|
646
|
+
(b = c.current) == null || b.call(c);
|
|
647
|
+
}, []);
|
|
648
|
+
const g = T((b) => {
|
|
649
|
+
if (b.button !== 0) return;
|
|
650
|
+
i.current = !0, l.current = !1, d.current = { x: b.clientX, y: b.clientY };
|
|
651
|
+
const M = b.currentTarget.getBoundingClientRect();
|
|
652
|
+
o.current = { x: M.left, y: M.top };
|
|
653
|
+
const m = (h) => {
|
|
654
|
+
if (!i.current) return;
|
|
655
|
+
const v = h.clientX - d.current.x, z = h.clientY - d.current.y;
|
|
656
|
+
(Math.abs(v) > 4 || Math.abs(z) > 4) && (l.current = !0), l.current && r(ot(o.current.x + v, o.current.y + z));
|
|
657
|
+
}, I = () => {
|
|
658
|
+
i.current = !1, document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", I), c.current = null;
|
|
659
|
+
};
|
|
660
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", I), c.current = I;
|
|
661
|
+
}, []), f = T(() => {
|
|
662
|
+
if (l.current) {
|
|
663
|
+
l.current = !1;
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
a();
|
|
667
|
+
}, [a]), y = s ? { left: s.x, top: s.y, width: X.TRIGGER_SIZE, height: X.TRIGGER_SIZE } : {
|
|
668
|
+
right: X.TRIGGER_RIGHT,
|
|
669
|
+
bottom: X.TRIGGER_BOTTOM,
|
|
670
|
+
width: X.TRIGGER_SIZE,
|
|
671
|
+
height: X.TRIGGER_SIZE
|
|
672
|
+
};
|
|
615
673
|
return /* @__PURE__ */ e(
|
|
616
674
|
"button",
|
|
617
675
|
{
|
|
618
676
|
type: "button",
|
|
619
677
|
className: `fixed z-[10000] flex items-center justify-center border-none bg-transparent p-0 transition-transform duration-200 ease-out hover:scale-[1.08] active:scale-95 ${t ? "pointer-events-none scale-50 opacity-0" : "opacity-100"}`,
|
|
620
|
-
style:
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
width: U.TRIGGER_SIZE,
|
|
624
|
-
height: U.TRIGGER_SIZE
|
|
625
|
-
},
|
|
626
|
-
onClick: a,
|
|
678
|
+
style: y,
|
|
679
|
+
onMouseDown: g,
|
|
680
|
+
onClick: f,
|
|
627
681
|
"aria-label": "打开 AI 助手",
|
|
628
682
|
title: "AI 助手",
|
|
629
|
-
children: /* @__PURE__ */ e("img", { src: n ||
|
|
683
|
+
children: /* @__PURE__ */ e("img", { src: n || K.triggerLogo, alt: "AI 助手", className: "block h-full w-full", draggable: !1 })
|
|
630
684
|
}
|
|
631
685
|
);
|
|
632
686
|
}
|
|
@@ -647,133 +701,133 @@ function te({
|
|
|
647
701
|
}
|
|
648
702
|
);
|
|
649
703
|
}
|
|
650
|
-
function
|
|
704
|
+
function dt({
|
|
651
705
|
onClose: t,
|
|
652
706
|
onToggleThreadList: a,
|
|
653
707
|
isMaximized: n = !1,
|
|
654
708
|
onToggleMaximize: s,
|
|
655
709
|
showHome: r = !1,
|
|
656
710
|
onHome: i,
|
|
657
|
-
showClose:
|
|
658
|
-
artifactCount:
|
|
659
|
-
onToggleArtifactDrawer:
|
|
711
|
+
showClose: l = !0,
|
|
712
|
+
artifactCount: d = 0,
|
|
713
|
+
onToggleArtifactDrawer: o
|
|
660
714
|
}) {
|
|
661
|
-
return /* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */ e(te, { tooltip: "历史记录", onClick: a, children: /* @__PURE__ */ e("img", { src:
|
|
664
|
-
r && i && /* @__PURE__ */ e(te, { tooltip: "回到首页", onClick: i, children: /* @__PURE__ */ e("img", { src:
|
|
715
|
+
return /* @__PURE__ */ p("div", { className: "relative z-20 flex h-9 shrink-0 select-none items-center justify-between px-[15px]", children: [
|
|
716
|
+
/* @__PURE__ */ p("div", { className: "flex items-center gap-3", children: [
|
|
717
|
+
/* @__PURE__ */ e(te, { tooltip: "历史记录", onClick: a, children: /* @__PURE__ */ e("img", { src: K.recently, alt: "", width: 20, height: 20 }) }),
|
|
718
|
+
r && i && /* @__PURE__ */ e(te, { tooltip: "回到首页", onClick: i, children: /* @__PURE__ */ e("img", { src: K.home, alt: "", width: 20, height: 20 }) })
|
|
665
719
|
] }),
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
|
|
668
|
-
/* @__PURE__ */
|
|
720
|
+
/* @__PURE__ */ p("div", { className: "flex items-center gap-2.5", children: [
|
|
721
|
+
d > 0 && o && /* @__PURE__ */ e(te, { tooltip: "会话产物", onClick: o, children: /* @__PURE__ */ p("span", { className: "relative flex items-center gap-1", children: [
|
|
722
|
+
/* @__PURE__ */ p("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
669
723
|
/* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
670
724
|
/* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
|
|
671
725
|
] }),
|
|
672
|
-
|
|
726
|
+
d > 0 && /* @__PURE__ */ e("span", { className: "absolute -right-2 -top-1.5 min-w-[14px] rounded-full bg-[var(--sa-primary)] px-0.5 text-center text-[9px] font-medium leading-[14px] text-white", children: d > 99 ? "99+" : d })
|
|
673
727
|
] }) }),
|
|
674
|
-
s && /* @__PURE__ */ e(te, { tooltip: n ? "小窗" : "大窗", onClick: s, children: /* @__PURE__ */ e("img", { src: n ?
|
|
675
|
-
|
|
728
|
+
s && /* @__PURE__ */ e(te, { tooltip: n ? "小窗" : "大窗", onClick: s, children: /* @__PURE__ */ e("img", { src: n ? K.spiltWindow : K.mergeWindow, alt: "", width: 20, height: 20 }) }),
|
|
729
|
+
l && /* @__PURE__ */ e(te, { tooltip: "关闭", onClick: t, children: /* @__PURE__ */ e("img", { src: K.close, alt: "", width: 20, height: 20 }) })
|
|
676
730
|
] })
|
|
677
731
|
] });
|
|
678
732
|
}
|
|
679
733
|
const ae = (t) => String(t).padStart(2, "0");
|
|
680
|
-
function
|
|
734
|
+
function ct(t) {
|
|
681
735
|
if (!t) return "";
|
|
682
736
|
const a = new Date(t);
|
|
683
737
|
return isNaN(a.getTime()) ? "" : `${a.getFullYear()}-${ae(a.getMonth() + 1)}-${ae(a.getDate())} ${ae(a.getHours())}:${ae(a.getMinutes())}:${ae(a.getSeconds())}`;
|
|
684
738
|
}
|
|
685
|
-
function
|
|
686
|
-
const a = /* @__PURE__ */ new Date(), n = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime(), s = n - 6 * 864e5, r = [], i = [],
|
|
687
|
-
for (const
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
const
|
|
692
|
-
return r.length &&
|
|
739
|
+
function Fe(t) {
|
|
740
|
+
const a = /* @__PURE__ */ new Date(), n = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime(), s = n - 6 * 864e5, r = [], i = [], l = [];
|
|
741
|
+
for (const o of t) {
|
|
742
|
+
const c = new Date(o.updateTime).getTime();
|
|
743
|
+
c >= n ? r.push(o) : c >= s ? i.push(o) : l.push(o);
|
|
744
|
+
}
|
|
745
|
+
const d = [];
|
|
746
|
+
return r.length && d.push({ label: "今天", items: r }), i.length && d.push({ label: "最近 7 天", items: i }), l.length && d.push({ label: "更早", items: l }), d;
|
|
693
747
|
}
|
|
694
|
-
function
|
|
748
|
+
function Ie({ width: t }) {
|
|
695
749
|
const {
|
|
696
750
|
conversations: a,
|
|
697
751
|
activeConversationId: n,
|
|
698
752
|
switchConversation: s,
|
|
699
753
|
newConversation: r,
|
|
700
754
|
deleteConversation: i,
|
|
701
|
-
renameConversation:
|
|
702
|
-
hasMore:
|
|
703
|
-
loadMoreConversations:
|
|
704
|
-
conversationsLoading:
|
|
705
|
-
} =
|
|
706
|
-
|
|
707
|
-
}, []),
|
|
708
|
-
|
|
709
|
-
}, [
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
}, [
|
|
713
|
-
return /* @__PURE__ */
|
|
755
|
+
renameConversation: l,
|
|
756
|
+
hasMore: d,
|
|
757
|
+
loadMoreConversations: o,
|
|
758
|
+
conversationsLoading: c
|
|
759
|
+
} = J(), [g, f] = _(null), [y, b] = _(""), [M, m] = _(null), I = F(null), h = T(($, A) => {
|
|
760
|
+
f($), b(A ?? "");
|
|
761
|
+
}, []), v = T(($) => {
|
|
762
|
+
y.trim() && l($, y.trim()), f(null);
|
|
763
|
+
}, [y, l]), z = T(() => {
|
|
764
|
+
const $ = I.current;
|
|
765
|
+
!$ || !d || $.scrollHeight - $.scrollTop - $.clientHeight < 50 && o();
|
|
766
|
+
}, [d, o]), E = re(() => Fe(a), [a]);
|
|
767
|
+
return /* @__PURE__ */ p(
|
|
714
768
|
"div",
|
|
715
769
|
{
|
|
716
|
-
className: "relative z-[5] flex shrink-0 flex-col overflow-visible border-r border-[#ECECEC] bg-[#FAFAFA] p-3 animate-sa-history-in",
|
|
770
|
+
className: "relative z-[5] flex h-full shrink-0 flex-col overflow-visible border-r border-[#ECECEC] bg-[#FAFAFA] p-3 animate-sa-history-in",
|
|
717
771
|
style: { width: t ?? 200 },
|
|
718
772
|
children: [
|
|
719
|
-
/* @__PURE__ */
|
|
773
|
+
/* @__PURE__ */ p(
|
|
720
774
|
"button",
|
|
721
775
|
{
|
|
722
776
|
type: "button",
|
|
723
777
|
className: "sa-new-chat mb-4 flex h-8 w-full shrink-0 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",
|
|
724
778
|
onClick: r,
|
|
725
779
|
children: [
|
|
726
|
-
/* @__PURE__ */ e("img", { src:
|
|
780
|
+
/* @__PURE__ */ e("img", { src: K.messageCreate, alt: "", width: 18, height: 18 }),
|
|
727
781
|
/* @__PURE__ */ e("span", { className: "sa-new-chat-text whitespace-nowrap", children: "新建对话" })
|
|
728
782
|
]
|
|
729
783
|
}
|
|
730
784
|
),
|
|
731
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ p("div", { className: "px-1 pb-2.5", children: [
|
|
732
786
|
/* @__PURE__ */ e("div", { className: "mb-1 text-[14px] font-semibold text-[#333]", children: "历史对话" }),
|
|
733
787
|
/* @__PURE__ */ e("div", { className: "text-[11px] text-[#999]", children: "展示最近的会话记录" })
|
|
734
788
|
] }),
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
|
|
737
|
-
!
|
|
738
|
-
|
|
739
|
-
/* @__PURE__ */ e("div", { className: "px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]", children:
|
|
740
|
-
|
|
789
|
+
/* @__PURE__ */ p("div", { ref: I, className: "flex-1 overflow-y-auto", onScroll: z, children: [
|
|
790
|
+
c && a.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "加载中..." }),
|
|
791
|
+
!c && a.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "暂无记录" }),
|
|
792
|
+
E.map(($) => /* @__PURE__ */ p("div", { className: "mb-1", children: [
|
|
793
|
+
/* @__PURE__ */ e("div", { className: "px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]", children: $.label }),
|
|
794
|
+
$.items.map((A) => /* @__PURE__ */ e(
|
|
741
795
|
"div",
|
|
742
796
|
{
|
|
743
|
-
className: `group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${
|
|
797
|
+
className: `group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${A.sessionId === n ? "bg-[#E8F1FE]" : "hover:bg-[#E8F1FE]"}`,
|
|
744
798
|
onClick: () => {
|
|
745
|
-
|
|
799
|
+
g !== A.sessionId && s(A.sessionId);
|
|
746
800
|
},
|
|
747
801
|
onMouseEnter: (w) => {
|
|
748
|
-
if (
|
|
749
|
-
const
|
|
750
|
-
|
|
802
|
+
if (g === A.sessionId) return;
|
|
803
|
+
const D = w.currentTarget.getBoundingClientRect();
|
|
804
|
+
m({ text: A.title || "新会话", x: D.right + 8, y: D.top + D.height / 2 });
|
|
751
805
|
},
|
|
752
|
-
onMouseLeave: () =>
|
|
753
|
-
children:
|
|
806
|
+
onMouseLeave: () => m(null),
|
|
807
|
+
children: g === A.sessionId ? /* @__PURE__ */ e(
|
|
754
808
|
"input",
|
|
755
809
|
{
|
|
756
810
|
className: "w-full rounded border border-[var(--sa-primary)] bg-white px-1.5 py-0.5 text-[12px] outline-none",
|
|
757
|
-
value:
|
|
758
|
-
onChange: (w) =>
|
|
759
|
-
onBlur: () =>
|
|
811
|
+
value: y,
|
|
812
|
+
onChange: (w) => b(w.target.value),
|
|
813
|
+
onBlur: () => v(A.sessionId),
|
|
760
814
|
onKeyDown: (w) => {
|
|
761
|
-
w.key === "Enter" &&
|
|
815
|
+
w.key === "Enter" && v(A.sessionId), w.key === "Escape" && f(null);
|
|
762
816
|
},
|
|
763
817
|
onClick: (w) => w.stopPropagation(),
|
|
764
818
|
autoFocus: !0
|
|
765
819
|
}
|
|
766
|
-
) : /* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */ e("img", { src:
|
|
768
|
-
/* @__PURE__ */ e("span", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]", children:
|
|
769
|
-
/* @__PURE__ */
|
|
820
|
+
) : /* @__PURE__ */ p(V, { children: [
|
|
821
|
+
/* @__PURE__ */ e("img", { src: K.message, alt: "", width: 16, height: 16, className: "shrink-0 opacity-60" }),
|
|
822
|
+
/* @__PURE__ */ e("span", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]", children: A.title || "新会话" }),
|
|
823
|
+
/* @__PURE__ */ p("span", { className: "hidden shrink-0 items-center gap-0.5 group-hover:flex", children: [
|
|
770
824
|
/* @__PURE__ */ e(
|
|
771
825
|
"button",
|
|
772
826
|
{
|
|
773
827
|
type: "button",
|
|
774
828
|
className: "flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",
|
|
775
829
|
onClick: (w) => {
|
|
776
|
-
w.stopPropagation(),
|
|
830
|
+
w.stopPropagation(), h(A.sessionId, A.title);
|
|
777
831
|
},
|
|
778
832
|
title: "重命名",
|
|
779
833
|
children: /* @__PURE__ */ e("svg", { width: 12, height: 12, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" }) })
|
|
@@ -785,7 +839,7 @@ function ke({ width: t }) {
|
|
|
785
839
|
type: "button",
|
|
786
840
|
className: "flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[#ef4444]",
|
|
787
841
|
onClick: (w) => {
|
|
788
|
-
w.stopPropagation(), i(
|
|
842
|
+
w.stopPropagation(), i(A.sessionId);
|
|
789
843
|
},
|
|
790
844
|
title: "删除",
|
|
791
845
|
children: /* @__PURE__ */ e("svg", { width: 12, height: 12, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }) })
|
|
@@ -794,50 +848,50 @@ function ke({ width: t }) {
|
|
|
794
848
|
] })
|
|
795
849
|
] })
|
|
796
850
|
},
|
|
797
|
-
|
|
851
|
+
A.sessionId
|
|
798
852
|
))
|
|
799
|
-
] },
|
|
800
|
-
|
|
801
|
-
!
|
|
853
|
+
] }, $.label)),
|
|
854
|
+
c && a.length > 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: d ? "加载更多..." : "加载中..." }),
|
|
855
|
+
!c && d && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]", children: "向下滚动加载更多" })
|
|
802
856
|
] }),
|
|
803
|
-
|
|
857
|
+
M && /* @__PURE__ */ e(
|
|
804
858
|
"div",
|
|
805
859
|
{
|
|
806
860
|
className: "pointer-events-none fixed z-[10001] whitespace-nowrap rounded border border-[#E8E8E8] bg-white px-2.5 py-1.5 text-[12px] leading-[1.4] text-[#333] shadow-[0_2px_8px_rgba(0,0,0,0.12)]",
|
|
807
|
-
style: { left:
|
|
808
|
-
children:
|
|
861
|
+
style: { left: M.x, top: M.y, transform: "translateY(-50%)" },
|
|
862
|
+
children: M.text
|
|
809
863
|
}
|
|
810
864
|
)
|
|
811
865
|
]
|
|
812
866
|
}
|
|
813
867
|
);
|
|
814
868
|
}
|
|
815
|
-
function
|
|
816
|
-
const a =
|
|
817
|
-
const
|
|
818
|
-
if (!
|
|
819
|
-
const { scrollTop:
|
|
820
|
-
|
|
869
|
+
function pt(t) {
|
|
870
|
+
const a = F(null), n = F(!1), s = F(0), r = T(() => {
|
|
871
|
+
const l = a.current;
|
|
872
|
+
if (!l) return;
|
|
873
|
+
const { scrollTop: d, scrollHeight: o, clientHeight: c } = l, g = o - d - c < 40;
|
|
874
|
+
d < s.current && !g && (n.current = !0), g && (n.current = !1), s.current = d;
|
|
821
875
|
}, []);
|
|
822
|
-
|
|
823
|
-
const
|
|
824
|
-
if (
|
|
825
|
-
return
|
|
826
|
-
}, [r]),
|
|
876
|
+
Y(() => {
|
|
877
|
+
const l = a.current;
|
|
878
|
+
if (l)
|
|
879
|
+
return l.addEventListener("scroll", r, { passive: !0 }), () => l.removeEventListener("scroll", r);
|
|
880
|
+
}, [r]), Y(() => {
|
|
827
881
|
if (n.current) return;
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
|
|
882
|
+
const l = a.current;
|
|
883
|
+
l && requestAnimationFrame(() => {
|
|
884
|
+
l.scrollTop = l.scrollHeight;
|
|
831
885
|
});
|
|
832
886
|
}, t);
|
|
833
|
-
const i =
|
|
887
|
+
const i = T(() => {
|
|
834
888
|
n.current = !1;
|
|
835
|
-
const
|
|
836
|
-
|
|
889
|
+
const l = a.current;
|
|
890
|
+
l && (l.scrollTop = l.scrollHeight);
|
|
837
891
|
}, []);
|
|
838
892
|
return { containerRef: a, scrollToBottom: i };
|
|
839
893
|
}
|
|
840
|
-
function
|
|
894
|
+
function Z(t) {
|
|
841
895
|
return t.value++;
|
|
842
896
|
}
|
|
843
897
|
function ee(t, a) {
|
|
@@ -846,132 +900,132 @@ function ee(t, a) {
|
|
|
846
900
|
};
|
|
847
901
|
let i = 0;
|
|
848
902
|
for (; i < t.length; ) {
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
851
|
-
const
|
|
852
|
-
if (
|
|
903
|
+
const l = t[i];
|
|
904
|
+
if (l === "`") {
|
|
905
|
+
const d = t.indexOf("`", i + 1);
|
|
906
|
+
if (d !== -1) {
|
|
853
907
|
r(), n.push(
|
|
854
|
-
/* @__PURE__ */ e("code", { className: "sa-inline-code", children: t.slice(i + 1,
|
|
855
|
-
), i =
|
|
908
|
+
/* @__PURE__ */ e("code", { className: "sa-inline-code", children: t.slice(i + 1, d) }, Z(a))
|
|
909
|
+
), i = d + 1;
|
|
856
910
|
continue;
|
|
857
911
|
}
|
|
858
|
-
} else if (
|
|
859
|
-
const
|
|
860
|
-
if (
|
|
912
|
+
} else if (l === "*" && t[i + 1] === "*") {
|
|
913
|
+
const d = t.indexOf("**", i + 2);
|
|
914
|
+
if (d !== -1) {
|
|
861
915
|
r(), n.push(
|
|
862
|
-
/* @__PURE__ */ e("strong", { children: ee(t.slice(i + 2,
|
|
863
|
-
), i =
|
|
916
|
+
/* @__PURE__ */ e("strong", { children: ee(t.slice(i + 2, d), a) }, Z(a))
|
|
917
|
+
), i = d + 2;
|
|
864
918
|
continue;
|
|
865
919
|
}
|
|
866
|
-
} else if (
|
|
867
|
-
const
|
|
868
|
-
if (
|
|
920
|
+
} else if (l === "*") {
|
|
921
|
+
const d = t.indexOf("*", i + 1);
|
|
922
|
+
if (d !== -1) {
|
|
869
923
|
r(), n.push(
|
|
870
|
-
/* @__PURE__ */ e("em", { children: ee(t.slice(i + 1,
|
|
871
|
-
), i =
|
|
924
|
+
/* @__PURE__ */ e("em", { children: ee(t.slice(i + 1, d), a) }, Z(a))
|
|
925
|
+
), i = d + 1;
|
|
872
926
|
continue;
|
|
873
927
|
}
|
|
874
|
-
} else if (
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
877
|
-
const
|
|
878
|
-
if (
|
|
879
|
-
const
|
|
928
|
+
} else if (l === "[") {
|
|
929
|
+
const d = t.indexOf("]", i + 1);
|
|
930
|
+
if (d !== -1 && t[d + 1] === "(") {
|
|
931
|
+
const o = t.indexOf(")", d + 2);
|
|
932
|
+
if (o !== -1) {
|
|
933
|
+
const c = t.slice(i + 1, d), g = t.slice(d + 2, o);
|
|
880
934
|
r(), n.push(
|
|
881
935
|
/* @__PURE__ */ e(
|
|
882
936
|
"a",
|
|
883
937
|
{
|
|
884
|
-
href:
|
|
938
|
+
href: g,
|
|
885
939
|
target: "_blank",
|
|
886
940
|
rel: "noreferrer",
|
|
887
|
-
children: ee(
|
|
941
|
+
children: ee(c, a)
|
|
888
942
|
},
|
|
889
|
-
|
|
943
|
+
Z(a)
|
|
890
944
|
)
|
|
891
|
-
), i =
|
|
945
|
+
), i = o + 1;
|
|
892
946
|
continue;
|
|
893
947
|
}
|
|
894
948
|
}
|
|
895
949
|
}
|
|
896
|
-
s.push(
|
|
950
|
+
s.push(l), i++;
|
|
897
951
|
}
|
|
898
952
|
return r(), n;
|
|
899
953
|
}
|
|
900
|
-
function
|
|
954
|
+
function ut(t, a) {
|
|
901
955
|
const n = [], s = t.split(`
|
|
902
956
|
`);
|
|
903
957
|
let r = 0;
|
|
904
|
-
const i = (
|
|
958
|
+
const i = (o) => o.trim() === "", l = (o) => /^#{1,6}\s+\S/.test(o.trim()), d = (o) => /^(?:[-*+]|\d+[.)])\s+\S/.test(o.trim());
|
|
905
959
|
for (; r < s.length; ) {
|
|
906
|
-
const
|
|
907
|
-
if (i(
|
|
960
|
+
const o = s[r], c = o.trim();
|
|
961
|
+
if (i(o)) {
|
|
908
962
|
r++;
|
|
909
963
|
continue;
|
|
910
964
|
}
|
|
911
|
-
if (o
|
|
912
|
-
const
|
|
913
|
-
if (
|
|
914
|
-
const
|
|
965
|
+
if (l(o)) {
|
|
966
|
+
const f = c.match(/^(#{1,6})\s+(.*)$/);
|
|
967
|
+
if (f) {
|
|
968
|
+
const b = `h${Math.min(f[1].length, 6)}`;
|
|
915
969
|
n.push(
|
|
916
970
|
Q.createElement(
|
|
917
|
-
|
|
918
|
-
{ key:
|
|
919
|
-
ee(
|
|
971
|
+
b,
|
|
972
|
+
{ key: Z(a) },
|
|
973
|
+
ee(f[2], a)
|
|
920
974
|
)
|
|
921
975
|
);
|
|
922
976
|
}
|
|
923
977
|
r++;
|
|
924
978
|
continue;
|
|
925
979
|
}
|
|
926
|
-
if (
|
|
927
|
-
const
|
|
928
|
-
for (; r < s.length &&
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
/* @__PURE__ */ e("li", { children: ee(
|
|
980
|
+
if (d(o)) {
|
|
981
|
+
const f = /^\d+[.)]/.test(c), y = [];
|
|
982
|
+
for (; r < s.length && d(s[r]); ) {
|
|
983
|
+
const b = s[r].trim().match(/^(?:[-*+]|\d+[.)])\s+(.*)$/);
|
|
984
|
+
b && y.push(
|
|
985
|
+
/* @__PURE__ */ e("li", { children: ee(b[1], a) }, Z(a))
|
|
932
986
|
), r++;
|
|
933
987
|
}
|
|
934
988
|
n.push(
|
|
935
|
-
|
|
989
|
+
f ? /* @__PURE__ */ e("ol", { className: "sa-list", children: y }, Z(a)) : /* @__PURE__ */ e("ul", { className: "sa-list", children: y }, Z(a))
|
|
936
990
|
);
|
|
937
991
|
continue;
|
|
938
992
|
}
|
|
939
|
-
const
|
|
940
|
-
for (; r < s.length && !i(s[r]) && !
|
|
941
|
-
|
|
993
|
+
const g = [];
|
|
994
|
+
for (; r < s.length && !i(s[r]) && !l(s[r]) && !d(s[r]); )
|
|
995
|
+
g.push(s[r]), r++;
|
|
942
996
|
n.push(
|
|
943
|
-
/* @__PURE__ */ e("p", { className: "sa-text-paragraph", children: ee(
|
|
997
|
+
/* @__PURE__ */ e("p", { className: "sa-text-paragraph", children: ee(g.join(" "), a) }, Z(a))
|
|
944
998
|
);
|
|
945
999
|
}
|
|
946
1000
|
return n;
|
|
947
1001
|
}
|
|
948
|
-
function
|
|
1002
|
+
function gt(t) {
|
|
949
1003
|
const a = { value: 0 }, n = [], s = t.split("```");
|
|
950
1004
|
for (let r = 0; r < s.length; r++)
|
|
951
1005
|
if (r % 2 === 0)
|
|
952
|
-
n.push(...
|
|
1006
|
+
n.push(...ut(s[r], a));
|
|
953
1007
|
else if (s[r].trim() !== "") {
|
|
954
1008
|
let i = s[r].replace(/^\r?\n/, "");
|
|
955
1009
|
i = i.replace(/^[a-zA-Z0-9_+#.-]+\r?\n/, ""), i = i.replace(/\r?\n$/, ""), n.push(
|
|
956
|
-
/* @__PURE__ */ e("pre", { className: "sa-code-block", children: /* @__PURE__ */ e("code", { children: i }) },
|
|
1010
|
+
/* @__PURE__ */ e("pre", { className: "sa-code-block", children: /* @__PURE__ */ e("code", { children: i }) }, Z(a))
|
|
957
1011
|
);
|
|
958
1012
|
}
|
|
959
1013
|
return n;
|
|
960
1014
|
}
|
|
961
|
-
function
|
|
962
|
-
return /* @__PURE__ */ e("div", { className: "sa-text-part", children:
|
|
1015
|
+
function ft({ content: t }) {
|
|
1016
|
+
return /* @__PURE__ */ e("div", { className: "sa-text-part", children: gt(t) });
|
|
963
1017
|
}
|
|
964
|
-
const
|
|
965
|
-
let
|
|
966
|
-
function
|
|
967
|
-
if (
|
|
968
|
-
|
|
1018
|
+
const ht = "https://at.alicdn.com/t/c/font_5210396_pffyg5g21kn.js";
|
|
1019
|
+
let Me = !1;
|
|
1020
|
+
function mt(t = ht) {
|
|
1021
|
+
if (Me || typeof document > "u") return;
|
|
1022
|
+
Me = !0;
|
|
969
1023
|
const a = t.split("?")[0].split("/").pop();
|
|
970
1024
|
if (a && document.querySelector(`script[src*="${a}"]`)) return;
|
|
971
1025
|
const n = document.createElement("script");
|
|
972
1026
|
n.src = t, document.head.appendChild(n);
|
|
973
1027
|
}
|
|
974
|
-
|
|
1028
|
+
mt();
|
|
975
1029
|
function B({ name: t, size: a = 16, color: n = "currentColor", className: s, style: r }) {
|
|
976
1030
|
return /* @__PURE__ */ e(
|
|
977
1031
|
"svg",
|
|
@@ -983,10 +1037,10 @@ function B({ name: t, size: a = 16, color: n = "currentColor", className: s, sty
|
|
|
983
1037
|
}
|
|
984
1038
|
);
|
|
985
1039
|
}
|
|
986
|
-
function
|
|
987
|
-
const [a, n] =
|
|
988
|
-
return /* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
1040
|
+
function xt({ content: t }) {
|
|
1041
|
+
const [a, n] = _(!1);
|
|
1042
|
+
return /* @__PURE__ */ p("div", { className: "sa-thinking-part", onClick: () => n(!a), children: [
|
|
1043
|
+
/* @__PURE__ */ p("div", { className: "sa-thinking-header", children: [
|
|
990
1044
|
/* @__PURE__ */ e("span", { className: "sa-thinking-icon", children: /* @__PURE__ */ e(B, { name: "brain", size: 14 }) }),
|
|
991
1045
|
/* @__PURE__ */ e("span", { className: "sa-thinking-label", children: "思考过程" }),
|
|
992
1046
|
/* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${a ? "expanded" : ""}`, children: /* @__PURE__ */ e(B, { name: "chevron-right", size: 12 }) })
|
|
@@ -994,32 +1048,32 @@ function nt({ content: t }) {
|
|
|
994
1048
|
a && /* @__PURE__ */ e("div", { className: "sa-thinking-content", children: t })
|
|
995
1049
|
] });
|
|
996
1050
|
}
|
|
997
|
-
function
|
|
998
|
-
const [s, r] =
|
|
999
|
-
let
|
|
1051
|
+
function wt({ toolName: t, toolCallId: a, args: n }) {
|
|
1052
|
+
const [s, r] = _(!1), [i, l] = _(!1);
|
|
1053
|
+
let d = n;
|
|
1000
1054
|
try {
|
|
1001
|
-
|
|
1055
|
+
d = JSON.stringify(JSON.parse(n), null, 2);
|
|
1002
1056
|
} catch {
|
|
1003
1057
|
}
|
|
1004
|
-
const
|
|
1005
|
-
var
|
|
1006
|
-
(
|
|
1007
|
-
|
|
1058
|
+
const o = T(() => {
|
|
1059
|
+
var c;
|
|
1060
|
+
(c = navigator.clipboard) == null || c.writeText(d).then(() => {
|
|
1061
|
+
l(!0), setTimeout(() => l(!1), 2e3);
|
|
1008
1062
|
}).catch(() => {
|
|
1009
1063
|
});
|
|
1010
|
-
}, [
|
|
1011
|
-
return /* @__PURE__ */
|
|
1012
|
-
/* @__PURE__ */
|
|
1064
|
+
}, [d]);
|
|
1065
|
+
return /* @__PURE__ */ p("div", { className: "sa-tool-call-part", children: [
|
|
1066
|
+
/* @__PURE__ */ p("div", { className: "sa-tool-call-header", onClick: () => r(!s), children: [
|
|
1013
1067
|
/* @__PURE__ */ e("span", { className: "sa-tool-icon", children: /* @__PURE__ */ e(B, { name: "zap", size: 14 }) }),
|
|
1014
|
-
/* @__PURE__ */
|
|
1068
|
+
/* @__PURE__ */ p("span", { className: "sa-tool-name", children: [
|
|
1015
1069
|
"调用工具: ",
|
|
1016
1070
|
t
|
|
1017
1071
|
] }),
|
|
1018
1072
|
/* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${s ? "expanded" : ""}`, children: /* @__PURE__ */ e(B, { name: "chevron-right", size: 12 }) })
|
|
1019
1073
|
] }),
|
|
1020
|
-
s && /* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */ e("pre", { className: "sa-tool-args", children:
|
|
1022
|
-
/* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */
|
|
1074
|
+
s && /* @__PURE__ */ p(V, { children: [
|
|
1075
|
+
/* @__PURE__ */ e("pre", { className: "sa-tool-args", children: d }),
|
|
1076
|
+
/* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ p("button", { className: "sa-action-btn", onClick: o, title: "复制", children: [
|
|
1023
1077
|
/* @__PURE__ */ e(B, { name: i ? "circle-check" : "copy", size: 14 }),
|
|
1024
1078
|
" ",
|
|
1025
1079
|
i ? "已复制" : "复制"
|
|
@@ -1027,9 +1081,9 @@ function st({ toolName: t, toolCallId: a, args: n }) {
|
|
|
1027
1081
|
] })
|
|
1028
1082
|
] });
|
|
1029
1083
|
}
|
|
1030
|
-
function
|
|
1031
|
-
const [a, n] =
|
|
1032
|
-
return /* @__PURE__ */
|
|
1084
|
+
function Ee({ text: t }) {
|
|
1085
|
+
const [a, n] = _(!1);
|
|
1086
|
+
return /* @__PURE__ */ p("button", { className: "sa-action-btn", onClick: () => {
|
|
1033
1087
|
var r;
|
|
1034
1088
|
(r = navigator.clipboard) == null || r.writeText(t).then(() => {
|
|
1035
1089
|
n(!0), setTimeout(() => n(!1), 2e3);
|
|
@@ -1041,9 +1095,9 @@ function Ne({ text: t }) {
|
|
|
1041
1095
|
a ? "已复制" : "复制"
|
|
1042
1096
|
] });
|
|
1043
1097
|
}
|
|
1044
|
-
function
|
|
1045
|
-
const [a, n] =
|
|
1046
|
-
return
|
|
1098
|
+
function bt({ html: t }) {
|
|
1099
|
+
const [a, n] = _(null);
|
|
1100
|
+
return Y(() => {
|
|
1047
1101
|
let s = !1;
|
|
1048
1102
|
return import("./purify.es-C-6FFqDW.js").then((r) => {
|
|
1049
1103
|
s || n(r.default.sanitize(t, { FORCE_BODY: !0, ADD_ATTR: ["target"] }));
|
|
@@ -1052,75 +1106,97 @@ function it({ html: t }) {
|
|
|
1052
1106
|
};
|
|
1053
1107
|
}, [t]), a === null ? null : /* @__PURE__ */ e("div", { className: "sa-tool-result-html-scroll", children: /* @__PURE__ */ e("div", { className: "sa-tool-result-html sa-text-part", dangerouslySetInnerHTML: { __html: a } }) });
|
|
1054
1108
|
}
|
|
1055
|
-
function
|
|
1056
|
-
const { openArtifactPreview:
|
|
1057
|
-
return /* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */
|
|
1109
|
+
function vt({ toolName: t, content: a, artifacts: n, renderMode: s, html: r, artifactPreview: i }) {
|
|
1110
|
+
const { openArtifactPreview: l } = J(), d = _e(n);
|
|
1111
|
+
return /* @__PURE__ */ p("div", { className: "sa-tool-result-part", children: [
|
|
1112
|
+
/* @__PURE__ */ p("div", { className: "sa-tool-result-header", children: [
|
|
1059
1113
|
/* @__PURE__ */ e("span", { className: "sa-tool-icon", children: /* @__PURE__ */ e(B, { name: "circle-check", size: 14, color: "#10b981" }) }),
|
|
1060
1114
|
/* @__PURE__ */ e("span", { className: "sa-tool-result-label", children: t || "工具返回" })
|
|
1061
1115
|
] }),
|
|
1062
|
-
s === "html" && r ? /* @__PURE__ */
|
|
1063
|
-
/* @__PURE__ */ e(
|
|
1064
|
-
/* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(
|
|
1065
|
-
] }) : a ? /* @__PURE__ */
|
|
1116
|
+
s === "html" && r ? /* @__PURE__ */ p(V, { children: [
|
|
1117
|
+
/* @__PURE__ */ e(bt, { html: r }),
|
|
1118
|
+
/* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(Ee, { text: r }) })
|
|
1119
|
+
] }) : a ? /* @__PURE__ */ p(V, { children: [
|
|
1066
1120
|
/* @__PURE__ */ e("pre", { className: "sa-tool-result-content", children: a }),
|
|
1067
|
-
/* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(
|
|
1121
|
+
/* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(Ee, { text: a }) })
|
|
1068
1122
|
] }) : /* @__PURE__ */ e("pre", { className: "sa-tool-result-content", children: "—" }),
|
|
1069
|
-
|
|
1123
|
+
d.length > 0 && /* @__PURE__ */ e("ul", { className: "sa-artifact-file-list", role: "list", children: d.map((o, c) => /* @__PURE__ */ p(
|
|
1070
1124
|
"li",
|
|
1071
1125
|
{
|
|
1072
1126
|
className: "sa-artifact-file-card",
|
|
1073
|
-
onClick: i ? () => o
|
|
1074
|
-
onKeyDown: i ? (
|
|
1075
|
-
(
|
|
1127
|
+
onClick: i ? () => l(o) : void 0,
|
|
1128
|
+
onKeyDown: i ? (g) => {
|
|
1129
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), l(o));
|
|
1076
1130
|
} : void 0,
|
|
1077
1131
|
tabIndex: i ? 0 : void 0,
|
|
1078
1132
|
role: i ? "button" : void 0,
|
|
1079
|
-
"aria-label": i ? `预览 ${
|
|
1133
|
+
"aria-label": i ? `预览 ${o.filename}` : void 0,
|
|
1080
1134
|
style: i ? { cursor: "pointer" } : void 0,
|
|
1081
1135
|
children: [
|
|
1082
|
-
/* @__PURE__ */ e("div", { className: "sa-artifact-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children:
|
|
1083
|
-
/* @__PURE__ */
|
|
1084
|
-
/* @__PURE__ */ e("span", { className: "sa-artifact-file-name", children:
|
|
1085
|
-
|
|
1136
|
+
/* @__PURE__ */ e("div", { className: "sa-artifact-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children: Le(o.type) }) }),
|
|
1137
|
+
/* @__PURE__ */ p("div", { className: "sa-artifact-file-info", children: [
|
|
1138
|
+
/* @__PURE__ */ e("span", { className: "sa-artifact-file-name", children: o.filename }),
|
|
1139
|
+
o.size != null && /* @__PURE__ */ e("span", { className: "sa-artifact-file-size", children: De(o.size) })
|
|
1086
1140
|
] }),
|
|
1087
1141
|
i && /* @__PURE__ */ e(
|
|
1088
1142
|
"button",
|
|
1089
1143
|
{
|
|
1090
1144
|
className: "sa-artifact-file-download",
|
|
1091
1145
|
title: "下载",
|
|
1092
|
-
"aria-label": `下载 ${
|
|
1093
|
-
onClick: (
|
|
1094
|
-
|
|
1146
|
+
"aria-label": `下载 ${o.filename}`,
|
|
1147
|
+
onClick: (g) => {
|
|
1148
|
+
g.stopPropagation(), ce(o);
|
|
1095
1149
|
},
|
|
1096
1150
|
children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) })
|
|
1097
1151
|
}
|
|
1098
1152
|
)
|
|
1099
1153
|
]
|
|
1100
1154
|
},
|
|
1101
|
-
|
|
1155
|
+
o.id || `art-${c}`
|
|
1102
1156
|
)) })
|
|
1103
1157
|
] });
|
|
1104
1158
|
}
|
|
1105
|
-
function
|
|
1106
|
-
return /* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1159
|
+
function yt({ content: t, onRetry: a }) {
|
|
1160
|
+
return /* @__PURE__ */ p("div", { className: "sa-error-part", children: [
|
|
1161
|
+
/* @__PURE__ */ p("div", { className: "sa-error-content", children: [
|
|
1108
1162
|
/* @__PURE__ */ e("span", { className: "sa-error-icon", children: /* @__PURE__ */ e(B, { name: "triangle-alert", size: 14 }) }),
|
|
1109
1163
|
/* @__PURE__ */ e("span", { children: t || "发生错误" })
|
|
1110
1164
|
] }),
|
|
1111
1165
|
a && /* @__PURE__ */ e("button", { className: "sa-error-retry", onClick: a, children: "重试" })
|
|
1112
1166
|
] });
|
|
1113
1167
|
}
|
|
1114
|
-
function
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1168
|
+
function He(t) {
|
|
1169
|
+
return t == null || Number.isNaN(t) ? "" : t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / 1024 / 1024).toFixed(1)} MB`;
|
|
1170
|
+
}
|
|
1171
|
+
function kt({ attachment: t }) {
|
|
1172
|
+
const a = /* @__PURE__ */ p(V, { children: [
|
|
1173
|
+
/* @__PURE__ */ e(B, { name: "file-text", size: 14, color: "#6366f1" }),
|
|
1174
|
+
/* @__PURE__ */ e("span", { className: "sa-attachment-chip-name", children: t.filename }),
|
|
1175
|
+
t.size != null && /* @__PURE__ */ e("span", { className: "sa-attachment-chip-size", children: He(t.size) })
|
|
1176
|
+
] });
|
|
1177
|
+
return t.url ? /* @__PURE__ */ e(
|
|
1178
|
+
"a",
|
|
1179
|
+
{
|
|
1180
|
+
className: "sa-attachment-chip",
|
|
1181
|
+
href: t.url,
|
|
1182
|
+
target: "_blank",
|
|
1183
|
+
rel: "noreferrer",
|
|
1184
|
+
download: t.filename,
|
|
1185
|
+
title: `下载 ${t.filename}`,
|
|
1186
|
+
children: a
|
|
1187
|
+
}
|
|
1188
|
+
) : /* @__PURE__ */ e("span", { className: "sa-attachment-chip", title: t.filename, children: a });
|
|
1189
|
+
}
|
|
1190
|
+
function Nt({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
1191
|
+
var d, o;
|
|
1192
|
+
const r = t.options, i = (typeof (r == null ? void 0 : r[0]) == "string" ? r[0] : (d = r == null ? void 0 : r[0]) == null ? void 0 : d.label) || "确认", l = (typeof (r == null ? void 0 : r[1]) == "string" ? r[1] : (o = r == null ? void 0 : r[1]) == null ? void 0 : o.label) || "取消";
|
|
1193
|
+
return /* @__PURE__ */ p("div", { className: "sa-interrupt-card", children: [
|
|
1194
|
+
/* @__PURE__ */ p("div", { className: "sa-interrupt-content", children: [
|
|
1119
1195
|
/* @__PURE__ */ e(B, { name: "circle-alert", size: 16, color: "#f59e0b" }),
|
|
1120
1196
|
/* @__PURE__ */ e("span", { children: t.content })
|
|
1121
1197
|
] }),
|
|
1122
|
-
/* @__PURE__ */
|
|
1123
|
-
/* @__PURE__ */
|
|
1198
|
+
/* @__PURE__ */ p("div", { className: "sa-interrupt-actions", children: [
|
|
1199
|
+
/* @__PURE__ */ p(
|
|
1124
1200
|
"button",
|
|
1125
1201
|
{
|
|
1126
1202
|
className: `sa-interrupt-btn sa-interrupt-btn-primary ${s === "confirm" ? "sa-interrupt-btn-answered" : ""}`,
|
|
@@ -1133,7 +1209,7 @@ function dt({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
|
1133
1209
|
]
|
|
1134
1210
|
}
|
|
1135
1211
|
),
|
|
1136
|
-
/* @__PURE__ */
|
|
1212
|
+
/* @__PURE__ */ p(
|
|
1137
1213
|
"button",
|
|
1138
1214
|
{
|
|
1139
1215
|
className: `sa-interrupt-btn sa-interrupt-btn-secondary ${s === "cancel" ? "sa-interrupt-btn-answered" : ""}`,
|
|
@@ -1142,7 +1218,7 @@ function dt({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
|
1142
1218
|
children: [
|
|
1143
1219
|
/* @__PURE__ */ e(B, { name: "x", size: 14 }),
|
|
1144
1220
|
" ",
|
|
1145
|
-
|
|
1221
|
+
l
|
|
1146
1222
|
]
|
|
1147
1223
|
}
|
|
1148
1224
|
)
|
|
@@ -1150,16 +1226,16 @@ function dt({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
|
1150
1226
|
n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
|
|
1151
1227
|
] });
|
|
1152
1228
|
}
|
|
1153
|
-
function
|
|
1154
|
-
var
|
|
1155
|
-
const r = t.options, i = (typeof (r == null ? void 0 : r[0]) == "string" ? r[0] : (
|
|
1156
|
-
return /* @__PURE__ */
|
|
1157
|
-
/* @__PURE__ */
|
|
1229
|
+
function Ct({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
1230
|
+
var c, g, f, y;
|
|
1231
|
+
const r = t.options, i = (typeof (r == null ? void 0 : r[0]) == "string" ? r[0] : (c = r == null ? void 0 : r[0]) == null ? void 0 : c.label) || "批准", l = (typeof (r == null ? void 0 : r[1]) == "string" ? r[1] : (g = r == null ? void 0 : r[1]) == null ? void 0 : g.label) || "拒绝", d = (typeof (r == null ? void 0 : r[2]) == "string" ? r[2] : (f = r == null ? void 0 : r[2]) == null ? void 0 : f.label) || "跳过", o = ((y = t.metadata) == null ? void 0 : y.showSkip) !== !1;
|
|
1232
|
+
return /* @__PURE__ */ p("div", { className: "sa-interrupt-card", children: [
|
|
1233
|
+
/* @__PURE__ */ p("div", { className: "sa-interrupt-content", children: [
|
|
1158
1234
|
/* @__PURE__ */ e(B, { name: "circle-alert", size: 16, color: "#f59e0b" }),
|
|
1159
1235
|
/* @__PURE__ */ e("span", { children: t.content })
|
|
1160
1236
|
] }),
|
|
1161
|
-
/* @__PURE__ */
|
|
1162
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ p("div", { className: "sa-interrupt-actions", children: [
|
|
1238
|
+
/* @__PURE__ */ p(
|
|
1163
1239
|
"button",
|
|
1164
1240
|
{
|
|
1165
1241
|
className: `sa-interrupt-btn sa-interrupt-btn-primary ${s === "approve" ? "sa-interrupt-btn-answered" : ""}`,
|
|
@@ -1172,7 +1248,7 @@ function ct({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
|
1172
1248
|
]
|
|
1173
1249
|
}
|
|
1174
1250
|
),
|
|
1175
|
-
/* @__PURE__ */
|
|
1251
|
+
/* @__PURE__ */ p(
|
|
1176
1252
|
"button",
|
|
1177
1253
|
{
|
|
1178
1254
|
className: `sa-interrupt-btn sa-interrupt-btn-danger ${s === "reject" ? "sa-interrupt-btn-answered" : ""}`,
|
|
@@ -1181,11 +1257,11 @@ function ct({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
|
1181
1257
|
children: [
|
|
1182
1258
|
/* @__PURE__ */ e(B, { name: "x", size: 14 }),
|
|
1183
1259
|
" ",
|
|
1184
|
-
|
|
1260
|
+
l
|
|
1185
1261
|
]
|
|
1186
1262
|
}
|
|
1187
1263
|
),
|
|
1188
|
-
|
|
1264
|
+
o && /* @__PURE__ */ p(
|
|
1189
1265
|
"button",
|
|
1190
1266
|
{
|
|
1191
1267
|
className: `sa-interrupt-btn sa-interrupt-btn-secondary ${s === "skip" ? "sa-interrupt-btn-answered" : ""}`,
|
|
@@ -1194,7 +1270,7 @@ function ct({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
|
1194
1270
|
children: [
|
|
1195
1271
|
/* @__PURE__ */ e(B, { name: "chevron-right", size: 14 }),
|
|
1196
1272
|
" ",
|
|
1197
|
-
|
|
1273
|
+
d
|
|
1198
1274
|
]
|
|
1199
1275
|
}
|
|
1200
1276
|
)
|
|
@@ -1202,26 +1278,26 @@ function ct({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
|
|
|
1202
1278
|
n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
|
|
1203
1279
|
] });
|
|
1204
1280
|
}
|
|
1205
|
-
function
|
|
1281
|
+
function zt(t) {
|
|
1206
1282
|
return typeof t == "string" ? { value: t, label: t } : t;
|
|
1207
1283
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const r = (t.options ?? []).map(
|
|
1210
|
-
return /* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1284
|
+
function Tt({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
1285
|
+
const r = (t.options ?? []).map(zt);
|
|
1286
|
+
return /* @__PURE__ */ p("div", { className: "sa-interrupt-card", children: [
|
|
1287
|
+
/* @__PURE__ */ p("div", { className: "sa-interrupt-content", children: [
|
|
1212
1288
|
/* @__PURE__ */ e(B, { name: "list", size: 16, color: "#6366f1" }),
|
|
1213
1289
|
/* @__PURE__ */ e("span", { children: t.content })
|
|
1214
1290
|
] }),
|
|
1215
1291
|
/* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((i) => {
|
|
1216
|
-
const
|
|
1217
|
-
return /* @__PURE__ */
|
|
1292
|
+
const l = s === i.value;
|
|
1293
|
+
return /* @__PURE__ */ p(
|
|
1218
1294
|
"button",
|
|
1219
1295
|
{
|
|
1220
|
-
className: `sa-interrupt-option ${i.danger ? "sa-interrupt-option-danger" : ""} ${
|
|
1296
|
+
className: `sa-interrupt-option ${i.danger ? "sa-interrupt-option-danger" : ""} ${l ? "sa-interrupt-option-selected" : ""}`,
|
|
1221
1297
|
disabled: n,
|
|
1222
1298
|
onClick: () => a({ action: "select", value: i.value }),
|
|
1223
1299
|
children: [
|
|
1224
|
-
/* @__PURE__ */ e(B, { name:
|
|
1300
|
+
/* @__PURE__ */ e(B, { name: l ? "circle-check" : "circle", size: 14 }),
|
|
1225
1301
|
i.icon && /* @__PURE__ */ e(B, { name: i.icon, size: 14 }),
|
|
1226
1302
|
/* @__PURE__ */ e("span", { children: i.label }),
|
|
1227
1303
|
i.description && /* @__PURE__ */ e("span", { className: "sa-interrupt-option-desc", children: i.description })
|
|
@@ -1233,37 +1309,37 @@ function ut({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
|
1233
1309
|
n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
|
|
1234
1310
|
] });
|
|
1235
1311
|
}
|
|
1236
|
-
function
|
|
1312
|
+
function It(t) {
|
|
1237
1313
|
return typeof t == "string" ? { value: t, label: t } : t;
|
|
1238
1314
|
}
|
|
1239
|
-
function
|
|
1240
|
-
const r = (t.options ?? []).map(
|
|
1315
|
+
function Mt({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
1316
|
+
const r = (t.options ?? []).map(It), [i, l] = _(
|
|
1241
1317
|
() => new Set(Array.isArray(s) ? s : [])
|
|
1242
|
-
),
|
|
1243
|
-
n ||
|
|
1244
|
-
const
|
|
1245
|
-
return
|
|
1318
|
+
), d = (o) => {
|
|
1319
|
+
n || l((c) => {
|
|
1320
|
+
const g = new Set(c);
|
|
1321
|
+
return g.has(o) ? g.delete(o) : g.add(o), g;
|
|
1246
1322
|
});
|
|
1247
1323
|
};
|
|
1248
|
-
return /* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ p("div", { className: "sa-interrupt-card", children: [
|
|
1325
|
+
/* @__PURE__ */ p("div", { className: "sa-interrupt-content", children: [
|
|
1250
1326
|
/* @__PURE__ */ e(B, { name: "list-checks", size: 16, color: "#6366f1" }),
|
|
1251
1327
|
/* @__PURE__ */ e("span", { children: t.content })
|
|
1252
1328
|
] }),
|
|
1253
|
-
/* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((
|
|
1329
|
+
/* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((o) => /* @__PURE__ */ p(
|
|
1254
1330
|
"button",
|
|
1255
1331
|
{
|
|
1256
|
-
className: `sa-interrupt-option ${i.has(
|
|
1332
|
+
className: `sa-interrupt-option ${i.has(o.value) ? "sa-interrupt-option-selected" : ""}`,
|
|
1257
1333
|
disabled: n,
|
|
1258
|
-
onClick: () =>
|
|
1334
|
+
onClick: () => d(o.value),
|
|
1259
1335
|
children: [
|
|
1260
|
-
/* @__PURE__ */ e(B, { name: i.has(
|
|
1261
|
-
/* @__PURE__ */ e("span", { children:
|
|
1336
|
+
/* @__PURE__ */ e(B, { name: i.has(o.value) ? "square-check" : "square", size: 14 }),
|
|
1337
|
+
/* @__PURE__ */ e("span", { children: o.label })
|
|
1262
1338
|
]
|
|
1263
1339
|
},
|
|
1264
|
-
|
|
1340
|
+
o.value
|
|
1265
1341
|
)) }),
|
|
1266
|
-
!n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */
|
|
1342
|
+
!n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ p(
|
|
1267
1343
|
"button",
|
|
1268
1344
|
{
|
|
1269
1345
|
className: "sa-interrupt-btn sa-interrupt-btn-primary",
|
|
@@ -1280,21 +1356,21 @@ function ft({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
|
1280
1356
|
n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
|
|
1281
1357
|
] });
|
|
1282
1358
|
}
|
|
1283
|
-
function
|
|
1284
|
-
const [r, i] =
|
|
1359
|
+
function Et({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
1360
|
+
const [r, i] = _(s ?? ""), l = t.inputType ?? "text", d = l === "textarea", o = () => {
|
|
1285
1361
|
n || t.required && !r.trim() || a({ action: "submit", value: r.trim() });
|
|
1286
1362
|
};
|
|
1287
|
-
return /* @__PURE__ */
|
|
1288
|
-
/* @__PURE__ */
|
|
1363
|
+
return /* @__PURE__ */ p("div", { className: "sa-interrupt-card", children: [
|
|
1364
|
+
/* @__PURE__ */ p("div", { className: "sa-interrupt-content", children: [
|
|
1289
1365
|
/* @__PURE__ */ e(B, { name: "text-cursor-input", size: 16, color: "#6366f1" }),
|
|
1290
1366
|
/* @__PURE__ */ e("span", { children: t.content })
|
|
1291
1367
|
] }),
|
|
1292
|
-
/* @__PURE__ */ e("div", { className: "sa-interrupt-input-area", children:
|
|
1368
|
+
/* @__PURE__ */ e("div", { className: "sa-interrupt-input-area", children: d ? /* @__PURE__ */ e(
|
|
1293
1369
|
"textarea",
|
|
1294
1370
|
{
|
|
1295
1371
|
className: "sa-interrupt-textarea",
|
|
1296
1372
|
value: r,
|
|
1297
|
-
onChange: (
|
|
1373
|
+
onChange: (c) => i(c.target.value),
|
|
1298
1374
|
placeholder: t.placeholder,
|
|
1299
1375
|
maxLength: t.maxLength,
|
|
1300
1376
|
rows: 3,
|
|
@@ -1304,21 +1380,21 @@ function ht({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
|
1304
1380
|
"input",
|
|
1305
1381
|
{
|
|
1306
1382
|
className: "sa-interrupt-input",
|
|
1307
|
-
type:
|
|
1383
|
+
type: l,
|
|
1308
1384
|
value: r,
|
|
1309
|
-
onChange: (
|
|
1385
|
+
onChange: (c) => i(c.target.value),
|
|
1310
1386
|
placeholder: t.placeholder,
|
|
1311
1387
|
maxLength: t.maxLength,
|
|
1312
|
-
onKeyDown: (
|
|
1388
|
+
onKeyDown: (c) => c.key === "Enter" && o(),
|
|
1313
1389
|
disabled: n
|
|
1314
1390
|
}
|
|
1315
1391
|
) }),
|
|
1316
|
-
!n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */
|
|
1392
|
+
!n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ p(
|
|
1317
1393
|
"button",
|
|
1318
1394
|
{
|
|
1319
1395
|
className: "sa-interrupt-btn sa-interrupt-btn-primary",
|
|
1320
1396
|
disabled: t.required ? !r.trim() : !1,
|
|
1321
|
-
onClick:
|
|
1397
|
+
onClick: o,
|
|
1322
1398
|
children: [
|
|
1323
1399
|
/* @__PURE__ */ e(B, { name: "check", size: 14 }),
|
|
1324
1400
|
" 提交"
|
|
@@ -1328,31 +1404,31 @@ function ht({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
|
1328
1404
|
n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
|
|
1329
1405
|
] });
|
|
1330
1406
|
}
|
|
1331
|
-
function
|
|
1332
|
-
const r = t.fields ?? [], [i,
|
|
1333
|
-
const
|
|
1334
|
-
for (const
|
|
1335
|
-
|
|
1336
|
-
return
|
|
1337
|
-
}),
|
|
1338
|
-
n ||
|
|
1339
|
-
},
|
|
1340
|
-
|
|
1407
|
+
function St({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
1408
|
+
const r = t.fields ?? [], [i, l] = _(() => {
|
|
1409
|
+
const g = {};
|
|
1410
|
+
for (const f of r)
|
|
1411
|
+
g[f.name] = (s == null ? void 0 : s[f.name]) ?? f.defaultValue ?? "";
|
|
1412
|
+
return g;
|
|
1413
|
+
}), d = (g, f) => {
|
|
1414
|
+
n || l((y) => ({ ...y, [g]: f }));
|
|
1415
|
+
}, o = !n && r.every((g) => !g.required || i[g.name]), c = () => {
|
|
1416
|
+
o && a({ action: "submit", value: i });
|
|
1341
1417
|
};
|
|
1342
|
-
return /* @__PURE__ */
|
|
1343
|
-
/* @__PURE__ */
|
|
1418
|
+
return /* @__PURE__ */ p("div", { className: "sa-interrupt-card", children: [
|
|
1419
|
+
/* @__PURE__ */ p("div", { className: "sa-interrupt-content", children: [
|
|
1344
1420
|
/* @__PURE__ */ e(B, { name: "file-text", size: 16, color: "#6366f1" }),
|
|
1345
1421
|
/* @__PURE__ */ e("span", { children: t.content })
|
|
1346
1422
|
] }),
|
|
1347
|
-
/* @__PURE__ */ e("div", { className: "sa-interrupt-form", children: r.map((
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
|
|
1350
|
-
|
|
1423
|
+
/* @__PURE__ */ e("div", { className: "sa-interrupt-form", children: r.map((g) => /* @__PURE__ */ p("div", { className: "sa-interrupt-form-field", children: [
|
|
1424
|
+
/* @__PURE__ */ p("label", { className: "sa-interrupt-form-label", children: [
|
|
1425
|
+
g.label,
|
|
1426
|
+
g.required && /* @__PURE__ */ e("span", { className: "sa-interrupt-form-required", children: "*" })
|
|
1351
1427
|
] }),
|
|
1352
|
-
|
|
1353
|
-
] },
|
|
1354
|
-
!n && /* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1428
|
+
At(g, i[g.name], (f) => d(g.name, f), n)
|
|
1429
|
+
] }, g.name)) }),
|
|
1430
|
+
!n && /* @__PURE__ */ p("div", { className: "sa-interrupt-actions", children: [
|
|
1431
|
+
/* @__PURE__ */ p("button", { className: "sa-interrupt-btn sa-interrupt-btn-primary", disabled: !o, onClick: c, children: [
|
|
1356
1432
|
/* @__PURE__ */ e(B, { name: "check", size: 14 }),
|
|
1357
1433
|
" 提交"
|
|
1358
1434
|
] }),
|
|
@@ -1361,34 +1437,34 @@ function mt({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
|
|
|
1361
1437
|
n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
|
|
1362
1438
|
] });
|
|
1363
1439
|
}
|
|
1364
|
-
function
|
|
1440
|
+
function Se(t) {
|
|
1365
1441
|
return typeof t == "string" ? { value: t, label: t } : t;
|
|
1366
1442
|
}
|
|
1367
|
-
function
|
|
1443
|
+
function At(t, a, n, s) {
|
|
1368
1444
|
switch (t.type) {
|
|
1369
1445
|
case "textarea":
|
|
1370
1446
|
return /* @__PURE__ */ e("textarea", { className: "sa-interrupt-textarea", value: a, onChange: (r) => n(r.target.value), placeholder: t.placeholder, rows: 3, disabled: s });
|
|
1371
1447
|
case "select": {
|
|
1372
|
-
const r = (t.options ?? []).map(
|
|
1373
|
-
return /* @__PURE__ */
|
|
1448
|
+
const r = (t.options ?? []).map(Se);
|
|
1449
|
+
return /* @__PURE__ */ p("select", { className: "sa-interrupt-select", value: a, onChange: (i) => n(i.target.value), disabled: s, children: [
|
|
1374
1450
|
/* @__PURE__ */ e("option", { value: "", children: "请选择" }),
|
|
1375
1451
|
r.map((i) => /* @__PURE__ */ e("option", { value: i.value, children: i.label }, i.value))
|
|
1376
1452
|
] });
|
|
1377
1453
|
}
|
|
1378
1454
|
case "multiSelect": {
|
|
1379
|
-
const r = (t.options ?? []).map(
|
|
1380
|
-
s || n(i.includes(
|
|
1455
|
+
const r = (t.options ?? []).map(Se), i = Array.isArray(a) ? a : [], l = (d) => {
|
|
1456
|
+
s || n(i.includes(d) ? i.filter((o) => o !== d) : [...i, d]);
|
|
1381
1457
|
};
|
|
1382
|
-
return /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((
|
|
1458
|
+
return /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((d) => /* @__PURE__ */ e(
|
|
1383
1459
|
"button",
|
|
1384
1460
|
{
|
|
1385
1461
|
type: "button",
|
|
1386
|
-
className: `sa-interrupt-option ${i.includes(
|
|
1462
|
+
className: `sa-interrupt-option ${i.includes(d.value) ? "sa-interrupt-option-selected" : ""}`,
|
|
1387
1463
|
disabled: s,
|
|
1388
|
-
onClick: () =>
|
|
1389
|
-
children:
|
|
1464
|
+
onClick: () => l(d.value),
|
|
1465
|
+
children: d.label
|
|
1390
1466
|
},
|
|
1391
|
-
|
|
1467
|
+
d.value
|
|
1392
1468
|
)) });
|
|
1393
1469
|
}
|
|
1394
1470
|
case "password":
|
|
@@ -1397,29 +1473,29 @@ function xt(t, a, n, s) {
|
|
|
1397
1473
|
return /* @__PURE__ */ e("input", { className: "sa-interrupt-input", type: t.type === "number" ? "number" : t.type === "date" ? "date" : "text", value: a, onChange: (r) => n(r.target.value), placeholder: t.placeholder, disabled: s });
|
|
1398
1474
|
}
|
|
1399
1475
|
}
|
|
1400
|
-
function
|
|
1476
|
+
function $t({ interrupt: t, resolved: a, response: n, onRespond: s }) {
|
|
1401
1477
|
const r = a, i = n == null ? void 0 : n.value;
|
|
1402
1478
|
switch (t.interruptType) {
|
|
1403
1479
|
case "confirm":
|
|
1404
|
-
return /* @__PURE__ */ e(
|
|
1480
|
+
return /* @__PURE__ */ e(Nt, { interrupt: t, onRespond: s, disabled: r, answeredAction: n == null ? void 0 : n.action });
|
|
1405
1481
|
case "approve":
|
|
1406
|
-
return /* @__PURE__ */ e(
|
|
1482
|
+
return /* @__PURE__ */ e(Ct, { interrupt: t, onRespond: s, disabled: r, answeredAction: n == null ? void 0 : n.action });
|
|
1407
1483
|
case "select":
|
|
1408
|
-
return /* @__PURE__ */ e(
|
|
1484
|
+
return /* @__PURE__ */ e(Tt, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
|
|
1409
1485
|
case "multiSelect":
|
|
1410
|
-
return /* @__PURE__ */ e(
|
|
1486
|
+
return /* @__PURE__ */ e(Mt, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
|
|
1411
1487
|
case "input":
|
|
1412
|
-
return /* @__PURE__ */ e(
|
|
1488
|
+
return /* @__PURE__ */ e(Et, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
|
|
1413
1489
|
case "form":
|
|
1414
|
-
return /* @__PURE__ */ e(
|
|
1490
|
+
return /* @__PURE__ */ e(St, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
|
|
1415
1491
|
default:
|
|
1416
|
-
return /* @__PURE__ */
|
|
1492
|
+
return /* @__PURE__ */ p("div", { className: "sa-interrupt-unknown", children: [
|
|
1417
1493
|
"未知的交互类型: ",
|
|
1418
1494
|
t.interruptType
|
|
1419
1495
|
] });
|
|
1420
1496
|
}
|
|
1421
1497
|
}
|
|
1422
|
-
const
|
|
1498
|
+
const Dt = [
|
|
1423
1499
|
{ value: 1, label: "事实错误" },
|
|
1424
1500
|
{ value: 2, label: "逻辑问题" },
|
|
1425
1501
|
{ value: 3, label: "不相关" },
|
|
@@ -1427,45 +1503,45 @@ const bt = [
|
|
|
1427
1503
|
{ value: 5, label: "冗长啰嗦" },
|
|
1428
1504
|
{ value: 6, label: "难以理解" }
|
|
1429
1505
|
];
|
|
1430
|
-
function
|
|
1431
|
-
const { status: r, cancelFeedback: i } =
|
|
1432
|
-
a(),
|
|
1433
|
-
}, [a]),
|
|
1434
|
-
|
|
1435
|
-
}, [
|
|
1436
|
-
|
|
1437
|
-
}, [
|
|
1438
|
-
|
|
1439
|
-
}, [t.id, s]),
|
|
1440
|
-
|
|
1506
|
+
function Lt({ message: t, onCopy: a, onRegenerate: n, onFeedback: s }) {
|
|
1507
|
+
const { status: r, cancelFeedback: i } = J(), [l, d] = _(null), [o, c] = _(!1), [g, f] = _(!1), y = F(null), b = T(() => {
|
|
1508
|
+
a(), c(!0), setTimeout(() => c(!1), 2e3);
|
|
1509
|
+
}, [a]), M = T(() => {
|
|
1510
|
+
l === "like" ? (d(null), i(t.id)) : (d("like"), f(!1), s == null || s(t.id, "like"));
|
|
1511
|
+
}, [l, t.id, s, i]), m = T(() => {
|
|
1512
|
+
l === "dislike" ? (d(null), f(!1), i(t.id)) : f(!0);
|
|
1513
|
+
}, [l, t.id, i]), I = T((v, z) => {
|
|
1514
|
+
d("dislike"), f(!1), s == null || s(t.id, "dislike", { reason: v, remark: (z == null ? void 0 : z.trim()) || void 0 });
|
|
1515
|
+
}, [t.id, s]), h = T(() => {
|
|
1516
|
+
f(!1);
|
|
1441
1517
|
}, []);
|
|
1442
|
-
return
|
|
1443
|
-
if (!
|
|
1444
|
-
const
|
|
1445
|
-
|
|
1446
|
-
},
|
|
1447
|
-
|
|
1518
|
+
return Y(() => {
|
|
1519
|
+
if (!g) return;
|
|
1520
|
+
const v = (E) => {
|
|
1521
|
+
y.current && !y.current.contains(E.target) && f(!1);
|
|
1522
|
+
}, z = (E) => {
|
|
1523
|
+
E.key === "Escape" && f(!1);
|
|
1448
1524
|
};
|
|
1449
|
-
return document.addEventListener("mousedown",
|
|
1450
|
-
document.removeEventListener("mousedown",
|
|
1525
|
+
return document.addEventListener("mousedown", v), document.addEventListener("keydown", z), () => {
|
|
1526
|
+
document.removeEventListener("mousedown", v), document.removeEventListener("keydown", z);
|
|
1451
1527
|
};
|
|
1452
|
-
}, [
|
|
1453
|
-
/* @__PURE__ */
|
|
1454
|
-
/* @__PURE__ */ e(B, { name:
|
|
1528
|
+
}, [g]), r !== "ready" && r !== "error" ? null : /* @__PURE__ */ p("div", { className: "sa-action-bar", children: [
|
|
1529
|
+
/* @__PURE__ */ p("button", { className: "sa-action-btn", onClick: b, title: "复制", children: [
|
|
1530
|
+
/* @__PURE__ */ e(B, { name: o ? "circle-check" : "copy", size: 14 }),
|
|
1455
1531
|
" ",
|
|
1456
|
-
|
|
1532
|
+
o ? "已复制" : "复制"
|
|
1457
1533
|
] }),
|
|
1458
|
-
n && /* @__PURE__ */
|
|
1534
|
+
n && /* @__PURE__ */ p("button", { className: "sa-action-btn", onClick: n, title: "重新生成", children: [
|
|
1459
1535
|
/* @__PURE__ */ e(B, { name: "refresh-cw", size: 14 }),
|
|
1460
1536
|
" 重新生成"
|
|
1461
1537
|
] }),
|
|
1462
|
-
s && /* @__PURE__ */
|
|
1538
|
+
s && /* @__PURE__ */ p(V, { children: [
|
|
1463
1539
|
/* @__PURE__ */ e("span", { className: "sa-action-divider" }),
|
|
1464
1540
|
/* @__PURE__ */ e(
|
|
1465
1541
|
"button",
|
|
1466
1542
|
{
|
|
1467
|
-
className: `sa-action-btn ${
|
|
1468
|
-
onClick:
|
|
1543
|
+
className: `sa-action-btn ${l === "like" ? "sa-action-btn-active" : ""}`,
|
|
1544
|
+
onClick: M,
|
|
1469
1545
|
title: "有用",
|
|
1470
1546
|
"aria-label": "点赞",
|
|
1471
1547
|
children: /* @__PURE__ */ e(B, { name: "thumbs-up", size: 14 })
|
|
@@ -1474,31 +1550,31 @@ function vt({ message: t, onCopy: a, onRegenerate: n, onFeedback: s }) {
|
|
|
1474
1550
|
/* @__PURE__ */ e(
|
|
1475
1551
|
"button",
|
|
1476
1552
|
{
|
|
1477
|
-
className: `sa-action-btn ${
|
|
1478
|
-
onClick:
|
|
1553
|
+
className: `sa-action-btn ${l === "dislike" ? "sa-action-btn-active" : ""}`,
|
|
1554
|
+
onClick: m,
|
|
1479
1555
|
title: "无用",
|
|
1480
1556
|
"aria-label": "踩",
|
|
1481
|
-
"aria-expanded":
|
|
1557
|
+
"aria-expanded": g,
|
|
1482
1558
|
"aria-haspopup": "dialog",
|
|
1483
1559
|
children: /* @__PURE__ */ e(B, { name: "thumbs-down", size: 14 })
|
|
1484
1560
|
}
|
|
1485
1561
|
)
|
|
1486
1562
|
] }),
|
|
1487
|
-
|
|
1563
|
+
g && /* @__PURE__ */ e("div", { ref: y, children: /* @__PURE__ */ e(_t, { onSubmit: I, onCancel: h }) })
|
|
1488
1564
|
] });
|
|
1489
1565
|
}
|
|
1490
|
-
function
|
|
1491
|
-
const [n, s] =
|
|
1492
|
-
return /* @__PURE__ */
|
|
1566
|
+
function _t({ onSubmit: t, onCancel: a }) {
|
|
1567
|
+
const [n, s] = _(void 0), [r, i] = _("");
|
|
1568
|
+
return /* @__PURE__ */ p("div", { className: "sa-dislike-panel", children: [
|
|
1493
1569
|
/* @__PURE__ */ e("div", { className: "sa-dislike-panel-title", children: "请选择不满意的原因(可选)" }),
|
|
1494
|
-
/* @__PURE__ */ e("div", { className: "sa-dislike-reasons", children:
|
|
1570
|
+
/* @__PURE__ */ e("div", { className: "sa-dislike-reasons", children: Dt.map((l) => /* @__PURE__ */ e(
|
|
1495
1571
|
"button",
|
|
1496
1572
|
{
|
|
1497
|
-
className: `sa-dislike-reason-btn ${n ===
|
|
1498
|
-
onClick: () => s(n ===
|
|
1499
|
-
children:
|
|
1573
|
+
className: `sa-dislike-reason-btn ${n === l.value ? "active" : ""}`,
|
|
1574
|
+
onClick: () => s(n === l.value ? void 0 : l.value),
|
|
1575
|
+
children: l.label
|
|
1500
1576
|
},
|
|
1501
|
-
|
|
1577
|
+
l.value
|
|
1502
1578
|
)) }),
|
|
1503
1579
|
/* @__PURE__ */ e(
|
|
1504
1580
|
"textarea",
|
|
@@ -1507,182 +1583,194 @@ function yt({ onSubmit: t, onCancel: a }) {
|
|
|
1507
1583
|
placeholder: "补充描述(选填,≤500 字)",
|
|
1508
1584
|
maxLength: 500,
|
|
1509
1585
|
value: r,
|
|
1510
|
-
onChange: (
|
|
1586
|
+
onChange: (l) => i(l.target.value),
|
|
1511
1587
|
rows: 2
|
|
1512
1588
|
}
|
|
1513
1589
|
),
|
|
1514
|
-
/* @__PURE__ */
|
|
1590
|
+
/* @__PURE__ */ p("div", { className: "sa-dislike-actions", children: [
|
|
1515
1591
|
/* @__PURE__ */ e("button", { className: "sa-dislike-submit", onClick: () => t(n, r || void 0), children: "提交" }),
|
|
1516
1592
|
/* @__PURE__ */ e("button", { className: "sa-dislike-cancel", onClick: a, children: "取消" })
|
|
1517
1593
|
] })
|
|
1518
1594
|
] });
|
|
1519
1595
|
}
|
|
1520
|
-
const
|
|
1521
|
-
function
|
|
1522
|
-
return t ?
|
|
1596
|
+
const Rt = /^(https?:\/\/|data:|blob:|\/\/|\/|\.\/|\.\.\/)/;
|
|
1597
|
+
function Ae({ src: t, alt: a }) {
|
|
1598
|
+
return t ? Rt.test(t) ? /* @__PURE__ */ e("img", { src: t, alt: a ?? "", className: "sa-msg-avatar", draggable: !1 }) : /* @__PURE__ */ e("span", { className: "sa-msg-avatar sa-msg-avatar-text", children: t }) : null;
|
|
1523
1599
|
}
|
|
1524
|
-
function
|
|
1600
|
+
function Ft({
|
|
1525
1601
|
message: t,
|
|
1526
1602
|
isStreaming: a,
|
|
1527
1603
|
isLast: n,
|
|
1528
1604
|
slots: s,
|
|
1529
1605
|
avatar: r,
|
|
1530
1606
|
artifactPreview: i,
|
|
1531
|
-
showTimestamp:
|
|
1607
|
+
showTimestamp: l
|
|
1532
1608
|
}) {
|
|
1533
|
-
const { regenerate:
|
|
1534
|
-
var
|
|
1535
|
-
const
|
|
1609
|
+
const { regenerate: d, feedback: o, respondToInterrupt: c } = J(), g = T(() => {
|
|
1610
|
+
var $;
|
|
1611
|
+
const E = t.parts.filter((A) => A.type === "text").map((A) => A.content).join(`
|
|
1536
1612
|
`);
|
|
1537
|
-
(
|
|
1613
|
+
($ = navigator.clipboard) == null || $.writeText(E).catch(() => {
|
|
1538
1614
|
});
|
|
1539
|
-
}, [t]),
|
|
1540
|
-
if (
|
|
1615
|
+
}, [t]), f = t.role === "user", y = s.Message;
|
|
1616
|
+
if (y)
|
|
1541
1617
|
return /* @__PURE__ */ e(
|
|
1542
|
-
|
|
1618
|
+
y,
|
|
1543
1619
|
{
|
|
1544
1620
|
message: t,
|
|
1545
1621
|
isStreaming: a,
|
|
1546
1622
|
isLast: n,
|
|
1547
1623
|
avatar: r,
|
|
1548
1624
|
slots: s,
|
|
1549
|
-
onCopy:
|
|
1550
|
-
onRegenerate:
|
|
1551
|
-
onFeedback:
|
|
1552
|
-
showTimestamp:
|
|
1625
|
+
onCopy: g,
|
|
1626
|
+
onRegenerate: d,
|
|
1627
|
+
onFeedback: o,
|
|
1628
|
+
showTimestamp: l
|
|
1553
1629
|
}
|
|
1554
1630
|
);
|
|
1555
|
-
const
|
|
1556
|
-
return /* @__PURE__ */
|
|
1631
|
+
const b = s.TextPart ?? ft, M = s.ThinkingPart ?? xt, m = s.ToolCallPart ?? wt, I = s.ToolResultPart ?? vt, h = s.ErrorPart ?? yt, v = s.ActionBar ?? Lt, z = !f && t.parts.some((E) => E.type === "text" && E.content);
|
|
1632
|
+
return /* @__PURE__ */ p(
|
|
1557
1633
|
"div",
|
|
1558
1634
|
{
|
|
1559
|
-
className: `sa-message ${
|
|
1635
|
+
className: `sa-message ${f ? "sa-message-user" : "sa-message-assistant"}`,
|
|
1560
1636
|
children: [
|
|
1561
|
-
!
|
|
1562
|
-
|
|
1637
|
+
!f && /* @__PURE__ */ e(
|
|
1638
|
+
Ae,
|
|
1563
1639
|
{
|
|
1564
|
-
src: (r == null ? void 0 : r.assistant) || (a && n ?
|
|
1640
|
+
src: (r == null ? void 0 : r.assistant) || (a && n ? K.assistantAvatarGenerating : K.assistantAvatar),
|
|
1565
1641
|
alt: "AI"
|
|
1566
1642
|
}
|
|
1567
1643
|
),
|
|
1568
|
-
/* @__PURE__ */
|
|
1569
|
-
|
|
1644
|
+
/* @__PURE__ */ p("div", { className: "sa-message-content", children: [
|
|
1645
|
+
l && /* @__PURE__ */ e(
|
|
1570
1646
|
"span",
|
|
1571
1647
|
{
|
|
1572
|
-
className: `sa-message-time ${
|
|
1573
|
-
children:
|
|
1648
|
+
className: `sa-message-time ${f ? "sa-message-time-right" : ""}`,
|
|
1649
|
+
children: ct(t.timestamp)
|
|
1574
1650
|
}
|
|
1575
1651
|
),
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
t.parts.map((
|
|
1578
|
-
switch (
|
|
1652
|
+
/* @__PURE__ */ p("div", { className: "sa-message-body", children: [
|
|
1653
|
+
t.parts.map((E, $) => {
|
|
1654
|
+
switch (E.type) {
|
|
1579
1655
|
case "text":
|
|
1580
|
-
return /* @__PURE__ */ e(
|
|
1656
|
+
return /* @__PURE__ */ e(b, { content: E.content }, $);
|
|
1657
|
+
case "attachment":
|
|
1658
|
+
return /* @__PURE__ */ e(kt, { attachment: E.attachment }, $);
|
|
1581
1659
|
case "thinking":
|
|
1582
|
-
return /* @__PURE__ */ e(
|
|
1660
|
+
return /* @__PURE__ */ e(M, { content: E.content }, $);
|
|
1583
1661
|
case "tool_call":
|
|
1584
1662
|
return /* @__PURE__ */ e(
|
|
1585
|
-
|
|
1663
|
+
m,
|
|
1586
1664
|
{
|
|
1587
|
-
toolName:
|
|
1588
|
-
toolCallId:
|
|
1589
|
-
args:
|
|
1665
|
+
toolName: E.toolName,
|
|
1666
|
+
toolCallId: E.toolCallId,
|
|
1667
|
+
args: E.args
|
|
1590
1668
|
},
|
|
1591
|
-
|
|
1669
|
+
$
|
|
1592
1670
|
);
|
|
1593
1671
|
case "tool_result":
|
|
1594
1672
|
return /* @__PURE__ */ e(
|
|
1595
|
-
|
|
1673
|
+
I,
|
|
1596
1674
|
{
|
|
1597
|
-
toolName:
|
|
1598
|
-
toolCallId:
|
|
1599
|
-
content:
|
|
1600
|
-
artifacts:
|
|
1601
|
-
renderMode:
|
|
1602
|
-
html:
|
|
1675
|
+
toolName: E.toolName,
|
|
1676
|
+
toolCallId: E.toolCallId,
|
|
1677
|
+
content: E.content,
|
|
1678
|
+
artifacts: E.artifacts,
|
|
1679
|
+
renderMode: E.renderMode,
|
|
1680
|
+
html: E.html,
|
|
1603
1681
|
artifactPreview: i
|
|
1604
1682
|
},
|
|
1605
|
-
|
|
1683
|
+
$
|
|
1606
1684
|
);
|
|
1607
1685
|
case "error":
|
|
1608
1686
|
return /* @__PURE__ */ e(
|
|
1609
|
-
|
|
1687
|
+
h,
|
|
1610
1688
|
{
|
|
1611
|
-
content:
|
|
1612
|
-
onRetry:
|
|
1689
|
+
content: E.content,
|
|
1690
|
+
onRetry: d
|
|
1613
1691
|
},
|
|
1614
|
-
|
|
1692
|
+
$
|
|
1615
1693
|
);
|
|
1616
1694
|
case "interrupt":
|
|
1617
1695
|
return /* @__PURE__ */ e(
|
|
1618
|
-
|
|
1696
|
+
$t,
|
|
1619
1697
|
{
|
|
1620
|
-
interrupt:
|
|
1621
|
-
resolved:
|
|
1622
|
-
response:
|
|
1623
|
-
onRespond: (
|
|
1698
|
+
interrupt: E.interrupt,
|
|
1699
|
+
resolved: E.resolved ?? !1,
|
|
1700
|
+
response: E.response,
|
|
1701
|
+
onRespond: (A) => c(E.interrupt.interruptId, A)
|
|
1624
1702
|
},
|
|
1625
|
-
|
|
1703
|
+
$
|
|
1626
1704
|
);
|
|
1627
1705
|
default:
|
|
1628
1706
|
return null;
|
|
1629
1707
|
}
|
|
1630
1708
|
}),
|
|
1631
|
-
a && n && !
|
|
1632
|
-
!
|
|
1633
|
-
|
|
1709
|
+
a && n && !f && !z && /* @__PURE__ */ e("span", { className: "sa-thinking-indicator", children: "思考中…" }),
|
|
1710
|
+
!f && !a && z && /* @__PURE__ */ e(
|
|
1711
|
+
v,
|
|
1634
1712
|
{
|
|
1635
1713
|
message: t,
|
|
1636
|
-
onCopy:
|
|
1637
|
-
onRegenerate: n ?
|
|
1638
|
-
onFeedback:
|
|
1714
|
+
onCopy: g,
|
|
1715
|
+
onRegenerate: n ? d : void 0,
|
|
1716
|
+
onFeedback: o
|
|
1639
1717
|
}
|
|
1640
1718
|
)
|
|
1641
1719
|
] })
|
|
1642
1720
|
] }),
|
|
1643
|
-
|
|
1721
|
+
f && (r == null ? void 0 : r.user) && /* @__PURE__ */ e(Ae, { src: r.user, alt: "用户" })
|
|
1644
1722
|
]
|
|
1645
1723
|
}
|
|
1646
1724
|
);
|
|
1647
1725
|
}
|
|
1648
|
-
function
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1726
|
+
function Ht({ message: t, suggestedPrompts: a, onPromptClick: n, capabilities: s, quickLinks: r, logo: i, openPanel: l }) {
|
|
1727
|
+
const d = (o) => {
|
|
1728
|
+
if (o.onClick) {
|
|
1729
|
+
o.onClick();
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
const c = o.action;
|
|
1733
|
+
if (!c) {
|
|
1734
|
+
o.prompt && n(o.prompt);
|
|
1735
|
+
return;
|
|
1736
|
+
}
|
|
1737
|
+
l == null || l(c.type === "link" ? c : { ...c, title: c.title ?? o.label });
|
|
1738
|
+
};
|
|
1739
|
+
return /* @__PURE__ */ p("div", { className: "flex flex-col gap-8 py-2", children: [
|
|
1740
|
+
/* @__PURE__ */ p("div", { className: "flex flex-col items-center gap-1 opacity-0 animate-sa-home-fade-in", children: [
|
|
1741
|
+
/* @__PURE__ */ e("img", { src: i || K.logo, alt: "AI 助手", className: "block max-w-16 shrink-0 animate-sa-logo-float", draggable: !1 }),
|
|
1652
1742
|
/* @__PURE__ */ e("h3", { className: "sa-shimmer-text m-0 mb-1 text-[18px] font-bold leading-[1.3] text-[#333] animate-sa-title-shimmer", children: t || "你好!有什么可以帮你的?" })
|
|
1653
1743
|
] }),
|
|
1654
|
-
s && s.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-4 opacity-0 animate-sa-home-fade-in", style: { animationDelay: "150ms" }, children: s.map((o) => /* @__PURE__ */
|
|
1744
|
+
s && s.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-4 opacity-0 animate-sa-home-fade-in", style: { animationDelay: "150ms" }, children: s.map((o) => /* @__PURE__ */ p("div", { className: "inline-flex w-full max-w-full min-w-0 items-center gap-[7px]", children: [
|
|
1655
1745
|
o.icon && /* @__PURE__ */ e("img", { src: o.icon, alt: "", className: "h-[18px] w-[18px] shrink-0 object-contain", draggable: !1 }),
|
|
1656
1746
|
/* @__PURE__ */ e("span", { className: "shrink-0 text-[14px] leading-[1.4] text-[#333]", children: o.label }),
|
|
1657
|
-
o.desc && /* @__PURE__ */
|
|
1747
|
+
o.desc && /* @__PURE__ */ p(V, { children: [
|
|
1658
1748
|
/* @__PURE__ */ e("span", { className: "h-[13px] w-px shrink-0 bg-[#DCDCDC]" }),
|
|
1659
1749
|
/* @__PURE__ */ e("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-[14px] leading-[1.4] text-[#9A9A9A]", children: o.desc })
|
|
1660
1750
|
] })
|
|
1661
1751
|
] }, o.label)) }),
|
|
1662
|
-
a && a.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-3", children: a.map((o,
|
|
1752
|
+
a && a.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-3", children: a.map((o, c) => /* @__PURE__ */ p(
|
|
1663
1753
|
"button",
|
|
1664
1754
|
{
|
|
1665
1755
|
type: "button",
|
|
1666
1756
|
className: "sa-chip inline-flex h-7 items-center gap-1 rounded-md px-3 text-[14px] leading-none text-[#333] opacity-0 transition-colors animate-sa-chip-in",
|
|
1667
|
-
style: { animationDelay: `${300 +
|
|
1757
|
+
style: { animationDelay: `${300 + c * 130}ms` },
|
|
1668
1758
|
onClick: () => n(o),
|
|
1669
1759
|
children: [
|
|
1670
1760
|
/* @__PURE__ */ e("span", { className: "sa-chip-text overflow-hidden text-ellipsis whitespace-nowrap", children: o }),
|
|
1671
1761
|
/* @__PURE__ */ e("svg", { width: 13, height: 13, viewBox: "0 0 14 14", fill: "none", className: "shrink-0 text-[#9A9A9A]", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M5 3L9 7L5 11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1672
1762
|
]
|
|
1673
1763
|
},
|
|
1674
|
-
`${o}-${
|
|
1764
|
+
`${o}-${c}`
|
|
1675
1765
|
)) }),
|
|
1676
|
-
r && r.length > 0 && /* @__PURE__ */
|
|
1766
|
+
r && r.length > 0 && /* @__PURE__ */ p("div", { className: "opacity-0 animate-sa-home-fade-in", style: { animationDelay: "420ms" }, children: [
|
|
1677
1767
|
/* @__PURE__ */ e("div", { className: "mb-3 text-[14px] leading-none text-[#A0A0A0]", children: "快速查看" }),
|
|
1678
|
-
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-[22px]", children: r.map((o) => /* @__PURE__ */
|
|
1768
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-[22px]", children: r.map((o) => /* @__PURE__ */ p(
|
|
1679
1769
|
"button",
|
|
1680
1770
|
{
|
|
1681
1771
|
type: "button",
|
|
1682
1772
|
className: "inline-flex items-center gap-[7px] rounded-md px-1 py-1 transition-colors hover:bg-[#F5F5F5]",
|
|
1683
|
-
onClick: () =>
|
|
1684
|
-
o.onClick ? o.onClick() : o.prompt && n(o.prompt);
|
|
1685
|
-
},
|
|
1773
|
+
onClick: () => d(o),
|
|
1686
1774
|
children: [
|
|
1687
1775
|
o.icon && /* @__PURE__ */ e("span", { className: "flex h-[18px] w-[18px] shrink-0 items-center justify-center opacity-70", children: /* @__PURE__ */ e("img", { src: o.icon, alt: "", width: 18, height: 18, draggable: !1 }) }),
|
|
1688
1776
|
/* @__PURE__ */ e("span", { className: "text-[14px] leading-none text-[#333] transition-colors hover:text-[#1881F0]", children: o.label })
|
|
@@ -1693,47 +1781,51 @@ function Nt({ message: t, suggestedPrompts: a, onPromptClick: n, capabilities: s
|
|
|
1693
1781
|
] })
|
|
1694
1782
|
] });
|
|
1695
1783
|
}
|
|
1696
|
-
function
|
|
1697
|
-
const { messages:
|
|
1698
|
-
return
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1784
|
+
function Pe({ slots: t, welcomeMessage: a, suggestedPrompts: n, avatar: s, artifactPreview: r, capabilities: i, quickLinks: l, logo: d, showTimestamp: o }) {
|
|
1785
|
+
const { messages: c, status: g, sendMessage: f, openPanel: y } = J(), { containerRef: b } = pt([c]), M = g === "streaming", m = t.WelcomeScreen ?? Ht, I = t.AppendContainer;
|
|
1786
|
+
return c.length === 0 ? /* @__PURE__ */ p("div", { className: "sa-thread", ref: b, children: [
|
|
1787
|
+
/* @__PURE__ */ e(
|
|
1788
|
+
m,
|
|
1789
|
+
{
|
|
1790
|
+
message: a,
|
|
1791
|
+
suggestedPrompts: n,
|
|
1792
|
+
onPromptClick: f,
|
|
1793
|
+
capabilities: i,
|
|
1794
|
+
quickLinks: l,
|
|
1795
|
+
logo: d,
|
|
1796
|
+
openPanel: y
|
|
1797
|
+
}
|
|
1798
|
+
),
|
|
1799
|
+
I && /* @__PURE__ */ e(I, { openPanel: y })
|
|
1800
|
+
] }) : /* @__PURE__ */ e("div", { className: "sa-thread", ref: b, children: c.map((h, v) => /* @__PURE__ */ e(
|
|
1801
|
+
Ft,
|
|
1710
1802
|
{
|
|
1711
|
-
message:
|
|
1712
|
-
isStreaming:
|
|
1713
|
-
isLast:
|
|
1803
|
+
message: h,
|
|
1804
|
+
isStreaming: M,
|
|
1805
|
+
isLast: v === c.length - 1,
|
|
1714
1806
|
slots: t,
|
|
1715
1807
|
avatar: s,
|
|
1716
1808
|
artifactPreview: r,
|
|
1717
|
-
showTimestamp:
|
|
1809
|
+
showTimestamp: o
|
|
1718
1810
|
},
|
|
1719
|
-
|
|
1811
|
+
h.id
|
|
1720
1812
|
)) });
|
|
1721
1813
|
}
|
|
1722
|
-
function
|
|
1723
|
-
const s =
|
|
1724
|
-
return
|
|
1814
|
+
function Pt({ items: t, activeIndex: a, onSelect: n }) {
|
|
1815
|
+
const s = F(null);
|
|
1816
|
+
return Y(() => {
|
|
1725
1817
|
var i;
|
|
1726
1818
|
const r = (i = s.current) == null ? void 0 : i.children[a];
|
|
1727
1819
|
r == null || r.scrollIntoView({ block: "nearest" });
|
|
1728
|
-
}, [a]), t.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-slash-menu", children: /* @__PURE__ */ e("div", { className: "sa-slash-menu-empty", children: "没有匹配的技能" }) }) : /* @__PURE__ */ e("div", { className: "sa-slash-menu", ref: s, children: t.map((r, i) => /* @__PURE__ */
|
|
1820
|
+
}, [a]), t.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-slash-menu", children: /* @__PURE__ */ e("div", { className: "sa-slash-menu-empty", children: "没有匹配的技能" }) }) : /* @__PURE__ */ e("div", { className: "sa-slash-menu", ref: s, children: t.map((r, i) => /* @__PURE__ */ p(
|
|
1729
1821
|
"div",
|
|
1730
1822
|
{
|
|
1731
1823
|
className: `sa-slash-menu-item${i === a ? " sa-slash-menu-item--active" : ""}`,
|
|
1732
|
-
onMouseDown: (
|
|
1733
|
-
|
|
1824
|
+
onMouseDown: (l) => {
|
|
1825
|
+
l.preventDefault(), n(r);
|
|
1734
1826
|
},
|
|
1735
1827
|
children: [
|
|
1736
|
-
/* @__PURE__ */
|
|
1828
|
+
/* @__PURE__ */ p("span", { className: "sa-slash-menu-item-name", children: [
|
|
1737
1829
|
"/",
|
|
1738
1830
|
r.name
|
|
1739
1831
|
] }),
|
|
@@ -1743,97 +1835,186 @@ function zt({ items: t, activeIndex: a, onSelect: n }) {
|
|
|
1743
1835
|
r.code
|
|
1744
1836
|
)) });
|
|
1745
1837
|
}
|
|
1746
|
-
function
|
|
1747
|
-
const [s, r] =
|
|
1748
|
-
|
|
1749
|
-
|
|
1838
|
+
function Bt({ sdk: t, input: a, onSelect: n }) {
|
|
1839
|
+
const [s, r] = _([]), [i, l] = _(!1), [d, o] = _(0), c = F(!1);
|
|
1840
|
+
Y(() => {
|
|
1841
|
+
c.current || (c.current = !0, t.listSkills().then(r).catch(() => r([])));
|
|
1750
1842
|
}, [t]);
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
}, [
|
|
1755
|
-
|
|
1756
|
-
}, [a,
|
|
1757
|
-
const
|
|
1843
|
+
const g = /^\/\S*$/.test(a);
|
|
1844
|
+
Y(() => {
|
|
1845
|
+
l(g);
|
|
1846
|
+
}, [g]), Y(() => {
|
|
1847
|
+
g && o(0);
|
|
1848
|
+
}, [a, g]);
|
|
1849
|
+
const f = a.startsWith("/") ? a.slice(1).toLowerCase() : "", y = re(
|
|
1758
1850
|
() => s.filter(
|
|
1759
|
-
(
|
|
1851
|
+
(z) => !f || z.code.toLowerCase().includes(f) || z.name.toLowerCase().includes(f) || z.displayName && z.displayName.toLowerCase().includes(f)
|
|
1760
1852
|
),
|
|
1761
|
-
[s,
|
|
1762
|
-
),
|
|
1763
|
-
|
|
1764
|
-
const
|
|
1765
|
-
if (!
|
|
1766
|
-
switch (
|
|
1853
|
+
[s, f]
|
|
1854
|
+
), b = F(i), M = F(y), m = F(d), I = F(n);
|
|
1855
|
+
b.current = i, M.current = y, m.current = d, I.current = n;
|
|
1856
|
+
const h = T((z) => {
|
|
1857
|
+
if (!b.current || M.current.length === 0) return !1;
|
|
1858
|
+
switch (z.key) {
|
|
1767
1859
|
case "ArrowDown":
|
|
1768
|
-
return
|
|
1860
|
+
return z.preventDefault(), o((E) => (E + 1) % M.current.length), !0;
|
|
1769
1861
|
case "ArrowUp":
|
|
1770
|
-
return
|
|
1862
|
+
return z.preventDefault(), o((E) => (E - 1 + M.current.length) % M.current.length), !0;
|
|
1771
1863
|
case "Enter":
|
|
1772
1864
|
case "Tab":
|
|
1773
|
-
return
|
|
1865
|
+
return z.preventDefault(), I.current(M.current[m.current]), l(!1), !0;
|
|
1774
1866
|
case "Escape":
|
|
1775
|
-
return
|
|
1867
|
+
return z.preventDefault(), l(!1), !0;
|
|
1776
1868
|
default:
|
|
1777
1869
|
return !1;
|
|
1778
1870
|
}
|
|
1779
|
-
}, []),
|
|
1780
|
-
return { isOpen: i, items:
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1871
|
+
}, []), v = T(() => l(!1), []);
|
|
1872
|
+
return { isOpen: i, items: y, activeIndex: d, handleKeyDown: h, close: v };
|
|
1873
|
+
}
|
|
1874
|
+
const Ot = 10;
|
|
1875
|
+
function jt({ size: t = 16 }) {
|
|
1876
|
+
return /* @__PURE__ */ e("svg", { width: t, height: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" }) });
|
|
1877
|
+
}
|
|
1878
|
+
function Be() {
|
|
1879
|
+
const { status: t, sendMessage: a, stop: n, sdk: s, attachmentUploader: r, nosUpload: i } = J(), [l, d] = _(""), [o, c] = _([]), g = F(null), f = F(null), y = !!r || !!i, b = t === "streaming" || t === "submitted", M = o.filter((u) => u.attachment), m = o.some((u) => !u.attachment && u.status === "uploading"), I = !!l.trim() || o.length > 0 || b, h = !b && !m && (l.trim().length > 0 || M.length > 0), v = T((u) => {
|
|
1880
|
+
d(`/${u.name} `), setTimeout(() => {
|
|
1881
|
+
const S = g.current;
|
|
1882
|
+
S && (S.focus(), S.selectionStart = S.selectionEnd = S.value.length);
|
|
1787
1883
|
}, 0);
|
|
1788
|
-
}, []),
|
|
1884
|
+
}, []), z = Bt({
|
|
1789
1885
|
sdk: s,
|
|
1790
|
-
input:
|
|
1791
|
-
onSelect:
|
|
1792
|
-
}),
|
|
1793
|
-
const
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1886
|
+
input: l,
|
|
1887
|
+
onSelect: v
|
|
1888
|
+
}), E = T((u) => {
|
|
1889
|
+
const S = Array.from(u.target.files ?? []);
|
|
1890
|
+
if (u.target.value = "", !y || S.length === 0) return;
|
|
1891
|
+
const H = Ot - o.length, O = S.slice(0, Math.max(0, H));
|
|
1892
|
+
if (O.length === 0) return;
|
|
1893
|
+
const N = O.map((x) => ({
|
|
1894
|
+
key: `${x.name}_${x.size}_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
|
|
1895
|
+
file: x,
|
|
1896
|
+
status: "uploading"
|
|
1897
|
+
}));
|
|
1898
|
+
c((x) => [...x, ...N]);
|
|
1899
|
+
for (const { key: x, file: L } of N)
|
|
1900
|
+
(r || tt({
|
|
1901
|
+
baseURL: i.baseURL,
|
|
1902
|
+
headers: i.headers,
|
|
1903
|
+
trunkSize: i.trunkSize,
|
|
1904
|
+
onProgress: (R) => c((j) => j.map((C) => C.key === x ? { ...C, percent: R } : C))
|
|
1905
|
+
}))(L).then((R) => {
|
|
1906
|
+
c(
|
|
1907
|
+
(j) => j.map(
|
|
1908
|
+
(C) => C.key === x ? { ...C, attachment: { ...R, filename: R.filename || L.name, size: R.size ?? L.size, mime: R.mime ?? L.type } } : C
|
|
1909
|
+
)
|
|
1910
|
+
);
|
|
1911
|
+
}).catch((R) => {
|
|
1912
|
+
c(
|
|
1913
|
+
(j) => j.map(
|
|
1914
|
+
(C) => C.key === x ? { ...C, status: "error", errorMsg: R instanceof Error ? R.message : String(R) } : C
|
|
1915
|
+
)
|
|
1916
|
+
);
|
|
1917
|
+
});
|
|
1918
|
+
}, [r, i, o]), $ = T((u) => {
|
|
1919
|
+
c((S) => S.filter((H) => H.key !== u));
|
|
1920
|
+
}, []), A = T(() => {
|
|
1921
|
+
if (!h) return;
|
|
1922
|
+
const u = l.trim(), S = M.map((H) => H.attachment);
|
|
1923
|
+
a(u, S.length > 0 ? S : void 0), d(""), c([]), g.current && (g.current.style.height = "auto");
|
|
1924
|
+
}, [h, l, M, a]), w = T((u) => {
|
|
1925
|
+
z.handleKeyDown(u) || u.key === "Enter" && !u.shiftKey && (u.preventDefault(), A());
|
|
1926
|
+
}, [A, z.handleKeyDown]), D = T((u) => {
|
|
1927
|
+
d(u.target.value);
|
|
1928
|
+
const S = u.target;
|
|
1929
|
+
S.style.height = "auto", S.style.height = Math.min(S.scrollHeight, 90) + "px";
|
|
1930
|
+
}, []), P = T(() => {
|
|
1931
|
+
var u;
|
|
1932
|
+
b || (u = g.current) == null || u.focus();
|
|
1933
|
+
}, [b]);
|
|
1934
|
+
return /* @__PURE__ */ p("div", { className: "relative z-[2] shrink-0 px-[15px] pb-2.5", children: [
|
|
1935
|
+
z.isOpen && /* @__PURE__ */ e(
|
|
1936
|
+
Pt,
|
|
1808
1937
|
{
|
|
1809
|
-
items:
|
|
1810
|
-
activeIndex:
|
|
1811
|
-
onSelect:
|
|
1938
|
+
items: z.items,
|
|
1939
|
+
activeIndex: z.activeIndex,
|
|
1940
|
+
onSelect: v
|
|
1812
1941
|
}
|
|
1813
1942
|
),
|
|
1814
|
-
/* @__PURE__ */
|
|
1943
|
+
/* @__PURE__ */ p(
|
|
1815
1944
|
"form",
|
|
1816
1945
|
{
|
|
1817
|
-
className: `sa-input-form flex min-h-[70px] cursor-text items-start gap-2 rounded-[5px] p-2 ${
|
|
1818
|
-
onClick:
|
|
1819
|
-
onSubmit: (
|
|
1820
|
-
|
|
1946
|
+
className: `sa-input-form flex min-h-[70px] cursor-text items-start gap-2 rounded-[5px] p-2 ${I ? "sa-input-form-active" : ""}`,
|
|
1947
|
+
onClick: P,
|
|
1948
|
+
onSubmit: (u) => {
|
|
1949
|
+
u.preventDefault(), A();
|
|
1821
1950
|
},
|
|
1822
1951
|
children: [
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
"
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1952
|
+
/* @__PURE__ */ p("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
1953
|
+
o.length > 0 && /* @__PURE__ */ e("div", { className: "sa-attachment-tray", onClick: (u) => u.stopPropagation(), children: o.map((u) => /* @__PURE__ */ p(
|
|
1954
|
+
"span",
|
|
1955
|
+
{
|
|
1956
|
+
className: `sa-attachment-tray-chip ${u.status === "error" ? "sa-attachment-tray-chip-error" : ""}`,
|
|
1957
|
+
title: u.status === "error" ? `上传失败:${u.errorMsg ?? ""}` : u.file.name,
|
|
1958
|
+
children: [
|
|
1959
|
+
/* @__PURE__ */ e(B, { name: "file-text", size: 13, color: u.status === "error" ? "#ef4444" : "#6366f1" }),
|
|
1960
|
+
/* @__PURE__ */ e("span", { className: "sa-attachment-tray-chip-name", children: u.file.name }),
|
|
1961
|
+
/* @__PURE__ */ e("span", { className: "sa-attachment-tray-chip-size", children: u.attachment ? He(u.file.size) : u.status === "error" ? "失败" : u.percent != null ? `${Math.min(99, Math.round(u.percent))}%` : "上传中…" }),
|
|
1962
|
+
/* @__PURE__ */ e(
|
|
1963
|
+
"button",
|
|
1964
|
+
{
|
|
1965
|
+
type: "button",
|
|
1966
|
+
className: "sa-attachment-tray-chip-remove",
|
|
1967
|
+
"aria-label": `移除附件 ${u.file.name}`,
|
|
1968
|
+
onClick: () => $(u.key),
|
|
1969
|
+
children: "✕"
|
|
1970
|
+
}
|
|
1971
|
+
)
|
|
1972
|
+
]
|
|
1973
|
+
},
|
|
1974
|
+
u.key
|
|
1975
|
+
)) }),
|
|
1976
|
+
/* @__PURE__ */ p("div", { className: "flex items-end gap-2", children: [
|
|
1977
|
+
y && !b && /* @__PURE__ */ e(
|
|
1978
|
+
"button",
|
|
1979
|
+
{
|
|
1980
|
+
type: "button",
|
|
1981
|
+
className: "sa-attach-btn",
|
|
1982
|
+
"aria-label": "添加附件",
|
|
1983
|
+
title: "添加附件",
|
|
1984
|
+
onClick: () => {
|
|
1985
|
+
var u;
|
|
1986
|
+
return (u = f.current) == null ? void 0 : u.click();
|
|
1987
|
+
},
|
|
1988
|
+
children: /* @__PURE__ */ e(jt, { size: 15 })
|
|
1989
|
+
}
|
|
1990
|
+
),
|
|
1991
|
+
/* @__PURE__ */ e(
|
|
1992
|
+
"input",
|
|
1993
|
+
{
|
|
1994
|
+
ref: f,
|
|
1995
|
+
type: "file",
|
|
1996
|
+
multiple: !0,
|
|
1997
|
+
className: "hidden",
|
|
1998
|
+
onChange: E,
|
|
1999
|
+
"aria-label": "选择附件"
|
|
2000
|
+
}
|
|
2001
|
+
),
|
|
2002
|
+
/* @__PURE__ */ e(
|
|
2003
|
+
"textarea",
|
|
2004
|
+
{
|
|
2005
|
+
ref: g,
|
|
2006
|
+
className: "sa-input-field min-h-[34px] flex-1 resize-none border-none bg-transparent p-0 text-[14px] leading-[1.5] text-[#333] outline-none placeholder:text-[#B8B8B8]",
|
|
2007
|
+
value: l,
|
|
2008
|
+
onChange: D,
|
|
2009
|
+
onKeyDown: w,
|
|
2010
|
+
placeholder: "请输入你想要了解的关键词",
|
|
2011
|
+
rows: 1,
|
|
2012
|
+
disabled: b
|
|
2013
|
+
}
|
|
2014
|
+
)
|
|
2015
|
+
] })
|
|
2016
|
+
] }),
|
|
2017
|
+
b ? /* @__PURE__ */ e(
|
|
1837
2018
|
"button",
|
|
1838
2019
|
{
|
|
1839
2020
|
type: "button",
|
|
@@ -1847,10 +2028,11 @@ function Le() {
|
|
|
1847
2028
|
"button",
|
|
1848
2029
|
{
|
|
1849
2030
|
type: "submit",
|
|
1850
|
-
className: `sa-send-btn ${
|
|
2031
|
+
className: `sa-send-btn ${h ? "sa-send-btn-active" : ""}`,
|
|
1851
2032
|
"aria-label": "发送",
|
|
1852
2033
|
title: "发送",
|
|
1853
|
-
|
|
2034
|
+
disabled: !h,
|
|
2035
|
+
children: /* @__PURE__ */ e("img", { src: K.sendSolid, alt: "发送", width: 14, height: 14, draggable: !1 })
|
|
1854
2036
|
}
|
|
1855
2037
|
)
|
|
1856
2038
|
]
|
|
@@ -1859,352 +2041,425 @@ function Le() {
|
|
|
1859
2041
|
/* @__PURE__ */ e("div", { className: "mt-3 text-center text-[11px] leading-none text-[#B8B8B8]", children: "所有内容均由AI生成仅供参考" })
|
|
1860
2042
|
] });
|
|
1861
2043
|
}
|
|
1862
|
-
function
|
|
1863
|
-
const [a, n] = Q.useState(null), [s, r] = Q.useState(!0), [i,
|
|
2044
|
+
function Wt({ artifact: t }) {
|
|
2045
|
+
const [a, n] = Q.useState(null), [s, r] = Q.useState(!0), [i, l] = Q.useState(null);
|
|
1864
2046
|
return Q.useEffect(() => {
|
|
1865
|
-
let
|
|
1866
|
-
r(!0),
|
|
1867
|
-
async function
|
|
2047
|
+
let d = !1;
|
|
2048
|
+
r(!0), l(null), n(null);
|
|
2049
|
+
async function o() {
|
|
1868
2050
|
try {
|
|
1869
2051
|
if (t.type === "pdf") {
|
|
1870
|
-
|
|
2052
|
+
d || r(!1);
|
|
1871
2053
|
return;
|
|
1872
2054
|
}
|
|
1873
2055
|
if (t.type === "html") {
|
|
1874
|
-
const
|
|
1875
|
-
if (!
|
|
1876
|
-
const
|
|
1877
|
-
|
|
2056
|
+
const c = await fetch(t.url);
|
|
2057
|
+
if (!c.ok) throw new Error(`HTTP ${c.status}`);
|
|
2058
|
+
const g = await c.text(), f = (await import("./purify.es-C-6FFqDW.js")).default;
|
|
2059
|
+
d || (n(f.sanitize(g, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), r(!1));
|
|
1878
2060
|
return;
|
|
1879
2061
|
}
|
|
1880
2062
|
if (t.type === "docx") {
|
|
1881
|
-
const
|
|
1882
|
-
if (!
|
|
1883
|
-
const
|
|
1884
|
-
|
|
2063
|
+
const c = await fetch(t.url);
|
|
2064
|
+
if (!c.ok) throw new Error(`HTTP ${c.status}`);
|
|
2065
|
+
const g = await c.arrayBuffer(), y = await (await import("./mammoth.browser-Czw2m8xL.js").then((M) => M.m)).convertToHtml({ arrayBuffer: g }), b = (await import("./purify.es-C-6FFqDW.js")).default;
|
|
2066
|
+
d || (n(b.sanitize(y.value, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), r(!1));
|
|
1885
2067
|
return;
|
|
1886
2068
|
}
|
|
1887
|
-
|
|
1888
|
-
} catch (
|
|
1889
|
-
|
|
2069
|
+
d || (r(!1), l(`不支持预览「${t.type}」类型`));
|
|
2070
|
+
} catch (c) {
|
|
2071
|
+
d || (r(!1), l(c instanceof Error ? c.message : "加载失败"));
|
|
1890
2072
|
}
|
|
1891
2073
|
}
|
|
1892
|
-
return
|
|
1893
|
-
|
|
2074
|
+
return o(), () => {
|
|
2075
|
+
d = !0;
|
|
1894
2076
|
};
|
|
1895
|
-
}, [t]), s ? /* @__PURE__ */ e("div", { className: "sa-drawer-preview-loading", children: "加载中" }) : i ? /* @__PURE__ */
|
|
2077
|
+
}, [t]), s ? /* @__PURE__ */ e("div", { className: "sa-drawer-preview-loading", children: "加载中" }) : i ? /* @__PURE__ */ p("div", { className: "sa-drawer-preview-error", children: [
|
|
1896
2078
|
i,
|
|
1897
|
-
/* @__PURE__ */ e("button", { className: "sa-drawer-btn-sm", onClick: () => void
|
|
1898
|
-
] }) : t.type === "pdf" ? /* @__PURE__ */ e("iframe", { src: t.url, title: t.filename, className: "sa-drawer-preview-iframe", sandbox: "allow-scripts" }) : a !== null ? /* @__PURE__ */ e("
|
|
2079
|
+
/* @__PURE__ */ e("button", { className: "sa-drawer-btn-sm", onClick: () => void ce(t), children: "下载查看" })
|
|
2080
|
+
] }) : t.type === "pdf" ? /* @__PURE__ */ e("iframe", { src: t.url, title: t.filename, className: "sa-drawer-preview-iframe", sandbox: "allow-scripts" }) : a !== null ? /* @__PURE__ */ e("div", { className: "sa-drawer-preview-html-scroll", children: /* @__PURE__ */ e("div", { className: "sa-drawer-preview-html sa-text-part", dangerouslySetInnerHTML: { __html: a } }) }) : null;
|
|
1899
2081
|
}
|
|
1900
|
-
function
|
|
1901
|
-
const [s, r] =
|
|
2082
|
+
function Yt({ artifacts: t, initialArtifact: a, onClose: n }) {
|
|
2083
|
+
const [s, r] = _(
|
|
1902
2084
|
a ? { mode: "preview", artifact: a } : { mode: "list" }
|
|
1903
|
-
), [i,
|
|
1904
|
-
|
|
1905
|
-
a && (
|
|
2085
|
+
), [i, l] = _(!1), d = F(null), [o, c] = _(340), g = F(null);
|
|
2086
|
+
Y(() => {
|
|
2087
|
+
a && (d.current && (clearTimeout(d.current), d.current = null, l(!1)), r({ mode: "preview", artifact: a }));
|
|
1906
2088
|
}, [a]);
|
|
1907
|
-
const
|
|
1908
|
-
|
|
1909
|
-
|
|
2089
|
+
const f = T(() => {
|
|
2090
|
+
l(!0), d.current = setTimeout(() => {
|
|
2091
|
+
d.current = null, n();
|
|
1910
2092
|
}, 240);
|
|
1911
2093
|
}, [n]);
|
|
1912
|
-
|
|
1913
|
-
var
|
|
1914
|
-
|
|
2094
|
+
Y(() => () => {
|
|
2095
|
+
var m;
|
|
2096
|
+
d.current && clearTimeout(d.current), (m = g.current) == null || m.call(g);
|
|
1915
2097
|
}, []);
|
|
1916
|
-
const
|
|
1917
|
-
r({ mode: "preview", artifact:
|
|
1918
|
-
}, []),
|
|
2098
|
+
const y = T((m) => {
|
|
2099
|
+
r({ mode: "preview", artifact: m });
|
|
2100
|
+
}, []), b = T(() => {
|
|
1919
2101
|
r({ mode: "list" });
|
|
1920
2102
|
}, []);
|
|
1921
|
-
|
|
1922
|
-
const
|
|
1923
|
-
|
|
2103
|
+
Y(() => {
|
|
2104
|
+
const m = (I) => {
|
|
2105
|
+
I.key === "Escape" && f();
|
|
1924
2106
|
};
|
|
1925
|
-
return document.addEventListener("keydown",
|
|
1926
|
-
}, [
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
const
|
|
1930
|
-
const
|
|
1931
|
-
|
|
1932
|
-
},
|
|
1933
|
-
document.removeEventListener("mousemove",
|
|
2107
|
+
return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
|
|
2108
|
+
}, [f]);
|
|
2109
|
+
const M = T((m) => {
|
|
2110
|
+
m.preventDefault();
|
|
2111
|
+
const I = m.clientX, h = o, v = (E) => {
|
|
2112
|
+
const $ = I - E.clientX;
|
|
2113
|
+
c(Math.max(240, Math.min(window.innerWidth * 0.7, h + $)));
|
|
2114
|
+
}, z = () => {
|
|
2115
|
+
document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", z), document.body.style.cursor = "", document.body.style.userSelect = "", g.current = null;
|
|
1934
2116
|
};
|
|
1935
|
-
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove",
|
|
1936
|
-
}, [
|
|
1937
|
-
return /* @__PURE__ */
|
|
1938
|
-
/* @__PURE__ */ e("div", { className: "sa-drawer-resize-handle", onMouseDown:
|
|
1939
|
-
/* @__PURE__ */
|
|
1940
|
-
s.mode === "preview" ? /* @__PURE__ */
|
|
1941
|
-
/* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick:
|
|
2117
|
+
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", v), document.addEventListener("mouseup", z), g.current = z;
|
|
2118
|
+
}, [o]);
|
|
2119
|
+
return /* @__PURE__ */ p("div", { className: `sa-artifact-drawer ${i ? "sa-drawer-closing" : ""}`, style: { width: o }, children: [
|
|
2120
|
+
/* @__PURE__ */ e("div", { className: "sa-drawer-resize-handle", onMouseDown: M }),
|
|
2121
|
+
/* @__PURE__ */ p("div", { className: "sa-artifact-drawer-header", children: [
|
|
2122
|
+
s.mode === "preview" ? /* @__PURE__ */ p(V, { children: [
|
|
2123
|
+
/* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: b, title: "返回列表", "aria-label": "返回列表", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M15 18l-6-6 6-6" }) }) }),
|
|
1942
2124
|
/* @__PURE__ */ e("span", { className: "sa-artifact-drawer-title", children: s.artifact.filename })
|
|
1943
|
-
] }) : /* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
2125
|
+
] }) : /* @__PURE__ */ p(V, { children: [
|
|
2126
|
+
/* @__PURE__ */ p("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", style: { flexShrink: 0 }, children: [
|
|
1945
2127
|
/* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1946
2128
|
/* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
|
|
1947
2129
|
] }),
|
|
1948
2130
|
/* @__PURE__ */ e("span", { className: "sa-artifact-drawer-title", children: "会话产物" })
|
|
1949
2131
|
] }),
|
|
1950
2132
|
/* @__PURE__ */ e("div", { style: { flex: 1 } }),
|
|
1951
|
-
s.mode === "preview" && /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: () => void
|
|
1952
|
-
/* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick:
|
|
2133
|
+
s.mode === "preview" && /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: () => void ce(s.artifact), title: "下载", "aria-label": "下载", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) }) }),
|
|
2134
|
+
/* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: f, title: "关闭", "aria-label": "关闭", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M18 6L6 18M6 6l12 12" }) }) })
|
|
1953
2135
|
] }),
|
|
1954
|
-
/* @__PURE__ */ e("div", { className: "sa-artifact-drawer-body", children: s.mode === "list" ? t.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-drawer-empty", children: "暂无产物" }) : /* @__PURE__ */ e("ul", { className: "sa-drawer-file-list", role: "list", children: t.map((
|
|
2136
|
+
/* @__PURE__ */ e("div", { className: "sa-artifact-drawer-body", children: s.mode === "list" ? t.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-drawer-empty", children: "暂无产物" }) : /* @__PURE__ */ e("ul", { className: "sa-drawer-file-list", role: "list", children: t.map((m, I) => /* @__PURE__ */ p(
|
|
1955
2137
|
"li",
|
|
1956
2138
|
{
|
|
1957
2139
|
className: "sa-drawer-file-card",
|
|
1958
|
-
onClick: () =>
|
|
1959
|
-
onKeyDown: (
|
|
1960
|
-
(
|
|
2140
|
+
onClick: () => y(m),
|
|
2141
|
+
onKeyDown: (h) => {
|
|
2142
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), y(m));
|
|
1961
2143
|
},
|
|
1962
2144
|
tabIndex: 0,
|
|
1963
2145
|
role: "button",
|
|
1964
|
-
"aria-label": `预览 ${
|
|
2146
|
+
"aria-label": `预览 ${m.filename}`,
|
|
1965
2147
|
children: [
|
|
1966
|
-
/* @__PURE__ */ e("div", { className: "sa-drawer-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children:
|
|
1967
|
-
/* @__PURE__ */
|
|
1968
|
-
/* @__PURE__ */ e("span", { className: "sa-drawer-file-name", children:
|
|
1969
|
-
/* @__PURE__ */ e("span", { className: "sa-drawer-file-size", children:
|
|
2148
|
+
/* @__PURE__ */ e("div", { className: "sa-drawer-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children: Le(m.type) }) }),
|
|
2149
|
+
/* @__PURE__ */ p("div", { className: "sa-drawer-file-info", children: [
|
|
2150
|
+
/* @__PURE__ */ e("span", { className: "sa-drawer-file-name", children: m.filename }),
|
|
2151
|
+
/* @__PURE__ */ e("span", { className: "sa-drawer-file-size", children: De(m.size) })
|
|
1970
2152
|
] }),
|
|
1971
2153
|
/* @__PURE__ */ e(
|
|
1972
2154
|
"button",
|
|
1973
2155
|
{
|
|
1974
2156
|
className: "sa-drawer-btn",
|
|
1975
2157
|
title: "下载",
|
|
1976
|
-
"aria-label": `下载 ${
|
|
1977
|
-
onClick: (
|
|
1978
|
-
|
|
2158
|
+
"aria-label": `下载 ${m.filename}`,
|
|
2159
|
+
onClick: (h) => {
|
|
2160
|
+
h.stopPropagation(), ce(m);
|
|
1979
2161
|
},
|
|
1980
2162
|
children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) })
|
|
1981
2163
|
}
|
|
1982
2164
|
)
|
|
1983
2165
|
]
|
|
1984
2166
|
},
|
|
1985
|
-
|
|
1986
|
-
)) }) : /* @__PURE__ */ e("div", { className: "sa-drawer-view-enter", children: /* @__PURE__ */ e(
|
|
2167
|
+
m.id || `artifact-${I}`
|
|
2168
|
+
)) }) : /* @__PURE__ */ e("div", { className: "sa-drawer-view-enter", children: /* @__PURE__ */ e(Wt, { artifact: s.artifact }) }) })
|
|
2169
|
+
] });
|
|
2170
|
+
}
|
|
2171
|
+
function Gt({ page: t, onBack: a, centered: n }) {
|
|
2172
|
+
Y(() => {
|
|
2173
|
+
const r = (i) => {
|
|
2174
|
+
i.key === "Escape" && a();
|
|
2175
|
+
};
|
|
2176
|
+
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
2177
|
+
}, [a]);
|
|
2178
|
+
const s = Ze(t.component) ? Je(t.component, { close: a }) : Qe(t.component, { close: a });
|
|
2179
|
+
return /* @__PURE__ */ p("div", { className: `sa-page-overlay ${n ? "sa-page-overlay-centered" : ""}`, children: [
|
|
2180
|
+
/* @__PURE__ */ p("div", { className: "sa-page-overlay-bar", children: [
|
|
2181
|
+
/* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: a, title: "返回", "aria-label": "返回", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M15 18l-6-6 6-6" }) }) }),
|
|
2182
|
+
t.title && /* @__PURE__ */ e("span", { className: "sa-page-overlay-title", children: t.title })
|
|
2183
|
+
] }),
|
|
2184
|
+
/* @__PURE__ */ e("div", { className: "sa-page-overlay-body", children: s })
|
|
1987
2185
|
] });
|
|
1988
2186
|
}
|
|
1989
|
-
|
|
2187
|
+
const Ut = "mx-auto w-full max-w-[800px]";
|
|
2188
|
+
function Oe({
|
|
2189
|
+
contentClassName: t,
|
|
2190
|
+
centered: a,
|
|
2191
|
+
composerClassName: n,
|
|
2192
|
+
thread: s,
|
|
2193
|
+
composer: r,
|
|
2194
|
+
artifactPreview: i
|
|
2195
|
+
}) {
|
|
2196
|
+
const {
|
|
2197
|
+
activePanel: l,
|
|
2198
|
+
closePanel: d,
|
|
2199
|
+
messagesLoading: o,
|
|
2200
|
+
isArtifactDrawerOpen: c,
|
|
2201
|
+
allArtifacts: g,
|
|
2202
|
+
activePreviewArtifact: f,
|
|
2203
|
+
toggleArtifactDrawer: y
|
|
2204
|
+
} = J();
|
|
2205
|
+
if (l)
|
|
2206
|
+
return /* @__PURE__ */ e(Gt, { page: l, onBack: d, centered: a });
|
|
2207
|
+
const b = a ? Ut : "";
|
|
2208
|
+
return /* @__PURE__ */ p(V, { children: [
|
|
2209
|
+
/* @__PURE__ */ p("div", { className: `${t} ${b}`, children: [
|
|
2210
|
+
o ? /* @__PURE__ */ p("div", { className: "sa-messages-loading", children: [
|
|
2211
|
+
/* @__PURE__ */ e("span", { className: "sa-loading-spinner" }),
|
|
2212
|
+
"加载对话..."
|
|
2213
|
+
] }) : s,
|
|
2214
|
+
i && c && /* @__PURE__ */ e(
|
|
2215
|
+
Yt,
|
|
2216
|
+
{
|
|
2217
|
+
artifacts: g,
|
|
2218
|
+
initialArtifact: f,
|
|
2219
|
+
onClose: y
|
|
2220
|
+
}
|
|
2221
|
+
)
|
|
2222
|
+
] }),
|
|
2223
|
+
n ? /* @__PURE__ */ e("div", { className: `${n} ${b}`, children: r }) : r
|
|
2224
|
+
] });
|
|
2225
|
+
}
|
|
2226
|
+
function Xt({
|
|
1990
2227
|
isOpen: t,
|
|
1991
2228
|
onClose: a,
|
|
1992
2229
|
title: n,
|
|
1993
2230
|
slots: s,
|
|
1994
2231
|
welcomeMessage: r,
|
|
1995
2232
|
suggestedPrompts: i,
|
|
1996
|
-
avatar:
|
|
1997
|
-
artifactPreview:
|
|
1998
|
-
capabilities:
|
|
1999
|
-
quickLinks:
|
|
2000
|
-
logo:
|
|
2001
|
-
defaultWidth:
|
|
2002
|
-
defaultHeight:
|
|
2003
|
-
showTimestamp:
|
|
2233
|
+
avatar: l,
|
|
2234
|
+
artifactPreview: d,
|
|
2235
|
+
capabilities: o,
|
|
2236
|
+
quickLinks: c,
|
|
2237
|
+
logo: g,
|
|
2238
|
+
defaultWidth: f,
|
|
2239
|
+
defaultHeight: y,
|
|
2240
|
+
showTimestamp: b
|
|
2004
2241
|
}) {
|
|
2005
2242
|
const {
|
|
2006
|
-
status:
|
|
2007
|
-
sendMessage:
|
|
2008
|
-
stop:
|
|
2009
|
-
toggleThreadList:
|
|
2010
|
-
setThreadListOpen:
|
|
2011
|
-
isThreadListOpen:
|
|
2012
|
-
toggleArtifactDrawer:
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
messages:
|
|
2017
|
-
messagesLoading:
|
|
2018
|
-
conversations:
|
|
2019
|
-
activeConversationId:
|
|
2020
|
-
switchConversation:
|
|
2021
|
-
newConversation:
|
|
2022
|
-
deleteConversation:
|
|
2023
|
-
renameConversation:
|
|
2024
|
-
hasMore:
|
|
2025
|
-
loadMoreConversations:
|
|
2026
|
-
} =
|
|
2027
|
-
width:
|
|
2028
|
-
position:
|
|
2029
|
-
hasCustomPosition:
|
|
2030
|
-
isMaximized:
|
|
2243
|
+
status: M,
|
|
2244
|
+
sendMessage: m,
|
|
2245
|
+
stop: I,
|
|
2246
|
+
toggleThreadList: h,
|
|
2247
|
+
setThreadListOpen: v,
|
|
2248
|
+
isThreadListOpen: z,
|
|
2249
|
+
toggleArtifactDrawer: E,
|
|
2250
|
+
allArtifacts: $,
|
|
2251
|
+
activePanel: A,
|
|
2252
|
+
closePanel: w,
|
|
2253
|
+
messages: D,
|
|
2254
|
+
messagesLoading: P,
|
|
2255
|
+
conversations: u,
|
|
2256
|
+
activeConversationId: S,
|
|
2257
|
+
switchConversation: H,
|
|
2258
|
+
newConversation: O,
|
|
2259
|
+
deleteConversation: N,
|
|
2260
|
+
renameConversation: x,
|
|
2261
|
+
hasMore: L,
|
|
2262
|
+
loadMoreConversations: k
|
|
2263
|
+
} = J(), {
|
|
2264
|
+
width: R,
|
|
2265
|
+
position: j,
|
|
2266
|
+
hasCustomPosition: C,
|
|
2267
|
+
isMaximized: W,
|
|
2031
2268
|
// 统一由 hook 计算的真实渲染几何(含侧边栏宽度、自适应高度、视口钳制)
|
|
2032
|
-
totalWidth:
|
|
2033
|
-
windowHeight:
|
|
2034
|
-
startWindowDrag:
|
|
2035
|
-
startResize:
|
|
2036
|
-
toggleMaximize:
|
|
2037
|
-
reset:
|
|
2038
|
-
setLockedHeight:
|
|
2039
|
-
} =
|
|
2040
|
-
defaultWidth:
|
|
2041
|
-
defaultHeight:
|
|
2269
|
+
totalWidth: G,
|
|
2270
|
+
windowHeight: ne,
|
|
2271
|
+
startWindowDrag: je,
|
|
2272
|
+
startResize: We,
|
|
2273
|
+
toggleMaximize: Ye,
|
|
2274
|
+
reset: fe,
|
|
2275
|
+
setLockedHeight: pe
|
|
2276
|
+
} = st({
|
|
2277
|
+
defaultWidth: f ?? X.DEFAULT_WIDTH,
|
|
2278
|
+
defaultHeight: y ?? X.DEFAULT_HEIGHT,
|
|
2042
2279
|
// 大窗不消费窗口几何,无需区分 isMaximized(避免与 hook 状态循环依赖)
|
|
2043
|
-
sidebarWidth:
|
|
2044
|
-
}),
|
|
2045
|
-
|
|
2046
|
-
t ||
|
|
2047
|
-
}, [t,
|
|
2048
|
-
|
|
2049
|
-
}, [
|
|
2050
|
-
|
|
2051
|
-
}, [
|
|
2052
|
-
const
|
|
2053
|
-
enabled: t &&
|
|
2280
|
+
sidebarWidth: 0
|
|
2281
|
+
}), he = F(null), me = F(null), ue = !P && D.length === 0, se = !P && D.length > 0, ie = !!A;
|
|
2282
|
+
Y(() => {
|
|
2283
|
+
t || (fe(), w());
|
|
2284
|
+
}, [t, fe, w]), Y(() => {
|
|
2285
|
+
v(W ? he.current ?? !0 : me.current ?? !1);
|
|
2286
|
+
}, [W, v]), Y(() => {
|
|
2287
|
+
se || pe(null);
|
|
2288
|
+
}, [se, pe]);
|
|
2289
|
+
const Ge = it({
|
|
2290
|
+
enabled: t && se && !W && !ie,
|
|
2054
2291
|
contentSelector: ".sa-panel-content",
|
|
2055
|
-
defaultHeight:
|
|
2056
|
-
onHeightChange:
|
|
2292
|
+
defaultHeight: y ?? X.DEFAULT_HEIGHT,
|
|
2293
|
+
onHeightChange: pe
|
|
2057
2294
|
});
|
|
2058
2295
|
if (!t) return null;
|
|
2059
|
-
const
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2062
|
-
},
|
|
2296
|
+
const xe = s.Header, we = s.Composer, oe = s.ThreadList, Ue = () => {
|
|
2297
|
+
const de = !z;
|
|
2298
|
+
h(), W ? he.current = de : me.current = de;
|
|
2299
|
+
}, be = 200, ve = z && !W, q = "var(--sa-radius, 16px)", ye = ve ? `0px ${q} ${q} 0px` : `${q} ${q} ${q} ${q}`, Xe = C ? j.x : window.innerWidth - G - 20, le = Math.min(be, Math.max(0, Xe - 1)), Ke = C ? { width: `${G}px`, height: `${ne}px`, left: `${j.x}px`, top: `${j.y}px` } : { width: `${G}px`, height: `${ne}px`, right: "20px", bottom: "20px" }, ke = {
|
|
2063
2300
|
title: n,
|
|
2064
2301
|
onClose: a,
|
|
2065
|
-
onToggleThreadList:
|
|
2066
|
-
isMaximized:
|
|
2067
|
-
onToggleMaximize:
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2302
|
+
onToggleThreadList: Ue,
|
|
2303
|
+
isMaximized: W,
|
|
2304
|
+
onToggleMaximize: Ye,
|
|
2305
|
+
// 整屏容器态隐藏「回到首页」与产物入口:返回按钮已接管退出,抽屉也随内容区一并被替换
|
|
2306
|
+
showHome: se && !ie,
|
|
2307
|
+
onHome: O,
|
|
2308
|
+
artifactCount: ie || !d ? 0 : $.length,
|
|
2309
|
+
onToggleArtifactDrawer: ie || !d ? void 0 : E
|
|
2310
|
+
}, Ne = {
|
|
2311
|
+
conversations: u,
|
|
2312
|
+
activeSessionId: S,
|
|
2313
|
+
onSwitch: H,
|
|
2314
|
+
onNew: O,
|
|
2315
|
+
onDelete: N,
|
|
2316
|
+
onRename: x,
|
|
2317
|
+
hasMore: L,
|
|
2318
|
+
onLoadMore: k
|
|
2319
|
+
}, Ce = /* @__PURE__ */ p(
|
|
2082
2320
|
"div",
|
|
2083
2321
|
{
|
|
2084
|
-
className: `relative flex min-w-0 flex-col bg-white ${
|
|
2085
|
-
style:
|
|
2322
|
+
className: `relative flex min-w-0 flex-col bg-white ${W ? "flex-1" : "h-full shrink-0"}`,
|
|
2323
|
+
style: W ? void 0 : { width: `${R}px`, borderRadius: ye, overflow: "hidden" },
|
|
2086
2324
|
children: [
|
|
2087
|
-
|
|
2325
|
+
ue && /* @__PURE__ */ p(V, { children: [
|
|
2088
2326
|
/* @__PURE__ */ e("div", { className: "sa-home-gradient pointer-events-none absolute inset-x-0 top-0 z-0 h-[238px] opacity-10" }),
|
|
2089
2327
|
/* @__PURE__ */ e("div", { className: "sa-home-gradient-fade pointer-events-none absolute inset-x-0 top-0 z-[1] h-[238px]" })
|
|
2090
2328
|
] }),
|
|
2091
2329
|
/* @__PURE__ */ e(
|
|
2092
2330
|
"div",
|
|
2093
2331
|
{
|
|
2094
|
-
className: `relative z-20 ${
|
|
2095
|
-
onMouseDown:
|
|
2096
|
-
children:
|
|
2332
|
+
className: `relative z-20 ${ue || W ? "" : "bg-white"} ${W ? "cursor-default" : "cursor-grab active:cursor-grabbing"}`,
|
|
2333
|
+
onMouseDown: W ? void 0 : je,
|
|
2334
|
+
children: xe ? /* @__PURE__ */ e(xe, { ...ke }) : /* @__PURE__ */ e(dt, { ...ke })
|
|
2097
2335
|
}
|
|
2098
2336
|
),
|
|
2099
|
-
/* @__PURE__ */
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
"
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2337
|
+
/* @__PURE__ */ e(
|
|
2338
|
+
Oe,
|
|
2339
|
+
{
|
|
2340
|
+
contentClassName: `sa-panel-content relative z-[2] ${ue ? "sa-home-view" : ""}`,
|
|
2341
|
+
centered: W,
|
|
2342
|
+
composerClassName: "shrink-0",
|
|
2343
|
+
artifactPreview: d,
|
|
2344
|
+
thread: /* @__PURE__ */ e(
|
|
2345
|
+
Pe,
|
|
2346
|
+
{
|
|
2347
|
+
slots: s,
|
|
2348
|
+
welcomeMessage: r,
|
|
2349
|
+
suggestedPrompts: i,
|
|
2350
|
+
avatar: l,
|
|
2351
|
+
artifactPreview: d,
|
|
2352
|
+
capabilities: o,
|
|
2353
|
+
quickLinks: c,
|
|
2354
|
+
logo: g,
|
|
2355
|
+
showTimestamp: b
|
|
2356
|
+
}
|
|
2357
|
+
),
|
|
2358
|
+
composer: we ? /* @__PURE__ */ e(we, { status: M, onSend: m, onStop: I }) : /* @__PURE__ */ e(Be, {})
|
|
2359
|
+
}
|
|
2360
|
+
)
|
|
2120
2361
|
]
|
|
2121
2362
|
}
|
|
2122
2363
|
);
|
|
2123
|
-
return
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2364
|
+
return W ? /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--sa-z-index,9999)] flex animate-sa-fade-in flex-col justify-end bg-black/30", children: /* @__PURE__ */ p(
|
|
2365
|
+
"div",
|
|
2366
|
+
{
|
|
2367
|
+
className: "flex h-[calc(100%_-_48px)] w-full animate-sa-slide-up-full flex-row overflow-hidden bg-[#F5F5F5] shadow-[0_-12px_48px_rgba(0,0,0,0.25)]",
|
|
2368
|
+
style: { borderRadius: "var(--sa-radius, 16px) var(--sa-radius, 16px) 0px 0px" },
|
|
2369
|
+
children: [
|
|
2370
|
+
z && (oe ? /* @__PURE__ */ e(oe, { ...Ne }) : /* @__PURE__ */ e(Ie, { width: 220 })),
|
|
2371
|
+
Ce
|
|
2372
|
+
]
|
|
2373
|
+
}
|
|
2374
|
+
) }) : /* @__PURE__ */ p(
|
|
2127
2375
|
"div",
|
|
2128
2376
|
{
|
|
2129
|
-
ref:
|
|
2130
|
-
className: "fixed z-[var(--sa-z-index,9999)] flex animate-sa-window-in flex-row overflow-
|
|
2131
|
-
style:
|
|
2377
|
+
ref: Ge,
|
|
2378
|
+
className: "fixed z-[var(--sa-z-index,9999)] flex animate-sa-window-in flex-row overflow-visible border border-[#DADADA] bg-white shadow-[0_12px_36px_rgba(0,0,0,0.18)]",
|
|
2379
|
+
style: { ...Ke, borderRadius: ye },
|
|
2132
2380
|
children: [
|
|
2133
2381
|
/* @__PURE__ */ e(
|
|
2134
2382
|
"div",
|
|
2135
2383
|
{
|
|
2136
|
-
className: "sa-resize-handle absolute bottom-0 left-[-3px] top-0 z-
|
|
2137
|
-
onMouseDown: (
|
|
2384
|
+
className: "sa-resize-handle absolute bottom-0 left-[-3px] top-0 z-20 w-[6px] cursor-col-resize",
|
|
2385
|
+
onMouseDown: (de) => We(de)
|
|
2138
2386
|
}
|
|
2139
2387
|
),
|
|
2140
|
-
/* @__PURE__ */ e(
|
|
2388
|
+
ve && (oe ? /* @__PURE__ */ e(
|
|
2141
2389
|
"div",
|
|
2142
2390
|
{
|
|
2143
|
-
className: "
|
|
2144
|
-
|
|
2391
|
+
className: "absolute -top-px -bottom-px -left-px z-10 overflow-hidden border border-r-0 border-[#DADADA] bg-[#FAFAFA] shadow-[0_12px_36px_rgba(0,0,0,0.18)]",
|
|
2392
|
+
style: { width: le, transform: `translateX(-${le}px)`, borderRadius: `${q} 0px 0px ${q}` },
|
|
2393
|
+
children: /* @__PURE__ */ e(oe, { ...Ne })
|
|
2145
2394
|
}
|
|
2146
|
-
)
|
|
2147
|
-
|
|
2148
|
-
|
|
2395
|
+
) : /* @__PURE__ */ e(
|
|
2396
|
+
"div",
|
|
2397
|
+
{
|
|
2398
|
+
className: "absolute -top-px -bottom-px -left-px z-10 overflow-hidden border border-r-0 border-[#DADADA] bg-[#FAFAFA] shadow-[0_12px_36px_rgba(0,0,0,0.18)]",
|
|
2399
|
+
style: { width: le, transform: `translateX(-${le}px)`, borderRadius: `${q} 0px 0px ${q}` },
|
|
2400
|
+
children: /* @__PURE__ */ e(Ie, { width: be })
|
|
2401
|
+
}
|
|
2402
|
+
)),
|
|
2403
|
+
Ce
|
|
2149
2404
|
]
|
|
2150
2405
|
}
|
|
2151
2406
|
);
|
|
2152
2407
|
}
|
|
2153
|
-
const
|
|
2408
|
+
const Kt = () => {
|
|
2154
2409
|
};
|
|
2155
|
-
function
|
|
2410
|
+
function Vt({
|
|
2156
2411
|
conversations: t,
|
|
2157
2412
|
activeSessionId: a,
|
|
2158
2413
|
onSwitch: n,
|
|
2159
2414
|
onNew: s,
|
|
2160
2415
|
onDelete: r,
|
|
2161
2416
|
onRename: i,
|
|
2162
|
-
isCollapsed:
|
|
2163
|
-
onToggleCollapse:
|
|
2164
|
-
hasMore:
|
|
2165
|
-
onLoadMore:
|
|
2166
|
-
conversationsLoading:
|
|
2417
|
+
isCollapsed: l,
|
|
2418
|
+
onToggleCollapse: d,
|
|
2419
|
+
hasMore: o,
|
|
2420
|
+
onLoadMore: c,
|
|
2421
|
+
conversationsLoading: g
|
|
2167
2422
|
}) {
|
|
2168
|
-
const [
|
|
2169
|
-
|
|
2423
|
+
const [f, y] = _(null), [b, M] = _(null), [m, I] = _(""), [h, v] = _(null), z = F(null);
|
|
2424
|
+
Y(
|
|
2170
2425
|
() => () => {
|
|
2171
|
-
|
|
2426
|
+
z.current && clearTimeout(z.current);
|
|
2172
2427
|
},
|
|
2173
2428
|
[]
|
|
2174
2429
|
);
|
|
2175
|
-
const
|
|
2176
|
-
(
|
|
2177
|
-
|
|
2178
|
-
() =>
|
|
2430
|
+
const E = T(
|
|
2431
|
+
(u, S) => {
|
|
2432
|
+
S.stopPropagation(), f === u ? (r(u), y(null)) : (y(u), z.current && clearTimeout(z.current), z.current = setTimeout(
|
|
2433
|
+
() => y(null),
|
|
2179
2434
|
3e3
|
|
2180
2435
|
));
|
|
2181
2436
|
},
|
|
2182
|
-
[
|
|
2183
|
-
),
|
|
2184
|
-
(
|
|
2185
|
-
|
|
2437
|
+
[f, r]
|
|
2438
|
+
), $ = T(
|
|
2439
|
+
(u, S, H) => {
|
|
2440
|
+
H.stopPropagation(), M(u), I(S ?? "");
|
|
2186
2441
|
},
|
|
2187
2442
|
[]
|
|
2188
|
-
),
|
|
2189
|
-
(
|
|
2190
|
-
|
|
2443
|
+
), A = T(
|
|
2444
|
+
(u) => {
|
|
2445
|
+
m.trim() && i(u, m.trim()), M(null);
|
|
2191
2446
|
},
|
|
2192
|
-
[
|
|
2193
|
-
), w =
|
|
2194
|
-
const
|
|
2195
|
-
!
|
|
2196
|
-
}, [
|
|
2197
|
-
() =>
|
|
2447
|
+
[m, i]
|
|
2448
|
+
), w = F(null), D = T(() => {
|
|
2449
|
+
const u = w.current;
|
|
2450
|
+
!u || !o || !c || u.scrollHeight - u.scrollTop - u.clientHeight < 50 && c();
|
|
2451
|
+
}, [o, c]), P = re(
|
|
2452
|
+
() => Fe(t),
|
|
2198
2453
|
[t]
|
|
2199
2454
|
);
|
|
2200
|
-
return
|
|
2455
|
+
return l ? /* @__PURE__ */ p("div", { className: "flex w-12 shrink-0 flex-col items-center gap-1 border-r border-[#ECECEC] bg-[#FAFAFA] py-3", children: [
|
|
2201
2456
|
/* @__PURE__ */ e(
|
|
2202
2457
|
"button",
|
|
2203
2458
|
{
|
|
2204
2459
|
type: "button",
|
|
2205
2460
|
className: "sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white",
|
|
2206
2461
|
"data-tooltip": "展开",
|
|
2207
|
-
onClick:
|
|
2462
|
+
onClick: d,
|
|
2208
2463
|
children: /* @__PURE__ */ e(B, { name: "panel-left", size: 18 })
|
|
2209
2464
|
}
|
|
2210
2465
|
),
|
|
@@ -2215,21 +2470,21 @@ function St({
|
|
|
2215
2470
|
className: "sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white",
|
|
2216
2471
|
"data-tooltip": "新建对话",
|
|
2217
2472
|
onClick: () => {
|
|
2218
|
-
s(),
|
|
2473
|
+
s(), d();
|
|
2219
2474
|
},
|
|
2220
|
-
children: /* @__PURE__ */ e("img", { src:
|
|
2475
|
+
children: /* @__PURE__ */ e("img", { src: K.messageCreate, alt: "", width: 18, height: 18 })
|
|
2221
2476
|
}
|
|
2222
2477
|
)
|
|
2223
|
-
] }) : /* @__PURE__ */
|
|
2224
|
-
/* @__PURE__ */
|
|
2225
|
-
/* @__PURE__ */
|
|
2478
|
+
] }) : /* @__PURE__ */ p("div", { className: "relative flex w-[220px] shrink-0 flex-col border-r border-[#ECECEC] bg-[#FAFAFA] p-3", children: [
|
|
2479
|
+
/* @__PURE__ */ p("div", { className: "mb-4 flex shrink-0 items-center gap-1.5", children: [
|
|
2480
|
+
/* @__PURE__ */ p(
|
|
2226
2481
|
"button",
|
|
2227
2482
|
{
|
|
2228
2483
|
type: "button",
|
|
2229
2484
|
className: "sa-new-chat flex h-8 flex-1 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",
|
|
2230
2485
|
onClick: s,
|
|
2231
2486
|
children: [
|
|
2232
|
-
/* @__PURE__ */ e("img", { src:
|
|
2487
|
+
/* @__PURE__ */ e("img", { src: K.messageCreate, alt: "", width: 18, height: 18 }),
|
|
2233
2488
|
/* @__PURE__ */ e("span", { className: "sa-new-chat-text whitespace-nowrap", children: "新建对话" })
|
|
2234
2489
|
]
|
|
2235
2490
|
}
|
|
@@ -2240,77 +2495,77 @@ function St({
|
|
|
2240
2495
|
type: "button",
|
|
2241
2496
|
className: "sa-tip relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white",
|
|
2242
2497
|
"data-tooltip": "收起侧边栏",
|
|
2243
|
-
onClick:
|
|
2498
|
+
onClick: d,
|
|
2244
2499
|
children: /* @__PURE__ */ e(B, { name: "panel-left-close", size: 16 })
|
|
2245
2500
|
}
|
|
2246
2501
|
)
|
|
2247
2502
|
] }),
|
|
2248
|
-
/* @__PURE__ */
|
|
2503
|
+
/* @__PURE__ */ p("div", { className: "px-1 pb-2.5", children: [
|
|
2249
2504
|
/* @__PURE__ */ e("div", { className: "mb-1 text-[14px] font-semibold text-[#333]", children: "历史对话" }),
|
|
2250
2505
|
/* @__PURE__ */ e("div", { className: "text-[11px] text-[#999]", children: "展示最近的会话记录" })
|
|
2251
2506
|
] }),
|
|
2252
|
-
/* @__PURE__ */
|
|
2507
|
+
/* @__PURE__ */ p(
|
|
2253
2508
|
"div",
|
|
2254
2509
|
{
|
|
2255
2510
|
ref: w,
|
|
2256
2511
|
className: "flex-1 overflow-y-auto",
|
|
2257
|
-
onScroll:
|
|
2512
|
+
onScroll: D,
|
|
2258
2513
|
children: [
|
|
2259
|
-
|
|
2260
|
-
!
|
|
2261
|
-
|
|
2262
|
-
/* @__PURE__ */ e("div", { className: "px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]", children:
|
|
2263
|
-
|
|
2264
|
-
const
|
|
2514
|
+
g && t.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "加载中..." }),
|
|
2515
|
+
!g && t.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "暂无记录" }),
|
|
2516
|
+
P.map((u) => /* @__PURE__ */ p("div", { className: "mb-1", children: [
|
|
2517
|
+
/* @__PURE__ */ e("div", { className: "px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]", children: u.label }),
|
|
2518
|
+
u.items.map((S) => {
|
|
2519
|
+
const H = S.sessionId === a, O = f === S.sessionId;
|
|
2265
2520
|
return /* @__PURE__ */ e(
|
|
2266
2521
|
"div",
|
|
2267
2522
|
{
|
|
2268
|
-
className: `group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${
|
|
2523
|
+
className: `group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${H ? "bg-[#E8F1FE]" : "hover:bg-[#E8F1FE]"}`,
|
|
2269
2524
|
onClick: () => {
|
|
2270
|
-
|
|
2525
|
+
b !== S.sessionId && n(S.sessionId);
|
|
2271
2526
|
},
|
|
2272
|
-
onMouseEnter: (
|
|
2273
|
-
if (
|
|
2274
|
-
const
|
|
2275
|
-
|
|
2276
|
-
text:
|
|
2277
|
-
x:
|
|
2278
|
-
y:
|
|
2527
|
+
onMouseEnter: (N) => {
|
|
2528
|
+
if (b === S.sessionId) return;
|
|
2529
|
+
const x = N.currentTarget.getBoundingClientRect();
|
|
2530
|
+
v({
|
|
2531
|
+
text: S.title || "新会话",
|
|
2532
|
+
x: x.right + 8,
|
|
2533
|
+
y: x.top + x.height / 2
|
|
2279
2534
|
});
|
|
2280
2535
|
},
|
|
2281
|
-
onMouseLeave: () =>
|
|
2282
|
-
children:
|
|
2536
|
+
onMouseLeave: () => v(null),
|
|
2537
|
+
children: b === S.sessionId ? /* @__PURE__ */ e(
|
|
2283
2538
|
"input",
|
|
2284
2539
|
{
|
|
2285
2540
|
className: "w-full rounded border border-[var(--sa-primary)] bg-white px-1.5 py-0.5 text-[12px] outline-none",
|
|
2286
|
-
value:
|
|
2287
|
-
onChange: (
|
|
2288
|
-
onBlur: () =>
|
|
2289
|
-
onKeyDown: (
|
|
2290
|
-
|
|
2541
|
+
value: m,
|
|
2542
|
+
onChange: (N) => I(N.target.value),
|
|
2543
|
+
onBlur: () => A(S.sessionId),
|
|
2544
|
+
onKeyDown: (N) => {
|
|
2545
|
+
N.key === "Enter" && A(S.sessionId), N.key === "Escape" && M(null);
|
|
2291
2546
|
},
|
|
2292
|
-
onClick: (
|
|
2547
|
+
onClick: (N) => N.stopPropagation(),
|
|
2293
2548
|
autoFocus: !0
|
|
2294
2549
|
}
|
|
2295
|
-
) : /* @__PURE__ */
|
|
2550
|
+
) : /* @__PURE__ */ p(V, { children: [
|
|
2296
2551
|
/* @__PURE__ */ e(
|
|
2297
2552
|
"img",
|
|
2298
2553
|
{
|
|
2299
|
-
src:
|
|
2554
|
+
src: K.message,
|
|
2300
2555
|
alt: "",
|
|
2301
2556
|
width: 16,
|
|
2302
2557
|
height: 16,
|
|
2303
2558
|
className: "shrink-0 opacity-60"
|
|
2304
2559
|
}
|
|
2305
2560
|
),
|
|
2306
|
-
/* @__PURE__ */ e("span", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]", children:
|
|
2307
|
-
/* @__PURE__ */
|
|
2561
|
+
/* @__PURE__ */ e("span", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]", children: S.title || "新会话" }),
|
|
2562
|
+
/* @__PURE__ */ p("span", { className: "hidden shrink-0 items-center gap-0.5 group-hover:flex", children: [
|
|
2308
2563
|
/* @__PURE__ */ e(
|
|
2309
2564
|
"button",
|
|
2310
2565
|
{
|
|
2311
2566
|
type: "button",
|
|
2312
2567
|
className: "flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",
|
|
2313
|
-
onClick: (
|
|
2568
|
+
onClick: (N) => $(S.sessionId, S.title, N),
|
|
2314
2569
|
title: "重命名",
|
|
2315
2570
|
children: /* @__PURE__ */ e(B, { name: "pen", size: 12 })
|
|
2316
2571
|
}
|
|
@@ -2319,13 +2574,13 @@ function St({
|
|
|
2319
2574
|
"button",
|
|
2320
2575
|
{
|
|
2321
2576
|
type: "button",
|
|
2322
|
-
className: `flex h-5 w-5 items-center justify-center rounded ${
|
|
2323
|
-
onClick: (
|
|
2324
|
-
title:
|
|
2577
|
+
className: `flex h-5 w-5 items-center justify-center rounded ${O ? "bg-[#fee2e2] text-[#ef4444]" : "text-[#999] hover:bg-white/70 hover:text-[#ef4444]"}`,
|
|
2578
|
+
onClick: (N) => E(S.sessionId, N),
|
|
2579
|
+
title: O ? "确认删除" : "删除",
|
|
2325
2580
|
children: /* @__PURE__ */ e(
|
|
2326
2581
|
B,
|
|
2327
2582
|
{
|
|
2328
|
-
name:
|
|
2583
|
+
name: O ? "x" : "trash2",
|
|
2329
2584
|
size: 12
|
|
2330
2585
|
}
|
|
2331
2586
|
)
|
|
@@ -2334,116 +2589,117 @@ function St({
|
|
|
2334
2589
|
] })
|
|
2335
2590
|
] })
|
|
2336
2591
|
},
|
|
2337
|
-
|
|
2592
|
+
S.sessionId
|
|
2338
2593
|
);
|
|
2339
2594
|
})
|
|
2340
|
-
] },
|
|
2341
|
-
|
|
2595
|
+
] }, u.label)),
|
|
2596
|
+
o && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]", children: "向下滚动加载更多" })
|
|
2342
2597
|
]
|
|
2343
2598
|
}
|
|
2344
2599
|
),
|
|
2345
|
-
|
|
2600
|
+
h && /* @__PURE__ */ e(
|
|
2346
2601
|
"div",
|
|
2347
2602
|
{
|
|
2348
2603
|
className: "pointer-events-none fixed z-[10001] whitespace-nowrap rounded border border-[#E8E8E8] bg-white px-2.5 py-1.5 text-[12px] leading-[1.4] text-[#333] shadow-[0_2px_8px_rgba(0,0,0,0.12)]",
|
|
2349
2604
|
style: {
|
|
2350
|
-
left:
|
|
2351
|
-
top:
|
|
2605
|
+
left: h.x,
|
|
2606
|
+
top: h.y,
|
|
2352
2607
|
transform: "translateY(-50%)"
|
|
2353
2608
|
},
|
|
2354
|
-
children:
|
|
2609
|
+
children: h.text
|
|
2355
2610
|
}
|
|
2356
2611
|
)
|
|
2357
2612
|
] });
|
|
2358
2613
|
}
|
|
2359
|
-
function
|
|
2614
|
+
function qt({
|
|
2360
2615
|
title: t,
|
|
2361
2616
|
slots: a,
|
|
2362
2617
|
welcomeMessage: n,
|
|
2363
2618
|
suggestedPrompts: s,
|
|
2364
2619
|
capabilities: r,
|
|
2365
2620
|
quickLinks: i,
|
|
2366
|
-
logo:
|
|
2367
|
-
sidebarDefaultOpen:
|
|
2368
|
-
onClose:
|
|
2369
|
-
avatar:
|
|
2370
|
-
artifactPreview:
|
|
2371
|
-
showTimestamp:
|
|
2621
|
+
logo: l,
|
|
2622
|
+
sidebarDefaultOpen: d = !0,
|
|
2623
|
+
onClose: o,
|
|
2624
|
+
avatar: c,
|
|
2625
|
+
artifactPreview: g,
|
|
2626
|
+
showTimestamp: f
|
|
2372
2627
|
}) {
|
|
2373
2628
|
const {
|
|
2374
|
-
status:
|
|
2375
|
-
sendMessage:
|
|
2376
|
-
stop:
|
|
2377
|
-
conversations:
|
|
2378
|
-
activeConversationId:
|
|
2379
|
-
switchConversation:
|
|
2380
|
-
newConversation:
|
|
2381
|
-
deleteConversation:
|
|
2382
|
-
renameConversation:
|
|
2383
|
-
toggleArtifactDrawer:
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
hasMore:
|
|
2388
|
-
loadMoreConversations:
|
|
2389
|
-
conversationsLoading:
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2629
|
+
status: y,
|
|
2630
|
+
sendMessage: b,
|
|
2631
|
+
stop: M,
|
|
2632
|
+
conversations: m,
|
|
2633
|
+
activeConversationId: I,
|
|
2634
|
+
switchConversation: h,
|
|
2635
|
+
newConversation: v,
|
|
2636
|
+
deleteConversation: z,
|
|
2637
|
+
renameConversation: E,
|
|
2638
|
+
toggleArtifactDrawer: $,
|
|
2639
|
+
allArtifacts: A,
|
|
2640
|
+
activePanel: w,
|
|
2641
|
+
closePanel: D,
|
|
2642
|
+
hasMore: P,
|
|
2643
|
+
loadMoreConversations: u,
|
|
2644
|
+
conversationsLoading: S
|
|
2645
|
+
} = J(), [H, O] = _(d), N = T(() => O((j) => !j), []), x = !!w;
|
|
2646
|
+
Y(() => () => D(), [D]);
|
|
2647
|
+
const L = a.ThreadList, k = a.Composer, R = a.Header;
|
|
2648
|
+
return /* @__PURE__ */ p("div", { className: "sa-fullpage", children: [
|
|
2649
|
+
L ? /* @__PURE__ */ e(
|
|
2394
2650
|
"div",
|
|
2395
2651
|
{
|
|
2396
|
-
className: `sa-fp-sidebar-wrapper ${
|
|
2652
|
+
className: `sa-fp-sidebar-wrapper ${H ? "" : "sa-fp-sidebar-wrapper-collapsed"}`,
|
|
2397
2653
|
children: /* @__PURE__ */ e(
|
|
2398
|
-
|
|
2654
|
+
L,
|
|
2399
2655
|
{
|
|
2400
|
-
conversations:
|
|
2401
|
-
activeSessionId:
|
|
2402
|
-
onSwitch:
|
|
2403
|
-
onNew:
|
|
2404
|
-
onDelete:
|
|
2405
|
-
onRename:
|
|
2406
|
-
hasMore:
|
|
2407
|
-
onLoadMore:
|
|
2656
|
+
conversations: m,
|
|
2657
|
+
activeSessionId: I,
|
|
2658
|
+
onSwitch: h,
|
|
2659
|
+
onNew: v,
|
|
2660
|
+
onDelete: z,
|
|
2661
|
+
onRename: E,
|
|
2662
|
+
hasMore: P,
|
|
2663
|
+
onLoadMore: u
|
|
2408
2664
|
}
|
|
2409
2665
|
)
|
|
2410
2666
|
}
|
|
2411
2667
|
) : /* @__PURE__ */ e(
|
|
2412
|
-
|
|
2668
|
+
Vt,
|
|
2413
2669
|
{
|
|
2414
|
-
conversations:
|
|
2415
|
-
activeSessionId:
|
|
2416
|
-
onSwitch:
|
|
2417
|
-
onNew:
|
|
2418
|
-
onDelete:
|
|
2419
|
-
onRename:
|
|
2420
|
-
isCollapsed: !
|
|
2421
|
-
onToggleCollapse:
|
|
2422
|
-
hasMore:
|
|
2423
|
-
onLoadMore:
|
|
2424
|
-
conversationsLoading:
|
|
2670
|
+
conversations: m,
|
|
2671
|
+
activeSessionId: I,
|
|
2672
|
+
onSwitch: h,
|
|
2673
|
+
onNew: v,
|
|
2674
|
+
onDelete: z,
|
|
2675
|
+
onRename: E,
|
|
2676
|
+
isCollapsed: !H,
|
|
2677
|
+
onToggleCollapse: N,
|
|
2678
|
+
hasMore: P,
|
|
2679
|
+
onLoadMore: u,
|
|
2680
|
+
conversationsLoading: S
|
|
2425
2681
|
}
|
|
2426
2682
|
),
|
|
2427
|
-
/* @__PURE__ */
|
|
2428
|
-
|
|
2429
|
-
|
|
2683
|
+
/* @__PURE__ */ p("div", { className: "sa-fp-main", children: [
|
|
2684
|
+
R ? /* @__PURE__ */ e(
|
|
2685
|
+
R,
|
|
2430
2686
|
{
|
|
2431
2687
|
title: t,
|
|
2432
|
-
onClose:
|
|
2433
|
-
onToggleThreadList:
|
|
2434
|
-
artifactCount:
|
|
2435
|
-
onToggleArtifactDrawer:
|
|
2688
|
+
onClose: o ?? Kt,
|
|
2689
|
+
onToggleThreadList: N,
|
|
2690
|
+
artifactCount: x || !g ? 0 : A.length,
|
|
2691
|
+
onToggleArtifactDrawer: x || !g ? void 0 : $
|
|
2436
2692
|
}
|
|
2437
|
-
) : /* @__PURE__ */
|
|
2693
|
+
) : /* @__PURE__ */ p("div", { className: "sa-fp-header", children: [
|
|
2438
2694
|
/* @__PURE__ */ e("div", { className: "sa-fp-header-title", children: t }),
|
|
2439
|
-
/* @__PURE__ */ e("div", { className: "sa-fp-header-actions", children:
|
|
2695
|
+
/* @__PURE__ */ e("div", { className: "sa-fp-header-actions", children: !x && g && A.length > 0 && /* @__PURE__ */ p(
|
|
2440
2696
|
"button",
|
|
2441
2697
|
{
|
|
2442
2698
|
className: "sa-fp-header-btn sa-header-btn-artifact",
|
|
2443
|
-
onClick:
|
|
2699
|
+
onClick: $,
|
|
2444
2700
|
title: "会话产物",
|
|
2445
2701
|
children: [
|
|
2446
|
-
/* @__PURE__ */
|
|
2702
|
+
/* @__PURE__ */ p(
|
|
2447
2703
|
"svg",
|
|
2448
2704
|
{
|
|
2449
2705
|
width: "14",
|
|
@@ -2463,109 +2719,105 @@ function At({
|
|
|
2463
2719
|
}
|
|
2464
2720
|
) })
|
|
2465
2721
|
] }),
|
|
2466
|
-
/* @__PURE__ */
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
"
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
initialArtifact: M,
|
|
2489
|
-
onClose: S
|
|
2490
|
-
}
|
|
2491
|
-
)
|
|
2492
|
-
] }),
|
|
2493
|
-
O ? /* @__PURE__ */ e(O, { status: b, onSend: m, onStop: x }) : /* @__PURE__ */ e(Le, {})
|
|
2722
|
+
/* @__PURE__ */ e(
|
|
2723
|
+
Oe,
|
|
2724
|
+
{
|
|
2725
|
+
contentClassName: "sa-fp-content-row",
|
|
2726
|
+
artifactPreview: g,
|
|
2727
|
+
thread: /* @__PURE__ */ e(
|
|
2728
|
+
Pe,
|
|
2729
|
+
{
|
|
2730
|
+
slots: a,
|
|
2731
|
+
welcomeMessage: n,
|
|
2732
|
+
suggestedPrompts: s,
|
|
2733
|
+
capabilities: r,
|
|
2734
|
+
quickLinks: i,
|
|
2735
|
+
logo: l,
|
|
2736
|
+
avatar: c,
|
|
2737
|
+
artifactPreview: g,
|
|
2738
|
+
showTimestamp: f
|
|
2739
|
+
}
|
|
2740
|
+
),
|
|
2741
|
+
composer: k ? /* @__PURE__ */ e(k, { status: y, onSend: b, onStop: M }) : /* @__PURE__ */ e(Be, {})
|
|
2742
|
+
}
|
|
2743
|
+
)
|
|
2494
2744
|
] })
|
|
2495
2745
|
] });
|
|
2496
2746
|
}
|
|
2497
|
-
function
|
|
2747
|
+
function Zt(t) {
|
|
2498
2748
|
const {
|
|
2499
2749
|
sdk: a,
|
|
2500
2750
|
mode: n = "floating",
|
|
2501
2751
|
slots: s = {},
|
|
2502
2752
|
hooks: r = {},
|
|
2503
2753
|
welcomeMessage: i,
|
|
2504
|
-
suggestedPrompts:
|
|
2505
|
-
title:
|
|
2506
|
-
initialOpen:
|
|
2507
|
-
onOpenChange:
|
|
2508
|
-
sidebarDefaultOpen:
|
|
2509
|
-
avatar:
|
|
2510
|
-
artifactPreview:
|
|
2511
|
-
capabilities:
|
|
2512
|
-
quickLinks:
|
|
2513
|
-
logo:
|
|
2514
|
-
triggerLogo:
|
|
2515
|
-
theme:
|
|
2516
|
-
showTimestamp:
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2754
|
+
suggestedPrompts: l,
|
|
2755
|
+
title: d = "AI Assistant",
|
|
2756
|
+
initialOpen: o = !1,
|
|
2757
|
+
onOpenChange: c,
|
|
2758
|
+
sidebarDefaultOpen: g,
|
|
2759
|
+
avatar: f,
|
|
2760
|
+
artifactPreview: y,
|
|
2761
|
+
capabilities: b,
|
|
2762
|
+
quickLinks: M,
|
|
2763
|
+
logo: m,
|
|
2764
|
+
triggerLogo: I,
|
|
2765
|
+
theme: h,
|
|
2766
|
+
showTimestamp: v,
|
|
2767
|
+
attachmentUploader: z,
|
|
2768
|
+
nosUpload: E
|
|
2769
|
+
} = t, [$, A] = _(o);
|
|
2770
|
+
Y(() => {
|
|
2771
|
+
A(o);
|
|
2772
|
+
}, [o]);
|
|
2773
|
+
const w = T(() => {
|
|
2774
|
+
var S, H;
|
|
2775
|
+
const u = !$;
|
|
2776
|
+
A(u), c == null || c(u), u ? (S = r.onOpen) == null || S.call(r) : (H = r.onClose) == null || H.call(r);
|
|
2777
|
+
}, [$, r, c]), D = T(() => {
|
|
2778
|
+
var u;
|
|
2779
|
+
A(!1), c == null || c(!1), (u = r.onClose) == null || u.call(r);
|
|
2780
|
+
}, [r, c]), P = s.Trigger ?? lt;
|
|
2781
|
+
return n === "fullpage" ? $ ? /* @__PURE__ */ e(Te, { sdk: a, hooks: r, attachmentUploader: z, nosUpload: E, children: /* @__PURE__ */ e(
|
|
2782
|
+
qt,
|
|
2531
2783
|
{
|
|
2532
|
-
title:
|
|
2784
|
+
title: d,
|
|
2533
2785
|
slots: s,
|
|
2534
2786
|
welcomeMessage: i,
|
|
2535
|
-
suggestedPrompts:
|
|
2536
|
-
capabilities:
|
|
2537
|
-
quickLinks:
|
|
2538
|
-
logo:
|
|
2539
|
-
sidebarDefaultOpen:
|
|
2787
|
+
suggestedPrompts: l,
|
|
2788
|
+
capabilities: b,
|
|
2789
|
+
quickLinks: M,
|
|
2790
|
+
logo: m,
|
|
2791
|
+
sidebarDefaultOpen: g,
|
|
2540
2792
|
onClose: D,
|
|
2541
|
-
avatar:
|
|
2542
|
-
artifactPreview:
|
|
2543
|
-
showTimestamp:
|
|
2793
|
+
avatar: f,
|
|
2794
|
+
artifactPreview: y,
|
|
2795
|
+
showTimestamp: v
|
|
2544
2796
|
}
|
|
2545
|
-
) }) : null : /* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */ e(
|
|
2797
|
+
) }) : null : /* @__PURE__ */ p(Te, { sdk: a, hooks: r, attachmentUploader: z, nosUpload: E, children: [
|
|
2798
|
+
/* @__PURE__ */ e(P, { isOpen: $, onClick: w, triggerLogo: I }),
|
|
2547
2799
|
/* @__PURE__ */ e(
|
|
2548
|
-
|
|
2800
|
+
Xt,
|
|
2549
2801
|
{
|
|
2550
|
-
isOpen:
|
|
2802
|
+
isOpen: $,
|
|
2551
2803
|
onClose: D,
|
|
2552
|
-
title:
|
|
2804
|
+
title: d,
|
|
2553
2805
|
slots: s,
|
|
2554
2806
|
welcomeMessage: i,
|
|
2555
|
-
suggestedPrompts:
|
|
2556
|
-
avatar:
|
|
2557
|
-
artifactPreview:
|
|
2558
|
-
capabilities:
|
|
2559
|
-
quickLinks:
|
|
2560
|
-
logo:
|
|
2561
|
-
defaultWidth:
|
|
2562
|
-
defaultHeight:
|
|
2563
|
-
showTimestamp:
|
|
2807
|
+
suggestedPrompts: l,
|
|
2808
|
+
avatar: f,
|
|
2809
|
+
artifactPreview: y,
|
|
2810
|
+
capabilities: b,
|
|
2811
|
+
quickLinks: M,
|
|
2812
|
+
logo: m,
|
|
2813
|
+
defaultWidth: h == null ? void 0 : h.panelWidth,
|
|
2814
|
+
defaultHeight: h == null ? void 0 : h.panelHeight,
|
|
2815
|
+
showTimestamp: v
|
|
2564
2816
|
}
|
|
2565
2817
|
)
|
|
2566
2818
|
] });
|
|
2567
2819
|
}
|
|
2568
|
-
const
|
|
2820
|
+
const Jt = `
|
|
2569
2821
|
[data-super-agent-widget] {
|
|
2570
2822
|
--sa-primary-dark: color-mix(in srgb, var(--sa-primary) 82%, #000);
|
|
2571
2823
|
--sa-primary-light: color-mix(in srgb, var(--sa-primary) 10%, #fff);
|
|
@@ -2583,16 +2835,32 @@ const $t = `
|
|
|
2583
2835
|
text-rendering: optimizeLegibility;
|
|
2584
2836
|
}
|
|
2585
2837
|
|
|
2838
|
+
/* 迷你 preflight(scoped):Tailwind preflight 已禁用(避免污染宿主页),
|
|
2839
|
+
但 border 工具类只输出 border-width、无 border-style(CSS 初始值 none → 边框不渲染),
|
|
2840
|
+
button/ul 也会吃到浏览器原生样式。此处补齐等价复位:
|
|
2841
|
+
- 特异性 (0,1,0),低于 scoped utility (0,2,0),靠源顺序让位于后置的 sa-* plain 类
|
|
2842
|
+
- 两条注入顺序固定为 widgetStyles + tailwindStyles(mount.ts),utility 恒在其后 */
|
|
2586
2843
|
[data-super-agent-widget] *,
|
|
2587
2844
|
[data-super-agent-widget] *::before,
|
|
2588
2845
|
[data-super-agent-widget] *::after {
|
|
2589
2846
|
box-sizing: border-box;
|
|
2590
2847
|
margin: 0;
|
|
2591
2848
|
padding: 0;
|
|
2849
|
+
border-width: 0;
|
|
2850
|
+
border-style: solid;
|
|
2851
|
+
border-color: var(--sa-border, #e5e7eb);
|
|
2592
2852
|
}
|
|
2593
2853
|
|
|
2594
|
-
|
|
2854
|
+
/* :where() 零特异性贡献:plain-CSS 组件类(如 .sa-new-chat 的渐变底)不受影响 */
|
|
2855
|
+
[data-super-agent-widget] :where(button) {
|
|
2595
2856
|
font-family: inherit;
|
|
2857
|
+
background-color: transparent;
|
|
2858
|
+
background-image: none;
|
|
2859
|
+
cursor: pointer;
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
[data-super-agent-widget] :where(ul, ol) {
|
|
2863
|
+
list-style: none;
|
|
2596
2864
|
}
|
|
2597
2865
|
|
|
2598
2866
|
/* ── Trigger / Panel / Header(浮窗框架已改用 Tailwind 实现,见 tailwind.css) ── */
|
|
@@ -3543,26 +3811,6 @@ const $t = `
|
|
|
3543
3811
|
padding: 24px 24px;
|
|
3544
3812
|
}
|
|
3545
3813
|
|
|
3546
|
-
.sa-fp-main .sa-composer {
|
|
3547
|
-
margin: 0 auto;
|
|
3548
|
-
width: 100%;
|
|
3549
|
-
padding: 12px 24px 20px;
|
|
3550
|
-
border-top: none;
|
|
3551
|
-
background: transparent;
|
|
3552
|
-
}
|
|
3553
|
-
|
|
3554
|
-
.sa-fp-main .sa-composer-input {
|
|
3555
|
-
background: #f7f7f8;
|
|
3556
|
-
border: 1px solid #e4e4e7;
|
|
3557
|
-
box-shadow: none;
|
|
3558
|
-
}
|
|
3559
|
-
|
|
3560
|
-
.sa-fp-main .sa-composer-input:focus {
|
|
3561
|
-
background: #fff;
|
|
3562
|
-
border-color: #d4d4d8;
|
|
3563
|
-
box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
|
|
3564
|
-
}
|
|
3565
|
-
|
|
3566
3814
|
/* ── Artifact file cards (in ToolResultPart) ── */
|
|
3567
3815
|
.sa-artifact-file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
|
|
3568
3816
|
.sa-artifact-file-card {
|
|
@@ -3648,7 +3896,8 @@ const $t = `
|
|
|
3648
3896
|
transition: background 0.15s ease, border-color 0.15s ease;
|
|
3649
3897
|
}
|
|
3650
3898
|
.sa-drawer-btn-sm:hover { background: var(--sa-surface); border-color: var(--sa-primary); }
|
|
3651
|
-
.sa-
|
|
3899
|
+
/* flex 列容器:让 .sa-drawer-view-enter(flex:1)与内层滚动/iframe 有真实高度链 */
|
|
3900
|
+
.sa-artifact-drawer-body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
|
|
3652
3901
|
.sa-drawer-empty { padding: 48px 24px; text-align: center; color: var(--sa-text-muted); font-size: 14px; }
|
|
3653
3902
|
.sa-drawer-file-list { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
|
|
3654
3903
|
.sa-drawer-file-card {
|
|
@@ -3671,6 +3920,9 @@ const $t = `
|
|
|
3671
3920
|
|
|
3672
3921
|
/* ── Drawer preview ── */
|
|
3673
3922
|
.sa-drawer-preview-iframe { width: 100%; height: 100%; border: none; background: #fff; animation: sa-fade-in 0.3s ease both; }
|
|
3923
|
+
/* html/docx 内联预览:与消息流 ToolResultPart 一致(无 iframe) */
|
|
3924
|
+
.sa-drawer-preview-html-scroll { flex: 1; min-height: 0; overflow: auto; padding: 12px; background: #fff; animation: sa-fade-in 0.3s ease both; }
|
|
3925
|
+
.sa-drawer-preview-html { max-width: none; }
|
|
3674
3926
|
.sa-drawer-preview-loading {
|
|
3675
3927
|
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
3676
3928
|
height: 100%; gap: 12px; color: var(--sa-text-muted); font-size: 14px;
|
|
@@ -3687,7 +3939,9 @@ const $t = `
|
|
|
3687
3939
|
}
|
|
3688
3940
|
|
|
3689
3941
|
/* ── Drawer view transition ── */
|
|
3690
|
-
|
|
3942
|
+
/* flex 列 + flex:1 撑满 drawer body,让内层 .sa-drawer-preview-html-scroll 的
|
|
3943
|
+
flex:1/min-height:0 与 pdf iframe 的 height:100% 有真实高度链 */
|
|
3944
|
+
.sa-drawer-view-enter { display: flex; flex-direction: column; flex: 1; min-height: 0; animation: sa-drawer-view-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) both; }
|
|
3691
3945
|
|
|
3692
3946
|
/* ── Layout helpers for drawer alongside thread ── */
|
|
3693
3947
|
.sa-panel-content { display: flex; flex: 1; min-height: 0; overflow: hidden; }
|
|
@@ -3696,6 +3950,24 @@ const $t = `
|
|
|
3696
3950
|
.sa-fp-content-row { display: flex; flex: 1; min-height: 0; overflow: hidden; }
|
|
3697
3951
|
.sa-fp-content-row .sa-thread { flex: 1; min-width: 0; transition: flex 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
|
|
3698
3952
|
|
|
3953
|
+
/* ── Page overlay(面板级整屏页面:替换内容区 + 输入区,Header 保留) ── */
|
|
3954
|
+
.sa-page-overlay {
|
|
3955
|
+
display: flex; flex-direction: column; flex: 1; min-height: 0;
|
|
3956
|
+
position: relative; z-index: 2; background: #fff; overflow: hidden;
|
|
3957
|
+
animation: sa-page-in 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
3958
|
+
}
|
|
3959
|
+
/* 大窗态与内容区/输入区一致的 800px 居中 */
|
|
3960
|
+
.sa-page-overlay-centered { width: 100%; max-width: 800px; margin: 0 auto; }
|
|
3961
|
+
.sa-page-overlay-bar {
|
|
3962
|
+
display: flex; align-items: center; gap: 8px; flex-shrink: 0;
|
|
3963
|
+
padding: 10px 14px; border-bottom: 1px solid var(--sa-border);
|
|
3964
|
+
background: var(--sa-surface); color: var(--sa-text);
|
|
3965
|
+
font-size: 15px; font-weight: 600;
|
|
3966
|
+
}
|
|
3967
|
+
.sa-page-overlay-back-label { font-size: 13px; font-weight: 400; }
|
|
3968
|
+
.sa-page-overlay-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3969
|
+
/* 滚动归 SDK,业务页不写滚动容器 */
|
|
3970
|
+
.sa-page-overlay-body { flex: 1; min-height: 0; overflow-y: auto; }
|
|
3699
3971
|
/* ── Artifact keyframes ── */
|
|
3700
3972
|
@keyframes sa-slide-in-right {
|
|
3701
3973
|
from { opacity: 0; transform: translateX(100%); }
|
|
@@ -3724,7 +3996,11 @@ const $t = `
|
|
|
3724
3996
|
from { opacity: 0; transform: translateX(12px); }
|
|
3725
3997
|
to { opacity: 1; transform: translateX(0); }
|
|
3726
3998
|
}
|
|
3727
|
-
`, Lt = '[data-super-agent-widget] .pointer-events-none{pointer-events:none}[data-super-agent-widget] .collapse{visibility:collapse}[data-super-agent-widget] .fixed{position:fixed}[data-super-agent-widget] .absolute{position:absolute}[data-super-agent-widget] .relative{position:relative}[data-super-agent-widget] .inset-0{top:0;right:0;bottom:0;left:0}[data-super-agent-widget] .inset-x-0{left:0;right:0}[data-super-agent-widget] .-right-2{right:-.5rem}[data-super-agent-widget] .-top-1\\.5{top:-.375rem}[data-super-agent-widget] .bottom-0{bottom:0}[data-super-agent-widget] .left-\\[-3px\\]{left:-3px}[data-super-agent-widget] .right-\\[-3px\\]{right:-3px}[data-super-agent-widget] .top-0{top:0}[data-super-agent-widget] .z-0{z-index:0}[data-super-agent-widget] .z-10{z-index:10}[data-super-agent-widget] .z-20{z-index:20}[data-super-agent-widget] .z-\\[10000\\]{z-index:10000}[data-super-agent-widget] .z-\\[10001\\]{z-index:10001}[data-super-agent-widget] .z-\\[1\\]{z-index:1}[data-super-agent-widget] .z-\\[2\\]{z-index:2}[data-super-agent-widget] .z-\\[5\\]{z-index:5}[data-super-agent-widget] .z-\\[var\\(--sa-z-index\\,9999\\)\\]{z-index:var(--sa-z-index,9999)}[data-super-agent-widget] .m-0{margin:0}[data-super-agent-widget] .mx-auto{margin-left:auto;margin-right:auto}[data-super-agent-widget] .mb-0\\.5{margin-bottom:.125rem}[data-super-agent-widget] .mb-1{margin-bottom:.25rem}[data-super-agent-widget] .mb-3{margin-bottom:.75rem}[data-super-agent-widget] .mb-4{margin-bottom:1rem}[data-super-agent-widget] .mt-3{margin-top:.75rem}[data-super-agent-widget] .block{display:block}[data-super-agent-widget] .inline{display:inline}[data-super-agent-widget] .flex{display:flex}[data-super-agent-widget] .inline-flex{display:inline-flex}[data-super-agent-widget] .table{display:table}[data-super-agent-widget] .hidden{display:none}[data-super-agent-widget] .h-14{height:3.5rem}[data-super-agent-widget] .h-5{height:1.25rem}[data-super-agent-widget] .h-7{height:1.75rem}[data-super-agent-widget] .h-8{height:2rem}[data-super-agent-widget] .h-9{height:2.25rem}[data-super-agent-widget] .h-\\[13px\\]{height:13px}[data-super-agent-widget] .h-\\[18px\\]{height:18px}[data-super-agent-widget] .h-\\[238px\\]{height:238px}[data-super-agent-widget] .h-\\[calc\\(100\\%_-_48px\\)\\]{height:calc(100% - 48px)}[data-super-agent-widget] .h-full{height:100%}[data-super-agent-widget] .min-h-\\[70px\\]{min-height:70px}[data-super-agent-widget] .w-12{width:3rem}[data-super-agent-widget] .w-14{width:3.5rem}[data-super-agent-widget] .w-5{width:1.25rem}[data-super-agent-widget] .w-7{width:1.75rem}[data-super-agent-widget] .w-\\[18px\\]{width:18px}[data-super-agent-widget] .w-\\[220px\\]{width:220px}[data-super-agent-widget] .w-\\[6px\\]{width:6px}[data-super-agent-widget] .w-full{width:100%}[data-super-agent-widget] .w-px{width:1px}[data-super-agent-widget] .min-w-0{min-width:0px}[data-super-agent-widget] .min-w-\\[14px\\]{min-width:14px}[data-super-agent-widget] .max-w-16{max-width:4rem}[data-super-agent-widget] .max-w-\\[800px\\]{max-width:800px}[data-super-agent-widget] .max-w-full{max-width:100%}[data-super-agent-widget] .flex-1{flex:1 1 0%}[data-super-agent-widget] .flex-shrink{flex-shrink:1}[data-super-agent-widget] .shrink-0{flex-shrink:0}[data-super-agent-widget] .border-collapse{border-collapse:collapse}[data-super-agent-widget] .scale-50{--tw-scale-x: .5;--tw-scale-y: .5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .cursor-col-resize{cursor:col-resize}[data-super-agent-widget] .cursor-default{cursor:default}[data-super-agent-widget] .cursor-grab{cursor:grab}[data-super-agent-widget] .cursor-pointer{cursor:pointer}[data-super-agent-widget] .cursor-text{cursor:text}[data-super-agent-widget] .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-super-agent-widget] .resize-none{resize:none}[data-super-agent-widget] .resize{resize:both}[data-super-agent-widget] .flex-row{flex-direction:row}[data-super-agent-widget] .flex-col{flex-direction:column}[data-super-agent-widget] .flex-wrap{flex-wrap:wrap}[data-super-agent-widget] .items-start{align-items:flex-start}[data-super-agent-widget] .items-center{align-items:center}[data-super-agent-widget] .justify-end{justify-content:flex-end}[data-super-agent-widget] .justify-center{justify-content:center}[data-super-agent-widget] .justify-between{justify-content:space-between}[data-super-agent-widget] .gap-0\\.5{gap:.125rem}[data-super-agent-widget] .gap-1{gap:.25rem}[data-super-agent-widget] .gap-1\\.5{gap:.375rem}[data-super-agent-widget] .gap-2{gap:.5rem}[data-super-agent-widget] .gap-2\\.5{gap:.625rem}[data-super-agent-widget] .gap-3{gap:.75rem}[data-super-agent-widget] .gap-4{gap:1rem}[data-super-agent-widget] .gap-8{gap:2rem}[data-super-agent-widget] .gap-\\[22px\\]{gap:22px}[data-super-agent-widget] .gap-\\[7px\\]{gap:7px}[data-super-agent-widget] .overflow-hidden{overflow:hidden}[data-super-agent-widget] .overflow-visible{overflow:visible}[data-super-agent-widget] .overflow-y-auto{overflow-y:auto}[data-super-agent-widget] .text-ellipsis{text-overflow:ellipsis}[data-super-agent-widget] .whitespace-nowrap{white-space:nowrap}[data-super-agent-widget] .rounded{border-radius:.25rem}[data-super-agent-widget] .rounded-\\[5px\\]{border-radius:5px}[data-super-agent-widget] .rounded-full{border-radius:9999px}[data-super-agent-widget] .rounded-md{border-radius:.375rem}[data-super-agent-widget] .rounded-xl{border-radius:.75rem}[data-super-agent-widget] .rounded-t-2xl{border-top-left-radius:1rem;border-top-right-radius:1rem}[data-super-agent-widget] .border{border-width:1px}[data-super-agent-widget] .border-r{border-right-width:1px}[data-super-agent-widget] .border-none{border-style:none}[data-super-agent-widget] .border-\\[\\#DADADA\\]{--tw-border-opacity: 1;border-color:rgb(218 218 218 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#E8E8E8\\]{--tw-border-opacity: 1;border-color:rgb(232 232 232 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#ECECEC\\]{--tw-border-opacity: 1;border-color:rgb(236 236 236 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[var\\(--sa-primary\\)\\]{border-color:var(--sa-primary)}[data-super-agent-widget] .bg-\\[\\#DCDCDC\\]{--tw-bg-opacity: 1;background-color:rgb(220 220 220 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#E8F1FE\\]{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#F5F5F5\\]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#FAFAFA\\]{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#fee2e2\\]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[var\\(--sa-primary\\)\\]{background-color:var(--sa-primary)}[data-super-agent-widget] .bg-black\\/30{background-color:#0000004d}[data-super-agent-widget] .bg-transparent{background-color:transparent}[data-super-agent-widget] .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .object-contain{-o-object-fit:contain;object-fit:contain}[data-super-agent-widget] .p-0{padding:0}[data-super-agent-widget] .p-2{padding:.5rem}[data-super-agent-widget] .p-3{padding:.75rem}[data-super-agent-widget] .px-0\\.5{padding-left:.125rem;padding-right:.125rem}[data-super-agent-widget] .px-1{padding-left:.25rem;padding-right:.25rem}[data-super-agent-widget] .px-1\\.5{padding-left:.375rem;padding-right:.375rem}[data-super-agent-widget] .px-2\\.5{padding-left:.625rem;padding-right:.625rem}[data-super-agent-widget] .px-3{padding-left:.75rem;padding-right:.75rem}[data-super-agent-widget] .px-\\[15px\\]{padding-left:15px;padding-right:15px}[data-super-agent-widget] .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}[data-super-agent-widget] .py-1{padding-top:.25rem;padding-bottom:.25rem}[data-super-agent-widget] .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}[data-super-agent-widget] .py-2{padding-top:.5rem;padding-bottom:.5rem}[data-super-agent-widget] .py-3{padding-top:.75rem;padding-bottom:.75rem}[data-super-agent-widget] .pb-1{padding-bottom:.25rem}[data-super-agent-widget] .pb-2\\.5{padding-bottom:.625rem}[data-super-agent-widget] .pt-2{padding-top:.5rem}[data-super-agent-widget] .text-left{text-align:left}[data-super-agent-widget] .text-center{text-align:center}[data-super-agent-widget] .text-\\[11px\\]{font-size:11px}[data-super-agent-widget] .text-\\[12px\\]{font-size:12px}[data-super-agent-widget] .text-\\[13px\\]{font-size:13px}[data-super-agent-widget] .text-\\[14px\\]{font-size:14px}[data-super-agent-widget] .text-\\[18px\\]{font-size:18px}[data-super-agent-widget] .text-\\[9px\\]{font-size:9px}[data-super-agent-widget] .font-bold{font-weight:700}[data-super-agent-widget] .font-medium{font-weight:500}[data-super-agent-widget] .font-semibold{font-weight:600}[data-super-agent-widget] .italic{font-style:italic}[data-super-agent-widget] .leading-\\[1\\.3\\]{line-height:1.3}[data-super-agent-widget] .leading-\\[1\\.4\\]{line-height:1.4}[data-super-agent-widget] .leading-\\[1\\.5\\]{line-height:1.5}[data-super-agent-widget] .leading-\\[14px\\]{line-height:14px}[data-super-agent-widget] .leading-none{line-height:1}[data-super-agent-widget] .text-\\[\\#333\\]{--tw-text-opacity: 1;color:rgb(51 51 51 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#666\\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#999\\]{--tw-text-opacity: 1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#9A9A9A\\]{--tw-text-opacity: 1;color:rgb(154 154 154 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#A0A0A0\\]{--tw-text-opacity: 1;color:rgb(160 160 160 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#B8B8B8\\]{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#C0C0C0\\]{--tw-text-opacity: 1;color:rgb(192 192 192 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#ef4444\\]{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .underline{text-decoration-line:underline}[data-super-agent-widget] .antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-super-agent-widget] .opacity-0{opacity:0}[data-super-agent-widget] .opacity-10{opacity:.1}[data-super-agent-widget] .opacity-100{opacity:1}[data-super-agent-widget] .opacity-60{opacity:.6}[data-super-agent-widget] .opacity-70{opacity:.7}[data-super-agent-widget] .shadow-\\[0_-12px_48px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 -12px 48px rgba(0,0,0,.25);--tw-shadow-colored: 0 -12px 48px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_12px_36px_rgba\\(0\\,0\\,0\\,0\\.18\\)\\]{--tw-shadow: 0 12px 36px rgba(0,0,0,.18);--tw-shadow-colored: 0 12px 36px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_2px_8px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow: 0 2px 8px rgba(0,0,0,.12);--tw-shadow-colored: 0 2px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .outline-none{outline:2px solid transparent;outline-offset:2px}[data-super-agent-widget] .outline{outline-style:solid}[data-super-agent-widget] .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .duration-200{transition-duration:.2s}[data-super-agent-widget] .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}[data-super-agent-widget] .ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes sa-window-in{0%{opacity:0;transform:translateY(20px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes sa-slide-up-full{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes sa-home-fade-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-chip-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-logo-float{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}@keyframes sa-title-shimmer{0%{background-position:100% 0}to{background-position:-100% 0}}@keyframes sa-history-in{0%{opacity:0;transform:translate(-10px)}to{opacity:1;transform:translate(0)}}[data-super-agent-widget] .animate-sa-window-in{animation:sa-window-in .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-slide-up-full{animation:sa-slide-up-full .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-fade-in{animation:sa-fade-in .2s ease}[data-super-agent-widget] .animate-sa-home-fade-in{animation:sa-home-fade-in .4s ease forwards}[data-super-agent-widget] .animate-sa-chip-in{animation:sa-chip-in .4s cubic-bezier(.22,1,.36,1) forwards}[data-super-agent-widget] .animate-sa-logo-float{animation:sa-logo-float 3s ease-in-out infinite}[data-super-agent-widget] .animate-sa-title-shimmer{animation:sa-title-shimmer 2.5s ease forwards}[data-super-agent-widget] .animate-sa-history-in{animation:sa-history-in .2s ease}[data-super-agent-widget] .sa-tip{position:relative}[data-super-agent-widget] .sa-tip:before,[data-super-agent-widget] .sa-tip:after{position:absolute;top:100%;left:50%;pointer-events:none;opacity:0;transition:opacity .15s ease;z-index:100}[data-super-agent-widget] .sa-tip:before{content:attr(data-tooltip);transform:translate(-50%);margin-top:6px;padding:4px 8px;background:#fff;color:#333;font-size:12px;line-height:1.4;white-space:nowrap;border-radius:4px;box-shadow:0 2px 8px #0000001f;border:1px solid #e8e8e8}[data-super-agent-widget] .sa-tip:after{content:"";transform:translate(-50%);margin-top:2px;border:4px solid transparent;border-bottom-color:#fff;filter:drop-shadow(0 -1px 1px rgba(0,0,0,.06))}[data-super-agent-widget] .sa-tip:hover:before,[data-super-agent-widget] .sa-tip:hover:after{opacity:1}[data-super-agent-widget] .sa-chip{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(#e0e0e0,#e0e0e0) border-box;border:1px solid transparent}[data-super-agent-widget] .sa-chip:hover{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7) border-box}[data-super-agent-widget] .sa-chip:hover .sa-chip-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-shimmer-text{background:linear-gradient(90deg,#333,#333 35%,#00d4ff 40%,#1881f0,#2b52ee,#d116ea,#ff2e7e 56%,#333 61%,#333);background-size:300% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-new-chat{background:linear-gradient(258deg,#ff2e7e1a -4%,#d116ea1a 16%,#2b52ee1a 53%,#1881f01a 81%,#00d4ff1a 106%)}[data-super-agent-widget] .sa-new-chat:hover{background:linear-gradient(258deg,#ff2e7e29 -4%,#d116ea29 16%,#2b52ee29 53%,#1881f029 81%,#00d4ff29 106%)}[data-super-agent-widget] .sa-new-chat .sa-new-chat-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-home-gradient{background:linear-gradient(239deg,#ff2e7e -3%,#d116ea 17%,#2b52ee 54%,#1881f0 82%,#00d4ff 107%)}[data-super-agent-widget] .sa-home-gradient-fade{background:linear-gradient(180deg,#fff0,#fff)}[data-super-agent-widget] .sa-home-view .sa-thread{background:transparent}[data-super-agent-widget] .sa-resize-handle:hover{background:color-mix(in srgb,var(--sa-primary) 30%,transparent)}[data-super-agent-widget] .sa-input-form{border:1px solid transparent;background-color:#fff;background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);background-origin:border-box;background-clip:padding-box,border-box;transition:background .15s ease}[data-super-agent-widget] .sa-input-form-active,[data-super-agent-widget] .sa-input-form:focus-within{background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);cursor:pointer;flex-shrink:0;align-self:flex-end;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-send-btn-active,[data-super-agent-widget] .sa-input-form:focus-within .sa-send-btn{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn:hover{opacity:.9}[data-super-agent-widget] .sa-send-btn:active{opacity:.7}[data-super-agent-widget] .sa-send-btn img{display:block;width:14px;height:14px;filter:brightness(0) invert(1)}[data-super-agent-widget] .sa-stop-icon{display:block;width:8px;height:8px;border-radius:2px;background:#fff}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:scale-\\[1\\.08\\]:hover{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .hover\\:bg-\\[\\#E8F1FE\\]:hover{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-\\[\\#F5F5F5\\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white\\/70:hover{background-color:#ffffffb3}[data-super-agent-widget] .hover\\:text-\\[\\#1881F0\\]:hover{--tw-text-opacity: 1;color:rgb(24 129 240 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[\\#ef4444\\]:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[var\\(--sa-primary\\)\\]:hover{color:var(--sa-primary)}[data-super-agent-widget] .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .active\\:cursor-grabbing:active{cursor:grabbing}[data-super-agent-widget] .active\\:bg-\\[\\#F5F5F5\\]:active{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] :is(.group:hover .group-hover\\:flex){display:flex}', _t = {
|
|
3999
|
+
@keyframes sa-page-in {
|
|
4000
|
+
from { opacity: 0; transform: translateY(10px); }
|
|
4001
|
+
to { opacity: 1; transform: translateY(0); }
|
|
4002
|
+
}
|
|
4003
|
+
`, Qt = '[data-super-agent-widget] .pointer-events-none{pointer-events:none}[data-super-agent-widget] .collapse{visibility:collapse}[data-super-agent-widget] .fixed{position:fixed}[data-super-agent-widget] .absolute{position:absolute}[data-super-agent-widget] .relative{position:relative}[data-super-agent-widget] .inset-0{top:0;right:0;bottom:0;left:0}[data-super-agent-widget] .inset-x-0{left:0;right:0}[data-super-agent-widget] .-bottom-px{bottom:-1px}[data-super-agent-widget] .-left-px{left:-1px}[data-super-agent-widget] .-right-2{right:-.5rem}[data-super-agent-widget] .-top-1\\.5{top:-.375rem}[data-super-agent-widget] .-top-px{top:-1px}[data-super-agent-widget] .bottom-0{bottom:0}[data-super-agent-widget] .left-\\[-3px\\]{left:-3px}[data-super-agent-widget] .top-0{top:0}[data-super-agent-widget] .z-0{z-index:0}[data-super-agent-widget] .z-10{z-index:10}[data-super-agent-widget] .z-20{z-index:20}[data-super-agent-widget] .z-\\[10000\\]{z-index:10000}[data-super-agent-widget] .z-\\[10001\\]{z-index:10001}[data-super-agent-widget] .z-\\[1\\]{z-index:1}[data-super-agent-widget] .z-\\[2\\]{z-index:2}[data-super-agent-widget] .z-\\[5\\]{z-index:5}[data-super-agent-widget] .z-\\[var\\(--sa-z-index\\,9999\\)\\]{z-index:var(--sa-z-index,9999)}[data-super-agent-widget] .m-0{margin:0}[data-super-agent-widget] .mx-auto{margin-left:auto;margin-right:auto}[data-super-agent-widget] .mb-0\\.5{margin-bottom:.125rem}[data-super-agent-widget] .mb-1{margin-bottom:.25rem}[data-super-agent-widget] .mb-3{margin-bottom:.75rem}[data-super-agent-widget] .mb-4{margin-bottom:1rem}[data-super-agent-widget] .mt-3{margin-top:.75rem}[data-super-agent-widget] .block{display:block}[data-super-agent-widget] .inline{display:inline}[data-super-agent-widget] .flex{display:flex}[data-super-agent-widget] .inline-flex{display:inline-flex}[data-super-agent-widget] .table{display:table}[data-super-agent-widget] .hidden{display:none}[data-super-agent-widget] .h-5{height:1.25rem}[data-super-agent-widget] .h-7{height:1.75rem}[data-super-agent-widget] .h-8{height:2rem}[data-super-agent-widget] .h-9{height:2.25rem}[data-super-agent-widget] .h-\\[13px\\]{height:13px}[data-super-agent-widget] .h-\\[18px\\]{height:18px}[data-super-agent-widget] .h-\\[238px\\]{height:238px}[data-super-agent-widget] .h-\\[calc\\(100\\%_-_48px\\)\\]{height:calc(100% - 48px)}[data-super-agent-widget] .h-full{height:100%}[data-super-agent-widget] .min-h-\\[34px\\]{min-height:34px}[data-super-agent-widget] .min-h-\\[70px\\]{min-height:70px}[data-super-agent-widget] .w-12{width:3rem}[data-super-agent-widget] .w-5{width:1.25rem}[data-super-agent-widget] .w-7{width:1.75rem}[data-super-agent-widget] .w-\\[18px\\]{width:18px}[data-super-agent-widget] .w-\\[220px\\]{width:220px}[data-super-agent-widget] .w-\\[6px\\]{width:6px}[data-super-agent-widget] .w-full{width:100%}[data-super-agent-widget] .w-px{width:1px}[data-super-agent-widget] .min-w-0{min-width:0px}[data-super-agent-widget] .min-w-\\[14px\\]{min-width:14px}[data-super-agent-widget] .max-w-16{max-width:4rem}[data-super-agent-widget] .max-w-\\[800px\\]{max-width:800px}[data-super-agent-widget] .max-w-full{max-width:100%}[data-super-agent-widget] .flex-1{flex:1 1 0%}[data-super-agent-widget] .flex-shrink{flex-shrink:1}[data-super-agent-widget] .shrink-0{flex-shrink:0}[data-super-agent-widget] .border-collapse{border-collapse:collapse}[data-super-agent-widget] .scale-50{--tw-scale-x: .5;--tw-scale-y: .5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .cursor-col-resize{cursor:col-resize}[data-super-agent-widget] .cursor-default{cursor:default}[data-super-agent-widget] .cursor-grab{cursor:grab}[data-super-agent-widget] .cursor-pointer{cursor:pointer}[data-super-agent-widget] .cursor-text{cursor:text}[data-super-agent-widget] .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-super-agent-widget] .resize-none{resize:none}[data-super-agent-widget] .resize{resize:both}[data-super-agent-widget] .flex-row{flex-direction:row}[data-super-agent-widget] .flex-col{flex-direction:column}[data-super-agent-widget] .flex-wrap{flex-wrap:wrap}[data-super-agent-widget] .items-start{align-items:flex-start}[data-super-agent-widget] .items-end{align-items:flex-end}[data-super-agent-widget] .items-center{align-items:center}[data-super-agent-widget] .justify-end{justify-content:flex-end}[data-super-agent-widget] .justify-center{justify-content:center}[data-super-agent-widget] .justify-between{justify-content:space-between}[data-super-agent-widget] .gap-0\\.5{gap:.125rem}[data-super-agent-widget] .gap-1{gap:.25rem}[data-super-agent-widget] .gap-1\\.5{gap:.375rem}[data-super-agent-widget] .gap-2{gap:.5rem}[data-super-agent-widget] .gap-2\\.5{gap:.625rem}[data-super-agent-widget] .gap-3{gap:.75rem}[data-super-agent-widget] .gap-4{gap:1rem}[data-super-agent-widget] .gap-8{gap:2rem}[data-super-agent-widget] .gap-\\[22px\\]{gap:22px}[data-super-agent-widget] .gap-\\[7px\\]{gap:7px}[data-super-agent-widget] .overflow-hidden{overflow:hidden}[data-super-agent-widget] .overflow-visible{overflow:visible}[data-super-agent-widget] .overflow-y-auto{overflow-y:auto}[data-super-agent-widget] .text-ellipsis{text-overflow:ellipsis}[data-super-agent-widget] .whitespace-nowrap{white-space:nowrap}[data-super-agent-widget] .rounded{border-radius:.25rem}[data-super-agent-widget] .rounded-\\[5px\\]{border-radius:5px}[data-super-agent-widget] .rounded-full{border-radius:9999px}[data-super-agent-widget] .rounded-md{border-radius:.375rem}[data-super-agent-widget] .border{border-width:1px}[data-super-agent-widget] .border-r{border-right-width:1px}[data-super-agent-widget] .border-r-0{border-right-width:0px}[data-super-agent-widget] .border-none{border-style:none}[data-super-agent-widget] .border-\\[\\#DADADA\\]{--tw-border-opacity: 1;border-color:rgb(218 218 218 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#E8E8E8\\]{--tw-border-opacity: 1;border-color:rgb(232 232 232 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#ECECEC\\]{--tw-border-opacity: 1;border-color:rgb(236 236 236 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[var\\(--sa-primary\\)\\]{border-color:var(--sa-primary)}[data-super-agent-widget] .bg-\\[\\#DCDCDC\\]{--tw-bg-opacity: 1;background-color:rgb(220 220 220 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#E8F1FE\\]{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#F5F5F5\\]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#FAFAFA\\]{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#fee2e2\\]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[var\\(--sa-primary\\)\\]{background-color:var(--sa-primary)}[data-super-agent-widget] .bg-black\\/30{background-color:#0000004d}[data-super-agent-widget] .bg-transparent{background-color:transparent}[data-super-agent-widget] .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .object-contain{-o-object-fit:contain;object-fit:contain}[data-super-agent-widget] .p-0{padding:0}[data-super-agent-widget] .p-2{padding:.5rem}[data-super-agent-widget] .p-3{padding:.75rem}[data-super-agent-widget] .px-0\\.5{padding-left:.125rem;padding-right:.125rem}[data-super-agent-widget] .px-1{padding-left:.25rem;padding-right:.25rem}[data-super-agent-widget] .px-1\\.5{padding-left:.375rem;padding-right:.375rem}[data-super-agent-widget] .px-2\\.5{padding-left:.625rem;padding-right:.625rem}[data-super-agent-widget] .px-3{padding-left:.75rem;padding-right:.75rem}[data-super-agent-widget] .px-\\[15px\\]{padding-left:15px;padding-right:15px}[data-super-agent-widget] .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}[data-super-agent-widget] .py-1{padding-top:.25rem;padding-bottom:.25rem}[data-super-agent-widget] .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}[data-super-agent-widget] .py-2{padding-top:.5rem;padding-bottom:.5rem}[data-super-agent-widget] .py-3{padding-top:.75rem;padding-bottom:.75rem}[data-super-agent-widget] .pb-1{padding-bottom:.25rem}[data-super-agent-widget] .pb-2\\.5{padding-bottom:.625rem}[data-super-agent-widget] .pt-2{padding-top:.5rem}[data-super-agent-widget] .text-left{text-align:left}[data-super-agent-widget] .text-center{text-align:center}[data-super-agent-widget] .text-\\[11px\\]{font-size:11px}[data-super-agent-widget] .text-\\[12px\\]{font-size:12px}[data-super-agent-widget] .text-\\[13px\\]{font-size:13px}[data-super-agent-widget] .text-\\[14px\\]{font-size:14px}[data-super-agent-widget] .text-\\[18px\\]{font-size:18px}[data-super-agent-widget] .text-\\[9px\\]{font-size:9px}[data-super-agent-widget] .font-bold{font-weight:700}[data-super-agent-widget] .font-medium{font-weight:500}[data-super-agent-widget] .font-semibold{font-weight:600}[data-super-agent-widget] .italic{font-style:italic}[data-super-agent-widget] .leading-\\[1\\.3\\]{line-height:1.3}[data-super-agent-widget] .leading-\\[1\\.4\\]{line-height:1.4}[data-super-agent-widget] .leading-\\[1\\.5\\]{line-height:1.5}[data-super-agent-widget] .leading-\\[14px\\]{line-height:14px}[data-super-agent-widget] .leading-none{line-height:1}[data-super-agent-widget] .text-\\[\\#333\\]{--tw-text-opacity: 1;color:rgb(51 51 51 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#666\\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#999\\]{--tw-text-opacity: 1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#9A9A9A\\]{--tw-text-opacity: 1;color:rgb(154 154 154 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#A0A0A0\\]{--tw-text-opacity: 1;color:rgb(160 160 160 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#B8B8B8\\]{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#C0C0C0\\]{--tw-text-opacity: 1;color:rgb(192 192 192 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#ef4444\\]{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .underline{text-decoration-line:underline}[data-super-agent-widget] .antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-super-agent-widget] .opacity-0{opacity:0}[data-super-agent-widget] .opacity-10{opacity:.1}[data-super-agent-widget] .opacity-100{opacity:1}[data-super-agent-widget] .opacity-60{opacity:.6}[data-super-agent-widget] .opacity-70{opacity:.7}[data-super-agent-widget] .shadow-\\[0_-12px_48px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 -12px 48px rgba(0,0,0,.25);--tw-shadow-colored: 0 -12px 48px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_12px_36px_rgba\\(0\\,0\\,0\\,0\\.18\\)\\]{--tw-shadow: 0 12px 36px rgba(0,0,0,.18);--tw-shadow-colored: 0 12px 36px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_2px_8px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow: 0 2px 8px rgba(0,0,0,.12);--tw-shadow-colored: 0 2px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .outline-none{outline:2px solid transparent;outline-offset:2px}[data-super-agent-widget] .outline{outline-style:solid}[data-super-agent-widget] .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .duration-200{transition-duration:.2s}[data-super-agent-widget] .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}[data-super-agent-widget] .ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes sa-window-in{0%{opacity:0;transform:translateY(20px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes sa-slide-up-full{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes sa-home-fade-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-chip-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-logo-float{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}@keyframes sa-title-shimmer{0%{background-position:100% 0}to{background-position:-100% 0}}@keyframes sa-history-in{0%{opacity:0;transform:translate(-10px)}to{opacity:1;transform:translate(0)}}[data-super-agent-widget] .animate-sa-window-in{animation:sa-window-in .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-slide-up-full{animation:sa-slide-up-full .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-fade-in{animation:sa-fade-in .2s ease}[data-super-agent-widget] .animate-sa-home-fade-in{animation:sa-home-fade-in .4s ease forwards}[data-super-agent-widget] .animate-sa-chip-in{animation:sa-chip-in .4s cubic-bezier(.22,1,.36,1) forwards}[data-super-agent-widget] .animate-sa-logo-float{animation:sa-logo-float 3s ease-in-out infinite}[data-super-agent-widget] .animate-sa-title-shimmer{animation:sa-title-shimmer 2.5s ease forwards}[data-super-agent-widget] .animate-sa-history-in{animation:sa-history-in .2s ease}[data-super-agent-widget] .sa-tip{position:relative}[data-super-agent-widget] .sa-tip:before,[data-super-agent-widget] .sa-tip:after{position:absolute;top:100%;left:50%;pointer-events:none;opacity:0;transition:opacity .15s ease;z-index:100}[data-super-agent-widget] .sa-tip:before{content:attr(data-tooltip);transform:translate(-50%);margin-top:6px;padding:4px 8px;background:#fff;color:#333;font-size:12px;line-height:1.4;white-space:nowrap;border-radius:4px;box-shadow:0 2px 8px #0000001f;border:1px solid #e8e8e8}[data-super-agent-widget] .sa-tip:after{content:"";transform:translate(-50%);margin-top:2px;border:4px solid transparent;border-bottom-color:#fff;filter:drop-shadow(0 -1px 1px rgba(0,0,0,.06))}[data-super-agent-widget] .sa-tip:hover:before,[data-super-agent-widget] .sa-tip:hover:after{opacity:1}[data-super-agent-widget] .sa-chip{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(#e0e0e0,#e0e0e0) border-box;border:1px solid transparent}[data-super-agent-widget] .sa-chip:hover{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7) border-box}[data-super-agent-widget] .sa-chip:hover .sa-chip-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-shimmer-text{background:linear-gradient(90deg,#333,#333 35%,#00d4ff 40%,#1881f0,#2b52ee,#d116ea,#ff2e7e 56%,#333 61%,#333);background-size:300% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-new-chat{background:linear-gradient(258deg,#ff2e7e1a -4%,#d116ea1a 16%,#2b52ee1a 53%,#1881f01a 81%,#00d4ff1a 106%)}[data-super-agent-widget] .sa-new-chat:hover{background:linear-gradient(258deg,#ff2e7e29 -4%,#d116ea29 16%,#2b52ee29 53%,#1881f029 81%,#00d4ff29 106%)}[data-super-agent-widget] .sa-new-chat .sa-new-chat-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-home-gradient{background:linear-gradient(239deg,#ff2e7e -3%,#d116ea 17%,#2b52ee 54%,#1881f0 82%,#00d4ff 107%)}[data-super-agent-widget] .sa-home-gradient-fade{background:linear-gradient(180deg,#fff0,#fff)}[data-super-agent-widget] .sa-home-view .sa-thread{background:transparent}[data-super-agent-widget] .sa-resize-handle:hover{background:color-mix(in srgb,var(--sa-primary) 30%,transparent)}[data-super-agent-widget] .sa-input-form{border:1px solid transparent;background-color:#fff;background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);background-origin:border-box;background-clip:padding-box,border-box;transition:background .15s ease}[data-super-agent-widget] .sa-input-form-active,[data-super-agent-widget] .sa-input-form:focus-within{background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);cursor:pointer;flex-shrink:0;align-self:flex-end;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-send-btn-active,[data-super-agent-widget] .sa-input-form:focus-within .sa-send-btn{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn:hover{opacity:.9}[data-super-agent-widget] .sa-send-btn:active{opacity:.7}[data-super-agent-widget] .sa-send-btn img{display:block;width:14px;height:14px;filter:brightness(0) invert(1)}[data-super-agent-widget] .sa-stop-icon{display:block;width:8px;height:8px;border-radius:2px;background:#fff}[data-super-agent-widget] .sa-attach-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);color:#fff;cursor:pointer;flex-shrink:0;align-self:flex-end;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-attach-btn:hover{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);opacity:.9}[data-super-agent-widget] .sa-attach-btn:active{opacity:.7}[data-super-agent-widget] .sa-attachment-tray{display:flex;flex-wrap:wrap;gap:6px;padding:2px 0}[data-super-agent-widget] .sa-attachment-tray-chip{display:inline-flex;align-items:center;gap:4px;max-width:220px;padding:4px 8px;border:1px solid rgba(40,92,255,.25);border-radius:6px;background:#285cff0d;font-size:12px;line-height:1;color:#333}[data-super-agent-widget] .sa-attachment-tray-chip-error{border-color:#ef444459;background:#ef44440f}[data-super-agent-widget] .sa-attachment-tray-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}[data-super-agent-widget] .sa-attachment-tray-chip-size{color:#b8b8b8;flex-shrink:0}[data-super-agent-widget] .sa-attachment-tray-chip-remove{display:flex;align-items:center;justify-content:center;width:14px;height:14px;border:none;border-radius:9999px;background:transparent;color:#b8b8b8;font-size:10px;line-height:1;cursor:pointer;flex-shrink:0;padding:0}[data-super-agent-widget] .sa-attachment-tray-chip-remove:hover{background:#00000014;color:#666}[data-super-agent-widget] .sa-attachment-chip{display:inline-flex;align-items:center;gap:4px;max-width:240px;margin:2px 0;padding:5px 10px;border-radius:8px;background:#ffffff59;font-size:12px;line-height:1;color:inherit}[data-super-agent-widget] .sa-attachment-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}[data-super-agent-widget] .sa-attachment-chip-size{color:#00000073;flex-shrink:0}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:scale-\\[1\\.08\\]:hover{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .hover\\:bg-\\[\\#E8F1FE\\]:hover{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-\\[\\#F5F5F5\\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white\\/70:hover{background-color:#ffffffb3}[data-super-agent-widget] .hover\\:text-\\[\\#1881F0\\]:hover{--tw-text-opacity: 1;color:rgb(24 129 240 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[\\#ef4444\\]:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[var\\(--sa-primary\\)\\]:hover{color:var(--sa-primary)}[data-super-agent-widget] .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .active\\:cursor-grabbing:active{cursor:grabbing}[data-super-agent-widget] .active\\:bg-\\[\\#F5F5F5\\]:active{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] :is(.group:hover .group-hover\\:flex){display:flex}', ea = {
|
|
3728
4004
|
primaryColor: "#6366f1",
|
|
3729
4005
|
backgroundColor: "#ffffff",
|
|
3730
4006
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
@@ -3734,16 +4010,16 @@ const $t = `
|
|
|
3734
4010
|
panelHeight: 648,
|
|
3735
4011
|
zIndex: 9999
|
|
3736
4012
|
};
|
|
3737
|
-
function
|
|
4013
|
+
function ta(t, a) {
|
|
3738
4014
|
const n = parseInt(t.slice(1, 3), 16), s = parseInt(t.slice(3, 5), 16), r = parseInt(t.slice(5, 7), 16), i = 1 - a;
|
|
3739
4015
|
return `#${Math.round(n * i).toString(16).padStart(2, "0")}${Math.round(s * i).toString(16).padStart(2, "0")}${Math.round(r * i).toString(16).padStart(2, "0")}`;
|
|
3740
4016
|
}
|
|
3741
|
-
function
|
|
4017
|
+
function aa(t, a) {
|
|
3742
4018
|
const n = parseInt(t.slice(1, 3), 16), s = parseInt(t.slice(3, 5), 16), r = parseInt(t.slice(5, 7), 16);
|
|
3743
4019
|
return `#${Math.round(n + (255 - n) * a).toString(16).padStart(2, "0")}${Math.round(s + (255 - s) * a).toString(16).padStart(2, "0")}${Math.round(r + (255 - r) * a).toString(16).padStart(2, "0")}`;
|
|
3744
4020
|
}
|
|
3745
|
-
function
|
|
3746
|
-
const a = { ...
|
|
4021
|
+
function ra(t) {
|
|
4022
|
+
const a = { ...ea, ...t }, n = a.primaryColor, s = a.backgroundColor;
|
|
3747
4023
|
return [
|
|
3748
4024
|
// 用户直接配置的变量
|
|
3749
4025
|
`--sa-primary: ${n}`,
|
|
@@ -3754,8 +4030,8 @@ function Rt(t) {
|
|
|
3754
4030
|
`--sa-panel-height: ${a.panelHeight}px`,
|
|
3755
4031
|
`--sa-z-index: ${a.zIndex}`,
|
|
3756
4032
|
// 从 primaryColor 自动派生
|
|
3757
|
-
`--sa-primary-dark: ${
|
|
3758
|
-
`--sa-primary-light: ${
|
|
4033
|
+
`--sa-primary-dark: ${ta(n, 0.15)}`,
|
|
4034
|
+
`--sa-primary-light: ${aa(n, 0.9)}`,
|
|
3759
4035
|
// 从 backgroundColor 自动派生的语义色
|
|
3760
4036
|
`--sa-surface: ${s}`,
|
|
3761
4037
|
"--sa-border: #e5e7eb",
|
|
@@ -3765,36 +4041,36 @@ function Rt(t) {
|
|
|
3765
4041
|
"--sa-text-light: #6b7280"
|
|
3766
4042
|
].join("; ");
|
|
3767
4043
|
}
|
|
3768
|
-
function
|
|
4044
|
+
function la(t, a) {
|
|
3769
4045
|
const n = typeof t == "string" ? document.querySelector(t) : t;
|
|
3770
4046
|
if (!n)
|
|
3771
4047
|
throw new Error(`Target element not found: ${t}`);
|
|
3772
4048
|
const s = document.createElement("div");
|
|
3773
4049
|
s.setAttribute("data-super-agent-widget", "");
|
|
3774
|
-
const r =
|
|
4050
|
+
const r = ra(a.theme ?? {});
|
|
3775
4051
|
if (s.setAttribute("style", `${r}; height: 100%;`), n.appendChild(s), !document.getElementById("sa-widget-styles")) {
|
|
3776
|
-
const
|
|
3777
|
-
|
|
3778
|
-
${
|
|
4052
|
+
const o = document.createElement("style");
|
|
4053
|
+
o.id = "sa-widget-styles", o.textContent = `${Jt}
|
|
4054
|
+
${Qt}`, document.head.appendChild(o);
|
|
3779
4055
|
}
|
|
3780
|
-
let i =
|
|
3781
|
-
const
|
|
4056
|
+
let i = et(s), l = !1;
|
|
4057
|
+
const d = (o) => {
|
|
3782
4058
|
i && i.render(
|
|
3783
|
-
Q.createElement(
|
|
4059
|
+
Q.createElement(Zt, {
|
|
3784
4060
|
...a,
|
|
3785
|
-
initialOpen:
|
|
3786
|
-
onOpenChange: (
|
|
3787
|
-
|
|
4061
|
+
initialOpen: o ?? l,
|
|
4062
|
+
onOpenChange: (c) => {
|
|
4063
|
+
l = c;
|
|
3788
4064
|
}
|
|
3789
4065
|
})
|
|
3790
4066
|
);
|
|
3791
4067
|
};
|
|
3792
|
-
return
|
|
4068
|
+
return d(!1), {
|
|
3793
4069
|
open() {
|
|
3794
|
-
|
|
4070
|
+
l = !0, d(!0);
|
|
3795
4071
|
},
|
|
3796
4072
|
close() {
|
|
3797
|
-
|
|
4073
|
+
l = !1, d(!1);
|
|
3798
4074
|
},
|
|
3799
4075
|
destroy() {
|
|
3800
4076
|
i && (i.unmount(), i = null), s.remove();
|
|
@@ -3802,32 +4078,33 @@ ${Lt}`, document.head.appendChild(d);
|
|
|
3802
4078
|
};
|
|
3803
4079
|
}
|
|
3804
4080
|
export {
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
4081
|
+
K as ASSETS,
|
|
4082
|
+
Lt as ActionBar,
|
|
4083
|
+
Te as ChatProvider,
|
|
4084
|
+
Zt as ChatWidget,
|
|
4085
|
+
Be as Composer,
|
|
4086
|
+
yt as ErrorPart,
|
|
4087
|
+
qt as FullpageLayout,
|
|
4088
|
+
dt as Header,
|
|
3813
4089
|
B as Icon,
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
4090
|
+
$t as InterruptCard,
|
|
4091
|
+
Ft as Message,
|
|
4092
|
+
Gt as PageOverlay,
|
|
4093
|
+
ft as TextPart,
|
|
4094
|
+
xt as ThinkingPart,
|
|
4095
|
+
Pe as Thread,
|
|
4096
|
+
Ie as ThreadList,
|
|
4097
|
+
wt as ToolCallPart,
|
|
4098
|
+
vt as ToolResultPart,
|
|
4099
|
+
lt as Trigger,
|
|
4100
|
+
Ht as WelcomeScreen,
|
|
4101
|
+
ea as defaultTheme,
|
|
4102
|
+
mt as ensureIconFont,
|
|
4103
|
+
la as mount,
|
|
4104
|
+
ra as themeToCSSVars,
|
|
4105
|
+
pt as useAutoScroll,
|
|
4106
|
+
at as useChat,
|
|
4107
|
+
J as useChatContext,
|
|
4108
|
+
nt as useConversations,
|
|
4109
|
+
Jt as widgetStyles
|
|
3833
4110
|
};
|