@yuku123/z-team-component 0.2.78 → 0.2.80
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/{menuPermission-CO2KgDX8.js → menuPermission-D9NGpBZP.js} +1 -1
- package/dist/pages.js +1 -1
- package/dist/z-team-component.css +2 -2
- package/package.json +1 -1
- package/dist/ChangeLogView-_bRZ55Yi.js +0 -542
- package/dist/ComponentDoc-Aw4QY8oI.js +0 -3998
- package/dist/InvitationManagementPage-Bv0ys--k.js +0 -495
- package/dist/OnboardingPage-B7274ITW.js +0 -393
- package/dist/ScheduledTasks-cc8n9giN.js +0 -9406
- package/dist/SystemShell-CPGtmxXl.js +0 -689
- package/dist/_commonjsHelpers-B52_cu2H.js +0 -26
- package/dist/api-B2APc1an.js +0 -20
- package/dist/api-CIhVblfa.js +0 -2155
- package/dist/browser-jb_PFvU3.js +0 -1538
- package/dist/createWorkspaceWsHandler-BWP5S5X3.js +0 -12951
- package/dist/ctc-sso-DtJHC-2M.js +0 -117
- package/dist/echarts-B1OU1xr4.js +0 -16
- package/dist/history-BlrA1eaW.js +0 -41
- package/dist/index-51d5011I.js +0 -178
- package/dist/index-62K6U_D_.js +0 -574
- package/dist/index-ACANAhdd.js +0 -242
- package/dist/index-B_LJRFsK.js +0 -339
- package/dist/index-BgIheStI.js +0 -133
- package/dist/index-BohoJQPr.js +0 -7631
- package/dist/index-Bpi_ysgC.js +0 -914
- package/dist/index-BwyN94l7.js +0 -9567
- package/dist/index-BydWNuk5.js +0 -1229
- package/dist/index-C6FYNbSB.js +0 -118
- package/dist/index-C815hPWS.js +0 -430
- package/dist/index-CNcX0oSU.js +0 -112
- package/dist/index-CUVdeb8y.js +0 -638
- package/dist/index-CijskN6t.js +0 -316
- package/dist/index-Cvx6rrxD.js +0 -956
- package/dist/index-Cwr5Slv1.js +0 -480
- package/dist/index-CxFAICql.js +0 -42050
- package/dist/index-D2cy0jVs.js +0 -1143
- package/dist/index-DGbL_CMP.js +0 -137
- package/dist/index-DK70mOTz.js +0 -143
- package/dist/index-DT80Pwa_.js +0 -5893
- package/dist/index-DWsfQMp8.js +0 -208
- package/dist/index-DhDdFRHC.js +0 -279
- package/dist/index-Dm3wmB0K.js +0 -435
- package/dist/index-DvBDj0ul.js +0 -93
- package/dist/index-DzS6-D3M.js +0 -1640
- package/dist/index-Xn84wLNu.js +0 -2700
- package/dist/index-_9zO-72Q.js +0 -2908
- package/dist/index-cdB5K3gx.js +0 -814
- package/dist/index-nU-V276i.js +0 -170
- package/dist/index-uF04Ucsi.js +0 -8
- package/dist/index.js +0 -10
- package/dist/index.module-CAa-2T7m.js +0 -72
- package/dist/index.module-UI0iz8K0.js +0 -42
package/dist/index-C6FYNbSB.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
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-CO2KgDX8.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
|
-
};
|
package/dist/index-C815hPWS.js
DELETED
|
@@ -1,430 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/index-CNcX0oSU.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useState as L, useMemo as p } from "react";
|
|
3
|
-
import { useNavigate as v, useLocation as A } from "react-router-dom";
|
|
4
|
-
import { DownOutlined as k, RightOutlined as w } from "@ant-design/icons";
|
|
5
|
-
import { P as W, R as $ } from "./index-DvBDj0ul.js";
|
|
6
|
-
import { f as E, M as g } from "./menuPermission-CO2KgDX8.js";
|
|
7
|
-
import { u as j } from "./useAppStore-BBr_Fwsz.js";
|
|
8
|
-
const H = "_shell_1jjcx_7", M = "_sidebar_1jjcx_15", R = "_menuList_1jjcx_37", T = "_menuGroup_1jjcx_43", C = "_menuGroupHeader_1jjcx_47", P = "_menuGroupIcon_1jjcx_65", z = "_menuGroupLabel_1jjcx_70", K = "_menuGroupArrow_1jjcx_74", U = "_menuSubList_1jjcx_80", Z = "_menuSubItem_1jjcx_86", B = "_menuSubItemActive_1jjcx_103", D = "_menuSubItemIcon_1jjcx_110", O = "_menuSubItemLabel_1jjcx_115", q = "_menuSubItemWrap_1jjcx_119", F = "_main_1jjcx_123", J = "_empty_1jjcx_134", Q = "_emptyIcon_1jjcx_144", V = "_emptyText_1jjcx_149", n = {
|
|
9
|
-
shell: H,
|
|
10
|
-
sidebar: M,
|
|
11
|
-
menuList: R,
|
|
12
|
-
menuGroup: T,
|
|
13
|
-
menuGroupHeader: C,
|
|
14
|
-
menuGroupIcon: P,
|
|
15
|
-
menuGroupLabel: z,
|
|
16
|
-
menuGroupArrow: K,
|
|
17
|
-
menuSubList: U,
|
|
18
|
-
menuSubItem: Z,
|
|
19
|
-
menuSubItemActive: B,
|
|
20
|
-
menuSubItemIcon: D,
|
|
21
|
-
menuSubItemLabel: O,
|
|
22
|
-
menuSubItemWrap: q,
|
|
23
|
-
main: F,
|
|
24
|
-
empty: J,
|
|
25
|
-
emptyIcon: Q,
|
|
26
|
-
emptyText: V
|
|
27
|
-
};
|
|
28
|
-
function X(m, r) {
|
|
29
|
-
for (const s of m)
|
|
30
|
-
if (s.path === r) return s.element;
|
|
31
|
-
for (const s of m)
|
|
32
|
-
if (s.path.includes("*") || s.path.includes(":")) {
|
|
33
|
-
const i = "^" + s.path.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, "[^/]+") + "$";
|
|
34
|
-
if (new RegExp(i).test(r)) return s.element;
|
|
35
|
-
}
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
function Y({ text: m }) {
|
|
39
|
-
return /* @__PURE__ */ u("div", { className: n.empty, children: [
|
|
40
|
-
/* @__PURE__ */ t("div", { className: n.emptyIcon, children: "⚙️" }),
|
|
41
|
-
/* @__PURE__ */ t("div", { className: n.emptyText, children: m })
|
|
42
|
-
] });
|
|
43
|
-
}
|
|
44
|
-
function oe({
|
|
45
|
-
groups: m,
|
|
46
|
-
routes: r,
|
|
47
|
-
mode: s,
|
|
48
|
-
emptyText: i,
|
|
49
|
-
activePathOverride: _,
|
|
50
|
-
menuOnly: h = !1
|
|
51
|
-
}) {
|
|
52
|
-
const I = v(), { pathname: a } = A(), d = j((e) => e.currentUser), b = j((e) => e.permissionState), [x, S] = L(
|
|
53
|
-
new Set(m.map((e) => e.title))
|
|
54
|
-
), l = p(
|
|
55
|
-
() => b === "failed" ? m : E(m, d),
|
|
56
|
-
[m, d, b]
|
|
57
|
-
), f = p(() => {
|
|
58
|
-
const e = _ ?? a;
|
|
59
|
-
for (const o of l)
|
|
60
|
-
for (const c of o.items)
|
|
61
|
-
if (c.path === e) return c.key;
|
|
62
|
-
return null;
|
|
63
|
-
}, [l, _, a]), G = (e) => {
|
|
64
|
-
S((o) => {
|
|
65
|
-
const c = new Set(o);
|
|
66
|
-
return c.has(e) ? c.delete(e) : c.add(e), c;
|
|
67
|
-
});
|
|
68
|
-
}, y = (e) => {
|
|
69
|
-
I(`${e.path}?mode=${s}`);
|
|
70
|
-
}, N = p(() => X(r, a), [r, a]);
|
|
71
|
-
return /* @__PURE__ */ u("div", { className: n.shell, children: [
|
|
72
|
-
/* @__PURE__ */ u("aside", { className: n.sidebar, children: [
|
|
73
|
-
/* @__PURE__ */ t(g, {}),
|
|
74
|
-
/* @__PURE__ */ t("nav", { className: n.menuList, children: l.map((e) => {
|
|
75
|
-
const o = x.has(e.title);
|
|
76
|
-
return /* @__PURE__ */ u("div", { className: n.menuGroup, children: [
|
|
77
|
-
/* @__PURE__ */ u(
|
|
78
|
-
"div",
|
|
79
|
-
{
|
|
80
|
-
className: n.menuGroupHeader,
|
|
81
|
-
onClick: () => G(e.title),
|
|
82
|
-
children: [
|
|
83
|
-
/* @__PURE__ */ t("span", { className: n.menuGroupIcon, children: e.icon }),
|
|
84
|
-
/* @__PURE__ */ t("span", { className: n.menuGroupLabel, children: e.title }),
|
|
85
|
-
/* @__PURE__ */ t("span", { className: n.menuGroupArrow, children: o ? /* @__PURE__ */ t(k, {}) : /* @__PURE__ */ t(w, {}) })
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
o && /* @__PURE__ */ t("ul", { className: n.menuSubList, children: e.items.map((c) => /* @__PURE__ */ u(
|
|
90
|
-
"li",
|
|
91
|
-
{
|
|
92
|
-
className: `${n.menuSubItemWrap} ${n.menuSubItem} ${f === c.key ? n.menuSubItemActive : ""}`,
|
|
93
|
-
onClick: () => y(c),
|
|
94
|
-
children: [
|
|
95
|
-
/* @__PURE__ */ t("span", { className: n.menuSubItemIcon, children: c.icon }),
|
|
96
|
-
/* @__PURE__ */ t("span", { className: n.menuSubItemLabel, children: c.label })
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
c.key
|
|
100
|
-
)) })
|
|
101
|
-
] }, e.title);
|
|
102
|
-
}) })
|
|
103
|
-
] }),
|
|
104
|
-
h ? null : /* @__PURE__ */ u("main", { className: n.main, children: [
|
|
105
|
-
/* @__PURE__ */ t(W, {}),
|
|
106
|
-
/* @__PURE__ */ t($, { resetKey: a, children: N ?? /* @__PURE__ */ t(Y, { text: i }) })
|
|
107
|
-
] })
|
|
108
|
-
] });
|
|
109
|
-
}
|
|
110
|
-
export {
|
|
111
|
-
oe as W
|
|
112
|
-
};
|