@yuku123/z-team-component 0.2.80 → 0.2.81
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-_bRZ55Yi.js +542 -0
- package/dist/ComponentDoc-BWciPDcn.js +3998 -0
- package/dist/InvitationManagementPage-X9t4igh7.js +495 -0
- package/dist/OnboardingPage-D2sVawTW.js +393 -0
- package/dist/ScheduledTasks-CdCX5FlH.js +9407 -0
- package/dist/SystemShell-Bd0UpmAs.js +689 -0
- package/dist/_commonjsHelpers-B52_cu2H.js +26 -0
- package/dist/api-BKjWEmUY.js +20 -0
- package/dist/api-CIhVblfa.js +2155 -0
- package/dist/browser-jb_PFvU3.js +1538 -0
- package/dist/createWorkspaceWsHandler-BWP5S5X3.js +12951 -0
- package/dist/ctc-sso-DtJHC-2M.js +117 -0
- package/dist/echarts-B1OU1xr4.js +16 -0
- package/dist/history-BlrA1eaW.js +41 -0
- package/dist/index-B_LJRFsK.js +339 -0
- package/dist/index-BgIheStI.js +133 -0
- package/dist/index-Bn6u-XqL.js +242 -0
- package/dist/index-BohoJQPr.js +7631 -0
- package/dist/index-BydWNuk5.js +1229 -0
- package/dist/index-C815hPWS.js +430 -0
- package/dist/index-CPXlkVYF.js +118 -0
- package/dist/index-CUVdeb8y.js +638 -0
- package/dist/index-CdsD23Cm.js +914 -0
- package/dist/index-CijskN6t.js +316 -0
- package/dist/index-CkhoaNnF.js +137 -0
- package/dist/index-Cvx6rrxD.js +956 -0
- package/dist/index-Cwr5Slv1.js +480 -0
- package/dist/index-CxFAICql.js +42050 -0
- package/dist/index-D6i_zovv.js +574 -0
- package/dist/index-D8aigFpH.js +9583 -0
- package/dist/index-DK70mOTz.js +143 -0
- package/dist/index-DSoOHdTf.js +178 -0
- package/dist/index-DT80Pwa_.js +5893 -0
- package/dist/index-DWsfQMp8.js +208 -0
- package/dist/index-DZoJnRKu.js +112 -0
- package/dist/index-DhDdFRHC.js +279 -0
- package/dist/index-DimSOV0E.js +1143 -0
- package/dist/index-Dm3wmB0K.js +435 -0
- package/dist/index-DsP2ysav.js +93 -0
- package/dist/index-Dwm0j8qF.js +2936 -0
- package/dist/index-DzS6-D3M.js +1640 -0
- package/dist/index-RVaaSElI.js +2700 -0
- package/dist/index-cdB5K3gx.js +814 -0
- package/dist/index-nU-V276i.js +170 -0
- package/dist/index-uF04Ucsi.js +8 -0
- package/dist/index.js +10 -0
- package/dist/index.module-CAa-2T7m.js +72 -0
- package/dist/index.module-UI0iz8K0.js +42 -0
- package/dist/{menuPermission-D9NGpBZP.js → menuPermission-Uzk46Gto.js} +1 -1
- package/dist/pages.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { jsxs as m, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { message as T } from "antd";
|
|
3
|
+
import { useState as b, useRef as D, useCallback as K, useEffect as J } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
const X = "/z-team", Y = typeof window < "u" && window.ZTEAM_USE_KAPI === !0, Z = Y, G = window.ENV_TYPE || window.envType || "", x = `${Z ? "/kapi" : ""}${X}/api/chatdemo`, Q = G || "local", $ = {
|
|
6
|
+
Accept: "application/json",
|
|
7
|
+
"project-env": Q
|
|
8
|
+
};
|
|
9
|
+
async function U(e, a) {
|
|
10
|
+
const s = await e.text().catch(() => "");
|
|
11
|
+
let i = {};
|
|
12
|
+
if (s)
|
|
13
|
+
try {
|
|
14
|
+
i = JSON.parse(s);
|
|
15
|
+
} catch {
|
|
16
|
+
if (!e.ok) throw new Error(a);
|
|
17
|
+
return s;
|
|
18
|
+
}
|
|
19
|
+
if (typeof i.success == "boolean") {
|
|
20
|
+
if (i.success)
|
|
21
|
+
return i.data !== void 0 ? i.data : !0;
|
|
22
|
+
throw new Error(i.message || a);
|
|
23
|
+
}
|
|
24
|
+
if (!e.ok) throw new Error(a);
|
|
25
|
+
return i;
|
|
26
|
+
}
|
|
27
|
+
async function tt(e) {
|
|
28
|
+
const a = e != null && e.trim() ? `?model=${encodeURIComponent(e.trim())}` : "", s = await fetch(`${x}/sessions${a}`, {
|
|
29
|
+
method: "POST",
|
|
30
|
+
credentials: "include",
|
|
31
|
+
headers: $
|
|
32
|
+
});
|
|
33
|
+
return U(s, "创建会话失败");
|
|
34
|
+
}
|
|
35
|
+
async function et(e) {
|
|
36
|
+
const a = await fetch(`${x}/sessions/${encodeURIComponent(e)}`, {
|
|
37
|
+
credentials: "include",
|
|
38
|
+
headers: $
|
|
39
|
+
});
|
|
40
|
+
return U(a, "加载会话失败");
|
|
41
|
+
}
|
|
42
|
+
async function nt(e, a, s) {
|
|
43
|
+
const i = await fetch(
|
|
44
|
+
`${x}/sessions/${encodeURIComponent(e)}/chat`,
|
|
45
|
+
{
|
|
46
|
+
method: "POST",
|
|
47
|
+
credentials: "include",
|
|
48
|
+
headers: { Accept: "application/json", ...$, "Content-Type": "application/json" },
|
|
49
|
+
body: JSON.stringify({
|
|
50
|
+
message: a,
|
|
51
|
+
...s != null && s.trim() ? { model: s.trim() } : {}
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
return U(i, "发送失败");
|
|
56
|
+
}
|
|
57
|
+
function st(e, a) {
|
|
58
|
+
const s = e.split(`
|
|
59
|
+
|
|
60
|
+
`), i = s.pop() ?? "";
|
|
61
|
+
for (const g of s) {
|
|
62
|
+
let u = "";
|
|
63
|
+
for (const _ of g.split(`
|
|
64
|
+
`))
|
|
65
|
+
_.startsWith("data:") && (u += _.slice(5).trim());
|
|
66
|
+
if (!(!u || u === "[DONE]"))
|
|
67
|
+
try {
|
|
68
|
+
a(JSON.parse(u));
|
|
69
|
+
} catch {
|
|
70
|
+
a({ type: "token", data: u });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return i;
|
|
74
|
+
}
|
|
75
|
+
async function ot(e, a, s, i) {
|
|
76
|
+
var N, p;
|
|
77
|
+
const g = await fetch(
|
|
78
|
+
`${x}/sessions/${encodeURIComponent(e)}/chat/stream`,
|
|
79
|
+
{
|
|
80
|
+
method: "POST",
|
|
81
|
+
credentials: "include",
|
|
82
|
+
headers: {
|
|
83
|
+
...$,
|
|
84
|
+
"Content-Type": "application/json",
|
|
85
|
+
Accept: "text/event-stream"
|
|
86
|
+
},
|
|
87
|
+
body: JSON.stringify({
|
|
88
|
+
message: a,
|
|
89
|
+
...i != null && i.trim() ? { model: i.trim() } : {}
|
|
90
|
+
}),
|
|
91
|
+
signal: s.signal
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
if (!g.ok || !g.body)
|
|
95
|
+
throw new Error(`流式请求失败 HTTP ${g.status}`);
|
|
96
|
+
const u = g.body.getReader(), _ = new TextDecoder();
|
|
97
|
+
let h = "";
|
|
98
|
+
try {
|
|
99
|
+
for (; ; ) {
|
|
100
|
+
const { done: f, value: w } = await u.read();
|
|
101
|
+
if (f) break;
|
|
102
|
+
h += _.decode(w, { stream: !0 }), h = st(h, s.onEvent);
|
|
103
|
+
}
|
|
104
|
+
} catch (f) {
|
|
105
|
+
if ((N = s.signal) != null && N.aborted) return;
|
|
106
|
+
throw (p = s.onError) == null || p.call(s, f instanceof Error ? f : new Error(String(f))), f;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const at = "_page_1u2ag_1", rt = "_header_1u2ag_9", ct = "_title_1u2ag_16", it = "_sub_1u2ag_22", lt = "_toolbar_1u2ag_29", ut = "_modelInput_1u2ag_37", dt = "_btn_1u2ag_47", gt = "_btnSecondary_1u2ag_57", pt = "_status_1u2ag_72", mt = "_panel_1u2ag_79", ft = "_messages_1u2ag_91", _t = "_empty_1u2ag_100", ht = "_msgOwn_1u2ag_107", yt = "_msgOwnBubble_1u2ag_112", bt = "_msgAgent_1u2ag_123", wt = "_avatar_1u2ag_129", vt = "_msgAgentBody_1u2ag_141", St = "_msgMeta_1u2ag_145", Nt = "_reasoning_1u2ag_151", At = "_msgAgentBubble_1u2ag_162", kt = "_toolHint_1u2ag_184", Et = "_inputArea_1u2ag_190", Ct = "_textarea_1u2ag_197", Tt = "_inputActions_1u2ag_215", xt = "_tokenUsage_1u2ag_222", o = {
|
|
110
|
+
page: at,
|
|
111
|
+
header: rt,
|
|
112
|
+
title: ct,
|
|
113
|
+
sub: it,
|
|
114
|
+
toolbar: lt,
|
|
115
|
+
modelInput: ut,
|
|
116
|
+
btn: dt,
|
|
117
|
+
btnSecondary: gt,
|
|
118
|
+
status: pt,
|
|
119
|
+
panel: mt,
|
|
120
|
+
messages: ft,
|
|
121
|
+
empty: _t,
|
|
122
|
+
msgOwn: ht,
|
|
123
|
+
msgOwnBubble: yt,
|
|
124
|
+
msgAgent: bt,
|
|
125
|
+
avatar: wt,
|
|
126
|
+
msgAgentBody: vt,
|
|
127
|
+
msgMeta: St,
|
|
128
|
+
reasoning: Nt,
|
|
129
|
+
msgAgentBubble: At,
|
|
130
|
+
toolHint: kt,
|
|
131
|
+
inputArea: Et,
|
|
132
|
+
textarea: Ct,
|
|
133
|
+
inputActions: Tt,
|
|
134
|
+
tokenUsage: xt
|
|
135
|
+
};
|
|
136
|
+
function $t(e, a, s) {
|
|
137
|
+
if (!s)
|
|
138
|
+
return { parts: e, lastKind: a };
|
|
139
|
+
if (a === "tool")
|
|
140
|
+
return {
|
|
141
|
+
parts: [...e, { kind: "tool", hint: s }],
|
|
142
|
+
lastKind: "tool"
|
|
143
|
+
};
|
|
144
|
+
const i = a === "thought" ? "reasoning" : "text", g = e[e.length - 1];
|
|
145
|
+
if (g && g.kind === i) {
|
|
146
|
+
const u = e.slice(0, -1);
|
|
147
|
+
return u.push({
|
|
148
|
+
kind: i,
|
|
149
|
+
content: g.content + s
|
|
150
|
+
}), { parts: u, lastKind: a };
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
parts: [...e, { kind: i, content: s }],
|
|
154
|
+
lastKind: a
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function L(e) {
|
|
158
|
+
const a = (e == null ? void 0 : e.trim()) ?? "";
|
|
159
|
+
return a ? [{ kind: "text", content: a }] : [];
|
|
160
|
+
}
|
|
161
|
+
const Ot = "deepseek-v4-flash";
|
|
162
|
+
function S() {
|
|
163
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
164
|
+
}
|
|
165
|
+
function Bt(e, a) {
|
|
166
|
+
return { id: e, role: "assistant", parts: [], streaming: a };
|
|
167
|
+
}
|
|
168
|
+
function Mt() {
|
|
169
|
+
const [e, a] = b(""), [s, i] = b(Ot), [g, u] = b([]), [_, h] = b(""), [N, p] = b(""), [f, w] = b(!1), [A, j] = b(!1), k = D(null), I = D(null), E = D(
|
|
170
|
+
/* @__PURE__ */ new Map()
|
|
171
|
+
), M = K(() => {
|
|
172
|
+
var t;
|
|
173
|
+
(t = I.current) == null || t.scrollIntoView({ behavior: "smooth" });
|
|
174
|
+
}, []);
|
|
175
|
+
J(() => {
|
|
176
|
+
M();
|
|
177
|
+
}, [g, M]);
|
|
178
|
+
const P = (t) => {
|
|
179
|
+
u(
|
|
180
|
+
t.map(
|
|
181
|
+
(n) => n.role === "user" ? { id: S(), role: "user", content: n.content || "" } : {
|
|
182
|
+
id: S(),
|
|
183
|
+
role: "assistant",
|
|
184
|
+
parts: L(n.content || "")
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
);
|
|
188
|
+
}, R = K(async () => {
|
|
189
|
+
w(!0), p("创建会话…");
|
|
190
|
+
try {
|
|
191
|
+
const t = await tt(s);
|
|
192
|
+
a(t.sessionId), P(t.messages || []), p("");
|
|
193
|
+
} catch (t) {
|
|
194
|
+
const n = t instanceof Error ? t.message : "创建失败";
|
|
195
|
+
p(n), T.error(n);
|
|
196
|
+
} finally {
|
|
197
|
+
w(!1);
|
|
198
|
+
}
|
|
199
|
+
}, [s]);
|
|
200
|
+
J(() => {
|
|
201
|
+
R();
|
|
202
|
+
}, []);
|
|
203
|
+
const V = async () => {
|
|
204
|
+
if (e) {
|
|
205
|
+
p("刷新中…");
|
|
206
|
+
try {
|
|
207
|
+
const t = await et(e);
|
|
208
|
+
P(t.messages || []), p("");
|
|
209
|
+
} catch (t) {
|
|
210
|
+
T.error(t instanceof Error ? t.message : "刷新失败");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}, F = () => {
|
|
214
|
+
const t = S();
|
|
215
|
+
return E.current.set(t, null), u((n) => [...n, Bt(t, !0)]), t;
|
|
216
|
+
}, O = (t, n) => {
|
|
217
|
+
u(
|
|
218
|
+
(l) => l.map(
|
|
219
|
+
(r) => r.id === t && r.role === "assistant" ? { ...r, ...n } : r
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
}, v = (t, n, l) => {
|
|
223
|
+
u(
|
|
224
|
+
(r) => r.map((c) => {
|
|
225
|
+
if (c.id !== t || c.role !== "assistant")
|
|
226
|
+
return c;
|
|
227
|
+
const { parts: y, lastKind: B } = $t(
|
|
228
|
+
c.parts,
|
|
229
|
+
n,
|
|
230
|
+
l
|
|
231
|
+
);
|
|
232
|
+
return E.current.set(t, B), { ...c, parts: y };
|
|
233
|
+
})
|
|
234
|
+
);
|
|
235
|
+
}, W = (t, n) => {
|
|
236
|
+
const l = n.type, r = n.data;
|
|
237
|
+
if (l === "token" && typeof r == "string")
|
|
238
|
+
v(t, "token", r);
|
|
239
|
+
else if (l === "thought" && typeof r == "string")
|
|
240
|
+
v(t, "thought", r);
|
|
241
|
+
else if (l === "tool_call" && r && typeof r == "object") {
|
|
242
|
+
const c = String(r.tool ?? "tool");
|
|
243
|
+
v(t, "tool", `🔧 ${c} …`);
|
|
244
|
+
} else if (l === "tool_result" && r && typeof r == "object") {
|
|
245
|
+
const c = r, y = String(c.tool ?? ""), B = String(c.result ?? "").slice(0, 120), z = !!c.error;
|
|
246
|
+
v(
|
|
247
|
+
t,
|
|
248
|
+
"tool",
|
|
249
|
+
`${z ? "✗" : "✓"} ${y}: ${B}`
|
|
250
|
+
);
|
|
251
|
+
} else if (l === "error")
|
|
252
|
+
v(t, "token", `
|
|
253
|
+
[错误] ${typeof r == "string" ? r : "error"}`);
|
|
254
|
+
else if (l === "done") {
|
|
255
|
+
E.current.delete(t);
|
|
256
|
+
const c = r && typeof r == "object" ? r.tokenUsage : void 0;
|
|
257
|
+
O(t, {
|
|
258
|
+
streaming: !1,
|
|
259
|
+
...c && typeof c == "object" ? { tokenUsage: c } : {}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}, H = async () => {
|
|
263
|
+
var l, r;
|
|
264
|
+
const t = _.trim();
|
|
265
|
+
if (!t || !e || A) return;
|
|
266
|
+
h(""), u((c) => [
|
|
267
|
+
...c,
|
|
268
|
+
{ id: S(), role: "user", content: t }
|
|
269
|
+
]);
|
|
270
|
+
const n = F();
|
|
271
|
+
j(!0), p("生成中…"), (l = k.current) == null || l.abort(), k.current = new AbortController();
|
|
272
|
+
try {
|
|
273
|
+
await ot(
|
|
274
|
+
e,
|
|
275
|
+
t,
|
|
276
|
+
{
|
|
277
|
+
signal: k.current.signal,
|
|
278
|
+
onEvent: (c) => W(n, c)
|
|
279
|
+
},
|
|
280
|
+
s
|
|
281
|
+
), O(n, { streaming: !1 }), E.current.delete(n), p("");
|
|
282
|
+
} catch (c) {
|
|
283
|
+
if (!((r = k.current) != null && r.signal.aborted)) {
|
|
284
|
+
const y = c instanceof Error ? c.message : "流式失败";
|
|
285
|
+
T.error(y), v(n, "token", `[失败] ${y}`), O(n, { streaming: !1 }), p(y);
|
|
286
|
+
}
|
|
287
|
+
} finally {
|
|
288
|
+
j(!1);
|
|
289
|
+
}
|
|
290
|
+
}, q = async () => {
|
|
291
|
+
const t = _.trim();
|
|
292
|
+
if (!(!t || !e || A)) {
|
|
293
|
+
h(""), u((n) => [
|
|
294
|
+
...n,
|
|
295
|
+
{ id: S(), role: "user", content: t }
|
|
296
|
+
]), w(!0), p("同步请求中…");
|
|
297
|
+
try {
|
|
298
|
+
const n = await nt(e, t, s);
|
|
299
|
+
u((l) => [
|
|
300
|
+
...l,
|
|
301
|
+
{
|
|
302
|
+
id: S(),
|
|
303
|
+
role: "assistant",
|
|
304
|
+
parts: L(n.reply || "")
|
|
305
|
+
}
|
|
306
|
+
]), p("");
|
|
307
|
+
} catch (n) {
|
|
308
|
+
T.error(n instanceof Error ? n.message : "发送失败");
|
|
309
|
+
} finally {
|
|
310
|
+
w(!1);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}, C = !e || f || A;
|
|
314
|
+
return /* @__PURE__ */ m("div", { className: o.page, children: [
|
|
315
|
+
/* @__PURE__ */ m("div", { className: o.header, children: [
|
|
316
|
+
/* @__PURE__ */ d("div", { className: o.title, children: "AINative Chat Demo" }),
|
|
317
|
+
/* @__PURE__ */ d("div", { className: o.sub, children: e ? `Session: ${e} · SSE(非 WebSocket)` : "正在初始化…" }),
|
|
318
|
+
/* @__PURE__ */ m("div", { className: o.toolbar, children: [
|
|
319
|
+
/* @__PURE__ */ d(
|
|
320
|
+
"input",
|
|
321
|
+
{
|
|
322
|
+
className: o.modelInput,
|
|
323
|
+
placeholder: "model / llmCode(可选)",
|
|
324
|
+
value: s,
|
|
325
|
+
onChange: (t) => i(t.target.value)
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
/* @__PURE__ */ d(
|
|
329
|
+
"button",
|
|
330
|
+
{
|
|
331
|
+
type: "button",
|
|
332
|
+
className: o.btnSecondary,
|
|
333
|
+
onClick: R,
|
|
334
|
+
disabled: f || A,
|
|
335
|
+
children: "新会话"
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
/* @__PURE__ */ d(
|
|
339
|
+
"button",
|
|
340
|
+
{
|
|
341
|
+
type: "button",
|
|
342
|
+
className: o.btnSecondary,
|
|
343
|
+
onClick: V,
|
|
344
|
+
disabled: C,
|
|
345
|
+
children: "刷新历史"
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
] })
|
|
349
|
+
] }),
|
|
350
|
+
N ? /* @__PURE__ */ d("div", { className: o.status, children: N }) : null,
|
|
351
|
+
/* @__PURE__ */ m("div", { className: o.panel, children: [
|
|
352
|
+
/* @__PURE__ */ m("div", { className: o.messages, children: [
|
|
353
|
+
g.length === 0 ? /* @__PURE__ */ d("div", { className: o.empty, children: "发送消息开始对话" }) : null,
|
|
354
|
+
g.map(
|
|
355
|
+
(t) => t.role === "user" ? /* @__PURE__ */ d("div", { className: o.msgOwn, children: /* @__PURE__ */ d("div", { className: o.msgOwnBubble, children: t.content }) }, t.id) : t.role === "assistant" ? /* @__PURE__ */ m("div", { className: o.msgAgent, children: [
|
|
356
|
+
/* @__PURE__ */ d("div", { className: o.avatar, children: "🤖" }),
|
|
357
|
+
/* @__PURE__ */ m("div", { className: o.msgAgentBody, children: [
|
|
358
|
+
/* @__PURE__ */ m("div", { className: o.msgMeta, children: [
|
|
359
|
+
"Assistant",
|
|
360
|
+
t.streaming ? " · 生成中" : ""
|
|
361
|
+
] }),
|
|
362
|
+
t.parts.length === 0 && t.streaming ? /* @__PURE__ */ d("div", { className: o.msgAgentBubble, children: "…" }) : null,
|
|
363
|
+
t.parts.map((n, l) => {
|
|
364
|
+
const c = l === t.parts.length - 1 && t.streaming ? "…" : "";
|
|
365
|
+
return n.kind === "reasoning" ? /* @__PURE__ */ m("div", { className: o.reasoning, children: [
|
|
366
|
+
n.content,
|
|
367
|
+
c
|
|
368
|
+
] }, l) : n.kind === "text" ? /* @__PURE__ */ m("div", { className: o.msgAgentBubble, children: [
|
|
369
|
+
n.content,
|
|
370
|
+
c
|
|
371
|
+
] }, l) : /* @__PURE__ */ d("div", { className: o.toolHint, children: n.hint }, l);
|
|
372
|
+
}),
|
|
373
|
+
t.tokenUsage && !t.streaming ? /* @__PURE__ */ m("div", { className: o.tokenUsage, children: [
|
|
374
|
+
"Token in ",
|
|
375
|
+
t.tokenUsage.inputTokenCount ?? 0,
|
|
376
|
+
" / out",
|
|
377
|
+
" ",
|
|
378
|
+
t.tokenUsage.outputTokenCount ?? 0,
|
|
379
|
+
" / total",
|
|
380
|
+
" ",
|
|
381
|
+
t.tokenUsage.totalTokenCount ?? 0
|
|
382
|
+
] }) : null
|
|
383
|
+
] })
|
|
384
|
+
] }, t.id) : null
|
|
385
|
+
),
|
|
386
|
+
/* @__PURE__ */ d("div", { ref: I })
|
|
387
|
+
] }),
|
|
388
|
+
/* @__PURE__ */ m("div", { className: o.inputArea, children: [
|
|
389
|
+
/* @__PURE__ */ d(
|
|
390
|
+
"textarea",
|
|
391
|
+
{
|
|
392
|
+
className: o.textarea,
|
|
393
|
+
placeholder: "输入消息,Enter 发送(Shift+Enter 换行)",
|
|
394
|
+
value: _,
|
|
395
|
+
disabled: C,
|
|
396
|
+
onChange: (t) => h(t.target.value),
|
|
397
|
+
onKeyDown: (t) => {
|
|
398
|
+
t.key === "Enter" && !t.shiftKey && (t.preventDefault(), H());
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ m("div", { className: o.inputActions, children: [
|
|
403
|
+
/* @__PURE__ */ d(
|
|
404
|
+
"button",
|
|
405
|
+
{
|
|
406
|
+
type: "button",
|
|
407
|
+
className: o.btnSecondary,
|
|
408
|
+
disabled: C,
|
|
409
|
+
onClick: q,
|
|
410
|
+
children: "同步"
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
/* @__PURE__ */ d(
|
|
414
|
+
"button",
|
|
415
|
+
{
|
|
416
|
+
type: "button",
|
|
417
|
+
className: o.btn,
|
|
418
|
+
disabled: C,
|
|
419
|
+
onClick: H,
|
|
420
|
+
children: "发送(SSE)"
|
|
421
|
+
}
|
|
422
|
+
)
|
|
423
|
+
] })
|
|
424
|
+
] })
|
|
425
|
+
] })
|
|
426
|
+
] });
|
|
427
|
+
}
|
|
428
|
+
export {
|
|
429
|
+
Mt as default
|
|
430
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useMemo as d } from "react";
|
|
3
|
+
import { useNavigate as G, useLocation as k } from "react-router-dom";
|
|
4
|
+
import { CodeOutlined as L, DownOutlined as N, RightOutlined as O, AppstoreOutlined as v, TableOutlined as A, DatabaseOutlined as w, RobotOutlined as H, FunctionOutlined as M, ApartmentOutlined as W, EyeOutlined as C, BranchesOutlined as $, DeploymentUnitOutlined as p, SafetyCertificateOutlined as g } from "@ant-design/icons";
|
|
5
|
+
import R from "@yuku123/z-lc-component";
|
|
6
|
+
import { f as U, M as x } from "./menuPermission-Uzk46Gto.js";
|
|
7
|
+
import { u as b } from "./useAppStore-BBr_Fwsz.js";
|
|
8
|
+
const D = "_shell_1n5c7_7", E = "_sidebar_1n5c7_15", P = "_sidebarHeader_1n5c7_26", j = "_menuList_1n5c7_37", K = "_menuGroup_1n5c7_43", T = "_menuGroupHeader_1n5c7_47", B = "_menuGroupLabel_1n5c7_65", F = "_menuGroupArrow_1n5c7_69", q = "_menuSubList_1n5c7_74", z = "_menuSubItemWrap_1n5c7_80", J = "_menuSubItem_1n5c7_80", Q = "_menuSubItemActive_1n5c7_101", V = "_menuSubItemIcon_1n5c7_108", X = "_menuSubItemLabel_1n5c7_113", Y = "_main_1n5c7_118", t = {
|
|
9
|
+
shell: D,
|
|
10
|
+
sidebar: E,
|
|
11
|
+
sidebarHeader: P,
|
|
12
|
+
menuList: j,
|
|
13
|
+
menuGroup: K,
|
|
14
|
+
menuGroupHeader: T,
|
|
15
|
+
menuGroupLabel: B,
|
|
16
|
+
menuGroupArrow: F,
|
|
17
|
+
menuSubList: q,
|
|
18
|
+
menuSubItemWrap: z,
|
|
19
|
+
menuSubItem: J,
|
|
20
|
+
menuSubItemActive: Q,
|
|
21
|
+
menuSubItemIcon: V,
|
|
22
|
+
menuSubItemLabel: X,
|
|
23
|
+
main: Y
|
|
24
|
+
}, r = [
|
|
25
|
+
{
|
|
26
|
+
title: "应用",
|
|
27
|
+
items: [
|
|
28
|
+
{ key: "apps", label: "应用列表", icon: /* @__PURE__ */ e(v, {}), path: "apps" }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: "建模",
|
|
33
|
+
items: [
|
|
34
|
+
{ key: "designer", label: "Schema 设计器", icon: /* @__PURE__ */ e(A, {}), path: "designer" },
|
|
35
|
+
{ key: "db-import", label: "从数据库导入", icon: /* @__PURE__ */ e(w, {}), path: "db-import" },
|
|
36
|
+
{ key: "admin-ai", label: "AI 建模", icon: /* @__PURE__ */ e(H, {}), path: "admin/ai" }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "配置",
|
|
41
|
+
items: [
|
|
42
|
+
{ key: "admin-dicts", label: "数据字典", icon: /* @__PURE__ */ e(M, {}), path: "admin/dicts" },
|
|
43
|
+
{ key: "admin-relations", label: "实体关系", icon: /* @__PURE__ */ e(W, {}), path: "admin/relations" },
|
|
44
|
+
{ key: "admin-views", label: "视图配置", icon: /* @__PURE__ */ e(C, {}), path: "admin/views" },
|
|
45
|
+
{ key: "admin-pipelines", label: "Pipeline", icon: /* @__PURE__ */ e($, {}), path: "admin/pipelines" },
|
|
46
|
+
{ key: "admin-workflows", label: "流程绑定", icon: /* @__PURE__ */ e(p, {}), path: "admin/workflows" }
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "运行",
|
|
51
|
+
items: [
|
|
52
|
+
{ key: "admin-permissions", label: "权限矩阵", icon: /* @__PURE__ */ e(g, {}), path: "admin/permissions", permission: "PERMISSION_MANAGE" },
|
|
53
|
+
{ key: "admin-deployments", label: "部署记录", icon: /* @__PURE__ */ e(p, {}), path: "admin/deployments" }
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
], c = "/lc";
|
|
57
|
+
function Z(l) {
|
|
58
|
+
if (!l.startsWith(c)) return null;
|
|
59
|
+
const m = l.slice(c.length).replace(/^\//, "");
|
|
60
|
+
for (const o of r)
|
|
61
|
+
for (const s of o.items)
|
|
62
|
+
if (m === s.path || m.startsWith(`${s.path}/`)) return s.key;
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
function le() {
|
|
66
|
+
const l = G(), { pathname: m } = k(), o = b((n) => n.currentUser), s = b((n) => n.permissionState), [_, h] = y(
|
|
67
|
+
new Set(r.map((n) => n.title))
|
|
68
|
+
), S = d(
|
|
69
|
+
() => s === "failed" ? r : U(r, o),
|
|
70
|
+
[o, s]
|
|
71
|
+
), I = d(() => Z(m), [m]), f = (n) => {
|
|
72
|
+
h((u) => {
|
|
73
|
+
const i = new Set(u);
|
|
74
|
+
return i.has(n) ? i.delete(n) : i.add(n), i;
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
return /* @__PURE__ */ a("div", { className: t.shell, children: [
|
|
78
|
+
/* @__PURE__ */ a("aside", { className: t.sidebar, children: [
|
|
79
|
+
/* @__PURE__ */ a("div", { className: t.sidebarHeader, children: [
|
|
80
|
+
/* @__PURE__ */ e(L, {}),
|
|
81
|
+
/* @__PURE__ */ e("span", { children: "研发工作台" })
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ e(x, {}),
|
|
84
|
+
/* @__PURE__ */ e("nav", { className: t.menuList, children: S.map((n) => {
|
|
85
|
+
const u = !_.has(n.title);
|
|
86
|
+
return /* @__PURE__ */ a("div", { className: t.menuGroup, children: [
|
|
87
|
+
/* @__PURE__ */ a(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
className: t.menuGroupHeader,
|
|
91
|
+
onClick: () => f(n.title),
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ e("span", { className: t.menuGroupLabel, children: n.title }),
|
|
94
|
+
/* @__PURE__ */ e("span", { className: t.menuGroupArrow, children: u ? /* @__PURE__ */ e(N, {}) : /* @__PURE__ */ e(O, {}) })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
u && /* @__PURE__ */ e("ul", { className: t.menuSubList, children: n.items.map((i) => /* @__PURE__ */ a(
|
|
99
|
+
"li",
|
|
100
|
+
{
|
|
101
|
+
className: `${t.menuSubItemWrap} ${t.menuSubItem} ${I === i.key ? t.menuSubItemActive : ""}`,
|
|
102
|
+
onClick: () => l(`${c}/${i.path}`),
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ e("span", { className: t.menuSubItemIcon, children: i.icon }),
|
|
105
|
+
/* @__PURE__ */ e("span", { className: t.menuSubItemLabel, children: i.label })
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
i.key
|
|
109
|
+
)) })
|
|
110
|
+
] }, n.title);
|
|
111
|
+
}) })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ e("main", { className: t.main, children: /* @__PURE__ */ e(R, {}) })
|
|
114
|
+
] });
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
le as default
|
|
118
|
+
};
|