@yuku123/z-team-component 0.2.136 → 0.2.138
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/{AdminModuleContent-T7ZXoVAV.js → AdminModuleContent-9gH_G78B.js} +12866 -13280
- package/dist/{ChangeLogView-ChmYvz8Z.js → ChangeLogView-DzFmZVBw.js} +1 -1
- package/dist/{ComponentDoc-D5Gbd6B_.js → ComponentDoc-KyD5wtuW.js} +435 -445
- package/dist/{InvitationManagementPage-kaqwNuPz.js → InvitationManagementPage-6-0uZNuO.js} +1 -1
- package/dist/{OnboardingPage-Cy_sPHS1.js → OnboardingPage-tLarxnp5.js} +2 -2
- package/dist/{ScheduledTasks-GAP-U6s9.js → ScheduledTasks-QGmD7Uhz.js} +6 -6
- package/dist/SystemShell-CWawiWOn.js +885 -0
- package/dist/SystemWorkbench.module-CZv_ruUa.js +36 -0
- package/dist/{admin-logs-BdwcT77i.js → admin-logs-DXjxD-y2.js} +1 -1
- package/dist/{api-6nYxtAbN.js → api-DOjASQ0k.js} +1 -1
- package/dist/{api-B0S5AhOe.js → api-Dzr8HLsU.js} +1 -1
- package/dist/{createWorkspaceWsHandler-B9UE_uoO.js → createWorkspaceWsHandler-DCokPv4M.js} +3 -3
- package/dist/{index-DJu6AFf9.js → index-0AjMJyFL.js} +3 -3
- package/dist/{index-CCsvaPw9.js → index-4NOi2xz4.js} +2 -2
- package/dist/{index-g36zRqmZ.js → index-4icVyiM3.js} +5 -5
- package/dist/{index-B0f8tIBU.js → index-8VddM67M.js} +2 -2
- package/dist/{index-BQYKmytF.js → index-B75TTql4.js} +2 -2
- package/dist/{index-Y9EcfhJG.js → index-BHfNKXIA.js} +3 -3
- package/dist/{index-tln7BkiQ.js → index-BdEokzAv.js} +6 -6
- package/dist/{index-CX19wylA.js → index-BgdqkNkT.js} +3 -3
- package/dist/{index-DOYSz9Bg.js → index-C9NwYJh-.js} +1 -1
- package/dist/{index-eqbuW74W.js → index-CLP0LnEz.js} +12 -12
- package/dist/index-CNmSLd0s.js +1894 -0
- package/dist/{index-cY1tZiV2.js → index-CUOByyqy.js} +3 -3
- package/dist/{index-CnKYpM41.js → index-CjYmL2yJ.js} +1 -1
- package/dist/{index-BWaPbYG2.js → index-Crzx3zh2.js} +2 -2
- package/dist/index-Cwptuq_d.js +1323 -0
- package/dist/{index-B6n7ueTc.js → index-DC1fQH0J.js} +2 -2
- package/dist/{index-DNAeZe0a.js → index-DGdtqBi4.js} +4 -4
- package/dist/{index-CazCOFR2.js → index-DXA0r7Co.js} +2 -2
- package/dist/{index-DgYhtv8V.js → index-DZcMGMHV.js} +4 -4
- package/dist/{index-BC6eLVMc.js → index-DarTFF-M.js} +1 -1
- package/dist/{index-C7DP8H_Q.js → index-DxZEpsT6.js} +2964 -2962
- package/dist/{index-DWi-8Esh.js → index-PJZV-bFc.js} +1 -1
- package/dist/{index-DJ2TNQP6.js → index-VqKcDrn3.js} +2 -2
- package/dist/{index-DbThmpZg.js → index-ZqDoLUxb.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{instance-ChzeFK3e.js → instance-CDA6R8yG.js} +1 -1
- package/dist/{menuPermission-DDzb20pQ.js → menuPermission-LCjN8Osm.js} +3 -3
- package/dist/pages.js +1 -1
- package/dist/{send-default-agent-team-message-DOgtkW6m.js → send-default-agent-team-message-3Uyy88s_.js} +1 -1
- package/dist/{sso-user-DaRbfrdM.js → sso-user-DX2FYQCh.js} +1 -1
- package/dist/{training-N-5-qsDf.js → training-BgYM7EV-.js} +1 -1
- package/dist/{webide-BEV0VT3u.js → webide-BsF30aLX.js} +1289 -1255
- package/dist/z-team-component.css +1 -1
- package/package.json +1 -1
- package/dist/SystemShell-69TBLWk8.js +0 -978
- package/dist/index-CE1Vtf-B.js +0 -1718
- package/dist/index-T4Rvjyn0.js +0 -1299
|
@@ -0,0 +1,1894 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { CopyOutlined as ie, ReloadOutlined as Te, PlusOutlined as Ke, StopOutlined as Ye, DeleteOutlined as Xe, ClearOutlined as Ze, CloseOutlined as et, SendOutlined as tt, RobotOutlined as he, DownOutlined as at, RightOutlined as nt, CloudServerOutlined as be, MessageOutlined as st, BarChartOutlined as ot, KeyOutlined as Me, NodeIndexOutlined as rt, ApiOutlined as lt, ToolOutlined as ct } from "@ant-design/icons";
|
|
3
|
+
import { useState as N, useEffect as V, useCallback as G, useRef as ye, useMemo as Ee, Suspense as it, lazy as dt } from "react";
|
|
4
|
+
import { Table as ce, Tooltip as oe, Tabs as $e, Input as Ne, Button as z, Modal as fe, Drawer as Oe, Spin as se, Statistic as P, message as q, Tag as Z, Select as mt, Checkbox as ut } from "antd";
|
|
5
|
+
import { u as Le } from "./ComponentDoc-KyD5wtuW.js";
|
|
6
|
+
import { s as U } from "./SystemWorkbench.module-CZv_ruUa.js";
|
|
7
|
+
import { AgentAppList as ht, AgentInstanceManager as pt, McpPage as kt, SkillMarket as gt } from "@yuku123/z-agent-component";
|
|
8
|
+
const ue = "ft_gateway_default_ak", Ue = "system-default", ee = "", Ce = "";
|
|
9
|
+
function te(a = {}) {
|
|
10
|
+
const n = { Accept: "application/json", ...a };
|
|
11
|
+
try {
|
|
12
|
+
const o = localStorage.getItem("token");
|
|
13
|
+
o && (n.Authorization = `Bearer ${o}`);
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
return n;
|
|
17
|
+
}
|
|
18
|
+
function yt(a) {
|
|
19
|
+
return {
|
|
20
|
+
modelName: String(a.modelName ?? a.model_name ?? a.service ?? ""),
|
|
21
|
+
service: String(a.service ?? a.modelName ?? ""),
|
|
22
|
+
endpoint: String(a.endpoint ?? ""),
|
|
23
|
+
modelProvider: a.modelProvider ?? a.model_provider ?? null,
|
|
24
|
+
apiType: String(a.apiType ?? a.api_type ?? "OpenAPI")
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async function we() {
|
|
28
|
+
let a;
|
|
29
|
+
try {
|
|
30
|
+
a = await fetch(`${ee}/api/scenario-instances/0/models`, {
|
|
31
|
+
credentials: "include",
|
|
32
|
+
headers: te({
|
|
33
|
+
Accept: "application/json",
|
|
34
|
+
"project-env": window.ENV_TYPE ?? "local"
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
} catch {
|
|
38
|
+
throw new Error("模型列表不可达:模型配置接口请求失败");
|
|
39
|
+
}
|
|
40
|
+
if (!a.ok)
|
|
41
|
+
throw new Error(`模型列表获取失败(HTTP ${a.status})`);
|
|
42
|
+
let n;
|
|
43
|
+
try {
|
|
44
|
+
n = await a.json();
|
|
45
|
+
} catch {
|
|
46
|
+
throw new Error("模型列表返回格式异常(非 JSON)");
|
|
47
|
+
}
|
|
48
|
+
const o = n != null && n.success ? n.data : (n == null ? void 0 : n.data) ?? n;
|
|
49
|
+
if (!Array.isArray(o))
|
|
50
|
+
throw new Error("模型列表返回格式异常(非数组)");
|
|
51
|
+
return o.map(yt);
|
|
52
|
+
}
|
|
53
|
+
async function ft(a, n, o, i) {
|
|
54
|
+
var A, C, g;
|
|
55
|
+
const c = await fetch(`${Ce}/v1/chat/completions`, {
|
|
56
|
+
method: "POST",
|
|
57
|
+
headers: {
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
Authorization: `Bearer ${a}`,
|
|
60
|
+
Accept: "text/event-stream"
|
|
61
|
+
},
|
|
62
|
+
body: JSON.stringify({
|
|
63
|
+
model: n,
|
|
64
|
+
messages: o,
|
|
65
|
+
stream: !0
|
|
66
|
+
}),
|
|
67
|
+
signal: i.signal
|
|
68
|
+
});
|
|
69
|
+
if (!c.ok || !c.body) {
|
|
70
|
+
const m = await c.text().catch(() => "");
|
|
71
|
+
if (/<!doctype html/i.test(m.slice(0, 200)))
|
|
72
|
+
throw new Error("模型网关未接入(/v1/chat/completions 落到主壳 SPA,无网关响应)");
|
|
73
|
+
let k = `HTTP ${c.status}`;
|
|
74
|
+
try {
|
|
75
|
+
const p = JSON.parse(m);
|
|
76
|
+
k = ((A = p == null ? void 0 : p.error) == null ? void 0 : A.message) ?? k;
|
|
77
|
+
} catch {
|
|
78
|
+
m && (k = m);
|
|
79
|
+
}
|
|
80
|
+
throw new Error(k);
|
|
81
|
+
}
|
|
82
|
+
const T = c.body.getReader(), B = new TextDecoder();
|
|
83
|
+
let S = "", f;
|
|
84
|
+
try {
|
|
85
|
+
for (; ; ) {
|
|
86
|
+
const { done: m, value: k } = await T.read();
|
|
87
|
+
if (m) break;
|
|
88
|
+
S += B.decode(k, { stream: !0 });
|
|
89
|
+
const p = S.split(`
|
|
90
|
+
|
|
91
|
+
`);
|
|
92
|
+
S = p.pop() ?? "";
|
|
93
|
+
for (const d of p) {
|
|
94
|
+
let _ = "";
|
|
95
|
+
for (const h of d.split(`
|
|
96
|
+
`))
|
|
97
|
+
h.startsWith("data:") && (_ += h.slice(5).trim());
|
|
98
|
+
if (!_ || _ === "[DONE]") {
|
|
99
|
+
if (_ === "[DONE]") {
|
|
100
|
+
i.onDone(f);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const h = JSON.parse(_), b = h == null ? void 0 : h.choices;
|
|
107
|
+
if (h != null && h.usage) {
|
|
108
|
+
const E = {
|
|
109
|
+
promptTokens: h.usage.prompt_tokens ?? 0,
|
|
110
|
+
completionTokens: h.usage.completion_tokens ?? 0,
|
|
111
|
+
totalTokens: h.usage.total_tokens ?? 0
|
|
112
|
+
};
|
|
113
|
+
(!f || E.totalTokens > 0) && (f = E);
|
|
114
|
+
}
|
|
115
|
+
if (Array.isArray(b) && b.length > 0) {
|
|
116
|
+
const E = (C = b[0]) == null ? void 0 : C.delta;
|
|
117
|
+
E != null && E.content && i.onDelta(E.content);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
i.onDone(f);
|
|
121
|
+
return;
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
i.onDone(f);
|
|
127
|
+
} catch (m) {
|
|
128
|
+
if ((g = i.signal) != null && g.aborted) return;
|
|
129
|
+
throw i.onError(m instanceof Error ? m : new Error(String(m))), m;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function re(a, n) {
|
|
133
|
+
const o = await a.text();
|
|
134
|
+
if (!a.ok)
|
|
135
|
+
throw new Error(`${n}失败 HTTP ${a.status}${o ? `: ${o.slice(0, 120)}` : ""}`);
|
|
136
|
+
if (/<!doctype html/i.test(o.slice(0, 200)))
|
|
137
|
+
throw new Error("AK 接口落到主壳 SPA(无后端响应)");
|
|
138
|
+
try {
|
|
139
|
+
return JSON.parse(o);
|
|
140
|
+
} catch {
|
|
141
|
+
throw new Error(`${n}返回非 JSON:${o.slice(0, 120)}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function _t(a) {
|
|
145
|
+
const n = a.status === 1;
|
|
146
|
+
return {
|
|
147
|
+
id: Number(a.id),
|
|
148
|
+
akPrefix: a.access_key ?? "",
|
|
149
|
+
userId: a.owner_user_id ?? "",
|
|
150
|
+
userName: a.owner_user_name ?? "",
|
|
151
|
+
description: a.description || a.ak_name || "",
|
|
152
|
+
status: n ? "active" : "disabled",
|
|
153
|
+
active: n,
|
|
154
|
+
isDeleted: a.is_deleted ?? 0,
|
|
155
|
+
totalRequests: 0,
|
|
156
|
+
totalTokens: Number(a.total_tokens ?? 0),
|
|
157
|
+
tokenQuota: 0,
|
|
158
|
+
rateLimitRpm: 0,
|
|
159
|
+
defaultModel: null,
|
|
160
|
+
lastUsedAt: a.last_used_time ?? null,
|
|
161
|
+
createTime: (a.created_time ?? "").replace("T", " ").slice(0, 19),
|
|
162
|
+
updateTime: (a.updated_time ?? "").replace("T", " ").slice(0, 19),
|
|
163
|
+
secret: a.secret_key
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function ze(a, n, o) {
|
|
167
|
+
const i = await fetch(`${ee}/api/ak/create`, {
|
|
168
|
+
method: "POST",
|
|
169
|
+
headers: te({ Accept: "application/json", "Content-Type": "application/json" }),
|
|
170
|
+
credentials: "include",
|
|
171
|
+
body: JSON.stringify({
|
|
172
|
+
akName: o || `AK-${n || a}`,
|
|
173
|
+
description: o,
|
|
174
|
+
akType: "PERSONAL",
|
|
175
|
+
ownerUserId: a,
|
|
176
|
+
ownerUserName: n
|
|
177
|
+
})
|
|
178
|
+
}), c = await re(i, "创建 AK"), T = (c == null ? void 0 : c.data) ?? {}, B = T.accessKey ?? "", S = T.secretKey ?? "";
|
|
179
|
+
return B && S && Ae(B, S), { apiKey: S, akPrefix: B, message: "AK 已创建,secretKey 仅创建时可见" };
|
|
180
|
+
}
|
|
181
|
+
async function pe(a) {
|
|
182
|
+
const n = await fetch(
|
|
183
|
+
`${ee}/api/ak/list`,
|
|
184
|
+
{ headers: te({ Accept: "application/json" }), credentials: "include" }
|
|
185
|
+
), o = await re(n, "获取 AK 列表"), i = Array.isArray(o == null ? void 0 : o.data) ? o.data : [];
|
|
186
|
+
return (a ? i.filter((T) => (T.owner_user_id == null || T.owner_user_id === "" ? Ue : String(T.owner_user_id)) === String(a)) : i).filter((T) => (T.is_deleted ?? 0) === 0).map(_t);
|
|
187
|
+
}
|
|
188
|
+
async function Nt(a) {
|
|
189
|
+
const n = await fetch(`${ee}/api/ak/delete?id=${encodeURIComponent(String(a))}`, {
|
|
190
|
+
method: "POST",
|
|
191
|
+
headers: te({ Accept: "application/json" }),
|
|
192
|
+
credentials: "include"
|
|
193
|
+
});
|
|
194
|
+
await re(n, "吊销 AK");
|
|
195
|
+
}
|
|
196
|
+
async function Ct(a, n) {
|
|
197
|
+
const o = await fetch(
|
|
198
|
+
`${ee}/api/ak/toggle?id=${encodeURIComponent(String(a))}&status=${n ? 1 : 0}`,
|
|
199
|
+
{
|
|
200
|
+
method: "POST",
|
|
201
|
+
headers: te({ Accept: "application/json" }),
|
|
202
|
+
credentials: "include"
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
await re(o, n ? "启用 AK" : "停用 AK");
|
|
206
|
+
}
|
|
207
|
+
async function Re(a) {
|
|
208
|
+
var m, k;
|
|
209
|
+
const n = await fetch(
|
|
210
|
+
`${ee}/api/admin/llm-call-monitor/stats?hours=168`,
|
|
211
|
+
{ headers: te({ Accept: "application/json" }), credentials: "include" }
|
|
212
|
+
), o = await re(n, "获取调用统计"), c = ((o == null ? void 0 : o.data) ?? {}).summary ?? {};
|
|
213
|
+
let T = [];
|
|
214
|
+
try {
|
|
215
|
+
const p = await fetch(
|
|
216
|
+
`${ee}/api/admin/llm-call-monitor/recent?page=1&size=20`,
|
|
217
|
+
{ headers: te({ Accept: "application/json" }), credentials: "include" }
|
|
218
|
+
), d = await re(p, "获取调用明细");
|
|
219
|
+
T = (Array.isArray((m = d == null ? void 0 : d.data) == null ? void 0 : m.records) ? d.data.records : []).map((h, b) => {
|
|
220
|
+
const E = Number(h.promptTokens ?? 0), F = Number(h.completionTokens ?? 0);
|
|
221
|
+
return {
|
|
222
|
+
id: Number(h.id ?? b),
|
|
223
|
+
apiKeyId: a,
|
|
224
|
+
protocol: "chat/completions",
|
|
225
|
+
model: String(h.model ?? ""),
|
|
226
|
+
stream: Number(h.stream ?? 0),
|
|
227
|
+
promptTokens: E,
|
|
228
|
+
completionTokens: F,
|
|
229
|
+
totalTokens: Number(h.totalTokens ?? E + F),
|
|
230
|
+
latencyMs: Number(h.durationMs ?? 0),
|
|
231
|
+
statusCode: h.success === !1 || h.success === 0 ? 500 : 200,
|
|
232
|
+
errorMsg: h.errorType ?? null,
|
|
233
|
+
createTime: String(h.createTime ?? "").replace("T", " ").slice(0, 19)
|
|
234
|
+
};
|
|
235
|
+
});
|
|
236
|
+
} catch {
|
|
237
|
+
}
|
|
238
|
+
const B = {}, S = {};
|
|
239
|
+
for (const p of T) {
|
|
240
|
+
const d = B[k = p.model] || (B[k] = [0, 0, 0]);
|
|
241
|
+
d[0] += 1, d[1] += p.promptTokens, d[2] += p.completionTokens;
|
|
242
|
+
const _ = (p.createTime || "").slice(0, 10);
|
|
243
|
+
if (_) {
|
|
244
|
+
const h = S[_] || (S[_] = [0, 0, 0]);
|
|
245
|
+
h[0] += 1, h[1] += p.promptTokens, h[2] += p.completionTokens;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const f = Number(c.totalTokens ?? 0), A = T.reduce((p, d) => p + d.totalTokens, 0), C = T.reduce((p, d) => p + d.promptTokens, 0), g = T.reduce((p, d) => p + d.completionTokens, 0);
|
|
249
|
+
return {
|
|
250
|
+
totalRequests: Number(c.totalCount ?? 0),
|
|
251
|
+
// 汇总口径优先用后端整窗合计(后端 selectStats 才有 token 合计),
|
|
252
|
+
// 明细只有最近一页 ⇒ 只在汇总缺失时用明细兜底。
|
|
253
|
+
totalPromptTokens: Number(c.totalPromptTokens ?? 0) || C,
|
|
254
|
+
totalCompletionTokens: Number(c.totalCompletionTokens ?? 0) || g,
|
|
255
|
+
totalTokens: f || A,
|
|
256
|
+
avgLatencyMs: Number(c.avgDurationMs ?? 0),
|
|
257
|
+
errorCount: Number(c.failCount ?? 0),
|
|
258
|
+
daily: S,
|
|
259
|
+
models: B,
|
|
260
|
+
recent: T
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function vt() {
|
|
264
|
+
return typeof window < "u" ? `${window.location.origin}${Ce}` : Ce;
|
|
265
|
+
}
|
|
266
|
+
async function Se(a) {
|
|
267
|
+
const n = await fetch(`${ee}${a}`, {
|
|
268
|
+
headers: te({ Accept: "application/json" }),
|
|
269
|
+
credentials: "include"
|
|
270
|
+
});
|
|
271
|
+
if (!(n.headers.get("content-type") || "").includes("json"))
|
|
272
|
+
throw new Error("网关控制面未启用(该路径返回的是前端页面,不是接口)");
|
|
273
|
+
if (!n.ok)
|
|
274
|
+
throw new Error(`网关控制面请求失败(HTTP ${n.status})`);
|
|
275
|
+
return n.json();
|
|
276
|
+
}
|
|
277
|
+
async function De() {
|
|
278
|
+
return Se("/z-llm/admin/overview");
|
|
279
|
+
}
|
|
280
|
+
async function Tt() {
|
|
281
|
+
return Se("/z-llm/admin/health");
|
|
282
|
+
}
|
|
283
|
+
async function He() {
|
|
284
|
+
const a = await Se("/z-llm/admin/usage");
|
|
285
|
+
return (Array.isArray(a == null ? void 0 : a.byTenant) ? a.byTenant : []).map((o) => ({
|
|
286
|
+
tenantCode: String(o.tenantCode ?? o.keyId ?? ""),
|
|
287
|
+
requests: Number(o.requests ?? o.count ?? 0),
|
|
288
|
+
promptTokens: Number(o.promptTokens ?? 0),
|
|
289
|
+
completionTokens: Number(o.completionTokens ?? 0),
|
|
290
|
+
cost: Number(o.cost ?? 0)
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
const ve = "ft_gateway_ak_cache";
|
|
294
|
+
function Ae(a, n) {
|
|
295
|
+
try {
|
|
296
|
+
const o = JSON.parse(localStorage.getItem(ve) || "{}");
|
|
297
|
+
o[a] = n, localStorage.setItem(ve, JSON.stringify(o));
|
|
298
|
+
} catch {
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function wt(a) {
|
|
302
|
+
try {
|
|
303
|
+
return JSON.parse(localStorage.getItem(ve) || "{}")[a] || null;
|
|
304
|
+
} catch {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
async function St() {
|
|
309
|
+
try {
|
|
310
|
+
const i = localStorage.getItem(ue);
|
|
311
|
+
if (i) return i;
|
|
312
|
+
} catch {
|
|
313
|
+
}
|
|
314
|
+
const n = (await pe("").catch(() => [])).find((i) => i.active && i.secret);
|
|
315
|
+
if (n != null && n.secret) {
|
|
316
|
+
try {
|
|
317
|
+
localStorage.setItem(ue, n.secret);
|
|
318
|
+
} catch {
|
|
319
|
+
}
|
|
320
|
+
return n.akPrefix && Ae(n.akPrefix, n.secret), n.secret;
|
|
321
|
+
}
|
|
322
|
+
const o = await ze(
|
|
323
|
+
"system-default",
|
|
324
|
+
"系统默认",
|
|
325
|
+
"智能工作台默认AK(自动创建)"
|
|
326
|
+
);
|
|
327
|
+
if (!o.apiKey)
|
|
328
|
+
throw new Error("AK 创建成功但未返回 secretKey");
|
|
329
|
+
try {
|
|
330
|
+
localStorage.setItem(ue, o.apiKey);
|
|
331
|
+
} catch {
|
|
332
|
+
}
|
|
333
|
+
return o.apiKey;
|
|
334
|
+
}
|
|
335
|
+
function Ge() {
|
|
336
|
+
try {
|
|
337
|
+
localStorage.removeItem(ue);
|
|
338
|
+
} catch {
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const At = "_container_1ctyd_7", xt = "_panelArea_1ctyd_16", Bt = "_modelMgmtHeader_1ctyd_28", It = "_modelMgmtTitle_1ctyd_32", bt = "_modelMgmtSubtitle_1ctyd_39", Mt = "_modelGrid_1ctyd_45", Pt = "_modelCard_1ctyd_51", Kt = "_modelCardSelected_1ctyd_80", Et = "_modelCardHeader_1ctyd_85", $t = "_modelIconWrap_1ctyd_92", Ot = "_modelCardInfo_1ctyd_105", Lt = "_modelName_1ctyd_110", Ut = "_modelTags_1ctyd_119", zt = "_modelEndpoint_1ctyd_135", Rt = "_modelCardFooter_1ctyd_144", Dt = "_modelCheckbox_1ctyd_152", Ht = "_modelActionBar_1ctyd_159", Gt = "_modelSelectionCount_1ctyd_173", jt = "_chatContainer_1ctyd_182", qt = "_chatHeader_1ctyd_189", Ft = "_chatTitle_1ctyd_197", Jt = "_chatPanels_1ctyd_204", Wt = "_chatPanel_1ctyd_204", Qt = "_chatPanelHeader_1ctyd_231", Vt = "_chatPanelClose_1ctyd_241", Yt = "_chatPanelBody_1ctyd_253", Xt = "_chatMsgUser_1ctyd_262", Zt = "_chatMsgAI_1ctyd_274", ea = "_chatMsgError_1ctyd_287", ta = "_chatStreamingCursor_1ctyd_297", aa = "_chatUsageBar_1ctyd_316", na = "_chatThinkBlock_1ctyd_326", sa = "_chatInputBar_1ctyd_375", oa = "_chatInput_1ctyd_375", ra = "_addPanelBtn_1ctyd_388", la = "_akContainer_1ctyd_417", ca = "_akIntegrationPanel_1ctyd_423", ia = "_akIntegrationTitle_1ctyd_430", da = "_akIntegrationGrid_1ctyd_437", ma = "_akCodeBlock_1ctyd_443", ua = "_akCodeLabel_1ctyd_455", ha = "_akCard_1ctyd_462", pa = "_akCardRow_1ctyd_480", ka = "_akTitle_1ctyd_487", ga = "_akPrefixSmall_1ctyd_497", ya = "_akStatus_1ctyd_503", fa = "_akStatusActive_1ctyd_509", _a = "_akStatusRevoked_1ctyd_515", Na = "_akCardActions_1ctyd_521", Ca = "_akCardRow2_1ctyd_528", va = "_akMiniBar_1ctyd_534", Ta = "_akMiniBarFill_1ctyd_543", wa = "_akUsageText_1ctyd_550", Sa = "_akMetaText_1ctyd_557", Aa = "_akEmpty_1ctyd_563", xa = "_akBaseUrlRow_1ctyd_571", Ba = "_akBaseUrlItem_1ctyd_577", Ia = "_akBaseUrlLabel_1ctyd_587", ba = "_akBaseUrlValue_1ctyd_593", Ma = "_akCopyIcon_1ctyd_603", Pa = "_usageDrawerContent_1ctyd_617", Ka = "_usageStatsGrid_1ctyd_623", Ea = "_usageSection_1ctyd_629", $a = "_usageSectionTitle_1ctyd_633", Oa = "_usageBarChart_1ctyd_643", La = "_usageBarCol_1ctyd_652", Ua = "_usageBar_1ctyd_643", za = "_usageBarLabel_1ctyd_675", Ra = "_modelBreakdown_1ctyd_683", Da = "_modelBreakdownRow_1ctyd_689", Ha = "_modelBreakdownName_1ctyd_695", Ga = "_modelBreakdownBar_1ctyd_705", ja = "_modelBreakdownFill_1ctyd_713", qa = "_modelBreakdownCount_1ctyd_720", Fa = "_usageEmpty_1ctyd_727", t = {
|
|
342
|
+
container: At,
|
|
343
|
+
panelArea: xt,
|
|
344
|
+
modelMgmtHeader: Bt,
|
|
345
|
+
modelMgmtTitle: It,
|
|
346
|
+
modelMgmtSubtitle: bt,
|
|
347
|
+
modelGrid: Mt,
|
|
348
|
+
modelCard: Pt,
|
|
349
|
+
modelCardSelected: Kt,
|
|
350
|
+
modelCardHeader: Et,
|
|
351
|
+
modelIconWrap: $t,
|
|
352
|
+
modelCardInfo: Ot,
|
|
353
|
+
modelName: Lt,
|
|
354
|
+
modelTags: Ut,
|
|
355
|
+
modelEndpoint: zt,
|
|
356
|
+
modelCardFooter: Rt,
|
|
357
|
+
modelCheckbox: Dt,
|
|
358
|
+
modelActionBar: Ht,
|
|
359
|
+
modelSelectionCount: Gt,
|
|
360
|
+
chatContainer: jt,
|
|
361
|
+
chatHeader: qt,
|
|
362
|
+
chatTitle: Ft,
|
|
363
|
+
chatPanels: Jt,
|
|
364
|
+
chatPanel: Wt,
|
|
365
|
+
chatPanelHeader: Qt,
|
|
366
|
+
chatPanelClose: Vt,
|
|
367
|
+
chatPanelBody: Yt,
|
|
368
|
+
chatMsgUser: Xt,
|
|
369
|
+
chatMsgAI: Zt,
|
|
370
|
+
chatMsgError: ea,
|
|
371
|
+
chatStreamingCursor: ta,
|
|
372
|
+
chatUsageBar: aa,
|
|
373
|
+
chatThinkBlock: na,
|
|
374
|
+
chatInputBar: sa,
|
|
375
|
+
chatInput: oa,
|
|
376
|
+
addPanelBtn: ra,
|
|
377
|
+
akContainer: la,
|
|
378
|
+
akIntegrationPanel: ca,
|
|
379
|
+
akIntegrationTitle: ia,
|
|
380
|
+
akIntegrationGrid: da,
|
|
381
|
+
akCodeBlock: ma,
|
|
382
|
+
akCodeLabel: ua,
|
|
383
|
+
akCard: ha,
|
|
384
|
+
akCardRow: pa,
|
|
385
|
+
akTitle: ka,
|
|
386
|
+
akPrefixSmall: ga,
|
|
387
|
+
akStatus: ya,
|
|
388
|
+
akStatusActive: fa,
|
|
389
|
+
akStatusRevoked: _a,
|
|
390
|
+
akCardActions: Na,
|
|
391
|
+
akCardRow2: Ca,
|
|
392
|
+
akMiniBar: va,
|
|
393
|
+
akMiniBarFill: Ta,
|
|
394
|
+
akUsageText: wa,
|
|
395
|
+
akMetaText: Sa,
|
|
396
|
+
akEmpty: Aa,
|
|
397
|
+
akBaseUrlRow: xa,
|
|
398
|
+
akBaseUrlItem: Ba,
|
|
399
|
+
akBaseUrlLabel: Ia,
|
|
400
|
+
akBaseUrlValue: ba,
|
|
401
|
+
akCopyIcon: Ma,
|
|
402
|
+
usageDrawerContent: Pa,
|
|
403
|
+
usageStatsGrid: Ka,
|
|
404
|
+
usageSection: Ea,
|
|
405
|
+
usageSectionTitle: $a,
|
|
406
|
+
usageBarChart: Oa,
|
|
407
|
+
usageBarCol: La,
|
|
408
|
+
usageBar: Ua,
|
|
409
|
+
usageBarLabel: za,
|
|
410
|
+
modelBreakdown: Ra,
|
|
411
|
+
modelBreakdownRow: Da,
|
|
412
|
+
modelBreakdownName: Ha,
|
|
413
|
+
modelBreakdownBar: Ga,
|
|
414
|
+
modelBreakdownFill: ja,
|
|
415
|
+
modelBreakdownCount: qa,
|
|
416
|
+
usageEmpty: Fa
|
|
417
|
+
};
|
|
418
|
+
function de(a) {
|
|
419
|
+
return a >= 1e6 ? `${(a / 1e6).toFixed(1)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : `${a}`;
|
|
420
|
+
}
|
|
421
|
+
function Ja(a, n) {
|
|
422
|
+
return `# OpenAI 兼容
|
|
423
|
+
curl -X POST ${a}/v1/chat/completions \\
|
|
424
|
+
-H "Content-Type: application/json" \\
|
|
425
|
+
-H "Authorization: Bearer ft-xxx" \\
|
|
426
|
+
-d '{
|
|
427
|
+
"model": "${n}",
|
|
428
|
+
"messages": [{"role":"user","content":"你好"}],
|
|
429
|
+
"stream": true
|
|
430
|
+
}'`;
|
|
431
|
+
}
|
|
432
|
+
function Wa(a, n) {
|
|
433
|
+
return `# Anthropic 兼容
|
|
434
|
+
curl -X POST ${a}/v1/messages \\
|
|
435
|
+
-H "Content-Type: application/json" \\
|
|
436
|
+
-H "x-api-key: ft-xxx" \\
|
|
437
|
+
-d '{
|
|
438
|
+
"model": "${n}",
|
|
439
|
+
"messages": [{"role":"user","content":"你好"}]
|
|
440
|
+
}'`;
|
|
441
|
+
}
|
|
442
|
+
function Qa() {
|
|
443
|
+
const [a, n] = N("personal"), [o, i] = N([]), [c, T] = N([]), [B, S] = N(!0), [f, A] = N(!1), [C, g] = N(!1), [m, k] = N(""), [p, d] = N({ open: !1 }), [_, h] = N(null), [b, E] = N(null), [F, ae] = N(!1), [Y, u] = N(null), [$, R] = N([]), [r, y] = N(""), x = Le((l) => l.currentUser), M = String((x == null ? void 0 : x.id) ?? ""), O = (x == null ? void 0 : x.username) ?? "", [K, J] = N(""), X = vt(), [D, j] = N("<model-name>");
|
|
444
|
+
V(() => {
|
|
445
|
+
let l = !1;
|
|
446
|
+
return we().then((v) => {
|
|
447
|
+
!l && v.length > 0 && j(v[0].modelName);
|
|
448
|
+
}).catch(() => {
|
|
449
|
+
}), () => {
|
|
450
|
+
l = !0;
|
|
451
|
+
};
|
|
452
|
+
}, []), V(() => {
|
|
453
|
+
let l = !1;
|
|
454
|
+
return Promise.all([De(), He()]).then(([v, Q]) => {
|
|
455
|
+
l || (u(v), R(Q), y(""));
|
|
456
|
+
}).catch((v) => {
|
|
457
|
+
l || (u(null), R([]), y(v instanceof Error ? v.message : "网关台账不可用"));
|
|
458
|
+
}), () => {
|
|
459
|
+
l = !0;
|
|
460
|
+
};
|
|
461
|
+
}, []);
|
|
462
|
+
const W = G(async () => {
|
|
463
|
+
S(!0);
|
|
464
|
+
try {
|
|
465
|
+
const l = M ? await pe(M).catch(() => []) : [], [v] = await Promise.all([
|
|
466
|
+
pe("system-default").catch(() => [])
|
|
467
|
+
]);
|
|
468
|
+
i(v), T(l);
|
|
469
|
+
} finally {
|
|
470
|
+
S(!1);
|
|
471
|
+
}
|
|
472
|
+
}, [M]);
|
|
473
|
+
V(() => {
|
|
474
|
+
W();
|
|
475
|
+
}, [W]);
|
|
476
|
+
const ke = () => {
|
|
477
|
+
k(""), g(!0);
|
|
478
|
+
}, xe = async () => {
|
|
479
|
+
if (!m.trim()) {
|
|
480
|
+
q.warning("请输入 AK 名称");
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
if (!M) {
|
|
484
|
+
q.warning("登录态不可用,无法生成 AK");
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
A(!0);
|
|
488
|
+
try {
|
|
489
|
+
const l = await ze(M, O, m.trim());
|
|
490
|
+
Ae(l.akPrefix, l.apiKey), g(!1), d({
|
|
491
|
+
open: !0,
|
|
492
|
+
apiKey: l.apiKey,
|
|
493
|
+
akPrefix: l.akPrefix
|
|
494
|
+
}), W();
|
|
495
|
+
} catch (l) {
|
|
496
|
+
q.error(l instanceof Error ? l.message : "创建 AK 失败");
|
|
497
|
+
} finally {
|
|
498
|
+
A(!1);
|
|
499
|
+
}
|
|
500
|
+
}, je = (l) => {
|
|
501
|
+
fe.confirm({
|
|
502
|
+
title: "确认吊销此 AK?",
|
|
503
|
+
content: "吊销后此 AK 将立即失效,无法恢复。",
|
|
504
|
+
okText: "确认吊销",
|
|
505
|
+
okType: "danger",
|
|
506
|
+
cancelText: "取消",
|
|
507
|
+
onOk: async () => {
|
|
508
|
+
try {
|
|
509
|
+
await Nt(l), q.success("AK 已吊销"), W(), Ge();
|
|
510
|
+
} catch (v) {
|
|
511
|
+
q.error(v instanceof Error ? v.message : "吊销失败");
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}, Be = async (l) => {
|
|
516
|
+
try {
|
|
517
|
+
await Ct(l.id, !l.active), q.success(l.active ? "AK 已停用" : "AK 已启用"), W();
|
|
518
|
+
} catch (v) {
|
|
519
|
+
q.error(v instanceof Error ? v.message : "操作失败");
|
|
520
|
+
}
|
|
521
|
+
}, le = (l) => {
|
|
522
|
+
navigator.clipboard.writeText(l).then(() => q.success("已复制到剪贴板")).catch(() => q.warning("复制失败,请手动复制"));
|
|
523
|
+
}, qe = (l) => {
|
|
524
|
+
const v = wt(l.akPrefix);
|
|
525
|
+
v ? le(v) : (le(l.akPrefix), q.info("完整 AK 未在本地缓存(可能在本设备外创建),已复制前缀"));
|
|
526
|
+
}, Fe = async (l) => {
|
|
527
|
+
h(l), ae(!0), E(null);
|
|
528
|
+
try {
|
|
529
|
+
const v = await Re(l.id);
|
|
530
|
+
E(v);
|
|
531
|
+
} catch (v) {
|
|
532
|
+
q.error(v instanceof Error ? v.message : "获取用量失败");
|
|
533
|
+
} finally {
|
|
534
|
+
ae(!1);
|
|
535
|
+
}
|
|
536
|
+
}, Je = () => {
|
|
537
|
+
h(null), E(null);
|
|
538
|
+
}, We = (l) => {
|
|
539
|
+
const v = Object.entries(l);
|
|
540
|
+
if (v.length === 0)
|
|
541
|
+
return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
542
|
+
const Q = Math.max(...v.map(([, L]) => L[1] + L[2]), 1);
|
|
543
|
+
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: v.map(([L, H]) => {
|
|
544
|
+
const w = H[1] + H[2], ge = w / Q * 100;
|
|
545
|
+
return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
|
|
546
|
+
/* @__PURE__ */ e(oe, { title: `${L}: ${H[0]}次 / ${w} tokens`, children: /* @__PURE__ */ e(
|
|
547
|
+
"div",
|
|
548
|
+
{
|
|
549
|
+
className: t.usageBar,
|
|
550
|
+
style: { height: `${Math.max(ge, 2)}%` }
|
|
551
|
+
}
|
|
552
|
+
) }),
|
|
553
|
+
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children: L })
|
|
554
|
+
] }, L);
|
|
555
|
+
}) });
|
|
556
|
+
}, Qe = (l) => {
|
|
557
|
+
const v = Object.entries(l);
|
|
558
|
+
if (v.length === 0)
|
|
559
|
+
return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
560
|
+
const Q = Math.max(...v.map(([, L]) => L[0]), 1);
|
|
561
|
+
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: v.sort((L, H) => H[1][0] - L[1][0]).map(([L, H]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
|
|
562
|
+
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: L }),
|
|
563
|
+
/* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
|
|
564
|
+
"div",
|
|
565
|
+
{
|
|
566
|
+
className: t.modelBreakdownFill,
|
|
567
|
+
style: { width: `${H[0] / Q * 100}%` }
|
|
568
|
+
}
|
|
569
|
+
) }),
|
|
570
|
+
/* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
|
|
571
|
+
H[0],
|
|
572
|
+
"次 / ",
|
|
573
|
+
H[1] + (H[2] || 0),
|
|
574
|
+
"tokens"
|
|
575
|
+
] })
|
|
576
|
+
] }, L)) });
|
|
577
|
+
}, Ve = [
|
|
578
|
+
{
|
|
579
|
+
title: "时间",
|
|
580
|
+
dataIndex: "createTime",
|
|
581
|
+
key: "createTime",
|
|
582
|
+
width: 160,
|
|
583
|
+
render: (l) => l ? new Date(l).toLocaleString("zh-CN") : "-"
|
|
584
|
+
},
|
|
585
|
+
{ title: "模型", dataIndex: "model", key: "model", width: 140 },
|
|
586
|
+
{
|
|
587
|
+
title: "协议",
|
|
588
|
+
dataIndex: "protocol",
|
|
589
|
+
key: "protocol",
|
|
590
|
+
width: 90,
|
|
591
|
+
render: (l) => /* @__PURE__ */ e(Z, { children: l })
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
title: "输入",
|
|
595
|
+
dataIndex: "promptTokens",
|
|
596
|
+
key: "promptTokens",
|
|
597
|
+
width: 70
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
title: "输出",
|
|
601
|
+
dataIndex: "completionTokens",
|
|
602
|
+
key: "completionTokens",
|
|
603
|
+
width: 70
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
title: "总Token",
|
|
607
|
+
dataIndex: "totalTokens",
|
|
608
|
+
key: "totalTokens",
|
|
609
|
+
width: 80
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
title: "耗时",
|
|
613
|
+
dataIndex: "latencyMs",
|
|
614
|
+
key: "latencyMs",
|
|
615
|
+
width: 70,
|
|
616
|
+
render: (l) => l ? `${l}ms` : "-"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
title: "状态",
|
|
620
|
+
dataIndex: "statusCode",
|
|
621
|
+
key: "statusCode",
|
|
622
|
+
width: 60,
|
|
623
|
+
render: (l) => l ? /* @__PURE__ */ e(Z, { color: l < 400 ? "green" : "red", children: l }) : "-"
|
|
624
|
+
}
|
|
625
|
+
], Ie = (l, v) => {
|
|
626
|
+
const Q = Array.isArray(l) ? l : [], L = K.trim().toLowerCase(), H = L ? Q.filter(
|
|
627
|
+
(w) => `${w.description || ""} ${w.akPrefix || ""} ${w.defaultModel || ""}`.toLowerCase().includes(L)
|
|
628
|
+
) : Q;
|
|
629
|
+
return B ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ e(se, { tip: "加载中..." }) }) : Q.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: v ? "暂无应用 AK" : "暂无个人 AK,点击上方按钮生成" }) : H.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: "无匹配 AK" }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: H.map((w) => /* @__PURE__ */ s(
|
|
630
|
+
"div",
|
|
631
|
+
{
|
|
632
|
+
className: t.akCard,
|
|
633
|
+
onClick: () => Fe(w),
|
|
634
|
+
children: [
|
|
635
|
+
/* @__PURE__ */ s("div", { className: t.akCardRow, children: [
|
|
636
|
+
/* @__PURE__ */ e("span", { className: t.akTitle, children: w.description || w.akPrefix.replace("...", "**") }),
|
|
637
|
+
/* @__PURE__ */ e("code", { className: t.akPrefixSmall, children: w.akPrefix.replace("...", "**") }),
|
|
638
|
+
/* @__PURE__ */ e(
|
|
639
|
+
"span",
|
|
640
|
+
{
|
|
641
|
+
className: `${t.akStatus} ${w.active ? t.akStatusActive : t.akStatusRevoked}`,
|
|
642
|
+
children: w.active ? "活跃" : "已吊销"
|
|
643
|
+
}
|
|
644
|
+
),
|
|
645
|
+
w.defaultModel && /* @__PURE__ */ s(Z, { style: { fontSize: 11 }, children: [
|
|
646
|
+
"默认: ",
|
|
647
|
+
w.defaultModel
|
|
648
|
+
] }),
|
|
649
|
+
/* @__PURE__ */ s(
|
|
650
|
+
"div",
|
|
651
|
+
{
|
|
652
|
+
className: t.akCardActions,
|
|
653
|
+
onClick: (ge) => ge.stopPropagation(),
|
|
654
|
+
children: [
|
|
655
|
+
/* @__PURE__ */ e(oe, { title: "复制完整 AK", children: /* @__PURE__ */ e(
|
|
656
|
+
z,
|
|
657
|
+
{
|
|
658
|
+
size: "small",
|
|
659
|
+
icon: /* @__PURE__ */ e(ie, {}),
|
|
660
|
+
onClick: () => qe(w),
|
|
661
|
+
children: "复制"
|
|
662
|
+
}
|
|
663
|
+
) }),
|
|
664
|
+
!v && w.active && /* @__PURE__ */ e(
|
|
665
|
+
z,
|
|
666
|
+
{
|
|
667
|
+
size: "small",
|
|
668
|
+
icon: /* @__PURE__ */ e(Ye, {}),
|
|
669
|
+
onClick: () => void Be(w),
|
|
670
|
+
children: "停用"
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
!v && !w.active && /* @__PURE__ */ e(
|
|
674
|
+
z,
|
|
675
|
+
{
|
|
676
|
+
size: "small",
|
|
677
|
+
type: "primary",
|
|
678
|
+
ghost: !0,
|
|
679
|
+
onClick: () => void Be(w),
|
|
680
|
+
children: "启用"
|
|
681
|
+
}
|
|
682
|
+
),
|
|
683
|
+
!v && w.active && /* @__PURE__ */ e(
|
|
684
|
+
z,
|
|
685
|
+
{
|
|
686
|
+
size: "small",
|
|
687
|
+
danger: !0,
|
|
688
|
+
icon: /* @__PURE__ */ e(Xe, {}),
|
|
689
|
+
onClick: () => je(w.id),
|
|
690
|
+
children: "吊销"
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
)
|
|
696
|
+
] }),
|
|
697
|
+
/* @__PURE__ */ s("div", { className: t.akCardRow2, children: [
|
|
698
|
+
w.tokenQuota > 0 && /* @__PURE__ */ e("div", { className: t.akMiniBar, children: /* @__PURE__ */ e(
|
|
699
|
+
"div",
|
|
700
|
+
{
|
|
701
|
+
className: t.akMiniBarFill,
|
|
702
|
+
style: {
|
|
703
|
+
width: `${Math.min(
|
|
704
|
+
(w.totalTokens || 0) / w.tokenQuota * 100,
|
|
705
|
+
100
|
|
706
|
+
)}%`
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
) }),
|
|
710
|
+
/* @__PURE__ */ s("span", { className: t.akUsageText, children: [
|
|
711
|
+
de(w.totalTokens || 0),
|
|
712
|
+
w.tokenQuota > 0 ? ` / ${de(w.tokenQuota)}` : " tokens"
|
|
713
|
+
] }),
|
|
714
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: w.lastUsedAt ? `最近使用 ${w.lastUsedAt}` : "尚未使用" }),
|
|
715
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: new Date(w.createTime).toLocaleDateString("zh-CN") })
|
|
716
|
+
] })
|
|
717
|
+
]
|
|
718
|
+
},
|
|
719
|
+
w.id
|
|
720
|
+
)) });
|
|
721
|
+
};
|
|
722
|
+
return /* @__PURE__ */ s("div", { className: t.akContainer, children: [
|
|
723
|
+
(Y || $.length > 0 || r) && /* @__PURE__ */ s("div", { className: t.akIntegrationPanel, children: [
|
|
724
|
+
/* @__PURE__ */ s("h4", { className: t.akIntegrationTitle, children: [
|
|
725
|
+
"网关台账",
|
|
726
|
+
Y && /* @__PURE__ */ e("span", { style: { fontWeight: 400, fontSize: 12, marginLeft: 8, opacity: 0.7 }, children: Y.vendors.map((l) => `${l.vendor} ${l.credentials} 凭据/${l.models} 模型`).join(" · ") })
|
|
727
|
+
] }),
|
|
728
|
+
r ? /* @__PURE__ */ e("div", { style: { fontSize: 12, opacity: 0.65 }, children: r }) : $.length === 0 ? /* @__PURE__ */ e("div", { style: { fontSize: 12, opacity: 0.65 }, children: "暂无租户用量(仅绑定 tenantCode 并发生过调用的 AK 才会入账)" }) : /* @__PURE__ */ e(
|
|
729
|
+
ce,
|
|
730
|
+
{
|
|
731
|
+
size: "small",
|
|
732
|
+
rowKey: "tenantCode",
|
|
733
|
+
pagination: !1,
|
|
734
|
+
dataSource: $,
|
|
735
|
+
columns: [
|
|
736
|
+
{ title: "租户", dataIndex: "tenantCode", key: "tenantCode" },
|
|
737
|
+
{ title: "请求数", dataIndex: "requests", key: "requests", width: 90 },
|
|
738
|
+
{
|
|
739
|
+
title: "Prompt",
|
|
740
|
+
dataIndex: "promptTokens",
|
|
741
|
+
key: "promptTokens",
|
|
742
|
+
width: 100,
|
|
743
|
+
render: (l) => de(l)
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
title: "Completion",
|
|
747
|
+
dataIndex: "completionTokens",
|
|
748
|
+
key: "completionTokens",
|
|
749
|
+
width: 110,
|
|
750
|
+
render: (l) => de(l)
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
title: "成本",
|
|
754
|
+
dataIndex: "cost",
|
|
755
|
+
key: "cost",
|
|
756
|
+
width: 90,
|
|
757
|
+
render: (l) => l ? l.toFixed(4) : "-"
|
|
758
|
+
}
|
|
759
|
+
]
|
|
760
|
+
}
|
|
761
|
+
)
|
|
762
|
+
] }),
|
|
763
|
+
/* @__PURE__ */ s("div", { className: t.akIntegrationPanel, children: [
|
|
764
|
+
/* @__PURE__ */ e("h4", { className: t.akIntegrationTitle, children: "协议接入地址" }),
|
|
765
|
+
/* @__PURE__ */ s("div", { className: t.akBaseUrlRow, children: [
|
|
766
|
+
/* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
|
|
767
|
+
/* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "OpenAI 兼容" }),
|
|
768
|
+
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: X }),
|
|
769
|
+
/* @__PURE__ */ e(oe, { title: "复制 Base URL", children: /* @__PURE__ */ e(
|
|
770
|
+
ie,
|
|
771
|
+
{
|
|
772
|
+
className: t.akCopyIcon,
|
|
773
|
+
onClick: () => le(X)
|
|
774
|
+
}
|
|
775
|
+
) })
|
|
776
|
+
] }),
|
|
777
|
+
/* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
|
|
778
|
+
/* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "Anthropic 兼容" }),
|
|
779
|
+
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: X }),
|
|
780
|
+
/* @__PURE__ */ e(oe, { title: "复制 Base URL", children: /* @__PURE__ */ e(
|
|
781
|
+
ie,
|
|
782
|
+
{
|
|
783
|
+
className: t.akCopyIcon,
|
|
784
|
+
onClick: () => le(X)
|
|
785
|
+
}
|
|
786
|
+
) })
|
|
787
|
+
] })
|
|
788
|
+
] }),
|
|
789
|
+
/* @__PURE__ */ s("div", { className: t.akIntegrationGrid, children: [
|
|
790
|
+
/* @__PURE__ */ s("div", { children: [
|
|
791
|
+
/* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "OpenAI 兼容 — curl 示例" }),
|
|
792
|
+
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: Ja(X, D) })
|
|
793
|
+
] }),
|
|
794
|
+
/* @__PURE__ */ s("div", { children: [
|
|
795
|
+
/* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "Anthropic 兼容 — curl 示例" }),
|
|
796
|
+
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: Wa(X, D) })
|
|
797
|
+
] })
|
|
798
|
+
] })
|
|
799
|
+
] }),
|
|
800
|
+
/* @__PURE__ */ s("div", { children: [
|
|
801
|
+
/* @__PURE__ */ s(
|
|
802
|
+
"div",
|
|
803
|
+
{
|
|
804
|
+
style: {
|
|
805
|
+
display: "flex",
|
|
806
|
+
justifyContent: "space-between",
|
|
807
|
+
alignItems: "center",
|
|
808
|
+
marginBottom: 12
|
|
809
|
+
},
|
|
810
|
+
children: [
|
|
811
|
+
/* @__PURE__ */ e(
|
|
812
|
+
$e,
|
|
813
|
+
{
|
|
814
|
+
activeKey: a,
|
|
815
|
+
onChange: (l) => n(l),
|
|
816
|
+
items: [
|
|
817
|
+
{ key: "app", label: "应用 AK" },
|
|
818
|
+
{ key: "personal", label: "个人 AK" }
|
|
819
|
+
],
|
|
820
|
+
style: { flex: 1 }
|
|
821
|
+
}
|
|
822
|
+
),
|
|
823
|
+
/* @__PURE__ */ s("div", { style: { display: "flex", gap: 8 }, children: [
|
|
824
|
+
/* @__PURE__ */ e(
|
|
825
|
+
Ne.Search,
|
|
826
|
+
{
|
|
827
|
+
allowClear: !0,
|
|
828
|
+
placeholder: "按名称 / 前缀过滤",
|
|
829
|
+
style: { width: 200 },
|
|
830
|
+
onChange: (l) => J(l.target.value)
|
|
831
|
+
}
|
|
832
|
+
),
|
|
833
|
+
/* @__PURE__ */ e(z, { icon: /* @__PURE__ */ e(Te, {}), onClick: W, size: "small", children: "刷新" }),
|
|
834
|
+
a === "personal" && /* @__PURE__ */ e(
|
|
835
|
+
z,
|
|
836
|
+
{
|
|
837
|
+
type: "primary",
|
|
838
|
+
icon: /* @__PURE__ */ e(Ke, {}),
|
|
839
|
+
onClick: ke,
|
|
840
|
+
loading: f,
|
|
841
|
+
children: "生成 AK"
|
|
842
|
+
}
|
|
843
|
+
)
|
|
844
|
+
] })
|
|
845
|
+
]
|
|
846
|
+
}
|
|
847
|
+
),
|
|
848
|
+
a === "app" ? Ie(o, !0) : Ie(c, !1)
|
|
849
|
+
] }),
|
|
850
|
+
/* @__PURE__ */ s(
|
|
851
|
+
fe,
|
|
852
|
+
{
|
|
853
|
+
open: C,
|
|
854
|
+
title: "生成新 AK",
|
|
855
|
+
onCancel: () => g(!1),
|
|
856
|
+
onOk: xe,
|
|
857
|
+
okText: "确认生成",
|
|
858
|
+
cancelText: "取消",
|
|
859
|
+
confirmLoading: f,
|
|
860
|
+
children: [
|
|
861
|
+
/* @__PURE__ */ e(
|
|
862
|
+
"div",
|
|
863
|
+
{
|
|
864
|
+
style: {
|
|
865
|
+
marginBottom: 8,
|
|
866
|
+
color: "var(--text-secondary)",
|
|
867
|
+
fontSize: 13
|
|
868
|
+
},
|
|
869
|
+
children: "请输入 AK 名称(用于标识此密钥的用途)"
|
|
870
|
+
}
|
|
871
|
+
),
|
|
872
|
+
/* @__PURE__ */ e(
|
|
873
|
+
Ne,
|
|
874
|
+
{
|
|
875
|
+
placeholder: "例如:测试用 AK、生产网关 AK",
|
|
876
|
+
value: m,
|
|
877
|
+
onChange: (l) => k(l.target.value),
|
|
878
|
+
onPressEnter: xe,
|
|
879
|
+
maxLength: 50,
|
|
880
|
+
autoFocus: !0
|
|
881
|
+
}
|
|
882
|
+
)
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ s(
|
|
887
|
+
fe,
|
|
888
|
+
{
|
|
889
|
+
open: p.open,
|
|
890
|
+
title: "AK 创建成功",
|
|
891
|
+
onCancel: () => d({ open: !1 }),
|
|
892
|
+
footer: [
|
|
893
|
+
/* @__PURE__ */ e(
|
|
894
|
+
z,
|
|
895
|
+
{
|
|
896
|
+
icon: /* @__PURE__ */ e(ie, {}),
|
|
897
|
+
onClick: () => p.apiKey && le(p.apiKey),
|
|
898
|
+
children: "复制 AK"
|
|
899
|
+
},
|
|
900
|
+
"copy"
|
|
901
|
+
),
|
|
902
|
+
/* @__PURE__ */ e(
|
|
903
|
+
z,
|
|
904
|
+
{
|
|
905
|
+
type: "primary",
|
|
906
|
+
onClick: () => d({ open: !1 }),
|
|
907
|
+
children: "我已保存"
|
|
908
|
+
},
|
|
909
|
+
"close"
|
|
910
|
+
)
|
|
911
|
+
],
|
|
912
|
+
children: [
|
|
913
|
+
/* @__PURE__ */ e("div", { style: { marginBottom: 8, color: "#faad14", fontSize: 14 }, children: "请立即保存此 AK,关闭后将无法再次查看完整密钥。" }),
|
|
914
|
+
/* @__PURE__ */ e(
|
|
915
|
+
"div",
|
|
916
|
+
{
|
|
917
|
+
style: {
|
|
918
|
+
background: "var(--bg-tertiary, #f6f8fa)",
|
|
919
|
+
padding: "12px 14px",
|
|
920
|
+
borderRadius: 8,
|
|
921
|
+
fontFamily: "SF Mono, Fira Code, monospace",
|
|
922
|
+
fontSize: 13,
|
|
923
|
+
wordBreak: "break-all",
|
|
924
|
+
userSelect: "all"
|
|
925
|
+
},
|
|
926
|
+
children: p.apiKey
|
|
927
|
+
}
|
|
928
|
+
),
|
|
929
|
+
/* @__PURE__ */ s("div", { style: { marginTop: 8, fontSize: 12, color: "var(--text-muted)" }, children: [
|
|
930
|
+
"前缀: ",
|
|
931
|
+
p.akPrefix
|
|
932
|
+
] })
|
|
933
|
+
]
|
|
934
|
+
}
|
|
935
|
+
),
|
|
936
|
+
/* @__PURE__ */ e(
|
|
937
|
+
Oe,
|
|
938
|
+
{
|
|
939
|
+
title: _ ? /* @__PURE__ */ s("span", { children: [
|
|
940
|
+
"AK 详情 — ",
|
|
941
|
+
/* @__PURE__ */ e("code", { children: _.akPrefix })
|
|
942
|
+
] }) : "AK 详情",
|
|
943
|
+
open: !!_,
|
|
944
|
+
onClose: Je,
|
|
945
|
+
size: "large",
|
|
946
|
+
children: F ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载用量数据..." }) }) : b ? /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
|
|
947
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 12, color: "#8c8c8c", marginBottom: 12 }, children: "以下为网关全局调用统计(近 7 天窗口), 监控侧不按 AK 留存;该 AK 自身的累计消耗见下方「本 AK 累计 Token」。" }),
|
|
948
|
+
/* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
|
|
949
|
+
/* @__PURE__ */ e(P, { title: "总请求数", value: b.totalRequests }),
|
|
950
|
+
/* @__PURE__ */ e(P, { title: "总 Token", value: b.totalTokens }),
|
|
951
|
+
/* @__PURE__ */ e(
|
|
952
|
+
P,
|
|
953
|
+
{
|
|
954
|
+
title: "输入 Token",
|
|
955
|
+
value: b.totalPromptTokens
|
|
956
|
+
}
|
|
957
|
+
),
|
|
958
|
+
/* @__PURE__ */ e(
|
|
959
|
+
P,
|
|
960
|
+
{
|
|
961
|
+
title: "输出 Token",
|
|
962
|
+
value: b.totalCompletionTokens
|
|
963
|
+
}
|
|
964
|
+
),
|
|
965
|
+
/* @__PURE__ */ e(
|
|
966
|
+
P,
|
|
967
|
+
{
|
|
968
|
+
title: "平均耗时",
|
|
969
|
+
value: b.avgLatencyMs,
|
|
970
|
+
suffix: "ms"
|
|
971
|
+
}
|
|
972
|
+
),
|
|
973
|
+
/* @__PURE__ */ e(
|
|
974
|
+
P,
|
|
975
|
+
{
|
|
976
|
+
title: "错误数",
|
|
977
|
+
value: b.errorCount,
|
|
978
|
+
styles: {
|
|
979
|
+
content: {
|
|
980
|
+
color: b.errorCount > 0 ? "#ff4d4f" : void 0
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
),
|
|
985
|
+
/* @__PURE__ */ e(
|
|
986
|
+
P,
|
|
987
|
+
{
|
|
988
|
+
title: "本 AK 累计 Token",
|
|
989
|
+
value: (_ == null ? void 0 : _.totalTokens) ?? 0
|
|
990
|
+
}
|
|
991
|
+
)
|
|
992
|
+
] }),
|
|
993
|
+
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
994
|
+
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "每日调用曲线(按最近调用明细聚合)" }),
|
|
995
|
+
We(b.daily)
|
|
996
|
+
] }),
|
|
997
|
+
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
998
|
+
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "模型用量分布" }),
|
|
999
|
+
Qe(b.models)
|
|
1000
|
+
] }),
|
|
1001
|
+
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1002
|
+
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "最近调用记录" }),
|
|
1003
|
+
/* @__PURE__ */ e(
|
|
1004
|
+
ce,
|
|
1005
|
+
{
|
|
1006
|
+
columns: Ve,
|
|
1007
|
+
dataSource: b.recent,
|
|
1008
|
+
rowKey: "id",
|
|
1009
|
+
size: "small",
|
|
1010
|
+
pagination: {
|
|
1011
|
+
pageSize: 10,
|
|
1012
|
+
size: "small",
|
|
1013
|
+
showSizeChanger: !0,
|
|
1014
|
+
pageSizeOptions: ["10", "20", "50", "100"],
|
|
1015
|
+
showTotal: (l) => `共 ${l} 条`
|
|
1016
|
+
},
|
|
1017
|
+
scroll: { x: 760 }
|
|
1018
|
+
}
|
|
1019
|
+
)
|
|
1020
|
+
] })
|
|
1021
|
+
] }) : /* @__PURE__ */ e("div", { className: t.usageEmpty, children: "暂无用量数据" })
|
|
1022
|
+
}
|
|
1023
|
+
)
|
|
1024
|
+
] });
|
|
1025
|
+
}
|
|
1026
|
+
function Va(a) {
|
|
1027
|
+
const n = [];
|
|
1028
|
+
if (!a) return n;
|
|
1029
|
+
const o = /<(think|thinking|reasoning)>([\s\S]*?)<\/\1>/gi;
|
|
1030
|
+
let i = 0, c;
|
|
1031
|
+
for (; (c = o.exec(a)) !== null; )
|
|
1032
|
+
c.index > i && n.push({ type: "text", text: a.slice(i, c.index) }), n.push({ type: "think", text: c[2] }), i = c.index + c[0].length;
|
|
1033
|
+
return i < a.length && n.push({ type: "text", text: a.slice(i) }), n;
|
|
1034
|
+
}
|
|
1035
|
+
const me = 4;
|
|
1036
|
+
let Ya = 0;
|
|
1037
|
+
function Xa({ initialModels: a }) {
|
|
1038
|
+
const [n, o] = N([]), [i, c] = N([]), [T, B] = N(!0), [S, f] = N(null), [A, C] = N(""), [g, m] = N(!1), k = ye(""), p = ye(/* @__PURE__ */ new Map()), d = ye(/* @__PURE__ */ new Map());
|
|
1039
|
+
V(() => {
|
|
1040
|
+
(async () => {
|
|
1041
|
+
try {
|
|
1042
|
+
const r = await we();
|
|
1043
|
+
c(r), B(!1);
|
|
1044
|
+
const y = a.length > 0 ? a : r.slice(0, 1).map((x) => x.modelName);
|
|
1045
|
+
o(y.slice(0, me).map((x) => _e(x)));
|
|
1046
|
+
} catch (r) {
|
|
1047
|
+
B(!1), f(r instanceof Error ? r.message : "模型列表加载失败");
|
|
1048
|
+
}
|
|
1049
|
+
})();
|
|
1050
|
+
}, []), V(() => {
|
|
1051
|
+
if (a.length > 0 && i.length > 0) {
|
|
1052
|
+
const r = a.slice(0, me).map((y) => _e(y));
|
|
1053
|
+
o(r);
|
|
1054
|
+
}
|
|
1055
|
+
}, [a.join(",")]);
|
|
1056
|
+
const _ = G((r) => {
|
|
1057
|
+
const y = d.current.get(r);
|
|
1058
|
+
y && (y.scrollTop = y.scrollHeight);
|
|
1059
|
+
}, []), h = G(
|
|
1060
|
+
(r, y) => {
|
|
1061
|
+
o((x) => x.map((M) => M.id === r ? y(M) : M));
|
|
1062
|
+
},
|
|
1063
|
+
[]
|
|
1064
|
+
), b = G(async () => {
|
|
1065
|
+
if (k.current) return k.current;
|
|
1066
|
+
const r = await St();
|
|
1067
|
+
return k.current = r, r;
|
|
1068
|
+
}, []), E = G(async () => {
|
|
1069
|
+
const r = A.trim();
|
|
1070
|
+
if (!r || g) return;
|
|
1071
|
+
let y;
|
|
1072
|
+
try {
|
|
1073
|
+
y = await b();
|
|
1074
|
+
} catch {
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
C(""), m(!0);
|
|
1078
|
+
const x = n.map((K) => ({
|
|
1079
|
+
...K,
|
|
1080
|
+
messages: [
|
|
1081
|
+
...K.messages,
|
|
1082
|
+
{ role: "user", content: r },
|
|
1083
|
+
{ role: "assistant", content: "" }
|
|
1084
|
+
],
|
|
1085
|
+
streamingContent: "",
|
|
1086
|
+
isStreaming: !0,
|
|
1087
|
+
error: null,
|
|
1088
|
+
usage: null
|
|
1089
|
+
}));
|
|
1090
|
+
o(x);
|
|
1091
|
+
const M = x;
|
|
1092
|
+
M.forEach((K) => {
|
|
1093
|
+
const J = new AbortController();
|
|
1094
|
+
p.current.set(K.id, J);
|
|
1095
|
+
const X = K.messages.slice(0, -1);
|
|
1096
|
+
ft(y, K.model, X, {
|
|
1097
|
+
onDelta: (D) => {
|
|
1098
|
+
h(K.id, (j) => ({
|
|
1099
|
+
...j,
|
|
1100
|
+
streamingContent: j.streamingContent + D,
|
|
1101
|
+
messages: j.messages.map(
|
|
1102
|
+
(W, ke) => ke === j.messages.length - 1 ? { ...W, content: j.streamingContent + D } : W
|
|
1103
|
+
)
|
|
1104
|
+
})), _(K.id);
|
|
1105
|
+
},
|
|
1106
|
+
onDone: (D) => {
|
|
1107
|
+
h(K.id, (j) => ({
|
|
1108
|
+
...j,
|
|
1109
|
+
isStreaming: !1,
|
|
1110
|
+
usage: D ? {
|
|
1111
|
+
promptTokens: D.promptTokens,
|
|
1112
|
+
completionTokens: D.completionTokens,
|
|
1113
|
+
totalTokens: D.totalTokens
|
|
1114
|
+
} : null
|
|
1115
|
+
})), p.current.delete(K.id);
|
|
1116
|
+
},
|
|
1117
|
+
onError: (D) => {
|
|
1118
|
+
(D.message.includes("401") || D.message.includes("API key")) && (Ge(), k.current = ""), h(K.id, (j) => ({
|
|
1119
|
+
...j,
|
|
1120
|
+
isStreaming: !1,
|
|
1121
|
+
error: D.message
|
|
1122
|
+
})), p.current.delete(K.id);
|
|
1123
|
+
},
|
|
1124
|
+
signal: J.signal
|
|
1125
|
+
}).catch(() => {
|
|
1126
|
+
});
|
|
1127
|
+
});
|
|
1128
|
+
const O = setInterval(() => {
|
|
1129
|
+
M.every(
|
|
1130
|
+
(J) => !p.current.has(J.id)
|
|
1131
|
+
) && (clearInterval(O), m(!1));
|
|
1132
|
+
}, 200);
|
|
1133
|
+
setTimeout(() => {
|
|
1134
|
+
clearInterval(O), m(!1);
|
|
1135
|
+
}, 300 * 1e3);
|
|
1136
|
+
}, [A, g, n, b, h, _]), F = G(() => {
|
|
1137
|
+
p.current.forEach((r) => r.abort()), p.current.clear(), o((r) => r.map((y) => ({ ...y, isStreaming: !1 }))), m(!1);
|
|
1138
|
+
}, []), ae = G(() => {
|
|
1139
|
+
var y;
|
|
1140
|
+
if (n.length >= me) return;
|
|
1141
|
+
const r = (y = i.find((x) => !n.some((M) => M.model === x.modelName))) == null ? void 0 : y.modelName;
|
|
1142
|
+
r && o((x) => [...x, _e(r)]);
|
|
1143
|
+
}, [n, i]), Y = G(() => {
|
|
1144
|
+
p.current.forEach((r) => r.abort()), p.current.clear(), o(
|
|
1145
|
+
(r) => r.map((y) => ({
|
|
1146
|
+
...y,
|
|
1147
|
+
messages: [],
|
|
1148
|
+
streamingContent: "",
|
|
1149
|
+
isStreaming: !1,
|
|
1150
|
+
error: null,
|
|
1151
|
+
usage: null
|
|
1152
|
+
}))
|
|
1153
|
+
), m(!1);
|
|
1154
|
+
}, [g, n]), u = G((r) => {
|
|
1155
|
+
const y = p.current.get(r);
|
|
1156
|
+
y && y.abort(), p.current.delete(r), o((x) => x.filter((M) => M.id !== r));
|
|
1157
|
+
}, []), $ = G(
|
|
1158
|
+
(r, y) => {
|
|
1159
|
+
h(r, (x) => ({ ...x, model: y }));
|
|
1160
|
+
},
|
|
1161
|
+
[h]
|
|
1162
|
+
), R = i.map((r) => ({
|
|
1163
|
+
label: r.modelName,
|
|
1164
|
+
value: r.modelName
|
|
1165
|
+
}));
|
|
1166
|
+
return T ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载模型列表..." }) }) : S ? /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
|
|
1167
|
+
/* @__PURE__ */ e("div", { className: t.chatHeader, children: /* @__PURE__ */ e("h3", { className: t.chatTitle, children: "模型对话" }) }),
|
|
1168
|
+
/* @__PURE__ */ s("div", { className: t.akEmpty, children: [
|
|
1169
|
+
"模型列表加载失败:",
|
|
1170
|
+
S
|
|
1171
|
+
] })
|
|
1172
|
+
] }) : /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
|
|
1173
|
+
/* @__PURE__ */ s("div", { className: t.chatHeader, children: [
|
|
1174
|
+
/* @__PURE__ */ s("h3", { className: t.chatTitle, children: [
|
|
1175
|
+
"模型对话",
|
|
1176
|
+
n.length > 1 && /* @__PURE__ */ s(Z, { color: "blue", style: { marginLeft: 12, fontSize: 12 }, children: [
|
|
1177
|
+
n.length,
|
|
1178
|
+
" 个模型对比"
|
|
1179
|
+
] })
|
|
1180
|
+
] }),
|
|
1181
|
+
/* @__PURE__ */ e(
|
|
1182
|
+
z,
|
|
1183
|
+
{
|
|
1184
|
+
size: "small",
|
|
1185
|
+
icon: /* @__PURE__ */ e(Ze, {}),
|
|
1186
|
+
onClick: Y,
|
|
1187
|
+
disabled: g || n.every((r) => r.messages.length === 0),
|
|
1188
|
+
children: "清空重新来"
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
1191
|
+
] }),
|
|
1192
|
+
/* @__PURE__ */ s("div", { className: t.chatPanels, children: [
|
|
1193
|
+
n.map((r) => /* @__PURE__ */ s("div", { className: t.chatPanel, children: [
|
|
1194
|
+
/* @__PURE__ */ s("div", { className: t.chatPanelHeader, children: [
|
|
1195
|
+
/* @__PURE__ */ e(
|
|
1196
|
+
mt,
|
|
1197
|
+
{
|
|
1198
|
+
size: "small",
|
|
1199
|
+
value: r.model,
|
|
1200
|
+
onChange: (y) => $(r.id, y),
|
|
1201
|
+
options: R,
|
|
1202
|
+
style: { minWidth: 140, flex: 1 },
|
|
1203
|
+
showSearch: !0,
|
|
1204
|
+
optionFilterProp: "label"
|
|
1205
|
+
}
|
|
1206
|
+
),
|
|
1207
|
+
n.length > 1 && /* @__PURE__ */ e(
|
|
1208
|
+
"span",
|
|
1209
|
+
{
|
|
1210
|
+
className: t.chatPanelClose,
|
|
1211
|
+
onClick: () => u(r.id),
|
|
1212
|
+
children: /* @__PURE__ */ e(et, {})
|
|
1213
|
+
}
|
|
1214
|
+
)
|
|
1215
|
+
] }),
|
|
1216
|
+
/* @__PURE__ */ s(
|
|
1217
|
+
"div",
|
|
1218
|
+
{
|
|
1219
|
+
className: t.chatPanelBody,
|
|
1220
|
+
ref: (y) => {
|
|
1221
|
+
d.current.set(r.id, y);
|
|
1222
|
+
},
|
|
1223
|
+
children: [
|
|
1224
|
+
r.messages.map((y, x) => /* @__PURE__ */ s(
|
|
1225
|
+
"div",
|
|
1226
|
+
{
|
|
1227
|
+
className: y.role === "user" ? t.chatMsgUser : t.chatMsgAI,
|
|
1228
|
+
children: [
|
|
1229
|
+
y.role === "assistant" ? Va(y.content).map(
|
|
1230
|
+
(M, O) => M.type === "think" ? /* @__PURE__ */ s(
|
|
1231
|
+
"details",
|
|
1232
|
+
{
|
|
1233
|
+
className: t.chatThinkBlock,
|
|
1234
|
+
children: [
|
|
1235
|
+
/* @__PURE__ */ e("summary", { children: "思考过程" }),
|
|
1236
|
+
/* @__PURE__ */ e("pre", { children: M.text })
|
|
1237
|
+
]
|
|
1238
|
+
},
|
|
1239
|
+
O
|
|
1240
|
+
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: M.text }, O)
|
|
1241
|
+
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: y.content }),
|
|
1242
|
+
r.isStreaming && x === r.messages.length - 1 && y.role === "assistant" && /* @__PURE__ */ e("span", { className: t.chatStreamingCursor })
|
|
1243
|
+
]
|
|
1244
|
+
},
|
|
1245
|
+
x
|
|
1246
|
+
)),
|
|
1247
|
+
r.error && /* @__PURE__ */ e("div", { className: t.chatMsgError, children: r.error }),
|
|
1248
|
+
r.usage && /* @__PURE__ */ s("div", { className: t.chatUsageBar, children: [
|
|
1249
|
+
/* @__PURE__ */ s("span", { children: [
|
|
1250
|
+
"输入: ",
|
|
1251
|
+
r.usage.promptTokens
|
|
1252
|
+
] }),
|
|
1253
|
+
/* @__PURE__ */ s("span", { children: [
|
|
1254
|
+
"输出: ",
|
|
1255
|
+
r.usage.completionTokens
|
|
1256
|
+
] })
|
|
1257
|
+
] })
|
|
1258
|
+
]
|
|
1259
|
+
}
|
|
1260
|
+
)
|
|
1261
|
+
] }, r.id)),
|
|
1262
|
+
n.length < me && /* @__PURE__ */ e(oe, { title: "添加面板", children: /* @__PURE__ */ e("div", { className: t.addPanelBtn, onClick: ae, children: /* @__PURE__ */ e(Ke, {}) }) })
|
|
1263
|
+
] }),
|
|
1264
|
+
/* @__PURE__ */ s("div", { className: t.chatInputBar, children: [
|
|
1265
|
+
/* @__PURE__ */ e(
|
|
1266
|
+
Ne.TextArea,
|
|
1267
|
+
{
|
|
1268
|
+
className: t.chatInput,
|
|
1269
|
+
value: A,
|
|
1270
|
+
onChange: (r) => C(r.target.value),
|
|
1271
|
+
placeholder: "输入消息,所有面板将同时收到并流式输出...",
|
|
1272
|
+
autoSize: { minRows: 1, maxRows: 4 },
|
|
1273
|
+
onPressEnter: (r) => {
|
|
1274
|
+
r.shiftKey || (r.preventDefault(), E());
|
|
1275
|
+
},
|
|
1276
|
+
disabled: g
|
|
1277
|
+
}
|
|
1278
|
+
),
|
|
1279
|
+
g ? /* @__PURE__ */ e(z, { danger: !0, onClick: F, children: "停止" }) : /* @__PURE__ */ s(z, { type: "primary", onClick: E, disabled: !A.trim(), children: [
|
|
1280
|
+
/* @__PURE__ */ e(tt, {}),
|
|
1281
|
+
" 发送"
|
|
1282
|
+
] })
|
|
1283
|
+
] })
|
|
1284
|
+
] });
|
|
1285
|
+
}
|
|
1286
|
+
function _e(a) {
|
|
1287
|
+
return {
|
|
1288
|
+
id: ++Ya,
|
|
1289
|
+
model: a,
|
|
1290
|
+
messages: [],
|
|
1291
|
+
streamingContent: "",
|
|
1292
|
+
isStreaming: !1,
|
|
1293
|
+
error: null,
|
|
1294
|
+
usage: null
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
function Za({ onStartChat: a }) {
|
|
1298
|
+
const [n, o] = N([]), [i, c] = N(!0), [T, B] = N(null), [S, f] = N(/* @__PURE__ */ new Set()), A = () => {
|
|
1299
|
+
c(!0), B(null), we().then((d) => {
|
|
1300
|
+
o(d), c(!1);
|
|
1301
|
+
}).catch((d) => {
|
|
1302
|
+
o([]), B(d instanceof Error ? d.message : "加载失败"), c(!1);
|
|
1303
|
+
});
|
|
1304
|
+
};
|
|
1305
|
+
V(() => {
|
|
1306
|
+
A();
|
|
1307
|
+
}, []);
|
|
1308
|
+
const C = (d) => {
|
|
1309
|
+
f((_) => {
|
|
1310
|
+
const h = new Set(_);
|
|
1311
|
+
return h.has(d) ? h.delete(d) : h.add(d), h;
|
|
1312
|
+
});
|
|
1313
|
+
}, g = Array.from(S), m = (d) => {
|
|
1314
|
+
a([d]);
|
|
1315
|
+
}, k = () => {
|
|
1316
|
+
g.length > 0 && a(g);
|
|
1317
|
+
}, p = (d) => {
|
|
1318
|
+
if (!d) return "default";
|
|
1319
|
+
const _ = d.toLowerCase();
|
|
1320
|
+
return _.includes("aliyun") || _.includes("ali") ? "blue" : _.includes("zhipu") || _.includes("glm") ? "purple" : _.includes("moonshot") || _.includes("kimi") ? "cyan" : _.includes("minimax") ? "orange" : "default";
|
|
1321
|
+
};
|
|
1322
|
+
return i ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载模型列表..." }) }) : T ? /* @__PURE__ */ s("div", { children: [
|
|
1323
|
+
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
1324
|
+
/* @__PURE__ */ e("h3", { className: t.modelMgmtTitle, children: "模型管理" }),
|
|
1325
|
+
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "数据库管理的可用模型,可选择单个或多个模型发起对话对比" })
|
|
1326
|
+
] }),
|
|
1327
|
+
/* @__PURE__ */ s("div", { className: t.akEmpty, children: [
|
|
1328
|
+
"模型列表加载失败:",
|
|
1329
|
+
T,
|
|
1330
|
+
/* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ e(z, { type: "primary", onClick: A, children: "重试" }) })
|
|
1331
|
+
] })
|
|
1332
|
+
] }) : /* @__PURE__ */ s("div", { children: [
|
|
1333
|
+
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
1334
|
+
/* @__PURE__ */ e("h3", { className: t.modelMgmtTitle, children: "模型管理" }),
|
|
1335
|
+
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "数据库管理的可用模型,可选择单个或多个模型发起对话对比" })
|
|
1336
|
+
] }),
|
|
1337
|
+
n.length === 0 && /* @__PURE__ */ e("div", { className: t.akEmpty, children: "后端暂无启用模型(z_team_model_config 中 enable=1 的行),请先在数据库或网关配置中启用" }),
|
|
1338
|
+
/* @__PURE__ */ e("div", { className: t.modelGrid, children: n.map((d) => {
|
|
1339
|
+
const _ = S.has(d.modelName);
|
|
1340
|
+
return /* @__PURE__ */ s(
|
|
1341
|
+
"div",
|
|
1342
|
+
{
|
|
1343
|
+
className: `${t.modelCard} ${_ ? t.modelCardSelected : ""}`,
|
|
1344
|
+
onClick: () => C(d.modelName),
|
|
1345
|
+
children: [
|
|
1346
|
+
/* @__PURE__ */ e(
|
|
1347
|
+
ut,
|
|
1348
|
+
{
|
|
1349
|
+
className: t.modelCheckbox,
|
|
1350
|
+
checked: _,
|
|
1351
|
+
onChange: (h) => {
|
|
1352
|
+
h.stopPropagation(), C(d.modelName);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
),
|
|
1356
|
+
/* @__PURE__ */ s("div", { className: t.modelCardHeader, children: [
|
|
1357
|
+
/* @__PURE__ */ e("div", { className: t.modelIconWrap, children: /* @__PURE__ */ e(he, {}) }),
|
|
1358
|
+
/* @__PURE__ */ s("div", { className: t.modelCardInfo, children: [
|
|
1359
|
+
/* @__PURE__ */ e("h4", { className: t.modelName, children: d.modelName }),
|
|
1360
|
+
/* @__PURE__ */ s("div", { className: t.modelTags, children: [
|
|
1361
|
+
d.modelProvider && /* @__PURE__ */ e(
|
|
1362
|
+
Z,
|
|
1363
|
+
{
|
|
1364
|
+
color: p(d.modelProvider),
|
|
1365
|
+
style: { fontSize: 11, margin: 0 },
|
|
1366
|
+
children: d.modelProvider
|
|
1367
|
+
}
|
|
1368
|
+
),
|
|
1369
|
+
/* @__PURE__ */ e(Z, { style: { fontSize: 11, margin: 0 }, children: d.apiType })
|
|
1370
|
+
] })
|
|
1371
|
+
] })
|
|
1372
|
+
] }),
|
|
1373
|
+
/* @__PURE__ */ e("p", { className: t.modelEndpoint, children: d.endpoint }),
|
|
1374
|
+
/* @__PURE__ */ e("div", { className: t.modelCardFooter, children: /* @__PURE__ */ e(
|
|
1375
|
+
z,
|
|
1376
|
+
{
|
|
1377
|
+
type: "link",
|
|
1378
|
+
size: "small",
|
|
1379
|
+
onClick: (h) => {
|
|
1380
|
+
h.stopPropagation(), m(d.modelName);
|
|
1381
|
+
},
|
|
1382
|
+
children: "发起对话"
|
|
1383
|
+
}
|
|
1384
|
+
) })
|
|
1385
|
+
]
|
|
1386
|
+
},
|
|
1387
|
+
d.modelName
|
|
1388
|
+
);
|
|
1389
|
+
}) }),
|
|
1390
|
+
g.length > 0 && /* @__PURE__ */ s("div", { className: t.modelActionBar, children: [
|
|
1391
|
+
/* @__PURE__ */ s("span", { className: t.modelSelectionCount, children: [
|
|
1392
|
+
"已选择 ",
|
|
1393
|
+
g.length,
|
|
1394
|
+
" 个模型"
|
|
1395
|
+
] }),
|
|
1396
|
+
/* @__PURE__ */ e(
|
|
1397
|
+
z,
|
|
1398
|
+
{
|
|
1399
|
+
type: "primary",
|
|
1400
|
+
onClick: k,
|
|
1401
|
+
disabled: g.length === 0,
|
|
1402
|
+
children: "批量对比"
|
|
1403
|
+
}
|
|
1404
|
+
)
|
|
1405
|
+
] })
|
|
1406
|
+
] });
|
|
1407
|
+
}
|
|
1408
|
+
const en = "_container_15pgq_5", tn = "_page_15pgq_10", an = "_kpiGrid_15pgq_16", nn = "_kpiCard_15pgq_22", sn = "_sectionCard_15pgq_29", on = "_sectionHead_15pgq_36", rn = "_sectionHint_15pgq_42", ln = "_akList_15pgq_47", cn = "_errorState_15pgq_54", dn = "_errorTitle_15pgq_66", mn = "_errorDetail_15pgq_72", I = {
|
|
1409
|
+
container: en,
|
|
1410
|
+
page: tn,
|
|
1411
|
+
kpiGrid: an,
|
|
1412
|
+
kpiCard: nn,
|
|
1413
|
+
sectionCard: sn,
|
|
1414
|
+
sectionHead: on,
|
|
1415
|
+
sectionHint: rn,
|
|
1416
|
+
akList: ln,
|
|
1417
|
+
errorState: cn,
|
|
1418
|
+
errorTitle: dn,
|
|
1419
|
+
errorDetail: mn
|
|
1420
|
+
}, un = dt(
|
|
1421
|
+
() => import("@yuku123/z-agent-component").then((a) => ({ default: a.AgentDashboard }))
|
|
1422
|
+
);
|
|
1423
|
+
function ne(a) {
|
|
1424
|
+
return a >= 1e6 ? `${(a / 1e6).toFixed(2)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : String(a ?? 0);
|
|
1425
|
+
}
|
|
1426
|
+
function hn({ daily: a }) {
|
|
1427
|
+
const n = Object.entries(a);
|
|
1428
|
+
if (n.length === 0) return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
1429
|
+
const o = Math.max(...n.map(([, i]) => i[1] + i[2]), 1);
|
|
1430
|
+
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: n.map(([i, c]) => {
|
|
1431
|
+
const T = c[1] + c[2];
|
|
1432
|
+
return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
|
|
1433
|
+
/* @__PURE__ */ e(oe, { title: `${i}: ${c[0]}次 / ${T} tokens`, children: /* @__PURE__ */ e(
|
|
1434
|
+
"div",
|
|
1435
|
+
{
|
|
1436
|
+
className: t.usageBar,
|
|
1437
|
+
style: { height: `${Math.max(T / o * 100, 2)}%` }
|
|
1438
|
+
}
|
|
1439
|
+
) }),
|
|
1440
|
+
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children: i })
|
|
1441
|
+
] }, i);
|
|
1442
|
+
}) });
|
|
1443
|
+
}
|
|
1444
|
+
function Pe({ models: a }) {
|
|
1445
|
+
const n = Object.entries(a);
|
|
1446
|
+
if (n.length === 0) return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
1447
|
+
const o = Math.max(...n.map(([, i]) => i[0]), 1);
|
|
1448
|
+
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: n.sort((i, c) => c[1][0] - i[1][0]).map(([i, c]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
|
|
1449
|
+
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: i }),
|
|
1450
|
+
/* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
|
|
1451
|
+
"div",
|
|
1452
|
+
{
|
|
1453
|
+
className: t.modelBreakdownFill,
|
|
1454
|
+
style: { width: `${c[0] / o * 100}%` }
|
|
1455
|
+
}
|
|
1456
|
+
) }),
|
|
1457
|
+
/* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
|
|
1458
|
+
c[0],
|
|
1459
|
+
"次 / ",
|
|
1460
|
+
ne(c[1] + (c[2] || 0)),
|
|
1461
|
+
"tokens"
|
|
1462
|
+
] })
|
|
1463
|
+
] }, i)) });
|
|
1464
|
+
}
|
|
1465
|
+
const pn = [
|
|
1466
|
+
{
|
|
1467
|
+
title: "时间",
|
|
1468
|
+
dataIndex: "createTime",
|
|
1469
|
+
key: "createTime",
|
|
1470
|
+
width: 160,
|
|
1471
|
+
render: (a) => a ? new Date(a).toLocaleString("zh-CN") : "-"
|
|
1472
|
+
},
|
|
1473
|
+
{ title: "模型", dataIndex: "model", key: "model", width: 150 },
|
|
1474
|
+
{ title: "协议", dataIndex: "protocol", key: "protocol", width: 90, render: (a) => /* @__PURE__ */ e(Z, { children: a }) },
|
|
1475
|
+
{ title: "输入", dataIndex: "promptTokens", key: "promptTokens", width: 70 },
|
|
1476
|
+
{ title: "输出", dataIndex: "completionTokens", key: "completionTokens", width: 70 },
|
|
1477
|
+
{ title: "总Token", dataIndex: "totalTokens", key: "totalTokens", width: 80 },
|
|
1478
|
+
{ title: "耗时", dataIndex: "latencyMs", key: "latencyMs", width: 70, render: (a) => a ? `${a}ms` : "-" },
|
|
1479
|
+
{
|
|
1480
|
+
title: "状态",
|
|
1481
|
+
dataIndex: "statusCode",
|
|
1482
|
+
key: "statusCode",
|
|
1483
|
+
width: 60,
|
|
1484
|
+
render: (a) => a ? /* @__PURE__ */ e(Z, { color: a < 400 ? "green" : "red", children: a }) : "-"
|
|
1485
|
+
}
|
|
1486
|
+
];
|
|
1487
|
+
function kn(a) {
|
|
1488
|
+
var n;
|
|
1489
|
+
return ((n = a == null ? void 0 : a.stats) == null ? void 0 : n.recent) ?? [];
|
|
1490
|
+
}
|
|
1491
|
+
function gn() {
|
|
1492
|
+
var g;
|
|
1493
|
+
const [a, n] = N(!0), [o, i] = N(null), [c, T] = N(null), [B, S] = N([]), [f, A] = N(null), C = G(async () => {
|
|
1494
|
+
n(!0), i(null);
|
|
1495
|
+
const m = await Promise.allSettled([
|
|
1496
|
+
De(),
|
|
1497
|
+
He(),
|
|
1498
|
+
Tt()
|
|
1499
|
+
]), [k, p, d] = m;
|
|
1500
|
+
k.status === "fulfilled" && T(k.value), p.status === "fulfilled" && S(p.value), d.status === "fulfilled" && A(d.value), m.every((_) => _.status === "rejected") && i(
|
|
1501
|
+
k.status === "rejected" && k.reason instanceof Error ? k.reason.message : "网关控制面加载失败"
|
|
1502
|
+
), n(!1);
|
|
1503
|
+
}, []);
|
|
1504
|
+
return V(() => {
|
|
1505
|
+
C();
|
|
1506
|
+
}, [C]), a ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载网关控制面..." }) }) : o && !c ? /* @__PURE__ */ s("div", { className: I.errorState, children: [
|
|
1507
|
+
/* @__PURE__ */ e("div", { className: I.errorTitle, children: "网关控制面不可用" }),
|
|
1508
|
+
/* @__PURE__ */ e("div", { className: I.errorDetail, children: o }),
|
|
1509
|
+
/* @__PURE__ */ e(z, { icon: /* @__PURE__ */ e(Te, {}), onClick: () => void C(), type: "primary", children: "重试" })
|
|
1510
|
+
] }) : /* @__PURE__ */ s("div", { className: I.page, children: [
|
|
1511
|
+
/* @__PURE__ */ s("div", { className: I.kpiGrid, children: [
|
|
1512
|
+
/* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(
|
|
1513
|
+
P,
|
|
1514
|
+
{
|
|
1515
|
+
title: "网关状态",
|
|
1516
|
+
value: f ? "在线" : "未知",
|
|
1517
|
+
valueStyle: f ? { color: "#52c41a" } : { color: "#faad14" }
|
|
1518
|
+
}
|
|
1519
|
+
) }),
|
|
1520
|
+
/* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(P, { title: "上游厂商", value: ((g = c == null ? void 0 : c.vendors) == null ? void 0 : g.length) ?? 0 }) }),
|
|
1521
|
+
/* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(
|
|
1522
|
+
P,
|
|
1523
|
+
{
|
|
1524
|
+
title: "上游模型总数",
|
|
1525
|
+
value: ((c == null ? void 0 : c.vendors) ?? []).reduce((m, k) => m + (k.models ?? 0), 0)
|
|
1526
|
+
}
|
|
1527
|
+
) }),
|
|
1528
|
+
/* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(P, { title: "网关 AK 数", value: (c == null ? void 0 : c.activeApiKeys) ?? "—" }) })
|
|
1529
|
+
] }),
|
|
1530
|
+
/* @__PURE__ */ e(
|
|
1531
|
+
ce,
|
|
1532
|
+
{
|
|
1533
|
+
size: "small",
|
|
1534
|
+
style: { marginTop: 16 },
|
|
1535
|
+
rowKey: "vendor",
|
|
1536
|
+
pagination: !1,
|
|
1537
|
+
columns: [
|
|
1538
|
+
{ title: "上游厂商", dataIndex: "vendor", key: "vendor" },
|
|
1539
|
+
{ title: "凭据数", dataIndex: "credentials", key: "credentials", width: 100 },
|
|
1540
|
+
{ title: "可用模型数", dataIndex: "models", key: "models", width: 110 }
|
|
1541
|
+
],
|
|
1542
|
+
dataSource: (c == null ? void 0 : c.vendors) ?? [],
|
|
1543
|
+
locale: { emptyText: "网关控制面未返回厂商数据" }
|
|
1544
|
+
}
|
|
1545
|
+
),
|
|
1546
|
+
/* @__PURE__ */ s("div", { className: t.usageSection, style: { marginTop: 16 }, children: [
|
|
1547
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "租户用量台账(网关 UsageLedger,按租户维度)" }),
|
|
1548
|
+
/* @__PURE__ */ e(
|
|
1549
|
+
ce,
|
|
1550
|
+
{
|
|
1551
|
+
size: "small",
|
|
1552
|
+
rowKey: "tenantCode",
|
|
1553
|
+
columns: [
|
|
1554
|
+
{ title: "租户", dataIndex: "tenantCode", key: "tenantCode" },
|
|
1555
|
+
{ title: "请求数", dataIndex: "requests", key: "requests", width: 100 },
|
|
1556
|
+
{ title: "Prompt Tokens", dataIndex: "promptTokens", key: "promptTokens", width: 130, render: (m) => ne(m) },
|
|
1557
|
+
{ title: "Completion Tokens", dataIndex: "completionTokens", key: "completionTokens", width: 160, render: (m) => ne(m) },
|
|
1558
|
+
{ title: "成本", dataIndex: "cost", key: "cost", width: 100 }
|
|
1559
|
+
],
|
|
1560
|
+
dataSource: B,
|
|
1561
|
+
locale: { emptyText: "暂无租户用量(还没有绑定租户的 key 发生过调用)" },
|
|
1562
|
+
pagination: {
|
|
1563
|
+
pageSize: 10,
|
|
1564
|
+
showSizeChanger: !0,
|
|
1565
|
+
pageSizeOptions: ["10", "20", "50"],
|
|
1566
|
+
showTotal: (m) => `共 ${m} 条`
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
)
|
|
1570
|
+
] })
|
|
1571
|
+
] });
|
|
1572
|
+
}
|
|
1573
|
+
function yn() {
|
|
1574
|
+
var _, h, b, E, F, ae, Y;
|
|
1575
|
+
const [a, n] = N(!0), [o, i] = N(null), [c, T] = N([]), [B, S] = N(null), [f, A] = N(null), C = String(Le((u) => {
|
|
1576
|
+
var $;
|
|
1577
|
+
return (($ = u.currentUser) == null ? void 0 : $.id) ?? "";
|
|
1578
|
+
})), g = Array.from(
|
|
1579
|
+
new Set([C, Ue].filter((u) => u !== ""))
|
|
1580
|
+
), m = G(async () => {
|
|
1581
|
+
n(!0), i(null);
|
|
1582
|
+
try {
|
|
1583
|
+
const u = await Promise.allSettled(
|
|
1584
|
+
g.map((O) => pe(O))
|
|
1585
|
+
), $ = [], R = /* @__PURE__ */ new Set();
|
|
1586
|
+
let r = 0;
|
|
1587
|
+
for (const O of u)
|
|
1588
|
+
if (O.status === "fulfilled")
|
|
1589
|
+
for (const K of O.value) {
|
|
1590
|
+
const J = String(K.id ?? K.akPrefix ?? "");
|
|
1591
|
+
R.has(J) || (R.add(J), $.push(K));
|
|
1592
|
+
}
|
|
1593
|
+
else r += 1;
|
|
1594
|
+
if (r === u.length)
|
|
1595
|
+
throw new Error("网关不可达:无法获取 AK 列表");
|
|
1596
|
+
$.sort((O, K) => (O.id ?? 0) - (K.id ?? 0));
|
|
1597
|
+
let y = null, x = null;
|
|
1598
|
+
try {
|
|
1599
|
+
y = await Re(0);
|
|
1600
|
+
} catch (O) {
|
|
1601
|
+
x = O instanceof Error ? O.message : "获取用量失败";
|
|
1602
|
+
}
|
|
1603
|
+
S(y);
|
|
1604
|
+
const M = $.map((O) => ({
|
|
1605
|
+
key: O,
|
|
1606
|
+
stats: y,
|
|
1607
|
+
statsError: x
|
|
1608
|
+
}));
|
|
1609
|
+
T(M);
|
|
1610
|
+
} catch (u) {
|
|
1611
|
+
i(u instanceof Error ? u.message : "加载失败");
|
|
1612
|
+
} finally {
|
|
1613
|
+
n(!1);
|
|
1614
|
+
}
|
|
1615
|
+
}, [g.join(",")]);
|
|
1616
|
+
V(() => {
|
|
1617
|
+
m();
|
|
1618
|
+
}, [m]);
|
|
1619
|
+
const k = Ee(() => {
|
|
1620
|
+
const u = B, $ = {};
|
|
1621
|
+
for (const [R, r] of Object.entries((u == null ? void 0 : u.models) ?? {}))
|
|
1622
|
+
$[R] = [r[0] ?? 0, r[1] ?? 0, r[2] ?? 0];
|
|
1623
|
+
return {
|
|
1624
|
+
requests: (u == null ? void 0 : u.totalRequests) ?? 0,
|
|
1625
|
+
tokens: (u == null ? void 0 : u.totalTokens) ?? 0,
|
|
1626
|
+
avgLatency: (u == null ? void 0 : u.avgLatencyMs) ?? 0,
|
|
1627
|
+
errors: (u == null ? void 0 : u.errorCount) ?? 0,
|
|
1628
|
+
models: $
|
|
1629
|
+
};
|
|
1630
|
+
}, [B]), p = c.reduce((u, $) => u + ($.key.tokenQuota || 0), 0), d = () => a ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载监控数据..." }) }) : o ? /* @__PURE__ */ s("div", { className: I.errorState, children: [
|
|
1631
|
+
/* @__PURE__ */ e("div", { className: I.errorTitle, children: "模型监控数据加载失败" }),
|
|
1632
|
+
/* @__PURE__ */ e("div", { className: I.errorDetail, children: o }),
|
|
1633
|
+
/* @__PURE__ */ e(z, { icon: /* @__PURE__ */ e(Te, {}), onClick: m, type: "primary", children: "重试" })
|
|
1634
|
+
] }) : /* @__PURE__ */ s("div", { className: I.page, children: [
|
|
1635
|
+
/* @__PURE__ */ s("div", { className: I.kpiGrid, children: [
|
|
1636
|
+
/* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(P, { title: "总请求(近7天)", value: k.requests }) }),
|
|
1637
|
+
/* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(P, { title: "总 Tokens", value: ne(k.tokens) }) }),
|
|
1638
|
+
/* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(P, { title: "平均延迟", value: k.avgLatency, suffix: "ms" }) }),
|
|
1639
|
+
/* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(
|
|
1640
|
+
P,
|
|
1641
|
+
{
|
|
1642
|
+
title: "错误数",
|
|
1643
|
+
value: k.errors,
|
|
1644
|
+
valueStyle: k.errors > 0 ? { color: "#ff4d4f" } : void 0
|
|
1645
|
+
}
|
|
1646
|
+
) })
|
|
1647
|
+
] }),
|
|
1648
|
+
/* @__PURE__ */ s("div", { className: I.sectionCard, children: [
|
|
1649
|
+
/* @__PURE__ */ s("div", { className: I.sectionHead, children: [
|
|
1650
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "AK 用量" }),
|
|
1651
|
+
p > 0 && /* @__PURE__ */ s("span", { className: I.sectionHint, children: [
|
|
1652
|
+
"合计额度 ",
|
|
1653
|
+
ne(p),
|
|
1654
|
+
" tokens"
|
|
1655
|
+
] })
|
|
1656
|
+
] }),
|
|
1657
|
+
c.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: "网关下暂无 AK" }) : /* @__PURE__ */ e("div", { className: I.akList, children: c.map((u) => {
|
|
1658
|
+
const $ = u.key.totalTokens ?? 0, R = u.key.tokenQuota || 0, r = R > 0 ? Math.min($ / R * 100, 100) : 0;
|
|
1659
|
+
return /* @__PURE__ */ s(
|
|
1660
|
+
"div",
|
|
1661
|
+
{
|
|
1662
|
+
className: t.akCard,
|
|
1663
|
+
onClick: () => A(u),
|
|
1664
|
+
children: [
|
|
1665
|
+
/* @__PURE__ */ s("div", { className: t.akCardRow, children: [
|
|
1666
|
+
/* @__PURE__ */ e("span", { className: t.akTitle, children: u.key.description || u.key.userName || `AK #${u.key.id}` }),
|
|
1667
|
+
/* @__PURE__ */ e("span", { className: t.akPrefixSmall, children: u.key.akPrefix }),
|
|
1668
|
+
/* @__PURE__ */ e(
|
|
1669
|
+
"span",
|
|
1670
|
+
{
|
|
1671
|
+
className: `${t.akStatus} ${u.key.active ? t.akStatusActive : t.akStatusRevoked}`,
|
|
1672
|
+
children: u.key.active ? "启用" : "吊销"
|
|
1673
|
+
}
|
|
1674
|
+
),
|
|
1675
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: u.key.userId === "system-default" ? "系统对话" : u.key.userId })
|
|
1676
|
+
] }),
|
|
1677
|
+
/* @__PURE__ */ s("div", { className: t.akCardRow2, children: [
|
|
1678
|
+
/* @__PURE__ */ e("div", { className: t.akMiniBar, children: /* @__PURE__ */ e(
|
|
1679
|
+
"div",
|
|
1680
|
+
{
|
|
1681
|
+
className: t.akMiniBarFill,
|
|
1682
|
+
style: { width: `${r}%` }
|
|
1683
|
+
}
|
|
1684
|
+
) }),
|
|
1685
|
+
/* @__PURE__ */ s("span", { className: t.akUsageText, children: [
|
|
1686
|
+
ne($),
|
|
1687
|
+
R > 0 ? ` / ${ne(R)}` : "",
|
|
1688
|
+
" tokens"
|
|
1689
|
+
] }),
|
|
1690
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: u.statsError ? u.statsError : u.key.lastUsedAt ? `最近使用 ${u.key.lastUsedAt}` : "尚未使用" })
|
|
1691
|
+
] })
|
|
1692
|
+
]
|
|
1693
|
+
},
|
|
1694
|
+
u.key.id
|
|
1695
|
+
);
|
|
1696
|
+
}) })
|
|
1697
|
+
] }),
|
|
1698
|
+
/* @__PURE__ */ s("div", { className: I.sectionCard, children: [
|
|
1699
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "模型用量分布(网关全局)" }),
|
|
1700
|
+
/* @__PURE__ */ e(Pe, { models: k.models })
|
|
1701
|
+
] })
|
|
1702
|
+
] });
|
|
1703
|
+
return /* @__PURE__ */ s("div", { className: I.container, children: [
|
|
1704
|
+
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
1705
|
+
/* @__PURE__ */ e("h2", { className: t.modelMgmtTitle, children: "模型监控" }),
|
|
1706
|
+
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "大模型网关管控视图 — 网关全局聚合调用量、Tokens 与延迟(近 7 天)" })
|
|
1707
|
+
] }),
|
|
1708
|
+
/* @__PURE__ */ e(
|
|
1709
|
+
$e,
|
|
1710
|
+
{
|
|
1711
|
+
defaultActiveKey: "usage",
|
|
1712
|
+
items: [
|
|
1713
|
+
{ key: "usage", label: "模型用量", children: d() },
|
|
1714
|
+
{
|
|
1715
|
+
key: "sessions",
|
|
1716
|
+
label: "会话统计",
|
|
1717
|
+
children: /* @__PURE__ */ e(it, { fallback: /* @__PURE__ */ e(se, { tip: "加载会话统计..." }), children: /* @__PURE__ */ e(un, {}) })
|
|
1718
|
+
},
|
|
1719
|
+
{ key: "gateway", label: "网关控制面", children: /* @__PURE__ */ e(gn, {}) }
|
|
1720
|
+
]
|
|
1721
|
+
}
|
|
1722
|
+
),
|
|
1723
|
+
/* @__PURE__ */ e(
|
|
1724
|
+
Oe,
|
|
1725
|
+
{
|
|
1726
|
+
title: f ? `AK 用量 — ${f.key.description || f.key.akPrefix}` : "",
|
|
1727
|
+
width: 860,
|
|
1728
|
+
open: !!f,
|
|
1729
|
+
onClose: () => A(null),
|
|
1730
|
+
destroyOnHidden: !0,
|
|
1731
|
+
children: f && /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
|
|
1732
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 12, color: "#8c8c8c", marginBottom: 12 }, children: "调用监控是网关全局维度(不按 AK 留存),以下统计覆盖全部 AK; 该 AK 自身的累计消耗见「本 AK 累计 Token」。" }),
|
|
1733
|
+
/* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
|
|
1734
|
+
/* @__PURE__ */ e(P, { title: "总请求", value: ((_ = f.stats) == null ? void 0 : _.totalRequests) ?? 0 }),
|
|
1735
|
+
/* @__PURE__ */ e(P, { title: "总 Tokens", value: ((h = f.stats) == null ? void 0 : h.totalTokens) ?? 0 }),
|
|
1736
|
+
/* @__PURE__ */ e(P, { title: "平均延迟", value: ((b = f.stats) == null ? void 0 : b.avgLatencyMs) ?? 0, suffix: "ms" }),
|
|
1737
|
+
/* @__PURE__ */ e(P, { title: "输入 Tokens", value: ((E = f.stats) == null ? void 0 : E.totalPromptTokens) ?? 0 }),
|
|
1738
|
+
/* @__PURE__ */ e(P, { title: "输出 Tokens", value: ((F = f.stats) == null ? void 0 : F.totalCompletionTokens) ?? 0 }),
|
|
1739
|
+
/* @__PURE__ */ e(
|
|
1740
|
+
P,
|
|
1741
|
+
{
|
|
1742
|
+
title: "本 AK 累计 Token",
|
|
1743
|
+
value: f.key.totalTokens ?? 0
|
|
1744
|
+
}
|
|
1745
|
+
),
|
|
1746
|
+
/* @__PURE__ */ e(
|
|
1747
|
+
P,
|
|
1748
|
+
{
|
|
1749
|
+
title: "错误数",
|
|
1750
|
+
value: ((ae = f.stats) == null ? void 0 : ae.errorCount) ?? 0,
|
|
1751
|
+
valueStyle: (((Y = f.stats) == null ? void 0 : Y.errorCount) ?? 0) > 0 ? { color: "#ff4d4f" } : void 0
|
|
1752
|
+
}
|
|
1753
|
+
)
|
|
1754
|
+
] }),
|
|
1755
|
+
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1756
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "每日用量(按最近调用明细聚合)" }),
|
|
1757
|
+
f.stats ? /* @__PURE__ */ e(hn, { daily: f.stats.daily ?? {} }) : /* @__PURE__ */ e("span", { className: t.usageEmpty, children: f.statsError ?? "暂无数据" })
|
|
1758
|
+
] }),
|
|
1759
|
+
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1760
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "模型用量分布(按最近调用明细聚合)" }),
|
|
1761
|
+
f.stats ? /* @__PURE__ */ e(Pe, { models: f.stats.models ?? {} }) : /* @__PURE__ */ e("span", { className: t.usageEmpty, children: f.statsError ?? "暂无数据" })
|
|
1762
|
+
] }),
|
|
1763
|
+
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1764
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "最近调用" }),
|
|
1765
|
+
/* @__PURE__ */ e(
|
|
1766
|
+
ce,
|
|
1767
|
+
{
|
|
1768
|
+
size: "small",
|
|
1769
|
+
columns: pn,
|
|
1770
|
+
dataSource: kn(f),
|
|
1771
|
+
rowKey: "id",
|
|
1772
|
+
pagination: {
|
|
1773
|
+
pageSize: 8,
|
|
1774
|
+
showSizeChanger: !0,
|
|
1775
|
+
pageSizeOptions: ["8", "20", "50", "100"],
|
|
1776
|
+
showTotal: (u) => `共 ${u} 条`
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
)
|
|
1780
|
+
] })
|
|
1781
|
+
] })
|
|
1782
|
+
}
|
|
1783
|
+
)
|
|
1784
|
+
] });
|
|
1785
|
+
}
|
|
1786
|
+
const fn = [
|
|
1787
|
+
{
|
|
1788
|
+
title: "模型",
|
|
1789
|
+
icon: /* @__PURE__ */ e(be, {}),
|
|
1790
|
+
items: [
|
|
1791
|
+
{ key: "model-management", label: "模型管理", icon: /* @__PURE__ */ e(be, {}) },
|
|
1792
|
+
{ key: "model-chat", label: "模型对话", icon: /* @__PURE__ */ e(st, {}) },
|
|
1793
|
+
{ key: "model-monitor", label: "模型监控", icon: /* @__PURE__ */ e(ot, {}) }
|
|
1794
|
+
]
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
title: "接入",
|
|
1798
|
+
icon: /* @__PURE__ */ e(Me, {}),
|
|
1799
|
+
items: [
|
|
1800
|
+
{ key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(Me, {}) }
|
|
1801
|
+
]
|
|
1802
|
+
},
|
|
1803
|
+
{
|
|
1804
|
+
title: "智能体",
|
|
1805
|
+
icon: /* @__PURE__ */ e(he, {}),
|
|
1806
|
+
items: [
|
|
1807
|
+
{ key: "agent-app", label: "Agent 应用", icon: /* @__PURE__ */ e(he, {}) },
|
|
1808
|
+
{ key: "agent-instance", label: "Agent 实例", icon: /* @__PURE__ */ e(rt, {}) },
|
|
1809
|
+
{ key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(lt, {}) },
|
|
1810
|
+
{ key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(ct, {}) }
|
|
1811
|
+
]
|
|
1812
|
+
}
|
|
1813
|
+
];
|
|
1814
|
+
function An() {
|
|
1815
|
+
const [a, n] = N("model-management"), [o, i] = N([]), [c, T] = N(/* @__PURE__ */ new Set()), B = (C) => {
|
|
1816
|
+
i(C), n("model-chat");
|
|
1817
|
+
}, S = Ee(() => fn, []);
|
|
1818
|
+
V(() => {
|
|
1819
|
+
a && S.forEach((C) => {
|
|
1820
|
+
C.items.some((g) => g.key === a) && T(
|
|
1821
|
+
(g) => g.has(C.title) ? g : new Set(g).add(C.title)
|
|
1822
|
+
);
|
|
1823
|
+
});
|
|
1824
|
+
}, [a, S]);
|
|
1825
|
+
const f = (C) => {
|
|
1826
|
+
T((g) => {
|
|
1827
|
+
const m = new Set(g);
|
|
1828
|
+
return m.has(C) ? m.delete(C) : m.add(C), m;
|
|
1829
|
+
});
|
|
1830
|
+
}, A = (C, g, m = !1) => /* @__PURE__ */ e(
|
|
1831
|
+
"div",
|
|
1832
|
+
{
|
|
1833
|
+
style: {
|
|
1834
|
+
display: a === C ? m ? "flex" : "block" : "none",
|
|
1835
|
+
height: "100%",
|
|
1836
|
+
...m ? { flexDirection: "column" } : {}
|
|
1837
|
+
},
|
|
1838
|
+
children: g
|
|
1839
|
+
}
|
|
1840
|
+
);
|
|
1841
|
+
return /* @__PURE__ */ s("div", { className: t.container, children: [
|
|
1842
|
+
/* @__PURE__ */ s("aside", { className: U.sidebar, children: [
|
|
1843
|
+
/* @__PURE__ */ s("div", { className: U.sidebarHeader, children: [
|
|
1844
|
+
/* @__PURE__ */ e(he, {}),
|
|
1845
|
+
/* @__PURE__ */ e("span", { children: "智能" })
|
|
1846
|
+
] }),
|
|
1847
|
+
/* @__PURE__ */ e("nav", { className: U.menuList, children: S.map((C) => {
|
|
1848
|
+
const g = c.has(C.title), m = C.items.findIndex((k) => k.key === a);
|
|
1849
|
+
return /* @__PURE__ */ s("div", { className: U.menuGroup, children: [
|
|
1850
|
+
/* @__PURE__ */ s(
|
|
1851
|
+
"div",
|
|
1852
|
+
{
|
|
1853
|
+
className: `${U.menuGroupHeader} ${g ? U.menuGroupHeaderOpen : ""} ${m >= 0 ? U.menuGroupHeaderActive : ""}`,
|
|
1854
|
+
onClick: () => f(C.title),
|
|
1855
|
+
children: [
|
|
1856
|
+
/* @__PURE__ */ e("span", { className: U.menuGroupIcon, children: C.icon }),
|
|
1857
|
+
/* @__PURE__ */ e("span", { className: U.menuGroupLabel, children: C.title }),
|
|
1858
|
+
/* @__PURE__ */ e("span", { className: U.menuGroupArrow, children: g ? /* @__PURE__ */ e(at, {}) : /* @__PURE__ */ e(nt, {}) })
|
|
1859
|
+
]
|
|
1860
|
+
}
|
|
1861
|
+
),
|
|
1862
|
+
g && /* @__PURE__ */ e("ul", { className: U.menuSubList, children: C.items.map((k, p) => {
|
|
1863
|
+
const d = m >= 0 && p <= m;
|
|
1864
|
+
return /* @__PURE__ */ e(
|
|
1865
|
+
"li",
|
|
1866
|
+
{
|
|
1867
|
+
className: `${U.menuSubItem} ${d ? U.menuItemOnPath : ""} ${a === k.key ? U.menuSubItemActive : ""}`,
|
|
1868
|
+
onClick: () => n(k.key),
|
|
1869
|
+
children: /* @__PURE__ */ s("div", { className: U.menuSubItemPill, children: [
|
|
1870
|
+
/* @__PURE__ */ e("span", { className: U.menuSubItemIcon, children: k.icon }),
|
|
1871
|
+
/* @__PURE__ */ e("span", { children: k.label })
|
|
1872
|
+
] })
|
|
1873
|
+
},
|
|
1874
|
+
k.key
|
|
1875
|
+
);
|
|
1876
|
+
}) })
|
|
1877
|
+
] }, C.title);
|
|
1878
|
+
}) })
|
|
1879
|
+
] }),
|
|
1880
|
+
/* @__PURE__ */ s("main", { className: t.panelArea, children: [
|
|
1881
|
+
A("model-management", /* @__PURE__ */ e(Za, { onStartChat: B })),
|
|
1882
|
+
A("model-chat", /* @__PURE__ */ e(Xa, { initialModels: o }), !0),
|
|
1883
|
+
A("ak-management", /* @__PURE__ */ e(Qa, {})),
|
|
1884
|
+
A("agent-app", /* @__PURE__ */ e(ht, {})),
|
|
1885
|
+
A("agent-instance", /* @__PURE__ */ e(pt, {})),
|
|
1886
|
+
A("mcp-service", /* @__PURE__ */ e(kt, {})),
|
|
1887
|
+
A("skill-market", /* @__PURE__ */ e(gt, {})),
|
|
1888
|
+
A("model-monitor", /* @__PURE__ */ e(yn, {}))
|
|
1889
|
+
] })
|
|
1890
|
+
] });
|
|
1891
|
+
}
|
|
1892
|
+
export {
|
|
1893
|
+
An as default
|
|
1894
|
+
};
|