@yuku123/z-team-component 0.2.57 → 0.2.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ComponentDoc-0L_mpFyu.js → ComponentDoc-Bx6NAJlK.js} +2 -2
- package/dist/{InvitationManagementPage-Ba5yy-Hl.js → InvitationManagementPage-Gkqisq4C.js} +1 -1
- package/dist/{OnboardingPage-rEAorVv0.js → OnboardingPage-C7C4PEjn.js} +2 -2
- package/dist/{ScheduledTasks-Db5a-nxu.js → ScheduledTasks-BQRcjBOd.js} +1 -1
- package/dist/SystemShell-Df9PZzLO.js +907 -0
- package/dist/{api-B4-sB0Pv.js → api-Y-52Ejhz.js} +1 -1
- package/dist/{index-C88kp8U2.js → index-63ovR-_x.js} +1 -1
- package/dist/{index-DTGL9OWw.js → index-BADGOdUu.js} +279 -245
- package/dist/{index-DJGEEIGt.js → index-Bpn6x1So.js} +2 -2
- package/dist/{index-CHb5cxi8.js → index-BvTYVEEv.js} +1 -1
- package/dist/index-Bw9yypc4.js +2841 -0
- package/dist/{index-BVYQ8p6A.js → index-CN9NsUQ6.js} +2 -2
- package/dist/{index-JpY3wmeg.js → index-CO6WYRIS.js} +2 -2
- package/dist/{index-C90C1lUS.js → index-DJ0FV74Y.js} +1 -1
- package/dist/{index-CmToF3CG.js → index-DfQCaS0z.js} +3914 -3911
- package/dist/{index-DRQFmqYV.js → index-Gt21FARO.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/pages.js +1 -1
- package/dist/z-team-component.css +2 -2
- package/package.json +1 -2
- package/dist/SystemShell-BbREgRq8.js +0 -637
- package/dist/index-9w4zGIUG.js +0 -2826
|
@@ -0,0 +1,2841 @@
|
|
|
1
|
+
import { jsx as t, jsxs as i, Fragment as xe } from "react/jsx-runtime";
|
|
2
|
+
import { S as Rt, T as Et, P as Ot } from "./webide-BcRzJX-h.js";
|
|
3
|
+
import { RightOutlined as $t, PlusOutlined as nn, LeftOutlined as sn, CheckOutlined as Ht, LoadingOutlined as Tt, EditOutlined as wt, DeleteOutlined as an, UpOutlined as It, RedoOutlined as ln, DownOutlined as cn, StopOutlined as on, CopyOutlined as rn, MessageOutlined as Pt, MoreOutlined as dn, DashboardOutlined as Ft, MenuUnfoldOutlined as un, MenuFoldOutlined as mn, SettingOutlined as pn, TeamOutlined as hn, FolderOpenOutlined as gn, BarChartOutlined as _n, PieChartOutlined as fn, CodeOutlined as yn, LinkOutlined as vn, UnorderedListOutlined as bn, FileTextOutlined as jt, ReadOutlined as Nn, ConsoleSqlOutlined as Cn, PlayCircleOutlined as kn } from "@ant-design/icons";
|
|
4
|
+
import { useState as m, useRef as O, useMemo as Me, useEffect as D, useCallback as U } from "react";
|
|
5
|
+
import { x as Tn, y as Wt, k as et, z as wn, A as In, C as Sn, D as An, E as Bn, F as Ln, G as Dn } from "./api-CALqShkO.js";
|
|
6
|
+
import { f as Kt, c as _t, a as Mn, b as xn, r as Rn, s as En, t as On, d as Ut, e as bt, g as $n, h as Hn, i as Vt, j as Pn, p as Fn, k as h, R as ut, D as ft, l as jn, m as Wn, F as yt, L as Kn, A as Un, C as Vn, W as Gn, n as zn, S as qn, o as Qn, U as Xn, T as Jn, q as Yn, u as Zn, P as es } from "./index-DfQCaS0z.js";
|
|
7
|
+
import { u as Gt, i as zt, T as ts, a as ns, s as ss } from "./createWorkspaceWsHandler-DP30xvug.js";
|
|
8
|
+
import { u as Ue } from "./useAppStore-kRZEA5WZ.js";
|
|
9
|
+
import { h as qt, f as as } from "./schedule-DfkgwPdE.js";
|
|
10
|
+
import ls from "react-markdown";
|
|
11
|
+
import is from "rehype-highlight";
|
|
12
|
+
import cs from "remark-gfm";
|
|
13
|
+
import { W as Nt, b as mt, T as Qt, c as Xt, a as Jt, P as Yt, S as os, E as rs, C as ds } from "./ScheduledTasks-BQRcjBOd.js";
|
|
14
|
+
import { message as rt, Tooltip as Ct } from "antd";
|
|
15
|
+
const us = "_container_3gc15_1", ms = "_sessionPanel_3gc15_9", ps = "_sessionHeader_3gc15_19", hs = "_sessionHeaderActions_3gc15_32", gs = "_sessionBtnSm_3gc15_37", _s = "_sessionList_3gc15_55", fs = "_sessionItem_3gc15_61", ys = "_sessionItemActive_3gc15_79", vs = "_sessionItemTitle_3gc15_84", bs = "_sessionLiveDot_3gc15_93", Ns = "_sessionItemTime_3gc15_100", Cs = "_sessionDeleteBtn_3gc15_106", ks = "_sessionRenameBtn_3gc15_127", Ts = "_sessionRenameInput_3gc15_148", ws = "_sessionCreateRow_3gc15_160", Is = "_sessionCreateInput_3gc15_166", Ss = "_sessionCreateConfirm_3gc15_180", As = "_sessionCreateCancel_3gc15_181", Bs = "_sessionSearchRow_3gc15_203", Ls = "_sessionSearchInput_3gc15_209", Ds = "_sessionSearchClear_3gc15_224", Ms = "_sessionEmpty_3gc15_245", xs = "_sessionExpandBtn_3gc15_255", Rs = "_chatPanel_3gc15_275", Es = "_chatHeader_3gc15_284", Os = "_agentAvatar_3gc15_296", $s = "_chatHeaderMeta_3gc15_309", Hs = "_chatHeaderName_3gc15_317", Ps = "_chatHeaderSession_3gc15_324", Fs = "_chatHeaderBadge_3gc15_332", js = "_streamingIndicator_3gc15_342", Ws = "_threadScroll_3gc15_351", Ks = "_threadInner_3gc15_357", Us = "_landing_3gc15_368", Vs = "_landingLogo_3gc15_378", Gs = "_landingTitle_3gc15_392", zs = "_landingHint_3gc15_398", qs = "_newChatLanding_3gc15_404", Qs = "_landingComposer_3gc15_415", Xs = "_landingInput_3gc15_432", Js = "_chatEmpty_3gc15_448", Ys = "_userRow_3gc15_459", Zs = "_userBubble_3gc15_464", ea = "_assistantBlock_3gc15_478", ta = "_md_3gc15_488", na = "_mdPreWrap_3gc15_546", sa = "_mdPreCopy_3gc15_550", aa = "_caretCursor_3gc15_585", la = "_errorBar_3gc15_602", ia = "_errorRetryBtn_3gc15_611", ca = "_stoppedBar_3gc15_626", oa = "_scrollTopBtn_3gc15_636", ra = "_scrollTopBtnVisible_3gc15_658", da = "_composerWrap_3gc15_669", ua = "_composer_3gc15_669", ma = "_composerInput_3gc15_691", pa = "_sendBtn_3gc15_709", ha = "_stopBtn_3gc15_710", ga = "_sendBtnReady_3gc15_730", _a = "_composerHint_3gc15_748", fa = "_msgMeta_3gc15_758", ya = "_copyBtn_3gc15_769", va = "_copyBtnInline_3gc15_799", ba = "_copyBtnDone_3gc15_806", Na = "_landingChips_3gc15_811", Ca = "_landingChip_3gc15_811", ka = "_userActions_3gc15_838", Ta = "_userActionBtn_3gc15_851", wa = "_editingBar_3gc15_874", Ia = "_pendingBar_3gc15_889", Sa = "_editingCancel_3gc15_910", c = {
|
|
16
|
+
container: us,
|
|
17
|
+
sessionPanel: ms,
|
|
18
|
+
sessionHeader: ps,
|
|
19
|
+
sessionHeaderActions: hs,
|
|
20
|
+
sessionBtnSm: gs,
|
|
21
|
+
sessionList: _s,
|
|
22
|
+
sessionItem: fs,
|
|
23
|
+
sessionItemActive: ys,
|
|
24
|
+
sessionItemTitle: vs,
|
|
25
|
+
sessionLiveDot: bs,
|
|
26
|
+
sessionItemTime: Ns,
|
|
27
|
+
sessionDeleteBtn: Cs,
|
|
28
|
+
sessionRenameBtn: ks,
|
|
29
|
+
sessionRenameInput: Ts,
|
|
30
|
+
sessionCreateRow: ws,
|
|
31
|
+
sessionCreateInput: Is,
|
|
32
|
+
sessionCreateConfirm: Ss,
|
|
33
|
+
sessionCreateCancel: As,
|
|
34
|
+
sessionSearchRow: Bs,
|
|
35
|
+
sessionSearchInput: Ls,
|
|
36
|
+
sessionSearchClear: Ds,
|
|
37
|
+
sessionEmpty: Ms,
|
|
38
|
+
sessionExpandBtn: xs,
|
|
39
|
+
chatPanel: Rs,
|
|
40
|
+
chatHeader: Es,
|
|
41
|
+
agentAvatar: Os,
|
|
42
|
+
chatHeaderMeta: $s,
|
|
43
|
+
chatHeaderName: Hs,
|
|
44
|
+
chatHeaderSession: Ps,
|
|
45
|
+
chatHeaderBadge: Fs,
|
|
46
|
+
streamingIndicator: js,
|
|
47
|
+
threadScroll: Ws,
|
|
48
|
+
threadInner: Ks,
|
|
49
|
+
landing: Us,
|
|
50
|
+
landingLogo: Vs,
|
|
51
|
+
landingTitle: Gs,
|
|
52
|
+
landingHint: zs,
|
|
53
|
+
newChatLanding: qs,
|
|
54
|
+
landingComposer: Qs,
|
|
55
|
+
landingInput: Xs,
|
|
56
|
+
chatEmpty: Js,
|
|
57
|
+
userRow: Ys,
|
|
58
|
+
userBubble: Zs,
|
|
59
|
+
assistantBlock: ea,
|
|
60
|
+
md: ta,
|
|
61
|
+
mdPreWrap: na,
|
|
62
|
+
mdPreCopy: sa,
|
|
63
|
+
caretCursor: aa,
|
|
64
|
+
errorBar: la,
|
|
65
|
+
errorRetryBtn: ia,
|
|
66
|
+
stoppedBar: ca,
|
|
67
|
+
scrollTopBtn: oa,
|
|
68
|
+
scrollTopBtnVisible: ra,
|
|
69
|
+
composerWrap: da,
|
|
70
|
+
composer: ua,
|
|
71
|
+
composerInput: ma,
|
|
72
|
+
sendBtn: pa,
|
|
73
|
+
stopBtn: ha,
|
|
74
|
+
sendBtnReady: ga,
|
|
75
|
+
composerHint: _a,
|
|
76
|
+
msgMeta: fa,
|
|
77
|
+
copyBtn: ya,
|
|
78
|
+
copyBtnInline: va,
|
|
79
|
+
copyBtnDone: ba,
|
|
80
|
+
landingChips: Na,
|
|
81
|
+
landingChip: Ca,
|
|
82
|
+
userActions: ka,
|
|
83
|
+
userActionBtn: Ta,
|
|
84
|
+
editingBar: wa,
|
|
85
|
+
pendingBar: Ia,
|
|
86
|
+
editingCancel: Sa
|
|
87
|
+
};
|
|
88
|
+
function Aa(s) {
|
|
89
|
+
if (s && s.trim().startsWith("{"))
|
|
90
|
+
try {
|
|
91
|
+
const r = JSON.parse(s);
|
|
92
|
+
if (r && Array.isArray(r.z_team_blocks))
|
|
93
|
+
return {
|
|
94
|
+
blocks: r.z_team_blocks,
|
|
95
|
+
totalMs: typeof r.totalMs == "number" ? r.totalMs : void 0,
|
|
96
|
+
usage: r.usage ?? void 0,
|
|
97
|
+
stopped: r.stopped === !0
|
|
98
|
+
};
|
|
99
|
+
} catch {
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
function St(s) {
|
|
104
|
+
return (s || []).map((r, d) => {
|
|
105
|
+
const _ = Aa(r.content);
|
|
106
|
+
return {
|
|
107
|
+
id: `local-${r.timestamp}-${r.role}-${d}`,
|
|
108
|
+
role: r.role === "assistant" ? "assistant" : "user",
|
|
109
|
+
blocks: _ ? _.blocks : [{ type: "text", text: r.content }],
|
|
110
|
+
totalMs: _ == null ? void 0 : _.totalMs,
|
|
111
|
+
usage: _ == null ? void 0 : _.usage,
|
|
112
|
+
stopped: (_ == null ? void 0 : _.stopped) === !0
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function qe(s) {
|
|
117
|
+
return s.filter((r) => r.type === "text").map((r) => r.text).join("");
|
|
118
|
+
}
|
|
119
|
+
function Ba(s) {
|
|
120
|
+
return s >= 1e4 ? `${Math.round(s / 1e3)}k` : s >= 1e3 ? `${(s / 1e3).toFixed(1)}k` : String(s);
|
|
121
|
+
}
|
|
122
|
+
function La(s) {
|
|
123
|
+
if (s == null || s <= 0) return "";
|
|
124
|
+
const r = Date.now() - s;
|
|
125
|
+
if (r < 6e4) return "刚刚";
|
|
126
|
+
if (r < 36e5) return `${Math.floor(r / 6e4)} 分钟前`;
|
|
127
|
+
if (r < 864e5) return `${Math.floor(r / 36e5)} 小时前`;
|
|
128
|
+
const d = new Date(Date.now() - 864e5);
|
|
129
|
+
if (new Date(s).toDateString() === d.toDateString()) return "昨天";
|
|
130
|
+
const _ = new Date(s);
|
|
131
|
+
return `${_.getMonth() + 1}-${String(_.getDate()).padStart(2, "0")}`;
|
|
132
|
+
}
|
|
133
|
+
const At = [
|
|
134
|
+
"#2F70F1",
|
|
135
|
+
"#52c41a",
|
|
136
|
+
"#fa8c16",
|
|
137
|
+
"#eb2f96",
|
|
138
|
+
"#722ed1",
|
|
139
|
+
"#13c2c2",
|
|
140
|
+
"#f522d0",
|
|
141
|
+
"#faad14"
|
|
142
|
+
];
|
|
143
|
+
function Bt(s) {
|
|
144
|
+
let r = 0;
|
|
145
|
+
for (let d = 0; d < s.length; d++) r = r * 31 + s.charCodeAt(d) | 0;
|
|
146
|
+
return At[Math.abs(r) % At.length];
|
|
147
|
+
}
|
|
148
|
+
function vt(s) {
|
|
149
|
+
return s ? s.charAt(0).toUpperCase() : "?";
|
|
150
|
+
}
|
|
151
|
+
function Da({ children: s }) {
|
|
152
|
+
const r = O(null);
|
|
153
|
+
return /* @__PURE__ */ i("div", { className: c.mdPreWrap, children: [
|
|
154
|
+
/* @__PURE__ */ t("div", { className: c.mdPreCopy, children: /* @__PURE__ */ t(kt, { getText: () => {
|
|
155
|
+
var d;
|
|
156
|
+
return ((d = r.current) == null ? void 0 : d.textContent) ?? "";
|
|
157
|
+
} }) }),
|
|
158
|
+
/* @__PURE__ */ t("pre", { ref: r, children: s })
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
function Ma({ text: s }) {
|
|
162
|
+
return /* @__PURE__ */ t("div", { className: c.md, children: /* @__PURE__ */ t(
|
|
163
|
+
ls,
|
|
164
|
+
{
|
|
165
|
+
remarkPlugins: [cs],
|
|
166
|
+
rehypePlugins: [is],
|
|
167
|
+
components: {
|
|
168
|
+
pre: (r) => /* @__PURE__ */ t(Da, { children: r.children })
|
|
169
|
+
},
|
|
170
|
+
children: s
|
|
171
|
+
}
|
|
172
|
+
) });
|
|
173
|
+
}
|
|
174
|
+
function xa({ startedAtMs: s }) {
|
|
175
|
+
const [, r] = m(0);
|
|
176
|
+
D(() => {
|
|
177
|
+
const _ = window.setInterval(() => r((k) => k + 1), 1e3);
|
|
178
|
+
return () => window.clearInterval(_);
|
|
179
|
+
}, []);
|
|
180
|
+
const d = Math.max(1, Math.round((Date.now() - s) / 1e3));
|
|
181
|
+
return /* @__PURE__ */ i("div", { className: c.msgMeta, children: [
|
|
182
|
+
d,
|
|
183
|
+
"s…"
|
|
184
|
+
] });
|
|
185
|
+
}
|
|
186
|
+
function Ra(s) {
|
|
187
|
+
var r;
|
|
188
|
+
if ((r = navigator.clipboard) != null && r.writeText)
|
|
189
|
+
return navigator.clipboard.writeText(s).catch(() => {
|
|
190
|
+
}), !0;
|
|
191
|
+
try {
|
|
192
|
+
const d = document.createElement("textarea");
|
|
193
|
+
d.value = s, d.style.position = "fixed", d.style.opacity = "0", document.body.appendChild(d), d.select();
|
|
194
|
+
const _ = document.execCommand("copy");
|
|
195
|
+
return document.body.removeChild(d), _;
|
|
196
|
+
} catch {
|
|
197
|
+
return !1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function kt({
|
|
201
|
+
getText: s,
|
|
202
|
+
inline: r,
|
|
203
|
+
label: d = "复制正文"
|
|
204
|
+
}) {
|
|
205
|
+
const [_, k] = m(!1);
|
|
206
|
+
return /* @__PURE__ */ t(
|
|
207
|
+
"button",
|
|
208
|
+
{
|
|
209
|
+
type: "button",
|
|
210
|
+
className: `${c.copyBtn} ${r ? c.copyBtnInline : ""} ${_ ? c.copyBtnDone : ""}`,
|
|
211
|
+
onClick: () => {
|
|
212
|
+
const I = s();
|
|
213
|
+
!I || !Ra(I) || (k(!0), window.setTimeout(() => k(!1), 1600));
|
|
214
|
+
},
|
|
215
|
+
title: d,
|
|
216
|
+
"aria-label": d,
|
|
217
|
+
children: _ ? /* @__PURE__ */ t(Ht, {}) : /* @__PURE__ */ t(rn, {})
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
const Lt = [
|
|
222
|
+
"查看当前目录的文件列表",
|
|
223
|
+
"总结当前目录里各文件的内容",
|
|
224
|
+
"帮我写一个脚本统计各文件的行数",
|
|
225
|
+
"说明一下你能使用哪些工具"
|
|
226
|
+
];
|
|
227
|
+
function Zt({
|
|
228
|
+
agent: s,
|
|
229
|
+
newSessionTrigger: r = 0,
|
|
230
|
+
autoSendDraft: d = null,
|
|
231
|
+
onAutoSendConsumed: _,
|
|
232
|
+
openSessionId: k = null,
|
|
233
|
+
onOpenSessionConsumed: I
|
|
234
|
+
}) {
|
|
235
|
+
var le;
|
|
236
|
+
const y = Ue((e) => e.currentUser), L = Gt(), [x, w] = m([]), [P, V] = m(""), [R, A] = m(null), [N, J] = m(""), F = O(!1), he = Me(() => {
|
|
237
|
+
const e = P.trim().toLowerCase();
|
|
238
|
+
return e ? x.filter((n) => n.title.toLowerCase().includes(e)) : x;
|
|
239
|
+
}, [x, P]), [S, B] = m(
|
|
240
|
+
null
|
|
241
|
+
), [$, C] = m([]), [q, j] = m(""), [H, ge] = m(!1), T = O(!1), W = O(null), [Ce, _e] = m(null), G = O(null), ye = O(null), ce = O(null);
|
|
242
|
+
D(() => {
|
|
243
|
+
ce.current = S;
|
|
244
|
+
}, [S]);
|
|
245
|
+
const ve = O(/* @__PURE__ */ new Map()), Re = O(null), Ee = (e) => {
|
|
246
|
+
T.current = e, ge(e);
|
|
247
|
+
}, [be, oe] = m(!1), [ke, Y] = m(""), [Te, fe] = m(!1), [we, re] = m(!1), [Z, de] = m(""), [Ie, Oe] = m(
|
|
248
|
+
() => localStorage.getItem("ft_local_session_collapsed") !== "false"
|
|
249
|
+
), [Qe, $e] = m(!0), [l, v] = m(!1), [E, ee] = m(null), te = O(null), ne = O(null), He = O(null), Se = O(null), Ae = O(!0), Xe = O(!1), ue = O(null), ze = U(
|
|
250
|
+
(e, n) => {
|
|
251
|
+
const a = ue.current;
|
|
252
|
+
if (a && a.sid === e) {
|
|
253
|
+
a.messages = n(a.messages), ce.current === e && C(a.messages);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
C((p) => n(p));
|
|
257
|
+
},
|
|
258
|
+
[]
|
|
259
|
+
), tt = H ? ((le = ue.current) == null ? void 0 : le.sid) ?? null : null, Be = U(async () => {
|
|
260
|
+
try {
|
|
261
|
+
const e = await Kt(s == null ? void 0 : s.localAgentId);
|
|
262
|
+
return w(e), $e(!0), e;
|
|
263
|
+
} catch {
|
|
264
|
+
return $e(!1), w([]), [];
|
|
265
|
+
}
|
|
266
|
+
}, [s == null ? void 0 : s.localAgentId]);
|
|
267
|
+
D(() => {
|
|
268
|
+
B(null), C([]), V(""), Be().then((e) => {
|
|
269
|
+
if (e.length > 0) {
|
|
270
|
+
const n = [...e].sort(
|
|
271
|
+
(a, p) => new Date(p.updatedAt).getTime() - new Date(a.updatedAt).getTime()
|
|
272
|
+
)[0];
|
|
273
|
+
B(n.id);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}, [Be]), D(() => {
|
|
277
|
+
r > 0 && (async () => {
|
|
278
|
+
try {
|
|
279
|
+
const e = await _t(
|
|
280
|
+
"新会话",
|
|
281
|
+
s == null ? void 0 : s.localAgentId
|
|
282
|
+
);
|
|
283
|
+
w((n) => [e, ...n]), B(e.id), C([]), V("");
|
|
284
|
+
} catch {
|
|
285
|
+
re(!0), de("");
|
|
286
|
+
}
|
|
287
|
+
})();
|
|
288
|
+
}, [r]);
|
|
289
|
+
const nt = O(!1);
|
|
290
|
+
D(() => {
|
|
291
|
+
!d || nt.current || (nt.current = !0, _ == null || _(), Ve(d));
|
|
292
|
+
}, []);
|
|
293
|
+
const se = O(null);
|
|
294
|
+
D(() => {
|
|
295
|
+
!k || se.current === k || (se.current = k, B(k), I == null || I());
|
|
296
|
+
}, [k, I]), D(() => {
|
|
297
|
+
const e = Re.current;
|
|
298
|
+
if (e != null && e !== S) {
|
|
299
|
+
ve.current.set(e, q);
|
|
300
|
+
const p = ve.current.get(S ?? "") ?? "";
|
|
301
|
+
j(p), requestAnimationFrame(() => {
|
|
302
|
+
const u = ne.current;
|
|
303
|
+
u && (u.style.height = "auto", u.style.height = Math.min(u.scrollHeight, 180) + "px");
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (Re.current = S, !S) {
|
|
307
|
+
C([]);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const n = ue.current;
|
|
311
|
+
if (n && n.sid === S) {
|
|
312
|
+
if (Ae.current = !0, C(n.messages), n.messages.some((p) => p.streaming || p.error)) return;
|
|
313
|
+
ue.current = null;
|
|
314
|
+
}
|
|
315
|
+
if (Xe.current) {
|
|
316
|
+
Xe.current = !1;
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
let a = !1;
|
|
320
|
+
return oe(!0), Mn(S).then((p) => {
|
|
321
|
+
a || C(St(p.messages));
|
|
322
|
+
}).catch(() => {
|
|
323
|
+
a || C([]);
|
|
324
|
+
}).finally(() => {
|
|
325
|
+
a || oe(!1);
|
|
326
|
+
}), () => {
|
|
327
|
+
a = !0;
|
|
328
|
+
};
|
|
329
|
+
}, [S]), D(() => {
|
|
330
|
+
Ae.current && te.current && (te.current.scrollTop = te.current.scrollHeight);
|
|
331
|
+
}, [$]);
|
|
332
|
+
const Je = U(() => {
|
|
333
|
+
const e = te.current;
|
|
334
|
+
if (!e) return;
|
|
335
|
+
const n = e.scrollHeight - e.scrollTop - e.clientHeight;
|
|
336
|
+
Ae.current = n < 80, v(n > 120);
|
|
337
|
+
}, []), st = U(() => {
|
|
338
|
+
const e = te.current;
|
|
339
|
+
e && (e.scrollTop = e.scrollHeight), Ae.current = !0, v(!1);
|
|
340
|
+
}, []);
|
|
341
|
+
D(() => {
|
|
342
|
+
localStorage.setItem(
|
|
343
|
+
"ft_local_session_collapsed",
|
|
344
|
+
Ie ? "true" : "false"
|
|
345
|
+
);
|
|
346
|
+
}, [Ie]);
|
|
347
|
+
const ae = async () => {
|
|
348
|
+
const e = Z.trim() || "新会话";
|
|
349
|
+
try {
|
|
350
|
+
const n = await _t(e, s == null ? void 0 : s.localAgentId);
|
|
351
|
+
w((a) => [n, ...a]), B(n.id), C([]), re(!1), de(""), V("");
|
|
352
|
+
} catch {
|
|
353
|
+
}
|
|
354
|
+
}, me = (e) => {
|
|
355
|
+
A(e.id), J(e.title), F.current = !1;
|
|
356
|
+
}, K = async () => {
|
|
357
|
+
if (F.current) return;
|
|
358
|
+
F.current = !0;
|
|
359
|
+
const e = R, n = N.trim();
|
|
360
|
+
if (A(null), !(!e || !n))
|
|
361
|
+
try {
|
|
362
|
+
await Rn(e, n), w(
|
|
363
|
+
(a) => a.map((p) => p.id === e ? { ...p, title: n } : p)
|
|
364
|
+
);
|
|
365
|
+
} catch {
|
|
366
|
+
}
|
|
367
|
+
}, at = async (e) => {
|
|
368
|
+
if (window.confirm("确定删除此会话吗?")) {
|
|
369
|
+
T.current && Se.current === e && Fe();
|
|
370
|
+
try {
|
|
371
|
+
await Tn(e), w((n) => n.filter((a) => a.id !== e)), S === e && (B(null), C([]));
|
|
372
|
+
} catch {
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}, Ye = U(
|
|
376
|
+
(e, n, a, p) => {
|
|
377
|
+
ze(
|
|
378
|
+
e,
|
|
379
|
+
(u) => u.map((g) => {
|
|
380
|
+
if (g.id !== n) return g;
|
|
381
|
+
const f = Date.now();
|
|
382
|
+
let b = {};
|
|
383
|
+
a === "thinking" && g.thinkingStartMs == null ? b = { thinkingStartMs: f } : a === "text" && g.thinkingStartMs != null && g.thinkingMs == null && (b = { thinkingMs: f - g.thinkingStartMs });
|
|
384
|
+
const M = [...g.blocks], X = M[M.length - 1];
|
|
385
|
+
return X != null && (a === "text" && X.type === "text" || a === "thinking" && X.type === "thinking") && X ? M[M.length - 1] = {
|
|
386
|
+
...X,
|
|
387
|
+
text: X.text + p
|
|
388
|
+
} : M.push({ type: a, text: p }), { ...g, ...b, blocks: M };
|
|
389
|
+
})
|
|
390
|
+
);
|
|
391
|
+
},
|
|
392
|
+
[ze]
|
|
393
|
+
), Pe = U(
|
|
394
|
+
(e, n, a) => {
|
|
395
|
+
ze(
|
|
396
|
+
e,
|
|
397
|
+
(p) => p.map((u) => {
|
|
398
|
+
if (u.id !== n) return u;
|
|
399
|
+
const g = Date.now(), f = u.thinkingStartMs != null && u.thinkingMs == null ? { thinkingMs: g - u.thinkingStartMs } : {}, b = [...u.blocks];
|
|
400
|
+
if (a.kind === "tool_call")
|
|
401
|
+
b.push({
|
|
402
|
+
type: "tool_call",
|
|
403
|
+
id: a.id,
|
|
404
|
+
name: a.name,
|
|
405
|
+
input: a.input,
|
|
406
|
+
_t0: g
|
|
407
|
+
});
|
|
408
|
+
else if (a.kind === "tool_end")
|
|
409
|
+
for (let M = b.length - 1; M >= 0; M--) {
|
|
410
|
+
const X = b[M];
|
|
411
|
+
if (X.type === "tool_call" && a.id && X.id === a.id) {
|
|
412
|
+
b[M] = { ...X, input: a.input };
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else a.kind === "tool_result" && b.push({
|
|
417
|
+
type: "tool_result",
|
|
418
|
+
id: a.id,
|
|
419
|
+
content: a.content,
|
|
420
|
+
_t1: g
|
|
421
|
+
});
|
|
422
|
+
return { ...u, ...f, blocks: b };
|
|
423
|
+
})
|
|
424
|
+
);
|
|
425
|
+
},
|
|
426
|
+
[ze]
|
|
427
|
+
), Fe = U(() => {
|
|
428
|
+
var u;
|
|
429
|
+
const e = Se.current;
|
|
430
|
+
Se.current = null, (u = He.current) == null || u.abort(), He.current = null, Ee(!1), e && xn(e).catch(() => {
|
|
431
|
+
});
|
|
432
|
+
const n = ue.current;
|
|
433
|
+
ue.current = null;
|
|
434
|
+
const a = (g) => g.map(
|
|
435
|
+
(f) => f.streaming ? {
|
|
436
|
+
...f,
|
|
437
|
+
streaming: !1,
|
|
438
|
+
stopped: !0,
|
|
439
|
+
// 停止回合也结算耗时(与 onComplete 一致),避免「已停止生成」缺耗时显示
|
|
440
|
+
durationMs: f.startedAtMs != null ? Date.now() - f.startedAtMs : void 0
|
|
441
|
+
} : f
|
|
442
|
+
);
|
|
443
|
+
n && e && n.sid === e ? ce.current === e && C(a(n.messages)) : C((g) => a(g));
|
|
444
|
+
const p = G.current;
|
|
445
|
+
G.current = null, ye.current = null, _e(null), p && j((g) => g ? g + `
|
|
446
|
+
` + p : p);
|
|
447
|
+
}, []);
|
|
448
|
+
D(() => {
|
|
449
|
+
const e = (n) => {
|
|
450
|
+
if (n.key !== "Escape" || n.isComposing) return;
|
|
451
|
+
const a = n.target;
|
|
452
|
+
a && (a.tagName === "TEXTAREA" || a.tagName === "INPUT") || (H ? (n.preventDefault(), Fe()) : E != null && (n.preventDefault(), ee(null), ne.current && (ne.current.style.height = "auto")));
|
|
453
|
+
};
|
|
454
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
455
|
+
}, [H, E, Fe]);
|
|
456
|
+
const Le = async (e, n) => {
|
|
457
|
+
const a = n ?? S;
|
|
458
|
+
if (!a || !e || T.current) return;
|
|
459
|
+
W.current = null;
|
|
460
|
+
const p = {
|
|
461
|
+
id: `local-user-${Date.now()}`,
|
|
462
|
+
role: "user",
|
|
463
|
+
blocks: [{ type: "text", text: e }]
|
|
464
|
+
}, u = `local-assistant-${Date.now()}`, g = {
|
|
465
|
+
id: u,
|
|
466
|
+
role: "assistant",
|
|
467
|
+
blocks: [],
|
|
468
|
+
streaming: !0,
|
|
469
|
+
startedAtMs: Date.now()
|
|
470
|
+
};
|
|
471
|
+
C((b) => {
|
|
472
|
+
const M = [...b, p, g];
|
|
473
|
+
return ue.current = { sid: a, messages: M }, M;
|
|
474
|
+
}), Ee(!0), Se.current = a, Ae.current = !0;
|
|
475
|
+
const f = new AbortController();
|
|
476
|
+
He.current = f, await En(
|
|
477
|
+
a,
|
|
478
|
+
e,
|
|
479
|
+
{
|
|
480
|
+
onToken: (b) => Ye(a, u, "text", b),
|
|
481
|
+
onReasoning: (b) => Ye(a, u, "thinking", b),
|
|
482
|
+
onEvent: (b) => Pe(a, u, b),
|
|
483
|
+
onFinal: (b) => {
|
|
484
|
+
W.current = b;
|
|
485
|
+
},
|
|
486
|
+
onError: (b) => {
|
|
487
|
+
W.current = null, Ee(!1), He.current = null, Se.current = null;
|
|
488
|
+
const M = ue.current, X = (Ne) => Ne.map(
|
|
489
|
+
(ie) => ie.id === u ? {
|
|
490
|
+
...ie,
|
|
491
|
+
streaming: !1,
|
|
492
|
+
// 出错回合也结算耗时(重发/重试前能看到该回合跑了多久)
|
|
493
|
+
durationMs: ie.startedAtMs != null ? Date.now() - ie.startedAtMs : void 0,
|
|
494
|
+
error: ie.blocks.length ? b.message : `[错误] ${b.message}`
|
|
495
|
+
} : ie
|
|
496
|
+
);
|
|
497
|
+
M && M.sid === a ? (M.messages = X(M.messages), ce.current === a && C(M.messages)) : C((Ne) => X(Ne));
|
|
498
|
+
const De = G.current;
|
|
499
|
+
G.current = null, ye.current = null, _e(null), De && j((Ne) => Ne ? Ne + `
|
|
500
|
+
` + De : De);
|
|
501
|
+
},
|
|
502
|
+
onComplete: () => {
|
|
503
|
+
Ee(!1), He.current = null, Se.current = null;
|
|
504
|
+
const b = W.current;
|
|
505
|
+
W.current = null;
|
|
506
|
+
const M = ue.current;
|
|
507
|
+
ue.current = null;
|
|
508
|
+
const X = (ie) => ie.map(
|
|
509
|
+
(je) => je.id === u ? {
|
|
510
|
+
...je,
|
|
511
|
+
streaming: !1,
|
|
512
|
+
durationMs: (b == null ? void 0 : b.totalMs) ?? (je.startedAtMs != null ? Date.now() - je.startedAtMs : void 0),
|
|
513
|
+
totalMs: (b == null ? void 0 : b.totalMs) ?? je.totalMs,
|
|
514
|
+
stopped: je.stopped || (b == null ? void 0 : b.stopped) === !0,
|
|
515
|
+
usage: je.usage ?? (b == null ? void 0 : b.usage)
|
|
516
|
+
} : je
|
|
517
|
+
);
|
|
518
|
+
M && M.sid === a ? ce.current === a && C(X(M.messages)) : C((ie) => X(ie));
|
|
519
|
+
const De = G.current, Ne = ye.current;
|
|
520
|
+
G.current = null, ye.current = null, _e(null), De && (Ne && ce.current === Ne ? Le(De, Ne) : j((ie) => ie ? ie + `
|
|
521
|
+
` + De : De));
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
agentType: s == null ? void 0 : s.localAgentType,
|
|
526
|
+
agentId: s == null ? void 0 : s.localAgentId,
|
|
527
|
+
signal: f.signal
|
|
528
|
+
}
|
|
529
|
+
);
|
|
530
|
+
}, Ze = async (e, n) => {
|
|
531
|
+
if (S)
|
|
532
|
+
try {
|
|
533
|
+
const { session: a, previousId: p } = await On(
|
|
534
|
+
S,
|
|
535
|
+
e
|
|
536
|
+
);
|
|
537
|
+
Xe.current = !0, w(
|
|
538
|
+
(u) => u.map((g) => g.id === p ? a : g)
|
|
539
|
+
), B(a.id), C(St(a.messages)), await Le(n, a.id);
|
|
540
|
+
} catch {
|
|
541
|
+
await Le(n);
|
|
542
|
+
}
|
|
543
|
+
}, pt = (e, n) => {
|
|
544
|
+
H || (j(n), ee(e), requestAnimationFrame(() => {
|
|
545
|
+
const a = ne.current;
|
|
546
|
+
a && (a.focus(), a.style.height = "auto", a.style.height = Math.min(a.scrollHeight, 180) + "px");
|
|
547
|
+
}));
|
|
548
|
+
}, pe = () => {
|
|
549
|
+
ee(null), ne.current && (ne.current.style.height = "auto");
|
|
550
|
+
}, lt = () => {
|
|
551
|
+
const e = G.current;
|
|
552
|
+
G.current = null, _e(null), e && j((n) => n ? n + `
|
|
553
|
+
` + e : e);
|
|
554
|
+
}, Ve = async (e) => {
|
|
555
|
+
const n = (e ?? ke).trim();
|
|
556
|
+
if (!(!n || Te || T.current)) {
|
|
557
|
+
fe(!0);
|
|
558
|
+
try {
|
|
559
|
+
const a = /* @__PURE__ */ new Date(), p = (f) => String(f).padStart(2, "0"), u = `${p(a.getMonth() + 1)}${p(a.getDate())} ${p(
|
|
560
|
+
a.getHours()
|
|
561
|
+
)}:${p(a.getMinutes())}`, g = await _t(u, s == null ? void 0 : s.localAgentId);
|
|
562
|
+
w((f) => [g, ...f]), B(g.id), C([]), Y(""), await Le(n, g.id);
|
|
563
|
+
} catch {
|
|
564
|
+
} finally {
|
|
565
|
+
fe(!1);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}, it = () => {
|
|
569
|
+
const e = q.trim();
|
|
570
|
+
if (e) {
|
|
571
|
+
if (H) {
|
|
572
|
+
G.current = G.current ? G.current + `
|
|
573
|
+
` + e : e, ye.current = S, _e(G.current), j(""), ve.current.delete(S ?? ""), ne.current && (ne.current.style.height = "auto");
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (j(""), ve.current.delete(S ?? ""), ne.current && (ne.current.style.height = "auto"), E != null) {
|
|
577
|
+
const n = E;
|
|
578
|
+
ee(null), Ze(n, e);
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
Le(e);
|
|
582
|
+
}
|
|
583
|
+
}, ht = (e) => {
|
|
584
|
+
zt(e, L.sendKey) && !e.nativeEvent.isComposing && (e.preventDefault(), it()), e.key === "Escape" && (H ? Fe() : E != null && pe());
|
|
585
|
+
}, ct = (e) => {
|
|
586
|
+
j(e.target.value);
|
|
587
|
+
const n = e.target;
|
|
588
|
+
n.style.height = "auto", n.style.height = Math.min(n.scrollHeight, 180) + "px";
|
|
589
|
+
}, Ge = Bt("local-default");
|
|
590
|
+
Bt(
|
|
591
|
+
(y == null ? void 0 : y.username) || (y == null ? void 0 : y.display_name) || "user"
|
|
592
|
+
);
|
|
593
|
+
const gt = (e) => {
|
|
594
|
+
const n = /* @__PURE__ */ new Map();
|
|
595
|
+
for (const u of e.blocks)
|
|
596
|
+
u.type === "tool_result" && u.id && n.set(u.id, u);
|
|
597
|
+
const a = /* @__PURE__ */ new Set();
|
|
598
|
+
for (const u of e.blocks)
|
|
599
|
+
u.type === "tool_call" && u.id && n.has(u.id) && a.add(u.id);
|
|
600
|
+
const p = [];
|
|
601
|
+
return e.blocks.forEach((u, g) => {
|
|
602
|
+
if (u.type === "thinking")
|
|
603
|
+
p.push(
|
|
604
|
+
/* @__PURE__ */ t(
|
|
605
|
+
ts,
|
|
606
|
+
{
|
|
607
|
+
text: u.text,
|
|
608
|
+
streaming: !!e.streaming,
|
|
609
|
+
startedAtMs: e.thinkingStartMs,
|
|
610
|
+
durationMs: e.thinkingMs ?? u.durationMs
|
|
611
|
+
},
|
|
612
|
+
g
|
|
613
|
+
)
|
|
614
|
+
);
|
|
615
|
+
else if (u.type === "tool_call") {
|
|
616
|
+
const f = u.id ? n.get(u.id) : void 0, b = u._t0 != null && (f == null ? void 0 : f._t1) != null ? Math.max(1, f._t1 - u._t0) : u.durationMs;
|
|
617
|
+
p.push(
|
|
618
|
+
/* @__PURE__ */ t(
|
|
619
|
+
ns,
|
|
620
|
+
{
|
|
621
|
+
call: u,
|
|
622
|
+
result: f,
|
|
623
|
+
running: !!e.streaming && f === void 0,
|
|
624
|
+
durationMs: b,
|
|
625
|
+
startedAtMs: u._t0
|
|
626
|
+
},
|
|
627
|
+
g
|
|
628
|
+
)
|
|
629
|
+
);
|
|
630
|
+
} else if (u.type === "tool_result") {
|
|
631
|
+
if (u.id && a.has(u.id)) return;
|
|
632
|
+
p.push(
|
|
633
|
+
/* @__PURE__ */ t("div", { className: c.toolItem, children: /* @__PURE__ */ i("div", { className: c.toolBody, children: [
|
|
634
|
+
/* @__PURE__ */ t("div", { className: c.toolSectionLabel, children: "工具结果" }),
|
|
635
|
+
/* @__PURE__ */ t("pre", { className: c.toolPre, children: u.content || "(空)" })
|
|
636
|
+
] }) }, g)
|
|
637
|
+
);
|
|
638
|
+
} else u.type === "text" && u.text && p.push(/* @__PURE__ */ t(Ma, { text: u.text }, g));
|
|
639
|
+
}), p;
|
|
640
|
+
};
|
|
641
|
+
if (!Qe)
|
|
642
|
+
return /* @__PURE__ */ t("div", { className: c.container, children: /* @__PURE__ */ t("div", { className: c.chatPanel, children: /* @__PURE__ */ t("div", { className: c.chatEmpty, children: "本地 Agent 未启动,请检查桌面端是否正常运行" }) }) });
|
|
643
|
+
const ot = x.find((e) => e.id === S);
|
|
644
|
+
return /* @__PURE__ */ i("div", { className: c.container, children: [
|
|
645
|
+
Ie ? /* @__PURE__ */ t(
|
|
646
|
+
"button",
|
|
647
|
+
{
|
|
648
|
+
type: "button",
|
|
649
|
+
className: c.sessionExpandBtn,
|
|
650
|
+
onClick: () => Oe(!1),
|
|
651
|
+
title: "展开会话列表",
|
|
652
|
+
children: /* @__PURE__ */ t($t, {})
|
|
653
|
+
}
|
|
654
|
+
) : /* @__PURE__ */ i("div", { className: c.sessionPanel, children: [
|
|
655
|
+
/* @__PURE__ */ i("div", { className: c.sessionHeader, children: [
|
|
656
|
+
/* @__PURE__ */ t("span", { children: "会话" }),
|
|
657
|
+
/* @__PURE__ */ i("div", { className: c.sessionHeaderActions, children: [
|
|
658
|
+
/* @__PURE__ */ t(
|
|
659
|
+
"button",
|
|
660
|
+
{
|
|
661
|
+
type: "button",
|
|
662
|
+
className: c.sessionBtnSm,
|
|
663
|
+
onClick: () => {
|
|
664
|
+
re(!0), de("");
|
|
665
|
+
},
|
|
666
|
+
title: "新建会话",
|
|
667
|
+
children: /* @__PURE__ */ t(nn, {})
|
|
668
|
+
}
|
|
669
|
+
),
|
|
670
|
+
/* @__PURE__ */ t(
|
|
671
|
+
"button",
|
|
672
|
+
{
|
|
673
|
+
type: "button",
|
|
674
|
+
className: c.sessionBtnSm,
|
|
675
|
+
onClick: () => Oe(!0),
|
|
676
|
+
title: "收起会话列表",
|
|
677
|
+
children: /* @__PURE__ */ t(sn, {})
|
|
678
|
+
}
|
|
679
|
+
)
|
|
680
|
+
] })
|
|
681
|
+
] }),
|
|
682
|
+
/* @__PURE__ */ i("div", { className: c.sessionSearchRow, children: [
|
|
683
|
+
/* @__PURE__ */ t(
|
|
684
|
+
"input",
|
|
685
|
+
{
|
|
686
|
+
className: c.sessionSearchInput,
|
|
687
|
+
type: "text",
|
|
688
|
+
placeholder: "搜索会话",
|
|
689
|
+
value: P,
|
|
690
|
+
onChange: (e) => V(e.target.value)
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
P && /* @__PURE__ */ t(
|
|
694
|
+
"button",
|
|
695
|
+
{
|
|
696
|
+
type: "button",
|
|
697
|
+
className: c.sessionSearchClear,
|
|
698
|
+
onClick: () => V(""),
|
|
699
|
+
title: "清除搜索",
|
|
700
|
+
children: "✕"
|
|
701
|
+
}
|
|
702
|
+
)
|
|
703
|
+
] }),
|
|
704
|
+
/* @__PURE__ */ i("div", { className: c.sessionList, children: [
|
|
705
|
+
we && /* @__PURE__ */ i("div", { className: c.sessionCreateRow, children: [
|
|
706
|
+
/* @__PURE__ */ t(
|
|
707
|
+
"input",
|
|
708
|
+
{
|
|
709
|
+
className: c.sessionCreateInput,
|
|
710
|
+
type: "text",
|
|
711
|
+
placeholder: "输入会话名称",
|
|
712
|
+
value: Z,
|
|
713
|
+
autoFocus: !0,
|
|
714
|
+
onChange: (e) => de(e.target.value),
|
|
715
|
+
onKeyDown: (e) => {
|
|
716
|
+
e.key === "Enter" && ae(), e.key === "Escape" && (re(!1), de(""));
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
),
|
|
720
|
+
/* @__PURE__ */ t(
|
|
721
|
+
"button",
|
|
722
|
+
{
|
|
723
|
+
type: "button",
|
|
724
|
+
className: c.sessionCreateConfirm,
|
|
725
|
+
onClick: () => void ae(),
|
|
726
|
+
title: "确认创建",
|
|
727
|
+
children: /* @__PURE__ */ t(Ht, {})
|
|
728
|
+
}
|
|
729
|
+
),
|
|
730
|
+
/* @__PURE__ */ t(
|
|
731
|
+
"button",
|
|
732
|
+
{
|
|
733
|
+
type: "button",
|
|
734
|
+
className: c.sessionCreateCancel,
|
|
735
|
+
onClick: () => {
|
|
736
|
+
re(!1), de("");
|
|
737
|
+
},
|
|
738
|
+
title: "取消",
|
|
739
|
+
children: "✕"
|
|
740
|
+
}
|
|
741
|
+
)
|
|
742
|
+
] }),
|
|
743
|
+
x.length === 0 && !we ? /* @__PURE__ */ i("div", { className: c.sessionEmpty, children: [
|
|
744
|
+
/* @__PURE__ */ t("span", { children: "暂无会话" }),
|
|
745
|
+
/* @__PURE__ */ t("span", { children: "点击「+」开始聊天" })
|
|
746
|
+
] }) : he.length === 0 ? /* @__PURE__ */ i("div", { className: c.sessionEmpty, children: [
|
|
747
|
+
/* @__PURE__ */ t("span", { children: "无匹配会话" }),
|
|
748
|
+
/* @__PURE__ */ t("span", { children: "换个关键词试试" })
|
|
749
|
+
] }) : he.map((e) => /* @__PURE__ */ i(
|
|
750
|
+
"div",
|
|
751
|
+
{
|
|
752
|
+
className: `${c.sessionItem} ${S === e.id ? c.sessionItemActive : ""}`,
|
|
753
|
+
onClick: () => B(e.id),
|
|
754
|
+
children: [
|
|
755
|
+
R === e.id ? /* @__PURE__ */ t(
|
|
756
|
+
"input",
|
|
757
|
+
{
|
|
758
|
+
className: c.sessionRenameInput,
|
|
759
|
+
type: "text",
|
|
760
|
+
value: N,
|
|
761
|
+
autoFocus: !0,
|
|
762
|
+
onFocus: (n) => n.currentTarget.select(),
|
|
763
|
+
onClick: (n) => n.stopPropagation(),
|
|
764
|
+
onChange: (n) => J(n.target.value),
|
|
765
|
+
onKeyDown: (n) => {
|
|
766
|
+
n.key === "Enter" && K(), n.key === "Escape" && (F.current = !0, A(null));
|
|
767
|
+
},
|
|
768
|
+
onBlur: () => void K()
|
|
769
|
+
}
|
|
770
|
+
) : /* @__PURE__ */ i(
|
|
771
|
+
"span",
|
|
772
|
+
{
|
|
773
|
+
className: c.sessionItemTitle,
|
|
774
|
+
title: e.title,
|
|
775
|
+
onDoubleClick: () => me(e),
|
|
776
|
+
children: [
|
|
777
|
+
e.id === tt && /* @__PURE__ */ t(
|
|
778
|
+
Tt,
|
|
779
|
+
{
|
|
780
|
+
spin: !0,
|
|
781
|
+
className: c.sessionLiveDot
|
|
782
|
+
}
|
|
783
|
+
),
|
|
784
|
+
e.title
|
|
785
|
+
]
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
R !== e.id && /* @__PURE__ */ t("span", { className: c.sessionItemTime, children: La(e.updatedAt) }),
|
|
789
|
+
/* @__PURE__ */ t(
|
|
790
|
+
"button",
|
|
791
|
+
{
|
|
792
|
+
type: "button",
|
|
793
|
+
className: c.sessionRenameBtn,
|
|
794
|
+
onClick: (n) => {
|
|
795
|
+
n.stopPropagation(), me(e);
|
|
796
|
+
},
|
|
797
|
+
title: "重命名会话",
|
|
798
|
+
children: /* @__PURE__ */ t(wt, {})
|
|
799
|
+
}
|
|
800
|
+
),
|
|
801
|
+
/* @__PURE__ */ t(
|
|
802
|
+
"button",
|
|
803
|
+
{
|
|
804
|
+
type: "button",
|
|
805
|
+
className: c.sessionDeleteBtn,
|
|
806
|
+
onClick: (n) => {
|
|
807
|
+
n.stopPropagation(), at(e.id);
|
|
808
|
+
},
|
|
809
|
+
title: "删除会话",
|
|
810
|
+
children: /* @__PURE__ */ t(an, {})
|
|
811
|
+
}
|
|
812
|
+
)
|
|
813
|
+
]
|
|
814
|
+
},
|
|
815
|
+
e.id
|
|
816
|
+
))
|
|
817
|
+
] })
|
|
818
|
+
] }),
|
|
819
|
+
/* @__PURE__ */ i("div", { className: c.chatPanel, children: [
|
|
820
|
+
/* @__PURE__ */ i("div", { className: c.chatHeader, children: [
|
|
821
|
+
/* @__PURE__ */ t(
|
|
822
|
+
"div",
|
|
823
|
+
{
|
|
824
|
+
className: c.agentAvatar,
|
|
825
|
+
style: { backgroundColor: Ge },
|
|
826
|
+
children: vt((s == null ? void 0 : s.displayName) || "本地 Agent")
|
|
827
|
+
}
|
|
828
|
+
),
|
|
829
|
+
/* @__PURE__ */ i("div", { className: c.chatHeaderMeta, children: [
|
|
830
|
+
/* @__PURE__ */ t("span", { className: c.chatHeaderName, children: (s == null ? void 0 : s.displayName) || "本地 Agent" }),
|
|
831
|
+
ot && /* @__PURE__ */ t("span", { className: c.chatHeaderSession, children: ot.title })
|
|
832
|
+
] }),
|
|
833
|
+
/* @__PURE__ */ t("span", { className: c.chatHeaderBadge, children: (s == null ? void 0 : s.localAgentType) === "jar" ? "内置模型" : s == null ? void 0 : s.localAgentType }),
|
|
834
|
+
H && /* @__PURE__ */ i("span", { className: c.streamingIndicator, children: [
|
|
835
|
+
/* @__PURE__ */ t(Tt, {}),
|
|
836
|
+
" 工作中…"
|
|
837
|
+
] })
|
|
838
|
+
] }),
|
|
839
|
+
S ? /* @__PURE__ */ i(xe, { children: [
|
|
840
|
+
/* @__PURE__ */ t(
|
|
841
|
+
"div",
|
|
842
|
+
{
|
|
843
|
+
className: c.threadScroll,
|
|
844
|
+
ref: te,
|
|
845
|
+
onScroll: Je,
|
|
846
|
+
children: /* @__PURE__ */ t("div", { className: c.threadInner, children: be && $.length === 0 ? /* @__PURE__ */ t("div", { className: c.chatEmpty, children: "加载中…" }) : $.length === 0 ? /* @__PURE__ */ i("div", { className: c.landing, children: [
|
|
847
|
+
/* @__PURE__ */ t(
|
|
848
|
+
"div",
|
|
849
|
+
{
|
|
850
|
+
className: c.landingLogo,
|
|
851
|
+
style: { backgroundColor: Ge },
|
|
852
|
+
children: vt((s == null ? void 0 : s.displayName) || "本地 Agent")
|
|
853
|
+
}
|
|
854
|
+
),
|
|
855
|
+
/* @__PURE__ */ i("div", { className: c.landingTitle, children: [
|
|
856
|
+
"与 ",
|
|
857
|
+
(s == null ? void 0 : s.displayName) || "本地 Agent",
|
|
858
|
+
" 协作"
|
|
859
|
+
] }),
|
|
860
|
+
/* @__PURE__ */ t("div", { className: c.landingHint, children: "思考过程与工具调用实时可见 · Enter 发送 · Esc 停止" }),
|
|
861
|
+
/* @__PURE__ */ t("div", { className: c.landingChips, children: Lt.map((e) => /* @__PURE__ */ t(
|
|
862
|
+
"button",
|
|
863
|
+
{
|
|
864
|
+
type: "button",
|
|
865
|
+
className: c.landingChip,
|
|
866
|
+
onClick: () => void Le(e),
|
|
867
|
+
children: e
|
|
868
|
+
},
|
|
869
|
+
e
|
|
870
|
+
)) })
|
|
871
|
+
] }) : $.map(
|
|
872
|
+
(e, n) => e.role === "user" ? /* @__PURE__ */ i("div", { className: c.userRow, children: [
|
|
873
|
+
/* @__PURE__ */ t("div", { className: c.userBubble, children: qe(e.blocks) }),
|
|
874
|
+
!H && /* @__PURE__ */ i("div", { className: c.userActions, children: [
|
|
875
|
+
/* @__PURE__ */ t(
|
|
876
|
+
kt,
|
|
877
|
+
{
|
|
878
|
+
inline: !0,
|
|
879
|
+
label: "复制",
|
|
880
|
+
getText: () => qe(e.blocks)
|
|
881
|
+
}
|
|
882
|
+
),
|
|
883
|
+
/* @__PURE__ */ t(
|
|
884
|
+
"button",
|
|
885
|
+
{
|
|
886
|
+
type: "button",
|
|
887
|
+
className: c.userActionBtn,
|
|
888
|
+
title: "编辑重发(其后内容将被截断)",
|
|
889
|
+
"aria-label": "编辑重发",
|
|
890
|
+
onClick: () => pt(n, qe(e.blocks)),
|
|
891
|
+
children: /* @__PURE__ */ t(wt, {})
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
/* @__PURE__ */ t(
|
|
895
|
+
"button",
|
|
896
|
+
{
|
|
897
|
+
type: "button",
|
|
898
|
+
className: c.userActionBtn,
|
|
899
|
+
title: "重发(截断后原样重发)",
|
|
900
|
+
"aria-label": "重发",
|
|
901
|
+
onClick: () => void Ze(
|
|
902
|
+
n,
|
|
903
|
+
qe(e.blocks)
|
|
904
|
+
),
|
|
905
|
+
children: /* @__PURE__ */ t(ln, {})
|
|
906
|
+
}
|
|
907
|
+
)
|
|
908
|
+
] })
|
|
909
|
+
] }, e.id) : /* @__PURE__ */ i("div", { className: c.assistantBlock, children: [
|
|
910
|
+
gt(e),
|
|
911
|
+
e.streaming && e.startedAtMs != null && /* @__PURE__ */ t(xa, { startedAtMs: e.startedAtMs }),
|
|
912
|
+
e.streaming && e.blocks.every(
|
|
913
|
+
(a) => a.type !== "tool_call" && a.type !== "thinking"
|
|
914
|
+
) && /* @__PURE__ */ t("span", { className: c.caretCursor }),
|
|
915
|
+
!e.streaming && (e.durationMs != null || e.totalMs != null) && /* @__PURE__ */ i("div", { className: c.msgMeta, children: [
|
|
916
|
+
((e.durationMs ?? e.totalMs) / 1e3).toFixed(1),
|
|
917
|
+
"s",
|
|
918
|
+
(() => {
|
|
919
|
+
var g, f;
|
|
920
|
+
const a = ((g = e.usage) == null ? void 0 : g.inputTokens) ?? 0, p = ((f = e.usage) == null ? void 0 : f.outputTokens) ?? 0, u = a + p;
|
|
921
|
+
return u > 0 ? ` · ${Ba(u)} tokens` : "";
|
|
922
|
+
})()
|
|
923
|
+
] }),
|
|
924
|
+
!e.streaming && /* @__PURE__ */ t(
|
|
925
|
+
kt,
|
|
926
|
+
{
|
|
927
|
+
getText: () => qe(e.blocks)
|
|
928
|
+
}
|
|
929
|
+
),
|
|
930
|
+
e.error && /* @__PURE__ */ i("div", { className: c.errorBar, children: [
|
|
931
|
+
e.error,
|
|
932
|
+
!H && E == null && /* @__PURE__ */ t(
|
|
933
|
+
"button",
|
|
934
|
+
{
|
|
935
|
+
type: "button",
|
|
936
|
+
className: c.errorRetryBtn,
|
|
937
|
+
title: "重试:重发上一条用户消息(其后内容截断)",
|
|
938
|
+
onClick: () => {
|
|
939
|
+
let a = n - 1;
|
|
940
|
+
for (; a >= 0 && $[a].role !== "user"; )
|
|
941
|
+
a--;
|
|
942
|
+
a >= 0 && Ze(
|
|
943
|
+
a,
|
|
944
|
+
qe($[a].blocks)
|
|
945
|
+
);
|
|
946
|
+
},
|
|
947
|
+
children: "重试"
|
|
948
|
+
}
|
|
949
|
+
)
|
|
950
|
+
] }),
|
|
951
|
+
e.stopped && /* @__PURE__ */ t("div", { className: c.stoppedBar, children: "已停止生成" })
|
|
952
|
+
] }, e.id)
|
|
953
|
+
) })
|
|
954
|
+
}
|
|
955
|
+
),
|
|
956
|
+
/* @__PURE__ */ t(
|
|
957
|
+
"button",
|
|
958
|
+
{
|
|
959
|
+
type: "button",
|
|
960
|
+
className: `${c.scrollTopBtn} ${l ? c.scrollTopBtnVisible : ""}`,
|
|
961
|
+
onClick: st,
|
|
962
|
+
title: "回到最新消息",
|
|
963
|
+
"aria-label": "回到最新消息",
|
|
964
|
+
children: /* @__PURE__ */ t(cn, {})
|
|
965
|
+
}
|
|
966
|
+
),
|
|
967
|
+
/* @__PURE__ */ i("div", { className: c.composerWrap, children: [
|
|
968
|
+
E != null && /* @__PURE__ */ i("div", { className: c.editingBar, children: [
|
|
969
|
+
/* @__PURE__ */ t("span", { children: "正在编辑历史消息:发送后其后内容将被丢弃,并以全新上下文重发" }),
|
|
970
|
+
/* @__PURE__ */ t(
|
|
971
|
+
"button",
|
|
972
|
+
{
|
|
973
|
+
type: "button",
|
|
974
|
+
className: c.editingCancel,
|
|
975
|
+
onClick: pe,
|
|
976
|
+
title: "取消编辑",
|
|
977
|
+
children: "取消"
|
|
978
|
+
}
|
|
979
|
+
)
|
|
980
|
+
] }),
|
|
981
|
+
Ce != null && /* @__PURE__ */ i("div", { className: c.pendingBar, children: [
|
|
982
|
+
/* @__PURE__ */ i("span", { children: [
|
|
983
|
+
"已排队:「",
|
|
984
|
+
Ce.slice(0, 30),
|
|
985
|
+
Ce.length > 30 ? "…" : "",
|
|
986
|
+
"」生成结束后自动发送"
|
|
987
|
+
] }),
|
|
988
|
+
/* @__PURE__ */ t(
|
|
989
|
+
"button",
|
|
990
|
+
{
|
|
991
|
+
type: "button",
|
|
992
|
+
className: c.editingCancel,
|
|
993
|
+
onClick: lt,
|
|
994
|
+
title: "取消排队消息(回填输入框)",
|
|
995
|
+
children: "取消"
|
|
996
|
+
}
|
|
997
|
+
)
|
|
998
|
+
] }),
|
|
999
|
+
/* @__PURE__ */ i("div", { className: c.composer, children: [
|
|
1000
|
+
/* @__PURE__ */ t(
|
|
1001
|
+
"textarea",
|
|
1002
|
+
{
|
|
1003
|
+
ref: ne,
|
|
1004
|
+
className: c.composerInput,
|
|
1005
|
+
placeholder: H ? S === tt ? "正在工作中…(Esc 停止)" : "后台回合进行中,输入将排队发送" : "向 Agent 发消息,Enter 发送,Shift+Enter 换行",
|
|
1006
|
+
value: q,
|
|
1007
|
+
onChange: ct,
|
|
1008
|
+
onKeyDown: ht,
|
|
1009
|
+
rows: 1
|
|
1010
|
+
}
|
|
1011
|
+
),
|
|
1012
|
+
H ? /* @__PURE__ */ t(
|
|
1013
|
+
"button",
|
|
1014
|
+
{
|
|
1015
|
+
type: "button",
|
|
1016
|
+
className: c.stopBtn,
|
|
1017
|
+
onClick: Fe,
|
|
1018
|
+
title: "停止生成(Esc)",
|
|
1019
|
+
"aria-label": "停止生成",
|
|
1020
|
+
children: /* @__PURE__ */ t(on, {})
|
|
1021
|
+
}
|
|
1022
|
+
) : /* @__PURE__ */ t(
|
|
1023
|
+
"button",
|
|
1024
|
+
{
|
|
1025
|
+
type: "button",
|
|
1026
|
+
className: `${c.sendBtn} ${q.trim() ? c.sendBtnReady : ""}`,
|
|
1027
|
+
disabled: !q.trim(),
|
|
1028
|
+
onClick: it,
|
|
1029
|
+
title: "发送",
|
|
1030
|
+
"aria-label": "发送",
|
|
1031
|
+
children: /* @__PURE__ */ t(It, {})
|
|
1032
|
+
}
|
|
1033
|
+
)
|
|
1034
|
+
] }),
|
|
1035
|
+
/* @__PURE__ */ t("div", { className: c.composerHint, children: H ? "Agent 正在工作中,可按 Esc 或点击停止按钮中断" : "Enter 发送 · Shift+Enter 换行 · 思考与工具调用自动展示" })
|
|
1036
|
+
] })
|
|
1037
|
+
] }) : x.length === 0 ? (
|
|
1038
|
+
/* 无会话:居中大输入框,发送自动建会话(时间戳命名) */
|
|
1039
|
+
/* @__PURE__ */ i("div", { className: c.newChatLanding, children: [
|
|
1040
|
+
/* @__PURE__ */ t(
|
|
1041
|
+
"div",
|
|
1042
|
+
{
|
|
1043
|
+
className: c.landingLogo,
|
|
1044
|
+
style: { backgroundColor: Ge },
|
|
1045
|
+
children: vt((s == null ? void 0 : s.displayName) || "本地 Agent")
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
/* @__PURE__ */ i("div", { className: c.landingTitle, children: [
|
|
1049
|
+
"与 ",
|
|
1050
|
+
(s == null ? void 0 : s.displayName) || "本地 Agent",
|
|
1051
|
+
" 协作"
|
|
1052
|
+
] }),
|
|
1053
|
+
/* @__PURE__ */ t("div", { className: c.landingHint, children: "输入即自动创建会话 · Enter 发送 · Esc 停止" }),
|
|
1054
|
+
/* @__PURE__ */ i("div", { className: c.landingComposer, children: [
|
|
1055
|
+
/* @__PURE__ */ t(
|
|
1056
|
+
"textarea",
|
|
1057
|
+
{
|
|
1058
|
+
className: c.landingInput,
|
|
1059
|
+
placeholder: "描述你的任务,发送后自动创建会话…",
|
|
1060
|
+
value: ke,
|
|
1061
|
+
autoFocus: !0,
|
|
1062
|
+
onChange: (e) => Y(e.target.value),
|
|
1063
|
+
onKeyDown: (e) => {
|
|
1064
|
+
e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && (e.preventDefault(), Ve());
|
|
1065
|
+
},
|
|
1066
|
+
rows: 3
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
/* @__PURE__ */ t(
|
|
1070
|
+
"button",
|
|
1071
|
+
{
|
|
1072
|
+
type: "button",
|
|
1073
|
+
className: `${c.sendBtn} ${ke.trim() && !Te ? c.sendBtnReady : ""}`,
|
|
1074
|
+
disabled: !ke.trim() || Te,
|
|
1075
|
+
onClick: () => void Ve(),
|
|
1076
|
+
title: "发送并创建会话",
|
|
1077
|
+
"aria-label": "发送并创建会话",
|
|
1078
|
+
children: /* @__PURE__ */ t(It, {})
|
|
1079
|
+
}
|
|
1080
|
+
)
|
|
1081
|
+
] }),
|
|
1082
|
+
/* @__PURE__ */ t("div", { className: c.landingChips, children: Lt.map((e) => /* @__PURE__ */ t(
|
|
1083
|
+
"button",
|
|
1084
|
+
{
|
|
1085
|
+
type: "button",
|
|
1086
|
+
className: c.landingChip,
|
|
1087
|
+
onClick: () => void Ve(e),
|
|
1088
|
+
children: e
|
|
1089
|
+
},
|
|
1090
|
+
e
|
|
1091
|
+
)) })
|
|
1092
|
+
] })
|
|
1093
|
+
) : /* @__PURE__ */ t("div", { className: c.chatEmpty, children: "请在左侧选择或创建一个会话" })
|
|
1094
|
+
] })
|
|
1095
|
+
] });
|
|
1096
|
+
}
|
|
1097
|
+
const Ea = "_sidebarInner_1vu3c_1", Oa = "_header_1vu3c_8", $a = "_headerActions_1vu3c_19", Ha = "_tabBar_1vu3c_26", Pa = "_tab_1vu3c_26", Fa = "_tabActive_1vu3c_50", ja = "_btnSm_1vu3c_66", Wa = "_agentSection_1vu3c_84", Ka = "_agentItem_1vu3c_90", Ua = "_agentItemActive_1vu3c_112", Va = "_agentAvatar_1vu3c_117", Ga = "_agentName_1vu3c_130", za = "_emptyState_1vu3c_156", qa = "_createInputRow_1vu3c_168", Qa = "_createInput_1vu3c_168", Xa = "_createConfirmBtn_1vu3c_188", Ja = "_contextMenu_1vu3c_205", Ya = "_contextMenuItem_1vu3c_216", Za = "_contextMenuItemDanger_1vu3c_231", el = "_contextMenuDivider_1vu3c_239", tl = "_renameOverlay_1vu3c_246", nl = "_renameDialog_1vu3c_259", sl = "_renameTitle_1vu3c_267", al = "_renameInput_1vu3c_274", ll = "_renameActions_1vu3c_289", il = "_renameBtn_1vu3c_295", cl = "_renameBtnPrimary_1vu3c_309", ol = "_agentDetailBtn_1vu3c_326", rl = "_agentItemShared_1vu3c_358", dl = "_agentInfo_1vu3c_362", ul = "_agentOwner_1vu3c_374", ml = "_sharedBadge_1vu3c_382", pl = "_createLocalDialog_1vu3c_430", hl = "_createLocalLabel_1vu3c_438", gl = "_agentTypeCards_1vu3c_446", _l = "_agentTypeCard_1vu3c_446", fl = "_agentTypeIcon_1vu3c_474", yl = "_agentTypeBody_1vu3c_487", vl = "_agentTypeTitle_1vu3c_494", bl = "_agentTypeDesc_1vu3c_500", Nl = "_agentTypeBadge_1vu3c_506", o = {
|
|
1098
|
+
sidebarInner: Ea,
|
|
1099
|
+
header: Oa,
|
|
1100
|
+
headerActions: $a,
|
|
1101
|
+
tabBar: Ha,
|
|
1102
|
+
tab: Pa,
|
|
1103
|
+
tabActive: Fa,
|
|
1104
|
+
btnSm: ja,
|
|
1105
|
+
agentSection: Wa,
|
|
1106
|
+
agentItem: Ka,
|
|
1107
|
+
agentItemActive: Ua,
|
|
1108
|
+
agentAvatar: Va,
|
|
1109
|
+
agentName: Ga,
|
|
1110
|
+
emptyState: za,
|
|
1111
|
+
createInputRow: qa,
|
|
1112
|
+
createInput: Qa,
|
|
1113
|
+
createConfirmBtn: Xa,
|
|
1114
|
+
contextMenu: Ja,
|
|
1115
|
+
contextMenuItem: Ya,
|
|
1116
|
+
contextMenuItemDanger: Za,
|
|
1117
|
+
contextMenuDivider: el,
|
|
1118
|
+
renameOverlay: tl,
|
|
1119
|
+
renameDialog: nl,
|
|
1120
|
+
renameTitle: sl,
|
|
1121
|
+
renameInput: al,
|
|
1122
|
+
renameActions: ll,
|
|
1123
|
+
renameBtn: il,
|
|
1124
|
+
renameBtnPrimary: cl,
|
|
1125
|
+
agentDetailBtn: ol,
|
|
1126
|
+
agentItemShared: rl,
|
|
1127
|
+
agentInfo: dl,
|
|
1128
|
+
agentOwner: ul,
|
|
1129
|
+
sharedBadge: ml,
|
|
1130
|
+
createLocalDialog: pl,
|
|
1131
|
+
createLocalLabel: hl,
|
|
1132
|
+
agentTypeCards: gl,
|
|
1133
|
+
agentTypeCard: _l,
|
|
1134
|
+
agentTypeIcon: fl,
|
|
1135
|
+
agentTypeBody: yl,
|
|
1136
|
+
agentTypeTitle: vl,
|
|
1137
|
+
agentTypeDesc: bl,
|
|
1138
|
+
agentTypeBadge: Nl
|
|
1139
|
+
}, Dt = [
|
|
1140
|
+
"#2F70F1",
|
|
1141
|
+
"#52c41a",
|
|
1142
|
+
"#fa8c16",
|
|
1143
|
+
"#eb2f96",
|
|
1144
|
+
"#722ed1",
|
|
1145
|
+
"#13c2c2",
|
|
1146
|
+
"#f5222d",
|
|
1147
|
+
"#faad14"
|
|
1148
|
+
];
|
|
1149
|
+
function Mt(s) {
|
|
1150
|
+
let r = 0;
|
|
1151
|
+
for (let d = 0; d < s.length; d++) r = r * 31 + s.charCodeAt(d) | 0;
|
|
1152
|
+
return Dt[Math.abs(r) % Dt.length];
|
|
1153
|
+
}
|
|
1154
|
+
function xt(s) {
|
|
1155
|
+
return s ? s.charAt(0).toUpperCase() : "?";
|
|
1156
|
+
}
|
|
1157
|
+
const dt = "-1";
|
|
1158
|
+
function Cl({
|
|
1159
|
+
selectedAgentId: s,
|
|
1160
|
+
selectedLocalAgentId: r,
|
|
1161
|
+
onSelectAgent: d,
|
|
1162
|
+
onShowDetail: _,
|
|
1163
|
+
onChatWithAgent: k
|
|
1164
|
+
}) {
|
|
1165
|
+
const I = Ue((l) => l.token), y = Ue((l) => l.personalChatNav), [L, x] = m(
|
|
1166
|
+
y.tab === "shared" ? "shared" : "remote"
|
|
1167
|
+
), [w, P] = m([]), [V, R] = m(!1), [A, N] = m(!1), [J, F] = m(""), [he, S] = m(!1), [B, $] = m(null), [C, q] = m(null), [j, H] = m(!1), [ge, T] = m([]), [W, Ce] = m(!1), [_e, G] = m(null), [ye, ce] = m(!1), [ve, Re] = m([]), [Ee, be] = m(!1), [oe, ke] = m(!1), Y = O(null), Te = U(async () => {
|
|
1168
|
+
R(!0);
|
|
1169
|
+
try {
|
|
1170
|
+
const l = await Wt(I);
|
|
1171
|
+
P(l), s && !l.find((v) => et(v.id, s)) && d(null);
|
|
1172
|
+
} catch {
|
|
1173
|
+
} finally {
|
|
1174
|
+
R(!1);
|
|
1175
|
+
}
|
|
1176
|
+
}, [I, s, d]), fe = U(async () => {
|
|
1177
|
+
Ce(!0);
|
|
1178
|
+
try {
|
|
1179
|
+
const l = await wn(I);
|
|
1180
|
+
T(l);
|
|
1181
|
+
} catch {
|
|
1182
|
+
} finally {
|
|
1183
|
+
Ce(!1);
|
|
1184
|
+
}
|
|
1185
|
+
}, [I]);
|
|
1186
|
+
D(() => {
|
|
1187
|
+
y.trigger > 0 && y.tab && x(y.tab);
|
|
1188
|
+
}, [y.trigger]), D(() => {
|
|
1189
|
+
L === "remote" ? Te() : L === "shared" && fe();
|
|
1190
|
+
}, [Te, fe, L]);
|
|
1191
|
+
const we = U(async () => {
|
|
1192
|
+
try {
|
|
1193
|
+
const l = await Ut();
|
|
1194
|
+
Re(l);
|
|
1195
|
+
} catch {
|
|
1196
|
+
Re([]);
|
|
1197
|
+
}
|
|
1198
|
+
}, []);
|
|
1199
|
+
D(() => {
|
|
1200
|
+
L === "local" && bt().then((l) => {
|
|
1201
|
+
ce(l), l && we();
|
|
1202
|
+
});
|
|
1203
|
+
}, [L, we]), D(() => {
|
|
1204
|
+
if (!B) return;
|
|
1205
|
+
const l = (v) => {
|
|
1206
|
+
Y.current && !Y.current.contains(v.target) && $(null);
|
|
1207
|
+
};
|
|
1208
|
+
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
1209
|
+
}, [B]);
|
|
1210
|
+
const re = async () => {
|
|
1211
|
+
const l = J.trim();
|
|
1212
|
+
if (l) {
|
|
1213
|
+
S(!0);
|
|
1214
|
+
try {
|
|
1215
|
+
const v = await In(l, I);
|
|
1216
|
+
P((E) => [...E, v]), F(""), N(!1), d(v);
|
|
1217
|
+
} catch {
|
|
1218
|
+
} finally {
|
|
1219
|
+
S(!1);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}, Z = async (l) => {
|
|
1223
|
+
if (l === "jar") {
|
|
1224
|
+
be(!1), k({
|
|
1225
|
+
id: dt,
|
|
1226
|
+
userId: "local",
|
|
1227
|
+
agentHubAgentId: null,
|
|
1228
|
+
agentCode: "local-default",
|
|
1229
|
+
displayName: "本地 Agent",
|
|
1230
|
+
avatar: null,
|
|
1231
|
+
isLocal: !0
|
|
1232
|
+
});
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
if (!ye) {
|
|
1236
|
+
if (!await bt()) {
|
|
1237
|
+
rt.error(
|
|
1238
|
+
"本地 Agent 未启动,请通过菜单栏「重启 Agent」启动后再试"
|
|
1239
|
+
);
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
ce(!0);
|
|
1243
|
+
}
|
|
1244
|
+
ke(!0);
|
|
1245
|
+
try {
|
|
1246
|
+
const v = l === "hermes" ? "hermes" : "claude-code";
|
|
1247
|
+
await $n(v, l), rt.success(`已引入 ${v},点击列表项即可开始对话`), be(!1), await we();
|
|
1248
|
+
} catch (v) {
|
|
1249
|
+
rt.error(
|
|
1250
|
+
v.message || "创建失败,请检查本地 Agent 是否正常运行"
|
|
1251
|
+
);
|
|
1252
|
+
} finally {
|
|
1253
|
+
ke(!1);
|
|
1254
|
+
}
|
|
1255
|
+
}, de = async (l) => {
|
|
1256
|
+
if (window.confirm("确定删除此 Agent?"))
|
|
1257
|
+
try {
|
|
1258
|
+
await Hn(l), await we();
|
|
1259
|
+
} catch (v) {
|
|
1260
|
+
rt.error(v.message || "删除失败");
|
|
1261
|
+
}
|
|
1262
|
+
}, Ie = async (l) => {
|
|
1263
|
+
if (window.confirm(
|
|
1264
|
+
`确定删除 Agent「${l.displayName}」吗?所有会话记录将一并删除。`
|
|
1265
|
+
))
|
|
1266
|
+
try {
|
|
1267
|
+
await Sn(l.id, I), P((v) => v.filter((E) => E.id !== l.id)), et(s, l.id) && d(null);
|
|
1268
|
+
} catch {
|
|
1269
|
+
}
|
|
1270
|
+
}, Oe = async () => {
|
|
1271
|
+
if (!C) return;
|
|
1272
|
+
const l = C.value.trim();
|
|
1273
|
+
if (!l || l === C.agent.displayName) {
|
|
1274
|
+
q(null);
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
H(!0);
|
|
1278
|
+
try {
|
|
1279
|
+
const v = await An(
|
|
1280
|
+
C.agent.id,
|
|
1281
|
+
l,
|
|
1282
|
+
I
|
|
1283
|
+
);
|
|
1284
|
+
P((E) => E.map((ee) => ee.id === v.id ? v : ee)), et(s, v.id) && d(v), q(null);
|
|
1285
|
+
} catch {
|
|
1286
|
+
} finally {
|
|
1287
|
+
H(!1);
|
|
1288
|
+
}
|
|
1289
|
+
}, Qe = async (l) => {
|
|
1290
|
+
const v = l.shared === 1;
|
|
1291
|
+
if (window.confirm(
|
|
1292
|
+
v ? `确定取消共享 Agent「${l.displayName}」吗?取消后其他用户将无法与此 Agent 聊天。` : `确定共享 Agent「${l.displayName}」吗?共享后其他用户可以与此 Agent 发起聊天。`
|
|
1293
|
+
)) {
|
|
1294
|
+
G(l.id);
|
|
1295
|
+
try {
|
|
1296
|
+
const E = await Bn(
|
|
1297
|
+
l.id,
|
|
1298
|
+
!v,
|
|
1299
|
+
I
|
|
1300
|
+
);
|
|
1301
|
+
P((ee) => ee.map((te) => te.id === E.id ? E : te));
|
|
1302
|
+
} catch {
|
|
1303
|
+
} finally {
|
|
1304
|
+
G(null);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
}, $e = (l, v) => {
|
|
1308
|
+
l.preventDefault(), l.stopPropagation(), $({ x: l.clientX, y: l.clientY, agent: v });
|
|
1309
|
+
};
|
|
1310
|
+
return /* @__PURE__ */ i("div", { className: o.sidebarInner, children: [
|
|
1311
|
+
/* @__PURE__ */ i("div", { className: o.header, children: [
|
|
1312
|
+
/* @__PURE__ */ t("span", { children: "个人 Agent" }),
|
|
1313
|
+
L === "remote" && /* @__PURE__ */ t("div", { className: o.headerActions, children: /* @__PURE__ */ t(
|
|
1314
|
+
"button",
|
|
1315
|
+
{
|
|
1316
|
+
type: "button",
|
|
1317
|
+
className: o.btnSm,
|
|
1318
|
+
onClick: () => {
|
|
1319
|
+
N((l) => !l), F("");
|
|
1320
|
+
},
|
|
1321
|
+
title: "新建个人 Agent",
|
|
1322
|
+
children: "+ 新建"
|
|
1323
|
+
}
|
|
1324
|
+
) }),
|
|
1325
|
+
L === "local" && /* @__PURE__ */ t("div", { className: o.headerActions, children: /* @__PURE__ */ t(
|
|
1326
|
+
"button",
|
|
1327
|
+
{
|
|
1328
|
+
type: "button",
|
|
1329
|
+
className: o.btnSm,
|
|
1330
|
+
onClick: () => be(!0),
|
|
1331
|
+
title: "新建本地 Agent",
|
|
1332
|
+
children: "+ 新增"
|
|
1333
|
+
}
|
|
1334
|
+
) })
|
|
1335
|
+
] }),
|
|
1336
|
+
/* @__PURE__ */ i("div", { className: o.tabBar, children: [
|
|
1337
|
+
/* @__PURE__ */ t(
|
|
1338
|
+
"button",
|
|
1339
|
+
{
|
|
1340
|
+
type: "button",
|
|
1341
|
+
className: `${o.tab} ${L === "local" ? o.tabActive : ""}`,
|
|
1342
|
+
onClick: () => x("local"),
|
|
1343
|
+
title: "本地 Agent",
|
|
1344
|
+
children: "本地"
|
|
1345
|
+
}
|
|
1346
|
+
),
|
|
1347
|
+
/* @__PURE__ */ t(
|
|
1348
|
+
"button",
|
|
1349
|
+
{
|
|
1350
|
+
type: "button",
|
|
1351
|
+
className: `${o.tab} ${L === "remote" ? o.tabActive : ""}`,
|
|
1352
|
+
onClick: () => x("remote"),
|
|
1353
|
+
children: "远程"
|
|
1354
|
+
}
|
|
1355
|
+
),
|
|
1356
|
+
/* @__PURE__ */ t(
|
|
1357
|
+
"button",
|
|
1358
|
+
{
|
|
1359
|
+
type: "button",
|
|
1360
|
+
className: `${o.tab} ${L === "shared" ? o.tabActive : ""}`,
|
|
1361
|
+
onClick: () => x("shared"),
|
|
1362
|
+
children: "共享"
|
|
1363
|
+
}
|
|
1364
|
+
)
|
|
1365
|
+
] }),
|
|
1366
|
+
L === "local" ? /* @__PURE__ */ t("div", { className: o.agentSection, children: ye ? /* @__PURE__ */ t(xe, { children: ve.map((l) => /* @__PURE__ */ i(
|
|
1367
|
+
"div",
|
|
1368
|
+
{
|
|
1369
|
+
className: `${o.agentItem} ${et(s, dt) && (l.type === "jar" && !r || r === l.id) ? o.agentItemActive : ""}`,
|
|
1370
|
+
onClick: () => {
|
|
1371
|
+
l.type === "jar" ? d({
|
|
1372
|
+
id: dt,
|
|
1373
|
+
userId: "local",
|
|
1374
|
+
agentHubAgentId: null,
|
|
1375
|
+
agentCode: "local-default",
|
|
1376
|
+
displayName: l.name,
|
|
1377
|
+
avatar: null,
|
|
1378
|
+
isLocal: !0
|
|
1379
|
+
}) : d({
|
|
1380
|
+
id: dt,
|
|
1381
|
+
userId: "local",
|
|
1382
|
+
agentHubAgentId: null,
|
|
1383
|
+
agentCode: l.name,
|
|
1384
|
+
displayName: l.name,
|
|
1385
|
+
avatar: null,
|
|
1386
|
+
isLocal: !0,
|
|
1387
|
+
localAgentId: l.id,
|
|
1388
|
+
localAgentType: l.type
|
|
1389
|
+
});
|
|
1390
|
+
},
|
|
1391
|
+
children: [
|
|
1392
|
+
/* @__PURE__ */ t(
|
|
1393
|
+
"div",
|
|
1394
|
+
{
|
|
1395
|
+
className: o.agentAvatar,
|
|
1396
|
+
style: {
|
|
1397
|
+
backgroundColor: l.type === "hermes" ? "#722ed1" : l.type === "claude-code" ? "#eb2f96" : "#52c41a"
|
|
1398
|
+
},
|
|
1399
|
+
children: l.type === "hermes" ? "H" : l.type === "claude-code" ? "C" : "L"
|
|
1400
|
+
}
|
|
1401
|
+
),
|
|
1402
|
+
/* @__PURE__ */ t("span", { className: o.agentName, children: l.name }),
|
|
1403
|
+
l.type !== "jar" && /* @__PURE__ */ t(
|
|
1404
|
+
"button",
|
|
1405
|
+
{
|
|
1406
|
+
type: "button",
|
|
1407
|
+
className: o.agentDetailBtn,
|
|
1408
|
+
onClick: (v) => {
|
|
1409
|
+
v.stopPropagation(), de(l.id);
|
|
1410
|
+
},
|
|
1411
|
+
title: "删除",
|
|
1412
|
+
children: /* @__PURE__ */ t("span", { style: { fontSize: 14 }, children: "×" })
|
|
1413
|
+
}
|
|
1414
|
+
)
|
|
1415
|
+
]
|
|
1416
|
+
},
|
|
1417
|
+
l.id
|
|
1418
|
+
)) }) : /* @__PURE__ */ i("div", { className: o.emptyState, children: [
|
|
1419
|
+
/* @__PURE__ */ t("span", { children: "本地 Agent 未启动" }),
|
|
1420
|
+
/* @__PURE__ */ t("span", { children: "请检查桌面端是否正常运行" })
|
|
1421
|
+
] }) }) : L === "shared" ? /* @__PURE__ */ t("div", { className: o.agentSection, children: W && ge.length === 0 ? /* @__PURE__ */ t("div", { className: o.emptyState, children: "加载中..." }) : ge.length === 0 ? /* @__PURE__ */ i("div", { className: o.emptyState, children: [
|
|
1422
|
+
/* @__PURE__ */ t("span", { children: "暂无共享 Agent" }),
|
|
1423
|
+
/* @__PURE__ */ t("span", { children: "其他用户共享的 Agent 会显示在这里" })
|
|
1424
|
+
] }) : ge.map((l) => /* @__PURE__ */ i(
|
|
1425
|
+
"div",
|
|
1426
|
+
{
|
|
1427
|
+
className: `${o.agentItem} ${o.agentItemShared}`,
|
|
1428
|
+
onClick: () => k(l),
|
|
1429
|
+
title: `点击与「${l.displayName}」聊天`,
|
|
1430
|
+
children: [
|
|
1431
|
+
/* @__PURE__ */ t(
|
|
1432
|
+
"div",
|
|
1433
|
+
{
|
|
1434
|
+
className: o.agentAvatar,
|
|
1435
|
+
style: {
|
|
1436
|
+
backgroundColor: Mt(
|
|
1437
|
+
l.agentCode || l.displayName
|
|
1438
|
+
)
|
|
1439
|
+
},
|
|
1440
|
+
children: xt(l.displayName)
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
/* @__PURE__ */ i("div", { className: o.agentInfo, children: [
|
|
1444
|
+
/* @__PURE__ */ t("span", { className: o.agentName, children: l.displayName }),
|
|
1445
|
+
/* @__PURE__ */ i("span", { className: o.agentOwner, children: [
|
|
1446
|
+
"来自: ",
|
|
1447
|
+
l.userId
|
|
1448
|
+
] })
|
|
1449
|
+
] }),
|
|
1450
|
+
/* @__PURE__ */ t(
|
|
1451
|
+
"button",
|
|
1452
|
+
{
|
|
1453
|
+
type: "button",
|
|
1454
|
+
className: o.agentDetailBtn,
|
|
1455
|
+
onClick: (v) => {
|
|
1456
|
+
v.stopPropagation(), k(l);
|
|
1457
|
+
},
|
|
1458
|
+
title: "开始聊天",
|
|
1459
|
+
children: /* @__PURE__ */ t(Pt, { style: { fontSize: 12 } })
|
|
1460
|
+
}
|
|
1461
|
+
)
|
|
1462
|
+
]
|
|
1463
|
+
},
|
|
1464
|
+
l.id
|
|
1465
|
+
)) }) : /* @__PURE__ */ i(xe, { children: [
|
|
1466
|
+
A && /* @__PURE__ */ i("div", { className: o.createInputRow, children: [
|
|
1467
|
+
/* @__PURE__ */ t(
|
|
1468
|
+
"input",
|
|
1469
|
+
{
|
|
1470
|
+
className: o.createInput,
|
|
1471
|
+
type: "text",
|
|
1472
|
+
placeholder: "输入 Agent 名称",
|
|
1473
|
+
value: J,
|
|
1474
|
+
autoFocus: !0,
|
|
1475
|
+
onChange: (l) => F(l.target.value),
|
|
1476
|
+
onKeyDown: (l) => {
|
|
1477
|
+
l.key === "Enter" && re(), l.key === "Escape" && (N(!1), F(""));
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
),
|
|
1481
|
+
/* @__PURE__ */ t(
|
|
1482
|
+
"button",
|
|
1483
|
+
{
|
|
1484
|
+
type: "button",
|
|
1485
|
+
className: o.createConfirmBtn,
|
|
1486
|
+
disabled: !J.trim() || he,
|
|
1487
|
+
onClick: re,
|
|
1488
|
+
children: he ? "..." : "创建"
|
|
1489
|
+
}
|
|
1490
|
+
)
|
|
1491
|
+
] }),
|
|
1492
|
+
/* @__PURE__ */ t("div", { className: o.agentSection, children: V && w.length === 0 ? /* @__PURE__ */ t("div", { className: o.emptyState, children: "加载中..." }) : w.length === 0 ? /* @__PURE__ */ i("div", { className: o.emptyState, children: [
|
|
1493
|
+
/* @__PURE__ */ t("span", { children: "暂无个人 Agent" }),
|
|
1494
|
+
/* @__PURE__ */ t("span", { children: "点击「新建」创建一个" })
|
|
1495
|
+
] }) : w.map((l) => /* @__PURE__ */ i(
|
|
1496
|
+
"div",
|
|
1497
|
+
{
|
|
1498
|
+
className: `${o.agentItem} ${et(s, l.id) ? o.agentItemActive : ""}`,
|
|
1499
|
+
onClick: () => d(l),
|
|
1500
|
+
onContextMenu: (v) => $e(v, l),
|
|
1501
|
+
children: [
|
|
1502
|
+
/* @__PURE__ */ t(
|
|
1503
|
+
"div",
|
|
1504
|
+
{
|
|
1505
|
+
className: o.agentAvatar,
|
|
1506
|
+
style: {
|
|
1507
|
+
backgroundColor: Mt(
|
|
1508
|
+
l.agentCode || l.displayName
|
|
1509
|
+
)
|
|
1510
|
+
},
|
|
1511
|
+
children: xt(l.displayName)
|
|
1512
|
+
}
|
|
1513
|
+
),
|
|
1514
|
+
/* @__PURE__ */ i("span", { className: o.agentName, children: [
|
|
1515
|
+
l.displayName,
|
|
1516
|
+
l.shared === 1 && /* @__PURE__ */ t("span", { className: o.sharedBadge, children: "共享" })
|
|
1517
|
+
] }),
|
|
1518
|
+
/* @__PURE__ */ t(
|
|
1519
|
+
"button",
|
|
1520
|
+
{
|
|
1521
|
+
type: "button",
|
|
1522
|
+
className: o.agentDetailBtn,
|
|
1523
|
+
onClick: (v) => {
|
|
1524
|
+
v.stopPropagation();
|
|
1525
|
+
const E = v.currentTarget.getBoundingClientRect();
|
|
1526
|
+
$({
|
|
1527
|
+
x: E.right - 120,
|
|
1528
|
+
y: E.bottom + 4,
|
|
1529
|
+
agent: l
|
|
1530
|
+
});
|
|
1531
|
+
},
|
|
1532
|
+
title: "更多操作",
|
|
1533
|
+
children: /* @__PURE__ */ t(dn, { style: { fontSize: 14 } })
|
|
1534
|
+
}
|
|
1535
|
+
)
|
|
1536
|
+
]
|
|
1537
|
+
},
|
|
1538
|
+
l.id
|
|
1539
|
+
)) })
|
|
1540
|
+
] }),
|
|
1541
|
+
B && /* @__PURE__ */ i(
|
|
1542
|
+
"div",
|
|
1543
|
+
{
|
|
1544
|
+
ref: Y,
|
|
1545
|
+
className: o.contextMenu,
|
|
1546
|
+
style: { top: B.y, left: B.x },
|
|
1547
|
+
children: [
|
|
1548
|
+
/* @__PURE__ */ t(
|
|
1549
|
+
"div",
|
|
1550
|
+
{
|
|
1551
|
+
className: o.contextMenuItem,
|
|
1552
|
+
onClick: () => {
|
|
1553
|
+
k(B.agent), $(null);
|
|
1554
|
+
},
|
|
1555
|
+
children: "开始聊天"
|
|
1556
|
+
}
|
|
1557
|
+
),
|
|
1558
|
+
/* @__PURE__ */ t(
|
|
1559
|
+
"div",
|
|
1560
|
+
{
|
|
1561
|
+
className: o.contextMenuItem,
|
|
1562
|
+
onClick: () => {
|
|
1563
|
+
_(B.agent), $(null);
|
|
1564
|
+
},
|
|
1565
|
+
children: "Agent 配置"
|
|
1566
|
+
}
|
|
1567
|
+
),
|
|
1568
|
+
/* @__PURE__ */ t("div", { className: o.contextMenuDivider }),
|
|
1569
|
+
/* @__PURE__ */ t(
|
|
1570
|
+
"div",
|
|
1571
|
+
{
|
|
1572
|
+
className: o.contextMenuItem,
|
|
1573
|
+
onClick: () => {
|
|
1574
|
+
q({
|
|
1575
|
+
agent: B.agent,
|
|
1576
|
+
value: B.agent.displayName
|
|
1577
|
+
}), $(null);
|
|
1578
|
+
},
|
|
1579
|
+
children: "重命名"
|
|
1580
|
+
}
|
|
1581
|
+
),
|
|
1582
|
+
/* @__PURE__ */ t(
|
|
1583
|
+
"div",
|
|
1584
|
+
{
|
|
1585
|
+
className: o.contextMenuItem,
|
|
1586
|
+
onClick: () => {
|
|
1587
|
+
_e === null && Qe(B.agent), $(null);
|
|
1588
|
+
},
|
|
1589
|
+
children: B.agent.shared === 1 ? "取消共享" : "共享给他人"
|
|
1590
|
+
}
|
|
1591
|
+
),
|
|
1592
|
+
/* @__PURE__ */ t("div", { className: o.contextMenuDivider }),
|
|
1593
|
+
/* @__PURE__ */ t(
|
|
1594
|
+
"div",
|
|
1595
|
+
{
|
|
1596
|
+
className: `${o.contextMenuItem} ${o.contextMenuItemDanger}`,
|
|
1597
|
+
onClick: () => {
|
|
1598
|
+
Ie(B.agent), $(null);
|
|
1599
|
+
},
|
|
1600
|
+
children: "删除"
|
|
1601
|
+
}
|
|
1602
|
+
)
|
|
1603
|
+
]
|
|
1604
|
+
}
|
|
1605
|
+
),
|
|
1606
|
+
Ee && /* @__PURE__ */ t(
|
|
1607
|
+
"div",
|
|
1608
|
+
{
|
|
1609
|
+
className: o.renameOverlay,
|
|
1610
|
+
onClick: () => !oe && be(!1),
|
|
1611
|
+
children: /* @__PURE__ */ i(
|
|
1612
|
+
"div",
|
|
1613
|
+
{
|
|
1614
|
+
className: o.createLocalDialog,
|
|
1615
|
+
onClick: (l) => l.stopPropagation(),
|
|
1616
|
+
children: [
|
|
1617
|
+
/* @__PURE__ */ t("div", { className: o.renameTitle, children: "新建本地 Agent" }),
|
|
1618
|
+
/* @__PURE__ */ t("div", { className: o.createLocalLabel, children: oe ? "正在创建..." : "点击选择,直接开始聊天" }),
|
|
1619
|
+
/* @__PURE__ */ i("div", { className: o.agentTypeCards, children: [
|
|
1620
|
+
/* @__PURE__ */ i(
|
|
1621
|
+
"div",
|
|
1622
|
+
{
|
|
1623
|
+
className: o.agentTypeCard,
|
|
1624
|
+
onClick: () => Z("jar"),
|
|
1625
|
+
children: [
|
|
1626
|
+
/* @__PURE__ */ t(
|
|
1627
|
+
"div",
|
|
1628
|
+
{
|
|
1629
|
+
className: o.agentTypeIcon,
|
|
1630
|
+
style: { backgroundColor: "#52c41a" },
|
|
1631
|
+
children: "L"
|
|
1632
|
+
}
|
|
1633
|
+
),
|
|
1634
|
+
/* @__PURE__ */ i("div", { className: o.agentTypeBody, children: [
|
|
1635
|
+
/* @__PURE__ */ i("div", { className: o.agentTypeTitle, children: [
|
|
1636
|
+
"自研",
|
|
1637
|
+
" ",
|
|
1638
|
+
/* @__PURE__ */ t("span", { className: o.agentTypeBadge, children: "已运行" })
|
|
1639
|
+
] }),
|
|
1640
|
+
/* @__PURE__ */ t("div", { className: o.agentTypeDesc, children: "自研 Java Agent,内置 ReAct 推理引擎与工具调用" })
|
|
1641
|
+
] })
|
|
1642
|
+
]
|
|
1643
|
+
}
|
|
1644
|
+
),
|
|
1645
|
+
/* @__PURE__ */ i(
|
|
1646
|
+
"div",
|
|
1647
|
+
{
|
|
1648
|
+
className: o.agentTypeCard,
|
|
1649
|
+
onClick: () => Z("hermes"),
|
|
1650
|
+
children: [
|
|
1651
|
+
/* @__PURE__ */ t(
|
|
1652
|
+
"div",
|
|
1653
|
+
{
|
|
1654
|
+
className: o.agentTypeIcon,
|
|
1655
|
+
style: { backgroundColor: "#722ed1" },
|
|
1656
|
+
children: "H"
|
|
1657
|
+
}
|
|
1658
|
+
),
|
|
1659
|
+
/* @__PURE__ */ i("div", { className: o.agentTypeBody, children: [
|
|
1660
|
+
/* @__PURE__ */ t("div", { className: o.agentTypeTitle, children: "Hermes" }),
|
|
1661
|
+
/* @__PURE__ */ t("div", { className: o.agentTypeDesc, children: "本地 Hermes CLI,支持 tool-calling 与多模型切换" })
|
|
1662
|
+
] })
|
|
1663
|
+
]
|
|
1664
|
+
}
|
|
1665
|
+
),
|
|
1666
|
+
/* @__PURE__ */ i(
|
|
1667
|
+
"div",
|
|
1668
|
+
{
|
|
1669
|
+
className: o.agentTypeCard,
|
|
1670
|
+
onClick: () => Z("claude-code"),
|
|
1671
|
+
children: [
|
|
1672
|
+
/* @__PURE__ */ t(
|
|
1673
|
+
"div",
|
|
1674
|
+
{
|
|
1675
|
+
className: o.agentTypeIcon,
|
|
1676
|
+
style: { backgroundColor: "#eb2f96" },
|
|
1677
|
+
children: "C"
|
|
1678
|
+
}
|
|
1679
|
+
),
|
|
1680
|
+
/* @__PURE__ */ i("div", { className: o.agentTypeBody, children: [
|
|
1681
|
+
/* @__PURE__ */ t("div", { className: o.agentTypeTitle, children: "Claude Code" }),
|
|
1682
|
+
/* @__PURE__ */ t("div", { className: o.agentTypeDesc, children: "Anthropic Claude CLI 编码助手" })
|
|
1683
|
+
] })
|
|
1684
|
+
]
|
|
1685
|
+
}
|
|
1686
|
+
)
|
|
1687
|
+
] }),
|
|
1688
|
+
/* @__PURE__ */ t("div", { className: o.renameActions, children: /* @__PURE__ */ t(
|
|
1689
|
+
"button",
|
|
1690
|
+
{
|
|
1691
|
+
type: "button",
|
|
1692
|
+
className: o.renameBtn,
|
|
1693
|
+
onClick: () => be(!1),
|
|
1694
|
+
disabled: oe,
|
|
1695
|
+
children: "取消"
|
|
1696
|
+
}
|
|
1697
|
+
) })
|
|
1698
|
+
]
|
|
1699
|
+
}
|
|
1700
|
+
)
|
|
1701
|
+
}
|
|
1702
|
+
),
|
|
1703
|
+
C && /* @__PURE__ */ t(
|
|
1704
|
+
"div",
|
|
1705
|
+
{
|
|
1706
|
+
className: o.renameOverlay,
|
|
1707
|
+
onClick: () => !j && q(null),
|
|
1708
|
+
children: /* @__PURE__ */ i(
|
|
1709
|
+
"div",
|
|
1710
|
+
{
|
|
1711
|
+
className: o.renameDialog,
|
|
1712
|
+
onClick: (l) => l.stopPropagation(),
|
|
1713
|
+
children: [
|
|
1714
|
+
/* @__PURE__ */ t("div", { className: o.renameTitle, children: "重命名 Agent" }),
|
|
1715
|
+
/* @__PURE__ */ t(
|
|
1716
|
+
"input",
|
|
1717
|
+
{
|
|
1718
|
+
className: o.renameInput,
|
|
1719
|
+
type: "text",
|
|
1720
|
+
value: C.value,
|
|
1721
|
+
autoFocus: !0,
|
|
1722
|
+
onChange: (l) => q({ ...C, value: l.target.value }),
|
|
1723
|
+
onKeyDown: (l) => {
|
|
1724
|
+
l.key === "Enter" && Oe(), l.key === "Escape" && q(null);
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
),
|
|
1728
|
+
/* @__PURE__ */ i("div", { className: o.renameActions, children: [
|
|
1729
|
+
/* @__PURE__ */ t(
|
|
1730
|
+
"button",
|
|
1731
|
+
{
|
|
1732
|
+
type: "button",
|
|
1733
|
+
className: o.renameBtn,
|
|
1734
|
+
onClick: () => q(null),
|
|
1735
|
+
disabled: j,
|
|
1736
|
+
children: "取消"
|
|
1737
|
+
}
|
|
1738
|
+
),
|
|
1739
|
+
/* @__PURE__ */ t(
|
|
1740
|
+
"button",
|
|
1741
|
+
{
|
|
1742
|
+
type: "button",
|
|
1743
|
+
className: o.renameBtnPrimary,
|
|
1744
|
+
disabled: !C.value.trim() || j,
|
|
1745
|
+
onClick: Oe,
|
|
1746
|
+
children: j ? "..." : "确定"
|
|
1747
|
+
}
|
|
1748
|
+
)
|
|
1749
|
+
] })
|
|
1750
|
+
]
|
|
1751
|
+
}
|
|
1752
|
+
)
|
|
1753
|
+
}
|
|
1754
|
+
)
|
|
1755
|
+
] });
|
|
1756
|
+
}
|
|
1757
|
+
const kl = "_shell_1w53k_2", Tl = "_inset_1w53k_33", wl = "_main_1w53k_40", Il = "_pane_1w53k_52", Sl = "_skipLink_1w53k_62", Al = "_personalMainArea_1w53k_82", Bl = "_personalSidebar_1w53k_90", Ll = "_personalChatArea_1w53k_103", We = {
|
|
1758
|
+
shell: kl,
|
|
1759
|
+
inset: Tl,
|
|
1760
|
+
main: wl,
|
|
1761
|
+
pane: Il,
|
|
1762
|
+
skipLink: Sl,
|
|
1763
|
+
personalMainArea: Al,
|
|
1764
|
+
personalSidebar: Bl,
|
|
1765
|
+
personalChatArea: Ll
|
|
1766
|
+
}, Dl = "_sidebar_y5tuo_1", Ml = "_collapsed_y5tuo_12", xl = "_sideHeader_y5tuo_17", Rl = "_sideHeaderIcon_y5tuo_32", El = "_sideHeaderTitle_y5tuo_45", Ol = "_sideContent_y5tuo_54", $l = "_groupLabel_y5tuo_61", Hl = "_navList_y5tuo_71", Pl = "_navItem_y5tuo_77", Fl = "_navItemActive_y5tuo_109", jl = "_navIcon_y5tuo_114", Wl = "_navLabel_y5tuo_120", Kl = "_sideFooter_y5tuo_131", Ul = "_footHint_y5tuo_138", z = {
|
|
1767
|
+
sidebar: Dl,
|
|
1768
|
+
collapsed: Ml,
|
|
1769
|
+
sideHeader: xl,
|
|
1770
|
+
sideHeaderIcon: Rl,
|
|
1771
|
+
sideHeaderTitle: El,
|
|
1772
|
+
sideContent: Ol,
|
|
1773
|
+
groupLabel: $l,
|
|
1774
|
+
navList: Hl,
|
|
1775
|
+
navItem: Pl,
|
|
1776
|
+
navItemActive: Fl,
|
|
1777
|
+
navIcon: jl,
|
|
1778
|
+
navLabel: Wl,
|
|
1779
|
+
sideFooter: Kl,
|
|
1780
|
+
footHint: Ul
|
|
1781
|
+
};
|
|
1782
|
+
function Vl({
|
|
1783
|
+
items: s,
|
|
1784
|
+
activeTab: r,
|
|
1785
|
+
collapsed: d,
|
|
1786
|
+
footerItems: _,
|
|
1787
|
+
onSelect: k,
|
|
1788
|
+
onSwitchMode: I
|
|
1789
|
+
}) {
|
|
1790
|
+
return /* @__PURE__ */ i(
|
|
1791
|
+
"aside",
|
|
1792
|
+
{
|
|
1793
|
+
className: `${z.sidebar} ${d ? z.collapsed : ""}`,
|
|
1794
|
+
"aria-label": "个人工作台导航",
|
|
1795
|
+
children: [
|
|
1796
|
+
/* @__PURE__ */ i("div", { className: z.sideHeader, children: [
|
|
1797
|
+
/* @__PURE__ */ t("span", { className: z.sideHeaderIcon, children: /* @__PURE__ */ t(Ft, {}) }),
|
|
1798
|
+
!d && /* @__PURE__ */ t("span", { className: z.sideHeaderTitle, children: "个人工作台" })
|
|
1799
|
+
] }),
|
|
1800
|
+
/* @__PURE__ */ i("div", { className: z.sideContent, children: [
|
|
1801
|
+
!d && /* @__PURE__ */ t("p", { className: z.groupLabel, children: "我的工作空间" }),
|
|
1802
|
+
/* @__PURE__ */ t("nav", { className: z.navList, "aria-label": "个人模块", children: s.map((y) => {
|
|
1803
|
+
const L = r === y.key, x = /* @__PURE__ */ i(
|
|
1804
|
+
"button",
|
|
1805
|
+
{
|
|
1806
|
+
type: "button",
|
|
1807
|
+
className: `${z.navItem} ${L ? z.navItemActive : ""}`,
|
|
1808
|
+
onClick: () => k(y.key),
|
|
1809
|
+
"aria-current": L ? "page" : void 0,
|
|
1810
|
+
children: [
|
|
1811
|
+
/* @__PURE__ */ t("span", { className: z.navIcon, children: y.icon }),
|
|
1812
|
+
!d && /* @__PURE__ */ t("span", { className: z.navLabel, children: y.label })
|
|
1813
|
+
]
|
|
1814
|
+
},
|
|
1815
|
+
y.key
|
|
1816
|
+
);
|
|
1817
|
+
return d ? /* @__PURE__ */ t(Ct, { placement: "right", title: y.label, children: x }, y.key) : x;
|
|
1818
|
+
}) })
|
|
1819
|
+
] }),
|
|
1820
|
+
/* @__PURE__ */ i("div", { className: z.sideFooter, children: [
|
|
1821
|
+
_.length > 0 && /* @__PURE__ */ t("nav", { className: z.navList, "aria-label": "快捷切换", children: _.map((y) => {
|
|
1822
|
+
const L = /* @__PURE__ */ i(
|
|
1823
|
+
"button",
|
|
1824
|
+
{
|
|
1825
|
+
type: "button",
|
|
1826
|
+
className: z.navItem,
|
|
1827
|
+
onClick: () => I == null ? void 0 : I(y.mode),
|
|
1828
|
+
children: [
|
|
1829
|
+
/* @__PURE__ */ t("span", { className: z.navIcon, children: y.icon }),
|
|
1830
|
+
!d && /* @__PURE__ */ t("span", { className: z.navLabel, children: y.label })
|
|
1831
|
+
]
|
|
1832
|
+
},
|
|
1833
|
+
y.mode
|
|
1834
|
+
);
|
|
1835
|
+
return d ? /* @__PURE__ */ t(Ct, { placement: "right", title: y.label, children: L }, y.mode) : L;
|
|
1836
|
+
}) }),
|
|
1837
|
+
!d && /* @__PURE__ */ t("p", { className: z.footHint, children: "⌘ / Ctrl + B 切换导航" })
|
|
1838
|
+
] })
|
|
1839
|
+
]
|
|
1840
|
+
}
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
const Gl = "_topbar_ms4b7_1", zl = "_topbarLeft_ms4b7_14", ql = "_collapseBtn_ms4b7_22", Ql = "_crumbs_ms4b7_49", Xl = "_crumbsRoot_ms4b7_57", Jl = "_crumbsSep_ms4b7_62", Yl = "_crumbsCurrent_ms4b7_68", Zl = "_topbarRight_ms4b7_76", Ke = {
|
|
1844
|
+
topbar: Gl,
|
|
1845
|
+
topbarLeft: zl,
|
|
1846
|
+
collapseBtn: ql,
|
|
1847
|
+
crumbs: Ql,
|
|
1848
|
+
crumbsRoot: Xl,
|
|
1849
|
+
crumbsSep: Jl,
|
|
1850
|
+
crumbsCurrent: Yl,
|
|
1851
|
+
topbarRight: Zl
|
|
1852
|
+
};
|
|
1853
|
+
function ei({
|
|
1854
|
+
label: s,
|
|
1855
|
+
collapsed: r,
|
|
1856
|
+
onToggleCollapse: d
|
|
1857
|
+
}) {
|
|
1858
|
+
return /* @__PURE__ */ i("header", { className: Ke.topbar, children: [
|
|
1859
|
+
/* @__PURE__ */ i("div", { className: Ke.topbarLeft, children: [
|
|
1860
|
+
/* @__PURE__ */ t(
|
|
1861
|
+
Ct,
|
|
1862
|
+
{
|
|
1863
|
+
title: r ? "展开个人菜单" : "收起个人菜单",
|
|
1864
|
+
placement: "bottom",
|
|
1865
|
+
children: /* @__PURE__ */ t(
|
|
1866
|
+
"button",
|
|
1867
|
+
{
|
|
1868
|
+
type: "button",
|
|
1869
|
+
className: Ke.collapseBtn,
|
|
1870
|
+
onClick: d,
|
|
1871
|
+
"aria-label": "展开或收起个人菜单",
|
|
1872
|
+
"aria-expanded": !r,
|
|
1873
|
+
children: r ? /* @__PURE__ */ t(un, {}) : /* @__PURE__ */ t(mn, {})
|
|
1874
|
+
}
|
|
1875
|
+
)
|
|
1876
|
+
}
|
|
1877
|
+
),
|
|
1878
|
+
/* @__PURE__ */ i("div", { className: Ke.crumbs, "aria-label": "当前位置", children: [
|
|
1879
|
+
/* @__PURE__ */ t("span", { className: Ke.crumbsRoot, children: "个人" }),
|
|
1880
|
+
/* @__PURE__ */ t($t, { className: Ke.crumbsSep }),
|
|
1881
|
+
/* @__PURE__ */ t("span", { className: Ke.crumbsCurrent, children: s })
|
|
1882
|
+
] })
|
|
1883
|
+
] }),
|
|
1884
|
+
/* @__PURE__ */ t("div", { className: Ke.topbarRight })
|
|
1885
|
+
] });
|
|
1886
|
+
}
|
|
1887
|
+
const en = [
|
|
1888
|
+
{ key: "workbench", label: "场景工作台", icon: /* @__PURE__ */ t(Ft, {}) },
|
|
1889
|
+
{ key: "projects", label: "工作单管理", icon: /* @__PURE__ */ t(gn, {}) },
|
|
1890
|
+
{ key: "personal", label: "个人统计", icon: /* @__PURE__ */ t(_n, {}) },
|
|
1891
|
+
{ key: "business-stats", label: "业务指标", icon: /* @__PURE__ */ t(fn, {}) },
|
|
1892
|
+
{ key: "tools", label: "常用工具", icon: /* @__PURE__ */ t(yn, {}) },
|
|
1893
|
+
{ key: "websites", label: "常用网站", icon: /* @__PURE__ */ t(vn, {}) },
|
|
1894
|
+
{ key: "smart-partner", label: "智能伙伴", icon: /* @__PURE__ */ t(Pt, {}) },
|
|
1895
|
+
{ key: "todo", label: "工作待办", icon: /* @__PURE__ */ t(bn, {}) },
|
|
1896
|
+
{ key: "notes", label: "个人笔记", icon: /* @__PURE__ */ t(jt, {}) },
|
|
1897
|
+
{
|
|
1898
|
+
key: "training",
|
|
1899
|
+
label: "培训中心",
|
|
1900
|
+
icon: /* @__PURE__ */ t(Nn, {}),
|
|
1901
|
+
// 学员侧学习入口与培训管理(TRAINING)解耦:按需单独分配,不随培训入口发放
|
|
1902
|
+
permission: "TRAINING_CENTER"
|
|
1903
|
+
},
|
|
1904
|
+
{ key: "webide", label: "WebIDE", icon: /* @__PURE__ */ t(Cn, {}) }
|
|
1905
|
+
], tn = "ft_pw_sidebar_collapsed";
|
|
1906
|
+
function ti() {
|
|
1907
|
+
try {
|
|
1908
|
+
return localStorage.getItem(tn) === "1";
|
|
1909
|
+
} catch {
|
|
1910
|
+
return !1;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
function ni(s) {
|
|
1914
|
+
const r = s;
|
|
1915
|
+
return r ? r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.isContentEditable === !0 : !1;
|
|
1916
|
+
}
|
|
1917
|
+
function si() {
|
|
1918
|
+
try {
|
|
1919
|
+
const s = new URLSearchParams(window.location.search).get("tab");
|
|
1920
|
+
return s && en.some((r) => r.key === s) ? s : null;
|
|
1921
|
+
} catch {
|
|
1922
|
+
return null;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
function ai({
|
|
1926
|
+
onOpenProject: s,
|
|
1927
|
+
openTodoId: r,
|
|
1928
|
+
selectedPersonalAgent: d,
|
|
1929
|
+
personalView: _,
|
|
1930
|
+
newSessionTrigger: k,
|
|
1931
|
+
onSelectPersonalAgent: I,
|
|
1932
|
+
onShowPersonalAgentDetail: y,
|
|
1933
|
+
onChatWithPersonalAgent: L,
|
|
1934
|
+
onSwitchMode: x
|
|
1935
|
+
}) {
|
|
1936
|
+
var ge;
|
|
1937
|
+
const [w, P] = m(
|
|
1938
|
+
// 惰性初始化:命中深链时直接以目标 Tab 首屏渲染,不先渲染场景工作台再切
|
|
1939
|
+
() => si() ?? "workbench"
|
|
1940
|
+
);
|
|
1941
|
+
D(() => {
|
|
1942
|
+
try {
|
|
1943
|
+
const T = new URL(window.location.href);
|
|
1944
|
+
if (!T.searchParams.has("tab")) return;
|
|
1945
|
+
T.searchParams.delete("tab"), window.history.replaceState(window.history.state, "", T.toString());
|
|
1946
|
+
} catch {
|
|
1947
|
+
}
|
|
1948
|
+
}, []);
|
|
1949
|
+
const [V, R] = m(ti);
|
|
1950
|
+
D(() => {
|
|
1951
|
+
try {
|
|
1952
|
+
localStorage.setItem(tn, V ? "1" : "0");
|
|
1953
|
+
} catch {
|
|
1954
|
+
}
|
|
1955
|
+
}, [V]);
|
|
1956
|
+
const A = U(() => {
|
|
1957
|
+
R((T) => !T), window.setTimeout(() => window.dispatchEvent(new Event("resize")), 300);
|
|
1958
|
+
}, []);
|
|
1959
|
+
D(() => {
|
|
1960
|
+
function T(W) {
|
|
1961
|
+
!(W.metaKey || W.ctrlKey) || W.altKey || W.key.toLowerCase() === "b" && (ni(W.target) || (W.preventDefault(), A()));
|
|
1962
|
+
}
|
|
1963
|
+
return window.addEventListener("keydown", T), () => window.removeEventListener("keydown", T);
|
|
1964
|
+
}, [A]);
|
|
1965
|
+
const N = Ue((T) => T.currentUser), J = en.filter(
|
|
1966
|
+
(T) => !T.permission || qt(N, T.permission)
|
|
1967
|
+
), F = Me(() => x ? [
|
|
1968
|
+
{ mode: "admin", label: "运营工作台", icon: /* @__PURE__ */ t(pn, {}) },
|
|
1969
|
+
{ mode: "collaboration", label: "协作工作台", icon: /* @__PURE__ */ t(hn, {}) }
|
|
1970
|
+
].filter(
|
|
1971
|
+
(W) => Vt(N, W.mode)
|
|
1972
|
+
) : [], [N, x]), he = ((ge = J.find((T) => T.key === w)) == null ? void 0 : ge.label) ?? "个人工作台", [S, B] = m(null), [$, C] = m(null), q = U((T) => {
|
|
1973
|
+
P(T);
|
|
1974
|
+
}, []), j = U((T) => {
|
|
1975
|
+
P("notes"), B({ id: T, ts: Date.now() });
|
|
1976
|
+
}, []), H = U((T) => {
|
|
1977
|
+
P("todo"), C({ id: T, ts: Date.now() });
|
|
1978
|
+
}, []);
|
|
1979
|
+
return D(() => {
|
|
1980
|
+
r != null && r.id && (P("todo"), C({ id: r.id, ts: r.ts }));
|
|
1981
|
+
}, [r == null ? void 0 : r.id, r == null ? void 0 : r.ts]), /* @__PURE__ */ i("div", { className: We.shell, children: [
|
|
1982
|
+
/* @__PURE__ */ t("a", { className: We.skipLink, href: "#pw-content", children: "跳到个人工作台内容" }),
|
|
1983
|
+
/* @__PURE__ */ t(
|
|
1984
|
+
Vl,
|
|
1985
|
+
{
|
|
1986
|
+
items: J,
|
|
1987
|
+
activeTab: w,
|
|
1988
|
+
collapsed: V,
|
|
1989
|
+
footerItems: F,
|
|
1990
|
+
onSelect: P,
|
|
1991
|
+
onSwitchMode: x
|
|
1992
|
+
}
|
|
1993
|
+
),
|
|
1994
|
+
/* @__PURE__ */ i("div", { className: We.inset, children: [
|
|
1995
|
+
/* @__PURE__ */ t(
|
|
1996
|
+
ei,
|
|
1997
|
+
{
|
|
1998
|
+
label: he,
|
|
1999
|
+
collapsed: V,
|
|
2000
|
+
onToggleCollapse: A
|
|
2001
|
+
}
|
|
2002
|
+
),
|
|
2003
|
+
/* @__PURE__ */ t(
|
|
2004
|
+
"main",
|
|
2005
|
+
{
|
|
2006
|
+
id: "pw-content",
|
|
2007
|
+
tabIndex: -1,
|
|
2008
|
+
"aria-label": `${he}内容`,
|
|
2009
|
+
className: We.main,
|
|
2010
|
+
children: /* @__PURE__ */ i("div", { className: We.pane, children: [
|
|
2011
|
+
(w === "workbench" || w === "projects" || w === "personal") && /* @__PURE__ */ t(
|
|
2012
|
+
Nt,
|
|
2013
|
+
{
|
|
2014
|
+
activeTab: w,
|
|
2015
|
+
onActiveTabChange: q,
|
|
2016
|
+
onOpenProject: s,
|
|
2017
|
+
hideTabs: !0
|
|
2018
|
+
}
|
|
2019
|
+
),
|
|
2020
|
+
w === "business-stats" && /* @__PURE__ */ t(Rt, { source: "scenario" }),
|
|
2021
|
+
w === "tools" && /* @__PURE__ */ t(mt, { showTools: !0, showWebsites: !1 }),
|
|
2022
|
+
w === "websites" && /* @__PURE__ */ t(mt, { showTools: !1, showWebsites: !0 }),
|
|
2023
|
+
w === "todo" && /* @__PURE__ */ t(
|
|
2024
|
+
Et,
|
|
2025
|
+
{
|
|
2026
|
+
onOpenProject: s,
|
|
2027
|
+
onOpenNote: j,
|
|
2028
|
+
openTodoId: $
|
|
2029
|
+
}
|
|
2030
|
+
),
|
|
2031
|
+
w === "notes" && /* @__PURE__ */ t(
|
|
2032
|
+
Ot,
|
|
2033
|
+
{
|
|
2034
|
+
onOpenProject: s,
|
|
2035
|
+
onOpenTodo: H,
|
|
2036
|
+
openNoteId: S
|
|
2037
|
+
}
|
|
2038
|
+
),
|
|
2039
|
+
w === "training" && /* @__PURE__ */ t(Qt, {}),
|
|
2040
|
+
w === "webide" && /* @__PURE__ */ t(Xt, {}),
|
|
2041
|
+
w === "smart-partner" && /* @__PURE__ */ i("div", { className: We.personalMainArea, children: [
|
|
2042
|
+
/* @__PURE__ */ t("div", { className: We.personalSidebar, children: /* @__PURE__ */ t(
|
|
2043
|
+
Cl,
|
|
2044
|
+
{
|
|
2045
|
+
selectedAgentId: (d == null ? void 0 : d.id) ?? null,
|
|
2046
|
+
selectedLocalAgentId: (d == null ? void 0 : d.localAgentId) ?? null,
|
|
2047
|
+
onSelectAgent: I,
|
|
2048
|
+
onShowDetail: y,
|
|
2049
|
+
onChatWithAgent: L
|
|
2050
|
+
}
|
|
2051
|
+
) }),
|
|
2052
|
+
/* @__PURE__ */ t("div", { className: We.personalChatArea, children: _ === "detail" && d && !d.isLocal ? /* @__PURE__ */ t(
|
|
2053
|
+
Jt,
|
|
2054
|
+
{
|
|
2055
|
+
agent: d,
|
|
2056
|
+
onBack: () => I(d)
|
|
2057
|
+
}
|
|
2058
|
+
) : d != null && d.isLocal ? /* @__PURE__ */ t(
|
|
2059
|
+
Zt,
|
|
2060
|
+
{
|
|
2061
|
+
agent: d,
|
|
2062
|
+
newSessionTrigger: k
|
|
2063
|
+
}
|
|
2064
|
+
) : /* @__PURE__ */ t(
|
|
2065
|
+
Yt,
|
|
2066
|
+
{
|
|
2067
|
+
agent: d,
|
|
2068
|
+
newSessionTrigger: k
|
|
2069
|
+
}
|
|
2070
|
+
) })
|
|
2071
|
+
] })
|
|
2072
|
+
] })
|
|
2073
|
+
}
|
|
2074
|
+
)
|
|
2075
|
+
] })
|
|
2076
|
+
] });
|
|
2077
|
+
}
|
|
2078
|
+
const Q = Yn() || typeof localStorage < "u" && localStorage.getItem("ft_exclusive_force_desktop") === "1", li = `${window.publicPath ?? "/"}logo.svg`, ii = [
|
|
2079
|
+
"帮我排查一个线上问题",
|
|
2080
|
+
"总结一下今天的群聊进展",
|
|
2081
|
+
"把这周的变更整理成周报"
|
|
2082
|
+
], ci = [
|
|
2083
|
+
{
|
|
2084
|
+
key: "video",
|
|
2085
|
+
label: "视频生成",
|
|
2086
|
+
icon: /* @__PURE__ */ t(kn, {}),
|
|
2087
|
+
action: "chat",
|
|
2088
|
+
prompt: "帮我写一条 15 秒短视频脚本,主题是:"
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
key: "docs",
|
|
2092
|
+
label: "文档办公",
|
|
2093
|
+
icon: /* @__PURE__ */ t(jt, {}),
|
|
2094
|
+
action: "tools"
|
|
2095
|
+
},
|
|
2096
|
+
{
|
|
2097
|
+
key: "vibe",
|
|
2098
|
+
label: "Vibe Coding",
|
|
2099
|
+
icon: /* @__PURE__ */ t(Zn, {}),
|
|
2100
|
+
action: "webide"
|
|
2101
|
+
},
|
|
2102
|
+
{
|
|
2103
|
+
key: "design",
|
|
2104
|
+
label: "设计视觉",
|
|
2105
|
+
icon: /* @__PURE__ */ t(es, {}),
|
|
2106
|
+
action: "chat",
|
|
2107
|
+
prompt: "帮我出一版视觉设计稿,风格偏:"
|
|
2108
|
+
},
|
|
2109
|
+
{
|
|
2110
|
+
key: "ask",
|
|
2111
|
+
label: "问问 Z-Team",
|
|
2112
|
+
icon: /* @__PURE__ */ t(ut, {}),
|
|
2113
|
+
action: "ask"
|
|
2114
|
+
}
|
|
2115
|
+
];
|
|
2116
|
+
function oi() {
|
|
2117
|
+
const s = (/* @__PURE__ */ new Date()).getHours();
|
|
2118
|
+
return s < 5 ? "夜深了" : s < 12 ? "早上好" : s < 14 ? "中午好" : s < 18 ? "下午好" : "晚上好";
|
|
2119
|
+
}
|
|
2120
|
+
function ri(s) {
|
|
2121
|
+
return s.type === "jar" ? {
|
|
2122
|
+
id: "-1",
|
|
2123
|
+
userId: "local",
|
|
2124
|
+
agentHubAgentId: null,
|
|
2125
|
+
agentCode: "local-default",
|
|
2126
|
+
displayName: s.name || "本地 Agent",
|
|
2127
|
+
avatar: null,
|
|
2128
|
+
isLocal: !0
|
|
2129
|
+
} : {
|
|
2130
|
+
id: "-1",
|
|
2131
|
+
userId: "local",
|
|
2132
|
+
agentHubAgentId: null,
|
|
2133
|
+
agentCode: s.name,
|
|
2134
|
+
displayName: s.name,
|
|
2135
|
+
avatar: null,
|
|
2136
|
+
isLocal: !0,
|
|
2137
|
+
localAgentId: s.id,
|
|
2138
|
+
localAgentType: s.type
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
function Ti({
|
|
2142
|
+
onSwitchMode: s,
|
|
2143
|
+
onOpenProject: r,
|
|
2144
|
+
openAgentRequest: d
|
|
2145
|
+
}) {
|
|
2146
|
+
const _ = Ue((e) => e.token), k = Ue((e) => e.currentUser), I = Gt(), [y, L] = m([]), [x, w] = m(!0), [P, V] = m(null), [R, A] = m("landing"), [N, J] = m(null), [F, he] = m(
|
|
2147
|
+
Q ? "local" : "cloud"
|
|
2148
|
+
), [S, B] = m(
|
|
2149
|
+
[]
|
|
2150
|
+
), [$, C] = m([]), [q, j] = m(!0), [H, ge] = m(!1), T = Ue((e) => e.projects), [W, Ce] = m([]), [_e, G] = m(null), [ye, ce] = m(
|
|
2151
|
+
/* @__PURE__ */ new Set()
|
|
2152
|
+
), [ve, Re] = m(0), [Ee, be] = m(null), [oe, ke] = m(!1), [Y, Te] = m([]), [fe, we] = m(null), [re, Z] = m(""), de = O(null), [Ie, Oe] = m(!1), [Qe, $e] = m(!1), [l, v] = m(null), [E, ee] = m(!1), te = U(
|
|
2153
|
+
(e) => {
|
|
2154
|
+
const n = Pn(e);
|
|
2155
|
+
n && !qt(k, n) || (Je(e), A("personalTab"));
|
|
2156
|
+
},
|
|
2157
|
+
[k]
|
|
2158
|
+
), [ne, He] = m(!1), [Se, Ae] = m(
|
|
2159
|
+
null
|
|
2160
|
+
), [Xe, ue] = m(
|
|
2161
|
+
null
|
|
2162
|
+
), [ze, tt] = m(
|
|
2163
|
+
null
|
|
2164
|
+
), Be = U(
|
|
2165
|
+
(e, n) => {
|
|
2166
|
+
r == null || r(e, n);
|
|
2167
|
+
},
|
|
2168
|
+
[r]
|
|
2169
|
+
), nt = U((e) => {
|
|
2170
|
+
Je("todo"), tt({ id: e, ts: Date.now() });
|
|
2171
|
+
}, []), [se, Je] = m("personal"), st = O(!1), ae = Me(() => Fn(y), [y]), me = Me(
|
|
2172
|
+
() => y.find((e) => e.id === P) ?? ae,
|
|
2173
|
+
[y, P, ae]
|
|
2174
|
+
);
|
|
2175
|
+
Q && oe && Y.length > 0;
|
|
2176
|
+
const K = Me(
|
|
2177
|
+
() => Y.find((e) => e.id === fe) ?? null,
|
|
2178
|
+
[Y, fe]
|
|
2179
|
+
);
|
|
2180
|
+
D(() => {
|
|
2181
|
+
let e = !0;
|
|
2182
|
+
return w(!0), Wt(_).then((n) => {
|
|
2183
|
+
e && L(n);
|
|
2184
|
+
}).catch(() => {
|
|
2185
|
+
}).finally(() => {
|
|
2186
|
+
e && w(!1);
|
|
2187
|
+
}), () => {
|
|
2188
|
+
e = !1;
|
|
2189
|
+
};
|
|
2190
|
+
}, [_]), D(() => {
|
|
2191
|
+
if (!Q) return;
|
|
2192
|
+
let e = !0;
|
|
2193
|
+
const n = async () => {
|
|
2194
|
+
const p = await bt();
|
|
2195
|
+
if (e) {
|
|
2196
|
+
if (ke(p), !p) {
|
|
2197
|
+
Te([]);
|
|
2198
|
+
return;
|
|
2199
|
+
}
|
|
2200
|
+
try {
|
|
2201
|
+
const u = await Ut();
|
|
2202
|
+
e && Te(u);
|
|
2203
|
+
} catch {
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
};
|
|
2207
|
+
n();
|
|
2208
|
+
const a = window.setInterval(() => void n(), 3e4);
|
|
2209
|
+
return () => {
|
|
2210
|
+
e = !1, window.clearInterval(a);
|
|
2211
|
+
};
|
|
2212
|
+
}, []), D(() => {
|
|
2213
|
+
if (!Q || Y.length === 0 || fe && Y.some((n) => n.id === fe))
|
|
2214
|
+
return;
|
|
2215
|
+
const e = Y.find((n) => n.type === "jar");
|
|
2216
|
+
we((e ?? Y[0]).id);
|
|
2217
|
+
}, [Y, fe]);
|
|
2218
|
+
const at = Me(() => {
|
|
2219
|
+
const e = /* @__PURE__ */ new Map();
|
|
2220
|
+
for (const n of y) e.set(n.id, n);
|
|
2221
|
+
return e;
|
|
2222
|
+
}, [y]), Ye = U(async () => {
|
|
2223
|
+
j(!0);
|
|
2224
|
+
const [e, n] = await Promise.allSettled([
|
|
2225
|
+
Ln(_),
|
|
2226
|
+
as(_)
|
|
2227
|
+
]);
|
|
2228
|
+
if (e.status === "fulfilled" && B(e.value || []), n.status === "fulfilled") {
|
|
2229
|
+
const a = /* @__PURE__ */ new Set(), p = [];
|
|
2230
|
+
for (const u of [...n.value.owned, ...n.value.joined])
|
|
2231
|
+
a.has(u.id) || (a.add(u.id), p.push(u));
|
|
2232
|
+
C(p);
|
|
2233
|
+
}
|
|
2234
|
+
j(!1);
|
|
2235
|
+
}, [_]);
|
|
2236
|
+
D(() => {
|
|
2237
|
+
Ye();
|
|
2238
|
+
}, [Ye, N == null ? void 0 : N.ts]);
|
|
2239
|
+
const Pe = Me(() => {
|
|
2240
|
+
const e = /* @__PURE__ */ new Map();
|
|
2241
|
+
for (const g of $)
|
|
2242
|
+
e.set(`sp:${String(g.id)}`, {
|
|
2243
|
+
key: `sp:${String(g.id)}`,
|
|
2244
|
+
title: g.title,
|
|
2245
|
+
sessions: []
|
|
2246
|
+
});
|
|
2247
|
+
const n = [], a = [...S].sort(
|
|
2248
|
+
(g, f) => (f.updateTime || f.createTime || "").localeCompare(
|
|
2249
|
+
g.updateTime || g.createTime || ""
|
|
2250
|
+
)
|
|
2251
|
+
);
|
|
2252
|
+
for (const g of a)
|
|
2253
|
+
if (g.projectSpaceId != null) {
|
|
2254
|
+
const f = `sp:${String(g.projectSpaceId)}`;
|
|
2255
|
+
e.has(f) || e.set(f, {
|
|
2256
|
+
key: f,
|
|
2257
|
+
title: g.projectSpaceTitle || `空间 ${g.projectSpaceId}`,
|
|
2258
|
+
sessions: []
|
|
2259
|
+
}), e.get(f).sessions.push(g);
|
|
2260
|
+
} else
|
|
2261
|
+
n.push(g);
|
|
2262
|
+
const p = (g) => {
|
|
2263
|
+
var f, b;
|
|
2264
|
+
return ((f = g.sessions[0]) == null ? void 0 : f.updateTime) || ((b = g.sessions[0]) == null ? void 0 : b.createTime) || "";
|
|
2265
|
+
}, u = [...e.values()];
|
|
2266
|
+
return u.sort((g, f) => g.sessions.length > 0 && f.sessions.length > 0 ? p(f).localeCompare(p(g)) : g.sessions.length > 0 ? -1 : f.sessions.length > 0 ? 1 : g.title.localeCompare(f.title)), n.length > 0 && u.push({ key: "sp:none", title: "未归组", sessions: n }), u;
|
|
2267
|
+
}, [$, S]), Fe = Me(
|
|
2268
|
+
() => {
|
|
2269
|
+
var e;
|
|
2270
|
+
return N != null && N.sessionId ? ((e = Pe.find(
|
|
2271
|
+
(n) => n.sessions.some((a) => a.id === N.sessionId)
|
|
2272
|
+
)) == null ? void 0 : e.key) ?? null : null;
|
|
2273
|
+
},
|
|
2274
|
+
[Pe, N == null ? void 0 : N.sessionId]
|
|
2275
|
+
);
|
|
2276
|
+
D(() => {
|
|
2277
|
+
var n;
|
|
2278
|
+
const e = Fe ?? (st.current ? null : ((n = Pe.find((a) => a.sessions.length > 0)) == null ? void 0 : n.key) ?? null);
|
|
2279
|
+
e && (st.current = !0, ce(
|
|
2280
|
+
(a) => a.has(e) ? a : new Set(a).add(e)
|
|
2281
|
+
));
|
|
2282
|
+
}, [Fe, Pe]);
|
|
2283
|
+
const Le = K && K.type !== "jar" ? K.id : void 0;
|
|
2284
|
+
D(() => {
|
|
2285
|
+
if (!Q || F !== "local" || !oe) return;
|
|
2286
|
+
let e = !0;
|
|
2287
|
+
return Kt(Le).then((n) => {
|
|
2288
|
+
e && Ce([...n].sort((a, p) => p.updatedAt - a.updatedAt));
|
|
2289
|
+
}).catch(() => {
|
|
2290
|
+
e && Ce([]);
|
|
2291
|
+
}), () => {
|
|
2292
|
+
e = !1;
|
|
2293
|
+
};
|
|
2294
|
+
}, [
|
|
2295
|
+
F,
|
|
2296
|
+
oe,
|
|
2297
|
+
Le,
|
|
2298
|
+
_e,
|
|
2299
|
+
ve
|
|
2300
|
+
]);
|
|
2301
|
+
const Ze = U(() => G(null), []), pt = (e) => {
|
|
2302
|
+
J(null), G(e), A("chat");
|
|
2303
|
+
}, pe = (e, n = null, a = null) => {
|
|
2304
|
+
V(e.id), J(
|
|
2305
|
+
(p) => p && p.agent.id === e.id && p.sessionId === n && !a ? p : { agent: e, sessionId: n, draft: a, ts: Date.now() }
|
|
2306
|
+
), A("chat");
|
|
2307
|
+
};
|
|
2308
|
+
D(() => {
|
|
2309
|
+
const e = d;
|
|
2310
|
+
if (!(e != null && e.agent) || !e.ts) return;
|
|
2311
|
+
const n = e.agent;
|
|
2312
|
+
if (V(n.id), e.view === "detail") {
|
|
2313
|
+
Ae(n), A("agentDetail");
|
|
2314
|
+
return;
|
|
2315
|
+
}
|
|
2316
|
+
pe(n, e.sessionId ?? null), e.newSession > 0 && Re((a) => a + 1);
|
|
2317
|
+
}, [d == null ? void 0 : d.ts]);
|
|
2318
|
+
const lt = () => {
|
|
2319
|
+
V((ae == null ? void 0 : ae.id) ?? null), J(null), Z(""), A("landing");
|
|
2320
|
+
}, Ve = () => {
|
|
2321
|
+
Re((e) => e + 1), J(null), A("chat");
|
|
2322
|
+
}, it = () => {
|
|
2323
|
+
if (Q && K) {
|
|
2324
|
+
Ve();
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
if (ae) {
|
|
2328
|
+
pe(ae);
|
|
2329
|
+
return;
|
|
2330
|
+
}
|
|
2331
|
+
lt();
|
|
2332
|
+
}, ht = () => {
|
|
2333
|
+
N ? A("chat") : ae && pe(ae);
|
|
2334
|
+
}, ct = async () => {
|
|
2335
|
+
const e = re.trim();
|
|
2336
|
+
if (!(!e || Ie)) {
|
|
2337
|
+
if (Q && K) {
|
|
2338
|
+
be(e), Z(""), A("chat");
|
|
2339
|
+
return;
|
|
2340
|
+
}
|
|
2341
|
+
if (me) {
|
|
2342
|
+
Oe(!0);
|
|
2343
|
+
try {
|
|
2344
|
+
const n = e.length > 20 ? `${e.slice(0, 20)}…` : e, a = await Dn(
|
|
2345
|
+
me.id,
|
|
2346
|
+
n,
|
|
2347
|
+
_,
|
|
2348
|
+
l
|
|
2349
|
+
);
|
|
2350
|
+
v(null), J({
|
|
2351
|
+
agent: me,
|
|
2352
|
+
sessionId: a.id,
|
|
2353
|
+
draft: e,
|
|
2354
|
+
ts: Date.now()
|
|
2355
|
+
}), Z(""), A("chat");
|
|
2356
|
+
} catch {
|
|
2357
|
+
} finally {
|
|
2358
|
+
Oe(!1);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}, Ge = I.nickname || (k == null ? void 0 : k.display_name) || (k == null ? void 0 : k.username) || "", gt = Me(() => s ? [
|
|
2363
|
+
{
|
|
2364
|
+
mode: "personal",
|
|
2365
|
+
label: "个人工作台",
|
|
2366
|
+
icon: /* @__PURE__ */ t(Xn, {})
|
|
2367
|
+
},
|
|
2368
|
+
{
|
|
2369
|
+
mode: "collaboration",
|
|
2370
|
+
label: "协作工作台",
|
|
2371
|
+
icon: /* @__PURE__ */ t(Jn, {})
|
|
2372
|
+
}
|
|
2373
|
+
].filter(
|
|
2374
|
+
(n) => Vt(k, n.mode)
|
|
2375
|
+
) : [], [k, s]), ot = N ? `${N.agent.id}-${N.sessionId ?? 0}-${N.ts}` : "none";
|
|
2376
|
+
let le;
|
|
2377
|
+
return R === "agentDetail" && Se ? le = /* @__PURE__ */ t("div", { className: h.detailHost, children: /* @__PURE__ */ t(
|
|
2378
|
+
Jt,
|
|
2379
|
+
{
|
|
2380
|
+
agent: Se,
|
|
2381
|
+
onBack: () => A("extensions")
|
|
2382
|
+
}
|
|
2383
|
+
) }) : R === "schedule" ? le = /* @__PURE__ */ t(os, { localOnline: oe }) : R === "extensions" ? le = /* @__PURE__ */ t(
|
|
2384
|
+
rs,
|
|
2385
|
+
{
|
|
2386
|
+
agents: y,
|
|
2387
|
+
loading: x,
|
|
2388
|
+
skillsAgent: ae,
|
|
2389
|
+
token: _,
|
|
2390
|
+
onChat: (e) => pe(e),
|
|
2391
|
+
onConfig: (e) => {
|
|
2392
|
+
Ae(e), A("agentDetail");
|
|
2393
|
+
},
|
|
2394
|
+
onCreated: (e) => L((n) => [...n, e])
|
|
2395
|
+
}
|
|
2396
|
+
) : R === "history" ? le = /* @__PURE__ */ t(
|
|
2397
|
+
ds,
|
|
2398
|
+
{
|
|
2399
|
+
agents: y,
|
|
2400
|
+
token: _,
|
|
2401
|
+
onOpenSession: (e, n) => pe(e, n)
|
|
2402
|
+
}
|
|
2403
|
+
) : R === "workbenchShell" ? le = /* @__PURE__ */ t(
|
|
2404
|
+
ai,
|
|
2405
|
+
{
|
|
2406
|
+
onOpenProject: Be,
|
|
2407
|
+
selectedPersonalAgent: me,
|
|
2408
|
+
personalView: "chat",
|
|
2409
|
+
newSessionTrigger: ve,
|
|
2410
|
+
onSelectPersonalAgent: (e) => V((e == null ? void 0 : e.id) ?? null),
|
|
2411
|
+
onShowPersonalAgentDetail: (e) => {
|
|
2412
|
+
Ae(e), A("agentDetail");
|
|
2413
|
+
},
|
|
2414
|
+
onChatWithPersonalAgent: (e) => pe(e),
|
|
2415
|
+
onSwitchMode: s
|
|
2416
|
+
}
|
|
2417
|
+
) : R === "personalTab" ? le = /* @__PURE__ */ i("div", { className: h.personalTabHost, children: [
|
|
2418
|
+
se === "projects" && /* @__PURE__ */ t(
|
|
2419
|
+
Nt,
|
|
2420
|
+
{
|
|
2421
|
+
activeTab: "projects",
|
|
2422
|
+
onActiveTabChange: () => {
|
|
2423
|
+
},
|
|
2424
|
+
onOpenProject: Be,
|
|
2425
|
+
hideTabs: !0
|
|
2426
|
+
}
|
|
2427
|
+
),
|
|
2428
|
+
se === "personal" && /* @__PURE__ */ t(
|
|
2429
|
+
Nt,
|
|
2430
|
+
{
|
|
2431
|
+
activeTab: "personal",
|
|
2432
|
+
onActiveTabChange: () => {
|
|
2433
|
+
},
|
|
2434
|
+
onOpenProject: Be,
|
|
2435
|
+
hideTabs: !0
|
|
2436
|
+
}
|
|
2437
|
+
),
|
|
2438
|
+
se === "business-stats" && /* @__PURE__ */ t(Rt, { source: "scenario" }),
|
|
2439
|
+
se === "tools" && /* @__PURE__ */ t(mt, { showTools: !0, showWebsites: !1 }),
|
|
2440
|
+
se === "websites" && /* @__PURE__ */ t(mt, { showTools: !1, showWebsites: !0 }),
|
|
2441
|
+
se === "todo" && /* @__PURE__ */ t(
|
|
2442
|
+
Et,
|
|
2443
|
+
{
|
|
2444
|
+
onOpenProject: Be,
|
|
2445
|
+
onOpenNote: (e) => {
|
|
2446
|
+
Je("notes"), ue({ id: e, ts: Date.now() });
|
|
2447
|
+
},
|
|
2448
|
+
openTodoId: ze
|
|
2449
|
+
}
|
|
2450
|
+
),
|
|
2451
|
+
se === "notes" && /* @__PURE__ */ t(
|
|
2452
|
+
Ot,
|
|
2453
|
+
{
|
|
2454
|
+
onOpenProject: Be,
|
|
2455
|
+
onOpenTodo: nt,
|
|
2456
|
+
openNoteId: Xe
|
|
2457
|
+
}
|
|
2458
|
+
),
|
|
2459
|
+
se === "training" && /* @__PURE__ */ t(Qt, {}),
|
|
2460
|
+
se === "webide" && /* @__PURE__ */ t(Xt, {})
|
|
2461
|
+
] }) : N ? le = /* @__PURE__ */ t("div", { className: h.chatHost, children: /* @__PURE__ */ t(
|
|
2462
|
+
Yt,
|
|
2463
|
+
{
|
|
2464
|
+
agent: N.agent,
|
|
2465
|
+
initialSessionId: N.sessionId,
|
|
2466
|
+
autoSendDraft: N.draft,
|
|
2467
|
+
chromeless: !0,
|
|
2468
|
+
agents: y,
|
|
2469
|
+
onSwitchAgent: (e) => pe(e)
|
|
2470
|
+
},
|
|
2471
|
+
ot
|
|
2472
|
+
) }) : Q && K && R !== "landing" ? le = /* @__PURE__ */ t("div", { className: h.chatHost, children: /* @__PURE__ */ t(
|
|
2473
|
+
Zt,
|
|
2474
|
+
{
|
|
2475
|
+
agent: ri(K),
|
|
2476
|
+
newSessionTrigger: ve,
|
|
2477
|
+
autoSendDraft: Ee,
|
|
2478
|
+
onAutoSendConsumed: () => be(null),
|
|
2479
|
+
openSessionId: _e,
|
|
2480
|
+
onOpenSessionConsumed: Ze
|
|
2481
|
+
},
|
|
2482
|
+
K.id
|
|
2483
|
+
) }) : le = /* @__PURE__ */ t("div", { className: h.landing, children: /* @__PURE__ */ i("div", { className: h.landingInner, children: [
|
|
2484
|
+
/* @__PURE__ */ t("div", { className: h.mascot, "aria-hidden": "true", children: /* @__PURE__ */ t("img", { src: li, alt: "" }) }),
|
|
2485
|
+
/* @__PURE__ */ t("h1", { className: h.landingTitle, children: I.greetingEnabled ? `${oi()}${Ge ? `,${Ge}` : ""}` : "开始新的对话" }),
|
|
2486
|
+
/* @__PURE__ */ t("p", { className: h.landingSub, children: I.bio || "我是你的智能伙伴,有什么可以帮你?" }),
|
|
2487
|
+
/* @__PURE__ */ i("div", { className: h.landingBox, children: [
|
|
2488
|
+
/* @__PURE__ */ t(
|
|
2489
|
+
"textarea",
|
|
2490
|
+
{
|
|
2491
|
+
ref: de,
|
|
2492
|
+
className: h.landingInput,
|
|
2493
|
+
placeholder: `给智能伙伴发送消息,${ss(I.sendKey)}`,
|
|
2494
|
+
rows: 3,
|
|
2495
|
+
value: re,
|
|
2496
|
+
autoFocus: !0,
|
|
2497
|
+
onChange: (e) => Z(e.target.value),
|
|
2498
|
+
onKeyDown: (e) => {
|
|
2499
|
+
zt(e, I.sendKey) && !e.nativeEvent.isComposing && (e.preventDefault(), ct());
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
),
|
|
2503
|
+
/* @__PURE__ */ i("div", { className: h.landingBoxBar, children: [
|
|
2504
|
+
Q && K ? /* @__PURE__ */ i("span", { className: h.agentChip, children: [
|
|
2505
|
+
/* @__PURE__ */ t(ut, {}),
|
|
2506
|
+
/* @__PURE__ */ i("span", { children: [
|
|
2507
|
+
K.name,
|
|
2508
|
+
"(本机)"
|
|
2509
|
+
] })
|
|
2510
|
+
] }) : me ? /* @__PURE__ */ i("div", { className: h.agentChipWrap, children: [
|
|
2511
|
+
/* @__PURE__ */ i(
|
|
2512
|
+
"button",
|
|
2513
|
+
{
|
|
2514
|
+
type: "button",
|
|
2515
|
+
className: h.agentChip,
|
|
2516
|
+
onClick: () => $e((e) => !e),
|
|
2517
|
+
children: [
|
|
2518
|
+
/* @__PURE__ */ t(ut, {}),
|
|
2519
|
+
/* @__PURE__ */ t("span", { children: me.displayName }),
|
|
2520
|
+
y.length > 1 && /* @__PURE__ */ t(ft, { className: h.chipCaret })
|
|
2521
|
+
]
|
|
2522
|
+
}
|
|
2523
|
+
),
|
|
2524
|
+
Qe && y.length > 1 && /* @__PURE__ */ i(xe, { children: [
|
|
2525
|
+
/* @__PURE__ */ t(
|
|
2526
|
+
"div",
|
|
2527
|
+
{
|
|
2528
|
+
className: h.agentMenuMask,
|
|
2529
|
+
onClick: () => $e(!1)
|
|
2530
|
+
}
|
|
2531
|
+
),
|
|
2532
|
+
/* @__PURE__ */ t("div", { className: h.agentMenu, role: "menu", children: y.map((e) => /* @__PURE__ */ i(
|
|
2533
|
+
"button",
|
|
2534
|
+
{
|
|
2535
|
+
type: "button",
|
|
2536
|
+
role: "menuitem",
|
|
2537
|
+
className: `${h.agentMenuItem} ${e.id === me.id ? h.agentMenuItemActive : ""}`,
|
|
2538
|
+
onClick: () => {
|
|
2539
|
+
V(e.id), $e(!1);
|
|
2540
|
+
},
|
|
2541
|
+
children: [
|
|
2542
|
+
/* @__PURE__ */ t(
|
|
2543
|
+
"span",
|
|
2544
|
+
{
|
|
2545
|
+
className: h.agentDot,
|
|
2546
|
+
style: { background: Wn(e.displayName) },
|
|
2547
|
+
children: jn(e.displayName)
|
|
2548
|
+
}
|
|
2549
|
+
),
|
|
2550
|
+
e.displayName
|
|
2551
|
+
]
|
|
2552
|
+
},
|
|
2553
|
+
e.id
|
|
2554
|
+
)) })
|
|
2555
|
+
] })
|
|
2556
|
+
] }) : /* @__PURE__ */ t("span", { className: h.agentChipEmpty, children: "还没有云端伙伴,可到个人工作台创建" }),
|
|
2557
|
+
!(Q && K) && me && /* @__PURE__ */ i("div", { className: h.agentChipWrap, children: [
|
|
2558
|
+
/* @__PURE__ */ i(
|
|
2559
|
+
"button",
|
|
2560
|
+
{
|
|
2561
|
+
type: "button",
|
|
2562
|
+
className: h.agentChip,
|
|
2563
|
+
title: "本次新建任务归入的项目空间(可选)",
|
|
2564
|
+
onClick: () => ee((e) => !e),
|
|
2565
|
+
children: [
|
|
2566
|
+
/* @__PURE__ */ t(yt, {}),
|
|
2567
|
+
/* @__PURE__ */ t("span", { children: l ? l.title : "不归组" }),
|
|
2568
|
+
/* @__PURE__ */ t(ft, { className: h.chipCaret })
|
|
2569
|
+
]
|
|
2570
|
+
}
|
|
2571
|
+
),
|
|
2572
|
+
E && /* @__PURE__ */ i(xe, { children: [
|
|
2573
|
+
/* @__PURE__ */ t(
|
|
2574
|
+
"div",
|
|
2575
|
+
{
|
|
2576
|
+
className: h.agentMenuMask,
|
|
2577
|
+
onClick: () => ee(!1)
|
|
2578
|
+
}
|
|
2579
|
+
),
|
|
2580
|
+
/* @__PURE__ */ t(
|
|
2581
|
+
ProjectSpaceMenu,
|
|
2582
|
+
{
|
|
2583
|
+
token: _,
|
|
2584
|
+
currentId: (l == null ? void 0 : l.id) ?? null,
|
|
2585
|
+
onPick: (e) => {
|
|
2586
|
+
v(e), ee(!1);
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
)
|
|
2590
|
+
] })
|
|
2591
|
+
] }),
|
|
2592
|
+
/* @__PURE__ */ t(
|
|
2593
|
+
"button",
|
|
2594
|
+
{
|
|
2595
|
+
type: "button",
|
|
2596
|
+
className: h.landingSend,
|
|
2597
|
+
disabled: !re.trim() || Ie || !me && !(Q && K),
|
|
2598
|
+
onClick: () => void ct(),
|
|
2599
|
+
"aria-label": "发送",
|
|
2600
|
+
children: Ie ? /* @__PURE__ */ t(Kn, {}) : /* @__PURE__ */ t(Un, {})
|
|
2601
|
+
}
|
|
2602
|
+
)
|
|
2603
|
+
] })
|
|
2604
|
+
] }),
|
|
2605
|
+
/* @__PURE__ */ i("div", { className: h.contextRow, children: [
|
|
2606
|
+
/* @__PURE__ */ i("span", { className: h.contextChip, children: [
|
|
2607
|
+
/* @__PURE__ */ t(yt, {}),
|
|
2608
|
+
/* @__PURE__ */ t("span", { children: l ? l.title : "未归组" })
|
|
2609
|
+
] }),
|
|
2610
|
+
/* @__PURE__ */ t("span", { className: h.contextChip, children: Q && K ? /* @__PURE__ */ i(xe, { children: [
|
|
2611
|
+
/* @__PURE__ */ t(ut, {}),
|
|
2612
|
+
/* @__PURE__ */ i("span", { children: [
|
|
2613
|
+
K.name,
|
|
2614
|
+
"(本机)"
|
|
2615
|
+
] })
|
|
2616
|
+
] }) : /* @__PURE__ */ i(xe, { children: [
|
|
2617
|
+
/* @__PURE__ */ t(Vn, {}),
|
|
2618
|
+
/* @__PURE__ */ t("span", { children: "云端" })
|
|
2619
|
+
] }) })
|
|
2620
|
+
] }),
|
|
2621
|
+
/* @__PURE__ */ t("div", { className: h.chipRow, children: ci.map((e) => /* @__PURE__ */ i(
|
|
2622
|
+
"button",
|
|
2623
|
+
{
|
|
2624
|
+
type: "button",
|
|
2625
|
+
className: h.capChip,
|
|
2626
|
+
onClick: () => {
|
|
2627
|
+
var n;
|
|
2628
|
+
if (e.action === "tools") {
|
|
2629
|
+
te("tools");
|
|
2630
|
+
return;
|
|
2631
|
+
}
|
|
2632
|
+
if (e.action === "webide") {
|
|
2633
|
+
te("webide");
|
|
2634
|
+
return;
|
|
2635
|
+
}
|
|
2636
|
+
if (e.action === "ask") {
|
|
2637
|
+
it();
|
|
2638
|
+
return;
|
|
2639
|
+
}
|
|
2640
|
+
Z(e.prompt ?? ""), (n = de.current) == null || n.focus();
|
|
2641
|
+
},
|
|
2642
|
+
children: [
|
|
2643
|
+
/* @__PURE__ */ t("span", { className: h.capChipIcon, children: e.icon }),
|
|
2644
|
+
/* @__PURE__ */ t("span", { children: e.label })
|
|
2645
|
+
]
|
|
2646
|
+
},
|
|
2647
|
+
e.key
|
|
2648
|
+
)) }),
|
|
2649
|
+
/* @__PURE__ */ t("div", { className: h.chipRow, children: ii.map((e) => /* @__PURE__ */ t(
|
|
2650
|
+
"button",
|
|
2651
|
+
{
|
|
2652
|
+
type: "button",
|
|
2653
|
+
className: h.suggestChip,
|
|
2654
|
+
onClick: () => {
|
|
2655
|
+
var n;
|
|
2656
|
+
Z(e), (n = de.current) == null || n.focus();
|
|
2657
|
+
},
|
|
2658
|
+
children: e
|
|
2659
|
+
},
|
|
2660
|
+
e
|
|
2661
|
+
)) })
|
|
2662
|
+
] }) }), /* @__PURE__ */ i("div", { className: h.shell, children: [
|
|
2663
|
+
/* @__PURE__ */ i("aside", { className: h.sidebar, "aria-label": "个人专享工作台导航", children: [
|
|
2664
|
+
/* @__PURE__ */ i("div", { className: h.sideContent, children: [
|
|
2665
|
+
/* @__PURE__ */ t(
|
|
2666
|
+
Gn,
|
|
2667
|
+
{
|
|
2668
|
+
currentUser: k,
|
|
2669
|
+
token: _,
|
|
2670
|
+
isDesktop: Q,
|
|
2671
|
+
activeNav: R === "schedule" ? "schedule" : R === "history" ? "history" : null,
|
|
2672
|
+
extensionsGroupActive: [
|
|
2673
|
+
"extensions",
|
|
2674
|
+
"agentDetail",
|
|
2675
|
+
"personalTab",
|
|
2676
|
+
"workbenchShell"
|
|
2677
|
+
].includes(R),
|
|
2678
|
+
activePersonalTab: R === "personalTab" ? se : null,
|
|
2679
|
+
onDesktopNewTask: Q && K ? Ve : void 0,
|
|
2680
|
+
onPickSpace: (e) => {
|
|
2681
|
+
v(e), lt();
|
|
2682
|
+
},
|
|
2683
|
+
currentSpaceId: (l == null ? void 0 : l.id) ?? null,
|
|
2684
|
+
onOpenSchedule: () => A("schedule"),
|
|
2685
|
+
onOpenExtensions: () => A("extensions"),
|
|
2686
|
+
onOpenHistory: () => A("history"),
|
|
2687
|
+
onOpenSearch: () => {
|
|
2688
|
+
ge(!0), Ue.getState().loadProjects();
|
|
2689
|
+
},
|
|
2690
|
+
searchActive: H,
|
|
2691
|
+
onOpenPersonalTab: te,
|
|
2692
|
+
onOpenWorkbenchShell: () => A("workbenchShell"),
|
|
2693
|
+
onCloudNav: Q ? ht : void 0,
|
|
2694
|
+
cloudNavActive: R === "chat" && !!N
|
|
2695
|
+
}
|
|
2696
|
+
),
|
|
2697
|
+
/* @__PURE__ */ i("div", { className: h.sideTasks, children: [
|
|
2698
|
+
Q && /* @__PURE__ */ i(
|
|
2699
|
+
"div",
|
|
2700
|
+
{
|
|
2701
|
+
className: h.segToggle,
|
|
2702
|
+
role: "tablist",
|
|
2703
|
+
"aria-label": "任务范围切换",
|
|
2704
|
+
children: [
|
|
2705
|
+
/* @__PURE__ */ t(
|
|
2706
|
+
"button",
|
|
2707
|
+
{
|
|
2708
|
+
type: "button",
|
|
2709
|
+
role: "tab",
|
|
2710
|
+
"aria-selected": F === "local",
|
|
2711
|
+
className: `${h.segBtn} ${F === "local" ? h.segBtnActive : ""}`,
|
|
2712
|
+
onClick: () => he("local"),
|
|
2713
|
+
children: "本地"
|
|
2714
|
+
}
|
|
2715
|
+
),
|
|
2716
|
+
/* @__PURE__ */ t(
|
|
2717
|
+
"button",
|
|
2718
|
+
{
|
|
2719
|
+
type: "button",
|
|
2720
|
+
role: "tab",
|
|
2721
|
+
"aria-selected": F === "cloud",
|
|
2722
|
+
className: `${h.segBtn} ${F === "cloud" ? h.segBtnActive : ""}`,
|
|
2723
|
+
onClick: () => he("cloud"),
|
|
2724
|
+
children: "云端"
|
|
2725
|
+
}
|
|
2726
|
+
)
|
|
2727
|
+
]
|
|
2728
|
+
}
|
|
2729
|
+
),
|
|
2730
|
+
Q && F === "local" ? /* @__PURE__ */ i(xe, { children: [
|
|
2731
|
+
/* @__PURE__ */ t("div", { className: h.tasksLabel, children: "本地任务" }),
|
|
2732
|
+
W.map((e) => /* @__PURE__ */ t(
|
|
2733
|
+
"button",
|
|
2734
|
+
{
|
|
2735
|
+
type: "button",
|
|
2736
|
+
className: `${h.recentItem} ${_e === e.id ? h.recentItemActive : ""}`,
|
|
2737
|
+
title: e.title,
|
|
2738
|
+
onClick: () => pt(e.id),
|
|
2739
|
+
children: /* @__PURE__ */ t("span", { className: h.recentItemText, children: e.title || "未命名会话" })
|
|
2740
|
+
},
|
|
2741
|
+
e.id
|
|
2742
|
+
)),
|
|
2743
|
+
W.length === 0 && /* @__PURE__ */ t("div", { className: h.tasksEmpty, children: oe ? "暂无本地任务,点上方新建任务开始" : "本机 Agent 未运行" })
|
|
2744
|
+
] }) : /* @__PURE__ */ i(xe, { children: [
|
|
2745
|
+
/* @__PURE__ */ t("div", { className: h.tasksLabel, children: "项目" }),
|
|
2746
|
+
Pe.length === 0 && !q && /* @__PURE__ */ t("div", { className: h.tasksEmpty, children: "还没有项目空间或云端任务" }),
|
|
2747
|
+
Pe.map((e) => {
|
|
2748
|
+
const n = ye.has(e.key);
|
|
2749
|
+
return /* @__PURE__ */ i("div", { children: [
|
|
2750
|
+
/* @__PURE__ */ i(
|
|
2751
|
+
"button",
|
|
2752
|
+
{
|
|
2753
|
+
type: "button",
|
|
2754
|
+
className: h.projFolder,
|
|
2755
|
+
"aria-expanded": n,
|
|
2756
|
+
onClick: () => ce((a) => {
|
|
2757
|
+
const p = new Set(a);
|
|
2758
|
+
return p.has(e.key) ? p.delete(e.key) : p.add(e.key), p;
|
|
2759
|
+
}),
|
|
2760
|
+
children: [
|
|
2761
|
+
/* @__PURE__ */ t(
|
|
2762
|
+
ft,
|
|
2763
|
+
{
|
|
2764
|
+
className: `${h.projCaret} ${n ? h.projCaretOpen : ""}`
|
|
2765
|
+
}
|
|
2766
|
+
),
|
|
2767
|
+
/* @__PURE__ */ t(yt, { className: h.projIcon }),
|
|
2768
|
+
/* @__PURE__ */ t("span", { className: h.projName, title: e.title, children: e.title }),
|
|
2769
|
+
/* @__PURE__ */ t("span", { className: h.projMeta, children: e.sessions.length > 0 ? e.sessions.length : "暂无任务" })
|
|
2770
|
+
]
|
|
2771
|
+
}
|
|
2772
|
+
),
|
|
2773
|
+
n && e.sessions.length > 0 && /* @__PURE__ */ t("div", { className: h.projRows, children: e.sessions.map((a) => {
|
|
2774
|
+
const p = at.get(a.personalAgentId);
|
|
2775
|
+
return /* @__PURE__ */ t(
|
|
2776
|
+
"button",
|
|
2777
|
+
{
|
|
2778
|
+
type: "button",
|
|
2779
|
+
className: `${h.recentItem} ${(N == null ? void 0 : N.sessionId) === a.id ? h.recentItemActive : ""}`,
|
|
2780
|
+
disabled: !p,
|
|
2781
|
+
title: p ? a.title || "未命名会话" : "伙伴已不存在,无法打开",
|
|
2782
|
+
onClick: () => p && pe(p, a.id),
|
|
2783
|
+
children: /* @__PURE__ */ t("span", { className: h.recentItemText, children: a.title || "未命名会话" })
|
|
2784
|
+
},
|
|
2785
|
+
a.id
|
|
2786
|
+
);
|
|
2787
|
+
}) })
|
|
2788
|
+
] }, e.key);
|
|
2789
|
+
})
|
|
2790
|
+
] })
|
|
2791
|
+
] })
|
|
2792
|
+
] }),
|
|
2793
|
+
/* @__PURE__ */ t(
|
|
2794
|
+
zn,
|
|
2795
|
+
{
|
|
2796
|
+
displayName: Ge,
|
|
2797
|
+
subtitle: "Z-Team · 个人(专享)",
|
|
2798
|
+
onOpenSettings: () => He(!0),
|
|
2799
|
+
children: gt.map((e) => /* @__PURE__ */ i(
|
|
2800
|
+
"button",
|
|
2801
|
+
{
|
|
2802
|
+
type: "button",
|
|
2803
|
+
role: "menuitem",
|
|
2804
|
+
className: h.agentMenuItem,
|
|
2805
|
+
onClick: () => s == null ? void 0 : s(e.mode),
|
|
2806
|
+
children: [
|
|
2807
|
+
/* @__PURE__ */ t("span", { className: h.navIcon, children: e.icon }),
|
|
2808
|
+
/* @__PURE__ */ t("span", { children: e.label })
|
|
2809
|
+
]
|
|
2810
|
+
},
|
|
2811
|
+
e.mode
|
|
2812
|
+
))
|
|
2813
|
+
}
|
|
2814
|
+
)
|
|
2815
|
+
] }),
|
|
2816
|
+
/* @__PURE__ */ t("main", { className: h.main, "aria-label": "个人专享工作台内容", children: x && !N && !K ? /* @__PURE__ */ t("div", { className: h.emptyState, children: /* @__PURE__ */ t("span", { className: h.emptyTitle, children: "正在加载智能伙伴…" }) }) : le }),
|
|
2817
|
+
/* @__PURE__ */ t(
|
|
2818
|
+
qn,
|
|
2819
|
+
{
|
|
2820
|
+
open: ne,
|
|
2821
|
+
onClose: () => He(!1),
|
|
2822
|
+
token: _
|
|
2823
|
+
}
|
|
2824
|
+
),
|
|
2825
|
+
H && /* @__PURE__ */ t(
|
|
2826
|
+
Qn,
|
|
2827
|
+
{
|
|
2828
|
+
sessions: S,
|
|
2829
|
+
agentsById: at,
|
|
2830
|
+
projects: T,
|
|
2831
|
+
token: _,
|
|
2832
|
+
onOpenSession: (e, n) => pe(e, n),
|
|
2833
|
+
onOpenProject: (e) => Be(e.id),
|
|
2834
|
+
onClose: () => ge(!1)
|
|
2835
|
+
}
|
|
2836
|
+
)
|
|
2837
|
+
] });
|
|
2838
|
+
}
|
|
2839
|
+
export {
|
|
2840
|
+
Ti as default
|
|
2841
|
+
};
|