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