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