@yuku123/z-team-component 0.2.46 → 0.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ComponentDoc-Bgk7vVRl.js → ComponentDoc-FxbM6ncV.js} +39 -39
- package/dist/{InvitationManagementPage-CJ7221xy.js → InvitationManagementPage-vVRv7TCo.js} +1 -1
- package/dist/{OnboardingPage-BAPaHWAG.js → OnboardingPage-clQvJ-M2.js} +2 -2
- package/dist/{SystemShell-9354yfAu.js → SystemShell-BEGk1kAl.js} +1 -1
- package/dist/{api-BBVndbPG.js → api-DYJa6iNh.js} +1 -1
- package/dist/{index-BNAnqNMm.js → index-9UUM0xgl.js} +1056 -1054
- package/dist/{index-3UOwUv4A.js → index-B5c2tEWO.js} +2 -2
- package/dist/{index-D4tQ0KN9.js → index-BAY37t4f.js} +1 -1
- package/dist/{index-CjhBIxoG.js → index-BI13V6Vn.js} +1 -1
- package/dist/index-BYboYcBe.js +844 -0
- package/dist/{index-BBKatjOg.js → index-BjECQ0AM.js} +1 -1
- package/dist/{index-BfRlRsfj.js → index-CR3sbzOU.js} +3 -3
- package/dist/{index-d-1KM3FU.js → index-CtWrcU5w.js} +2005 -1973
- package/dist/{index-BdQYlCsi.js → index-DdPQcBkY.js} +362 -357
- package/dist/{index-BKQbeDm4.js → index-oEt7V3Pg.js} +1203 -1218
- package/dist/index.js +1 -1
- package/dist/pages.js +1 -1
- package/dist/{schedule-Dstx5SE_.js → schedule-C-4ksDPw.js} +34 -34
- package/dist/{webide-qCE8lM1s.js → webide-RsFP9pHM.js} +1898 -1897
- package/package.json +1 -1
- package/dist/index-CcpWacSZ.js +0 -1664
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { CopyOutlined as se, ReloadOutlined as Te, PlusOutlined as Se, DeleteOutlined as
|
|
3
|
-
import { Tooltip as W, Tabs as Ae, Button as
|
|
4
|
-
import { useState as S, useEffect as X, useCallback as
|
|
2
|
+
import { CopyOutlined as se, ReloadOutlined as Te, PlusOutlined as Se, DeleteOutlined as Oe, ClearOutlined as De, CloseOutlined as Le, SendOutlined as ze, RobotOutlined as Ce, CloudServerOutlined as Re, MessageOutlined as Ue, KeyOutlined as He, ApiOutlined as je, ToolOutlined as qe, BarChartOutlined as Fe } from "@ant-design/icons";
|
|
3
|
+
import { Tooltip as W, Tabs as Ae, Button as R, Modal as de, Input as we, Drawer as xe, Spin as V, Statistic as $, Table as Ke, message as J, Tag as Q, Select as Ge, Checkbox as Je } from "antd";
|
|
4
|
+
import { useState as S, useEffect as X, useCallback as q, useRef as me, useMemo as Me, Suspense as Qe, lazy as We } from "react";
|
|
5
5
|
import { s as t } from "./SmartWorkbench.module-xRRmpTTw.js";
|
|
6
|
-
import { u as
|
|
7
|
-
import { AgentAppList as
|
|
8
|
-
const le = "ft_gateway_default_ak", Z = "", he = "";
|
|
6
|
+
import { u as _e } from "./useAppStore-ibJyVIAX.js";
|
|
7
|
+
import { AgentAppList as Ye, McpPage as Ve, SkillMarket as Xe } from "@yuku123/z-agent-component";
|
|
8
|
+
const le = "ft_gateway_default_ak", be = "system-default", Z = "", he = "";
|
|
9
9
|
function ee(a = {}) {
|
|
10
10
|
const n = { Accept: "application/json", ...a };
|
|
11
11
|
try {
|
|
@@ -15,7 +15,7 @@ function ee(a = {}) {
|
|
|
15
15
|
}
|
|
16
16
|
return n;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Ze(a) {
|
|
19
19
|
return {
|
|
20
20
|
modelName: String(a.modelName ?? a.model_name ?? a.service ?? ""),
|
|
21
21
|
service: String(a.service ?? a.modelName ?? ""),
|
|
@@ -48,10 +48,10 @@ async function ge() {
|
|
|
48
48
|
const l = n != null && n.success ? n.data : (n == null ? void 0 : n.data) ?? n;
|
|
49
49
|
if (!Array.isArray(l))
|
|
50
50
|
throw new Error("模型列表返回格式异常(非数组)");
|
|
51
|
-
return l.map(
|
|
51
|
+
return l.map(Ze);
|
|
52
52
|
}
|
|
53
|
-
async function
|
|
54
|
-
var f,
|
|
53
|
+
async function et(a, n, l, i) {
|
|
54
|
+
var f, M, D, x;
|
|
55
55
|
const m = await fetch(`${he}/v1/chat/completions`, {
|
|
56
56
|
method: "POST",
|
|
57
57
|
headers: {
|
|
@@ -67,25 +67,25 @@ async function Ze(a, n, l, i) {
|
|
|
67
67
|
signal: i.signal
|
|
68
68
|
});
|
|
69
69
|
if (!m.ok || !m.body) {
|
|
70
|
-
const
|
|
71
|
-
if (/<!doctype html/i.test(
|
|
70
|
+
const T = await m.text().catch(() => "");
|
|
71
|
+
if (/<!doctype html/i.test(T.slice(0, 200)))
|
|
72
72
|
throw new Error("模型网关未接入(/v1/chat/completions 落到主壳 SPA,无网关响应)");
|
|
73
|
-
let
|
|
73
|
+
let A = `HTTP ${m.status}`;
|
|
74
74
|
try {
|
|
75
|
-
const h = JSON.parse(
|
|
76
|
-
|
|
75
|
+
const h = JSON.parse(T);
|
|
76
|
+
A = ((f = h == null ? void 0 : h.error) == null ? void 0 : f.message) ?? A;
|
|
77
77
|
} catch {
|
|
78
|
-
|
|
78
|
+
T && (A = T);
|
|
79
79
|
}
|
|
80
|
-
throw new Error(
|
|
80
|
+
throw new Error(A);
|
|
81
81
|
}
|
|
82
|
-
const N = m.body.getReader(),
|
|
82
|
+
const N = m.body.getReader(), v = new TextDecoder();
|
|
83
83
|
let y = "";
|
|
84
84
|
try {
|
|
85
85
|
for (; ; ) {
|
|
86
|
-
const { done:
|
|
87
|
-
if (
|
|
88
|
-
y +=
|
|
86
|
+
const { done: T, value: A } = await N.read();
|
|
87
|
+
if (T) break;
|
|
88
|
+
y += v.decode(A, { stream: !0 });
|
|
89
89
|
const h = y.split(`
|
|
90
90
|
|
|
91
91
|
`);
|
|
@@ -103,10 +103,10 @@ async function Ze(a, n, l, i) {
|
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
105
|
try {
|
|
106
|
-
const o = JSON.parse(g),
|
|
107
|
-
if (Array.isArray(
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
106
|
+
const o = JSON.parse(g), K = o == null ? void 0 : o.choices;
|
|
107
|
+
if (Array.isArray(K) && K.length > 0) {
|
|
108
|
+
const E = (M = K[0]) == null ? void 0 : M.delta;
|
|
109
|
+
if (E != null && E.content && i.onDelta(E.content), (D = K[0]) == null ? void 0 : D.finish_reason) {
|
|
110
110
|
const G = o != null && o.usage ? {
|
|
111
111
|
promptTokens: o.usage.prompt_tokens ?? 0,
|
|
112
112
|
completionTokens: o.usage.completion_tokens ?? 0,
|
|
@@ -117,12 +117,12 @@ async function Ze(a, n, l, i) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
if (o != null && o.usage) {
|
|
120
|
-
const
|
|
120
|
+
const E = {
|
|
121
121
|
promptTokens: o.usage.prompt_tokens ?? 0,
|
|
122
122
|
completionTokens: o.usage.completion_tokens ?? 0,
|
|
123
123
|
totalTokens: o.usage.total_tokens ?? 0
|
|
124
124
|
};
|
|
125
|
-
i.onDone(
|
|
125
|
+
i.onDone(E);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
} catch {
|
|
@@ -130,9 +130,9 @@ async function Ze(a, n, l, i) {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
i.onDone();
|
|
133
|
-
} catch (
|
|
134
|
-
if ((
|
|
135
|
-
throw i.onError(
|
|
133
|
+
} catch (T) {
|
|
134
|
+
if ((x = i.signal) != null && x.aborted) return;
|
|
135
|
+
throw i.onError(T instanceof Error ? T : new Error(String(T))), T;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
async function ae(a, n) {
|
|
@@ -147,7 +147,7 @@ async function ae(a, n) {
|
|
|
147
147
|
throw new Error(`${n}返回非 JSON:${l.slice(0, 120)}`);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function tt(a) {
|
|
151
151
|
const n = a.status === 1;
|
|
152
152
|
return {
|
|
153
153
|
id: Number(a.id),
|
|
@@ -169,7 +169,7 @@ function et(a) {
|
|
|
169
169
|
secret: a.secret_key
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
async function
|
|
172
|
+
async function Ee(a, n, l) {
|
|
173
173
|
const i = await fetch(`${Z}/api/ak/create`, {
|
|
174
174
|
method: "POST",
|
|
175
175
|
headers: ee({ Accept: "application/json", "Content-Type": "application/json" }),
|
|
@@ -181,17 +181,17 @@ async function _e(a, n, l) {
|
|
|
181
181
|
ownerUserId: a,
|
|
182
182
|
ownerUserName: n
|
|
183
183
|
})
|
|
184
|
-
}), m = await ae(i, "创建 AK"), N = (m == null ? void 0 : m.data) ?? {},
|
|
185
|
-
return
|
|
184
|
+
}), m = await ae(i, "创建 AK"), N = (m == null ? void 0 : m.data) ?? {}, v = N.accessKey ?? "", y = N.secretKey ?? "";
|
|
185
|
+
return v && y && ke(v, y), { apiKey: y, akPrefix: v, message: "AK 已创建,secretKey 仅创建时可见" };
|
|
186
186
|
}
|
|
187
187
|
async function oe(a) {
|
|
188
188
|
const n = await fetch(
|
|
189
189
|
`${Z}/api/ak/list`,
|
|
190
190
|
{ headers: ee({ Accept: "application/json" }), credentials: "include" }
|
|
191
191
|
), l = await ae(n, "获取 AK 列表"), i = Array.isArray(l == null ? void 0 : l.data) ? l.data : [];
|
|
192
|
-
return (a ? i.filter((N) =>
|
|
192
|
+
return (a ? i.filter((N) => (N.owner_user_id == null || N.owner_user_id === "" ? be : String(N.owner_user_id)) === String(a)) : i).filter((N) => (N.is_deleted ?? 0) === 0).map(tt);
|
|
193
193
|
}
|
|
194
|
-
async function
|
|
194
|
+
async function at(a) {
|
|
195
195
|
const n = await fetch(`${Z}/api/ak/delete?id=${encodeURIComponent(String(a))}`, {
|
|
196
196
|
method: "POST",
|
|
197
197
|
headers: ee({ Accept: "application/json" }),
|
|
@@ -199,8 +199,8 @@ async function tt(a) {
|
|
|
199
199
|
});
|
|
200
200
|
await ae(n, "吊销 AK");
|
|
201
201
|
}
|
|
202
|
-
async function
|
|
203
|
-
var
|
|
202
|
+
async function Pe(a) {
|
|
203
|
+
var T, A;
|
|
204
204
|
const n = await fetch(
|
|
205
205
|
`${Z}/api/admin/llm-call-monitor/stats?hours=168`,
|
|
206
206
|
{ headers: ee({ Accept: "application/json" }), credentials: "include" }
|
|
@@ -211,17 +211,17 @@ async function Ee(a) {
|
|
|
211
211
|
`${Z}/api/admin/llm-call-monitor/recent?page=1&size=20`,
|
|
212
212
|
{ headers: ee({ Accept: "application/json" }), credentials: "include" }
|
|
213
213
|
), d = await ae(h, "获取调用明细");
|
|
214
|
-
N = (Array.isArray((
|
|
215
|
-
const
|
|
214
|
+
N = (Array.isArray((T = d == null ? void 0 : d.data) == null ? void 0 : T.records) ? d.data.records : []).map((o, K) => {
|
|
215
|
+
const E = Number(o.promptTokens ?? 0), F = Number(o.completionTokens ?? 0);
|
|
216
216
|
return {
|
|
217
|
-
id: Number(o.id ??
|
|
217
|
+
id: Number(o.id ?? K),
|
|
218
218
|
apiKeyId: a,
|
|
219
219
|
protocol: "chat/completions",
|
|
220
220
|
model: String(o.model ?? ""),
|
|
221
221
|
stream: Number(o.stream ?? 0),
|
|
222
|
-
promptTokens:
|
|
223
|
-
completionTokens:
|
|
224
|
-
totalTokens: Number(o.totalTokens ??
|
|
222
|
+
promptTokens: E,
|
|
223
|
+
completionTokens: F,
|
|
224
|
+
totalTokens: Number(o.totalTokens ?? E + F),
|
|
225
225
|
latencyMs: Number(o.durationMs ?? 0),
|
|
226
226
|
statusCode: o.success === !1 || o.success === 0 ? 500 : 200,
|
|
227
227
|
errorMsg: o.errorType ?? null,
|
|
@@ -230,9 +230,9 @@ async function Ee(a) {
|
|
|
230
230
|
});
|
|
231
231
|
} catch {
|
|
232
232
|
}
|
|
233
|
-
const
|
|
233
|
+
const v = {}, y = {};
|
|
234
234
|
for (const h of N) {
|
|
235
|
-
const d =
|
|
235
|
+
const d = v[A = h.model] || (v[A] = [0, 0, 0]);
|
|
236
236
|
d[0] += 1, d[1] += h.promptTokens, d[2] += h.completionTokens;
|
|
237
237
|
const g = (h.createTime || "").slice(0, 10);
|
|
238
238
|
if (g) {
|
|
@@ -240,22 +240,22 @@ async function Ee(a) {
|
|
|
240
240
|
o[0] += 1, o[1] += h.promptTokens, o[2] += h.completionTokens;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
const f = Number(m.totalTokens ?? 0),
|
|
243
|
+
const f = Number(m.totalTokens ?? 0), M = N.reduce((h, d) => h + d.totalTokens, 0), D = N.reduce((h, d) => h + d.promptTokens, 0), x = N.reduce((h, d) => h + d.completionTokens, 0);
|
|
244
244
|
return {
|
|
245
245
|
totalRequests: Number(m.totalCount ?? 0),
|
|
246
246
|
// 汇总口径优先用后端整窗合计(后端 selectStats 才有 token 合计),
|
|
247
247
|
// 明细只有最近一页 ⇒ 只在汇总缺失时用明细兜底。
|
|
248
|
-
totalPromptTokens: Number(m.totalPromptTokens ?? 0) ||
|
|
249
|
-
totalCompletionTokens: Number(m.totalCompletionTokens ?? 0) ||
|
|
250
|
-
totalTokens: f ||
|
|
248
|
+
totalPromptTokens: Number(m.totalPromptTokens ?? 0) || D,
|
|
249
|
+
totalCompletionTokens: Number(m.totalCompletionTokens ?? 0) || x,
|
|
250
|
+
totalTokens: f || M,
|
|
251
251
|
avgLatencyMs: Number(m.avgDurationMs ?? 0),
|
|
252
252
|
errorCount: Number(m.failCount ?? 0),
|
|
253
253
|
daily: y,
|
|
254
|
-
models:
|
|
254
|
+
models: v,
|
|
255
255
|
recent: N
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function nt() {
|
|
259
259
|
return typeof window < "u" ? `${window.location.origin}${he}` : he;
|
|
260
260
|
}
|
|
261
261
|
const pe = "ft_gateway_ak_cache";
|
|
@@ -266,14 +266,14 @@ function ke(a, n) {
|
|
|
266
266
|
} catch {
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function st(a) {
|
|
270
270
|
try {
|
|
271
271
|
return JSON.parse(localStorage.getItem(pe) || "{}")[a] || null;
|
|
272
272
|
} catch {
|
|
273
273
|
return null;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
async function
|
|
276
|
+
async function rt() {
|
|
277
277
|
try {
|
|
278
278
|
const i = localStorage.getItem(le);
|
|
279
279
|
if (i) return i;
|
|
@@ -287,7 +287,7 @@ async function st() {
|
|
|
287
287
|
}
|
|
288
288
|
return n.akPrefix && ke(n.akPrefix, n.secret), n.secret;
|
|
289
289
|
}
|
|
290
|
-
const l = await
|
|
290
|
+
const l = await Ee(
|
|
291
291
|
"system-default",
|
|
292
292
|
"系统默认",
|
|
293
293
|
"智能工作台默认AK(自动创建)"
|
|
@@ -300,7 +300,7 @@ async function st() {
|
|
|
300
300
|
}
|
|
301
301
|
return l.apiKey;
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function Ie() {
|
|
304
304
|
try {
|
|
305
305
|
localStorage.removeItem(le);
|
|
306
306
|
} catch {
|
|
@@ -309,7 +309,7 @@ function Pe() {
|
|
|
309
309
|
function Ne(a) {
|
|
310
310
|
return a >= 1e6 ? `${(a / 1e6).toFixed(1)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : `${a}`;
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function lt(a, n) {
|
|
313
313
|
return `# OpenAI 兼容
|
|
314
314
|
curl -X POST ${a}/v1/chat/completions \\
|
|
315
315
|
-H "Content-Type: application/json" \\
|
|
@@ -320,7 +320,7 @@ curl -X POST ${a}/v1/chat/completions \\
|
|
|
320
320
|
"stream": true
|
|
321
321
|
}'`;
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function ot(a, n) {
|
|
324
324
|
return `# Anthropic 兼容
|
|
325
325
|
curl -X POST ${a}/v1/messages \\
|
|
326
326
|
-H "Content-Type: application/json" \\
|
|
@@ -330,35 +330,35 @@ curl -X POST ${a}/v1/messages \\
|
|
|
330
330
|
"messages": [{"role":"user","content":"你好"}]
|
|
331
331
|
}'`;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
const [a, n] = S("personal"), [l, i] = S([]), [m, N] = S([]), [
|
|
333
|
+
function it() {
|
|
334
|
+
const [a, n] = S("personal"), [l, i] = S([]), [m, N] = S([]), [v, y] = S(!0), [f, M] = S(!1), [D, x] = S(!1), [T, A] = S(""), [h, d] = S({ open: !1 }), [g, o] = S(null), [K, E] = S(null), [F, G] = S(!1), H = _e((u) => u.currentUser), c = String((H == null ? void 0 : H.id) ?? ""), P = (H == null ? void 0 : H.username) ?? "", I = nt(), [r, p] = S("<model-name>");
|
|
335
335
|
X(() => {
|
|
336
336
|
let u = !1;
|
|
337
|
-
return ge().then((
|
|
338
|
-
!u &&
|
|
337
|
+
return ge().then((w) => {
|
|
338
|
+
!u && w.length > 0 && p(w[0].modelName);
|
|
339
339
|
}).catch(() => {
|
|
340
340
|
}), () => {
|
|
341
341
|
u = !0;
|
|
342
342
|
};
|
|
343
343
|
}, []);
|
|
344
|
-
const
|
|
344
|
+
const C = q(async () => {
|
|
345
345
|
y(!0);
|
|
346
346
|
try {
|
|
347
|
-
const u = c ? await oe(c).catch(() => []) : [], [
|
|
347
|
+
const u = c ? await oe(c).catch(() => []) : [], [w] = await Promise.all([
|
|
348
348
|
oe("system-default").catch(() => [])
|
|
349
349
|
]);
|
|
350
|
-
i(
|
|
350
|
+
i(w), N(u);
|
|
351
351
|
} finally {
|
|
352
352
|
y(!1);
|
|
353
353
|
}
|
|
354
354
|
}, [c]);
|
|
355
355
|
X(() => {
|
|
356
|
-
|
|
357
|
-
}, [
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
},
|
|
361
|
-
if (!
|
|
356
|
+
C();
|
|
357
|
+
}, [C]);
|
|
358
|
+
const B = () => {
|
|
359
|
+
A(""), x(!0);
|
|
360
|
+
}, b = async () => {
|
|
361
|
+
if (!T.trim()) {
|
|
362
362
|
J.warning("请输入 AK 名称");
|
|
363
363
|
return;
|
|
364
364
|
}
|
|
@@ -366,20 +366,20 @@ function ot() {
|
|
|
366
366
|
J.warning("登录态不可用,无法生成 AK");
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
M(!0);
|
|
370
370
|
try {
|
|
371
|
-
const u = await
|
|
372
|
-
ke(u.akPrefix, u.apiKey),
|
|
371
|
+
const u = await Ee(c, P, T.trim());
|
|
372
|
+
ke(u.akPrefix, u.apiKey), x(!1), d({
|
|
373
373
|
open: !0,
|
|
374
374
|
apiKey: u.apiKey,
|
|
375
375
|
akPrefix: u.akPrefix
|
|
376
|
-
}),
|
|
376
|
+
}), C();
|
|
377
377
|
} catch (u) {
|
|
378
378
|
J.error(u instanceof Error ? u.message : "创建 AK 失败");
|
|
379
379
|
} finally {
|
|
380
|
-
|
|
380
|
+
M(!1);
|
|
381
381
|
}
|
|
382
|
-
},
|
|
382
|
+
}, _ = (u) => {
|
|
383
383
|
de.confirm({
|
|
384
384
|
title: "确认吊销此 AK?",
|
|
385
385
|
content: "吊销后此 AK 将立即失效,无法恢复。",
|
|
@@ -388,65 +388,65 @@ function ot() {
|
|
|
388
388
|
cancelText: "取消",
|
|
389
389
|
onOk: async () => {
|
|
390
390
|
try {
|
|
391
|
-
await
|
|
392
|
-
} catch (
|
|
393
|
-
J.error(
|
|
391
|
+
await at(u), J.success("AK 已吊销"), C(), Ie();
|
|
392
|
+
} catch (w) {
|
|
393
|
+
J.error(w instanceof Error ? w.message : "吊销失败");
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
|
-
},
|
|
397
|
+
}, L = (u) => {
|
|
398
398
|
navigator.clipboard.writeText(u).then(() => J.success("已复制到剪贴板")).catch(() => J.warning("复制失败,请手动复制"));
|
|
399
399
|
}, ie = (u) => {
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
},
|
|
403
|
-
o(u), G(!0),
|
|
400
|
+
const w = st(u.akPrefix);
|
|
401
|
+
w ? L(w) : (L(u.akPrefix), J.info("完整 AK 未在本地缓存(可能在本设备外创建),已复制前缀"));
|
|
402
|
+
}, z = async (u) => {
|
|
403
|
+
o(u), G(!0), E(null);
|
|
404
404
|
try {
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
} catch (
|
|
408
|
-
J.error(
|
|
405
|
+
const w = await Pe(u.id);
|
|
406
|
+
E(w);
|
|
407
|
+
} catch (w) {
|
|
408
|
+
J.error(w instanceof Error ? w.message : "获取用量失败");
|
|
409
409
|
} finally {
|
|
410
410
|
G(!1);
|
|
411
411
|
}
|
|
412
|
-
},
|
|
413
|
-
o(null),
|
|
412
|
+
}, j = () => {
|
|
413
|
+
o(null), E(null);
|
|
414
414
|
}, ne = (u) => {
|
|
415
|
-
const
|
|
416
|
-
if (
|
|
415
|
+
const w = Object.entries(u);
|
|
416
|
+
if (w.length === 0)
|
|
417
417
|
return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
418
|
-
const Y = Math.max(...
|
|
419
|
-
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children:
|
|
420
|
-
const ye =
|
|
418
|
+
const Y = Math.max(...w.map(([, k]) => k[1] + k[2]), 1);
|
|
419
|
+
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: w.map(([k, U]) => {
|
|
420
|
+
const ye = U[1] + U[2], $e = ye / Y * 100;
|
|
421
421
|
return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
|
|
422
|
-
/* @__PURE__ */ e(W, { title: `${k}: ${
|
|
422
|
+
/* @__PURE__ */ e(W, { title: `${k}: ${U[0]}次 / ${ye} tokens`, children: /* @__PURE__ */ e(
|
|
423
423
|
"div",
|
|
424
424
|
{
|
|
425
425
|
className: t.usageBar,
|
|
426
|
-
style: { height: `${Math.max(
|
|
426
|
+
style: { height: `${Math.max($e, 2)}%` }
|
|
427
427
|
}
|
|
428
428
|
) }),
|
|
429
429
|
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children: k })
|
|
430
430
|
] }, k);
|
|
431
431
|
}) });
|
|
432
432
|
}, ce = (u) => {
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
433
|
+
const w = Object.entries(u);
|
|
434
|
+
if (w.length === 0)
|
|
435
435
|
return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
436
|
-
const Y = Math.max(...
|
|
437
|
-
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children:
|
|
436
|
+
const Y = Math.max(...w.map(([, k]) => k[0]), 1);
|
|
437
|
+
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: w.sort((k, U) => U[1][0] - k[1][0]).map(([k, U]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
|
|
438
438
|
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: k }),
|
|
439
439
|
/* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
|
|
440
440
|
"div",
|
|
441
441
|
{
|
|
442
442
|
className: t.modelBreakdownFill,
|
|
443
|
-
style: { width: `${
|
|
443
|
+
style: { width: `${U[0] / Y * 100}%` }
|
|
444
444
|
}
|
|
445
445
|
) }),
|
|
446
446
|
/* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
|
|
447
|
-
|
|
447
|
+
U[0],
|
|
448
448
|
"次 / ",
|
|
449
|
-
|
|
449
|
+
U[1] + (U[2] || 0),
|
|
450
450
|
"tokens"
|
|
451
451
|
] })
|
|
452
452
|
] }, k)) });
|
|
@@ -498,13 +498,13 @@ function ot() {
|
|
|
498
498
|
width: 60,
|
|
499
499
|
render: (u) => u ? /* @__PURE__ */ e(Q, { color: u < 400 ? "green" : "red", children: u }) : "-"
|
|
500
500
|
}
|
|
501
|
-
], fe = (u,
|
|
501
|
+
], fe = (u, w) => {
|
|
502
502
|
const Y = Array.isArray(u) ? u : [];
|
|
503
|
-
return
|
|
503
|
+
return v ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ e(V, { tip: "加载中..." }) }) : Y.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: w ? "暂无应用 AK" : "暂无个人 AK,点击上方按钮生成" }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: Y.map((k) => /* @__PURE__ */ s(
|
|
504
504
|
"div",
|
|
505
505
|
{
|
|
506
506
|
className: t.akCard,
|
|
507
|
-
onClick: () =>
|
|
507
|
+
onClick: () => z(k),
|
|
508
508
|
children: [
|
|
509
509
|
/* @__PURE__ */ s("div", { className: t.akCardRow, children: [
|
|
510
510
|
/* @__PURE__ */ e("span", { className: t.akTitle, children: k.description || k.akPrefix.replace("...", "**") }),
|
|
@@ -524,10 +524,10 @@ function ot() {
|
|
|
524
524
|
"div",
|
|
525
525
|
{
|
|
526
526
|
className: t.akCardActions,
|
|
527
|
-
onClick: (
|
|
527
|
+
onClick: (U) => U.stopPropagation(),
|
|
528
528
|
children: [
|
|
529
529
|
/* @__PURE__ */ e(W, { title: "复制完整 AK", children: /* @__PURE__ */ e(
|
|
530
|
-
|
|
530
|
+
R,
|
|
531
531
|
{
|
|
532
532
|
size: "small",
|
|
533
533
|
icon: /* @__PURE__ */ e(se, {}),
|
|
@@ -535,13 +535,13 @@ function ot() {
|
|
|
535
535
|
children: "复制"
|
|
536
536
|
}
|
|
537
537
|
) }),
|
|
538
|
-
!
|
|
539
|
-
|
|
538
|
+
!w && k.active && /* @__PURE__ */ e(
|
|
539
|
+
R,
|
|
540
540
|
{
|
|
541
541
|
size: "small",
|
|
542
542
|
danger: !0,
|
|
543
|
-
icon: /* @__PURE__ */ e(
|
|
544
|
-
onClick: () =>
|
|
543
|
+
icon: /* @__PURE__ */ e(Oe, {}),
|
|
544
|
+
onClick: () => _(k.id),
|
|
545
545
|
children: "吊销"
|
|
546
546
|
}
|
|
547
547
|
)
|
|
@@ -580,23 +580,23 @@ function ot() {
|
|
|
580
580
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlRow, children: [
|
|
581
581
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
|
|
582
582
|
/* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "OpenAI 兼容" }),
|
|
583
|
-
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children:
|
|
583
|
+
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: I }),
|
|
584
584
|
/* @__PURE__ */ e(W, { title: "复制 Base URL", children: /* @__PURE__ */ e(
|
|
585
585
|
se,
|
|
586
586
|
{
|
|
587
587
|
className: t.akCopyIcon,
|
|
588
|
-
onClick: () =>
|
|
588
|
+
onClick: () => L(I)
|
|
589
589
|
}
|
|
590
590
|
) })
|
|
591
591
|
] }),
|
|
592
592
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
|
|
593
593
|
/* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "Anthropic 兼容" }),
|
|
594
|
-
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children:
|
|
594
|
+
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: I }),
|
|
595
595
|
/* @__PURE__ */ e(W, { title: "复制 Base URL", children: /* @__PURE__ */ e(
|
|
596
596
|
se,
|
|
597
597
|
{
|
|
598
598
|
className: t.akCopyIcon,
|
|
599
|
-
onClick: () =>
|
|
599
|
+
onClick: () => L(I)
|
|
600
600
|
}
|
|
601
601
|
) })
|
|
602
602
|
] })
|
|
@@ -604,11 +604,11 @@ function ot() {
|
|
|
604
604
|
/* @__PURE__ */ s("div", { className: t.akIntegrationGrid, children: [
|
|
605
605
|
/* @__PURE__ */ s("div", { children: [
|
|
606
606
|
/* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "OpenAI 兼容 — curl 示例" }),
|
|
607
|
-
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children:
|
|
607
|
+
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: lt(I, r) })
|
|
608
608
|
] }),
|
|
609
609
|
/* @__PURE__ */ s("div", { children: [
|
|
610
610
|
/* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "Anthropic 兼容 — curl 示例" }),
|
|
611
|
-
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children:
|
|
611
|
+
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: ot(I, r) })
|
|
612
612
|
] })
|
|
613
613
|
] })
|
|
614
614
|
] }),
|
|
@@ -636,13 +636,13 @@ function ot() {
|
|
|
636
636
|
}
|
|
637
637
|
),
|
|
638
638
|
/* @__PURE__ */ s("div", { style: { display: "flex", gap: 8 }, children: [
|
|
639
|
-
/* @__PURE__ */ e(
|
|
639
|
+
/* @__PURE__ */ e(R, { icon: /* @__PURE__ */ e(Te, {}), onClick: C, size: "small", children: "刷新" }),
|
|
640
640
|
a === "personal" && /* @__PURE__ */ e(
|
|
641
|
-
|
|
641
|
+
R,
|
|
642
642
|
{
|
|
643
643
|
type: "primary",
|
|
644
644
|
icon: /* @__PURE__ */ e(Se, {}),
|
|
645
|
-
onClick:
|
|
645
|
+
onClick: B,
|
|
646
646
|
loading: f,
|
|
647
647
|
children: "生成 AK"
|
|
648
648
|
}
|
|
@@ -656,10 +656,10 @@ function ot() {
|
|
|
656
656
|
/* @__PURE__ */ s(
|
|
657
657
|
de,
|
|
658
658
|
{
|
|
659
|
-
open:
|
|
659
|
+
open: D,
|
|
660
660
|
title: "生成新 AK",
|
|
661
|
-
onCancel: () =>
|
|
662
|
-
onOk:
|
|
661
|
+
onCancel: () => x(!1),
|
|
662
|
+
onOk: b,
|
|
663
663
|
okText: "确认生成",
|
|
664
664
|
cancelText: "取消",
|
|
665
665
|
confirmLoading: f,
|
|
@@ -679,9 +679,9 @@ function ot() {
|
|
|
679
679
|
we,
|
|
680
680
|
{
|
|
681
681
|
placeholder: "例如:测试用 AK、生产网关 AK",
|
|
682
|
-
value:
|
|
683
|
-
onChange: (u) =>
|
|
684
|
-
onPressEnter:
|
|
682
|
+
value: T,
|
|
683
|
+
onChange: (u) => A(u.target.value),
|
|
684
|
+
onPressEnter: b,
|
|
685
685
|
maxLength: 50,
|
|
686
686
|
autoFocus: !0
|
|
687
687
|
}
|
|
@@ -697,16 +697,16 @@ function ot() {
|
|
|
697
697
|
onCancel: () => d({ open: !1 }),
|
|
698
698
|
footer: [
|
|
699
699
|
/* @__PURE__ */ e(
|
|
700
|
-
|
|
700
|
+
R,
|
|
701
701
|
{
|
|
702
702
|
icon: /* @__PURE__ */ e(se, {}),
|
|
703
|
-
onClick: () => h.apiKey &&
|
|
703
|
+
onClick: () => h.apiKey && L(h.apiKey),
|
|
704
704
|
children: "复制 AK"
|
|
705
705
|
},
|
|
706
706
|
"copy"
|
|
707
707
|
),
|
|
708
708
|
/* @__PURE__ */ e(
|
|
709
|
-
|
|
709
|
+
R,
|
|
710
710
|
{
|
|
711
711
|
type: "primary",
|
|
712
712
|
onClick: () => d({ open: !1 }),
|
|
@@ -747,49 +747,49 @@ function ot() {
|
|
|
747
747
|
/* @__PURE__ */ e("code", { children: g.akPrefix })
|
|
748
748
|
] }) : "AK 详情",
|
|
749
749
|
open: !!g,
|
|
750
|
-
onClose:
|
|
750
|
+
onClose: j,
|
|
751
751
|
size: "large",
|
|
752
|
-
children:
|
|
752
|
+
children: F ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(V, { tip: "加载用量数据..." }) }) : K ? /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
|
|
753
753
|
/* @__PURE__ */ e("div", { style: { fontSize: 12, color: "#8c8c8c", marginBottom: 12 }, children: "以下为网关全局调用统计(近 7 天窗口), 监控侧不按 AK 留存;该 AK 自身的累计消耗见下方「本 AK 累计 Token」。" }),
|
|
754
754
|
/* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
|
|
755
|
-
/* @__PURE__ */ e(
|
|
756
|
-
/* @__PURE__ */ e(
|
|
755
|
+
/* @__PURE__ */ e($, { title: "总请求数", value: K.totalRequests }),
|
|
756
|
+
/* @__PURE__ */ e($, { title: "总 Token", value: K.totalTokens }),
|
|
757
757
|
/* @__PURE__ */ e(
|
|
758
|
-
|
|
758
|
+
$,
|
|
759
759
|
{
|
|
760
760
|
title: "输入 Token",
|
|
761
|
-
value:
|
|
761
|
+
value: K.totalPromptTokens
|
|
762
762
|
}
|
|
763
763
|
),
|
|
764
764
|
/* @__PURE__ */ e(
|
|
765
|
-
|
|
765
|
+
$,
|
|
766
766
|
{
|
|
767
767
|
title: "输出 Token",
|
|
768
|
-
value:
|
|
768
|
+
value: K.totalCompletionTokens
|
|
769
769
|
}
|
|
770
770
|
),
|
|
771
771
|
/* @__PURE__ */ e(
|
|
772
|
-
|
|
772
|
+
$,
|
|
773
773
|
{
|
|
774
774
|
title: "平均耗时",
|
|
775
|
-
value:
|
|
775
|
+
value: K.avgLatencyMs,
|
|
776
776
|
suffix: "ms"
|
|
777
777
|
}
|
|
778
778
|
),
|
|
779
779
|
/* @__PURE__ */ e(
|
|
780
|
-
|
|
780
|
+
$,
|
|
781
781
|
{
|
|
782
782
|
title: "错误数",
|
|
783
|
-
value:
|
|
783
|
+
value: K.errorCount,
|
|
784
784
|
styles: {
|
|
785
785
|
content: {
|
|
786
|
-
color:
|
|
786
|
+
color: K.errorCount > 0 ? "#ff4d4f" : void 0
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
790
|
),
|
|
791
791
|
/* @__PURE__ */ e(
|
|
792
|
-
|
|
792
|
+
$,
|
|
793
793
|
{
|
|
794
794
|
title: "本 AK 累计 Token",
|
|
795
795
|
value: (g == null ? void 0 : g.totalTokens) ?? 0
|
|
@@ -798,11 +798,11 @@ function ot() {
|
|
|
798
798
|
] }),
|
|
799
799
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
800
800
|
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "每日调用曲线(按最近调用明细聚合)" }),
|
|
801
|
-
ne(
|
|
801
|
+
ne(K.daily)
|
|
802
802
|
] }),
|
|
803
803
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
804
804
|
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "模型用量分布" }),
|
|
805
|
-
ce(
|
|
805
|
+
ce(K.models)
|
|
806
806
|
] }),
|
|
807
807
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
808
808
|
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "最近调用记录" }),
|
|
@@ -810,7 +810,7 @@ function ot() {
|
|
|
810
810
|
Ke,
|
|
811
811
|
{
|
|
812
812
|
columns: Be,
|
|
813
|
-
dataSource:
|
|
813
|
+
dataSource: K.recent,
|
|
814
814
|
rowKey: "id",
|
|
815
815
|
size: "small",
|
|
816
816
|
pagination: {
|
|
@@ -829,7 +829,7 @@ function ot() {
|
|
|
829
829
|
)
|
|
830
830
|
] });
|
|
831
831
|
}
|
|
832
|
-
function
|
|
832
|
+
function ct(a) {
|
|
833
833
|
const n = [];
|
|
834
834
|
if (!a) return n;
|
|
835
835
|
const l = /<(think|thinking|reasoning)>([\s\S]*?)<\/\1>/gi;
|
|
@@ -839,18 +839,18 @@ function it(a) {
|
|
|
839
839
|
return i < a.length && n.push({ type: "text", text: a.slice(i) }), n;
|
|
840
840
|
}
|
|
841
841
|
const re = 4;
|
|
842
|
-
let
|
|
843
|
-
function
|
|
844
|
-
const [n, l] = S([]), [i, m] = S([]), [N,
|
|
842
|
+
let dt = 0;
|
|
843
|
+
function mt({ initialModels: a }) {
|
|
844
|
+
const [n, l] = S([]), [i, m] = S([]), [N, v] = S(!0), [y, f] = S(null), [M, D] = S(""), [x, T] = S(!1), A = me(""), h = me(/* @__PURE__ */ new Map()), d = me(/* @__PURE__ */ new Map());
|
|
845
845
|
X(() => {
|
|
846
846
|
(async () => {
|
|
847
847
|
try {
|
|
848
848
|
const r = await ge();
|
|
849
|
-
m(r),
|
|
850
|
-
const p = a.length > 0 ? a : r.slice(0, 1).map((
|
|
851
|
-
l(p.slice(0, re).map((
|
|
849
|
+
m(r), v(!1);
|
|
850
|
+
const p = a.length > 0 ? a : r.slice(0, 1).map((C) => C.modelName);
|
|
851
|
+
l(p.slice(0, re).map((C) => ue(C)));
|
|
852
852
|
} catch (r) {
|
|
853
|
-
|
|
853
|
+
v(!1), f(r instanceof Error ? r.message : "模型列表加载失败");
|
|
854
854
|
}
|
|
855
855
|
})();
|
|
856
856
|
}, []), X(() => {
|
|
@@ -859,32 +859,32 @@ function dt({ initialModels: a }) {
|
|
|
859
859
|
l(r);
|
|
860
860
|
}
|
|
861
861
|
}, [a.join(",")]);
|
|
862
|
-
const g =
|
|
862
|
+
const g = q((r) => {
|
|
863
863
|
const p = d.current.get(r);
|
|
864
864
|
p && (p.scrollTop = p.scrollHeight);
|
|
865
|
-
}, []), o =
|
|
865
|
+
}, []), o = q(
|
|
866
866
|
(r, p) => {
|
|
867
|
-
l((
|
|
867
|
+
l((C) => C.map((B) => B.id === r ? p(B) : B));
|
|
868
868
|
},
|
|
869
869
|
[]
|
|
870
|
-
),
|
|
871
|
-
if (
|
|
872
|
-
const r = await
|
|
873
|
-
return
|
|
874
|
-
}, []),
|
|
875
|
-
const r =
|
|
876
|
-
if (!r ||
|
|
870
|
+
), K = q(async () => {
|
|
871
|
+
if (A.current) return A.current;
|
|
872
|
+
const r = await rt();
|
|
873
|
+
return A.current = r, r;
|
|
874
|
+
}, []), E = q(async () => {
|
|
875
|
+
const r = M.trim();
|
|
876
|
+
if (!r || x) return;
|
|
877
877
|
let p;
|
|
878
878
|
try {
|
|
879
|
-
p = await
|
|
879
|
+
p = await K();
|
|
880
880
|
} catch {
|
|
881
881
|
return;
|
|
882
882
|
}
|
|
883
|
-
|
|
884
|
-
const
|
|
885
|
-
...
|
|
883
|
+
D(""), T(!0);
|
|
884
|
+
const C = n.map((_) => ({
|
|
885
|
+
..._,
|
|
886
886
|
messages: [
|
|
887
|
-
...
|
|
887
|
+
..._.messages,
|
|
888
888
|
{ role: "user", content: r },
|
|
889
889
|
{ role: "assistant", content: "" }
|
|
890
890
|
],
|
|
@@ -893,60 +893,60 @@ function dt({ initialModels: a }) {
|
|
|
893
893
|
error: null,
|
|
894
894
|
usage: null
|
|
895
895
|
}));
|
|
896
|
-
l(
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
h.current.set(
|
|
901
|
-
const ie =
|
|
902
|
-
|
|
903
|
-
onDelta: (
|
|
904
|
-
o(
|
|
905
|
-
...
|
|
906
|
-
streamingContent:
|
|
907
|
-
messages:
|
|
908
|
-
(ne, ce) => ce ===
|
|
896
|
+
l(C);
|
|
897
|
+
const B = C;
|
|
898
|
+
B.forEach((_) => {
|
|
899
|
+
const L = new AbortController();
|
|
900
|
+
h.current.set(_.id, L);
|
|
901
|
+
const ie = _.messages.slice(0, -1);
|
|
902
|
+
et(p, _.model, ie, {
|
|
903
|
+
onDelta: (z) => {
|
|
904
|
+
o(_.id, (j) => ({
|
|
905
|
+
...j,
|
|
906
|
+
streamingContent: j.streamingContent + z,
|
|
907
|
+
messages: j.messages.map(
|
|
908
|
+
(ne, ce) => ce === j.messages.length - 1 ? { ...ne, content: j.streamingContent + z } : ne
|
|
909
909
|
)
|
|
910
|
-
})), g(
|
|
910
|
+
})), g(_.id);
|
|
911
911
|
},
|
|
912
|
-
onDone: (
|
|
913
|
-
o(
|
|
914
|
-
...
|
|
912
|
+
onDone: (z) => {
|
|
913
|
+
o(_.id, (j) => ({
|
|
914
|
+
...j,
|
|
915
915
|
isStreaming: !1,
|
|
916
|
-
usage:
|
|
917
|
-
promptTokens:
|
|
918
|
-
completionTokens:
|
|
919
|
-
totalTokens:
|
|
916
|
+
usage: z ? {
|
|
917
|
+
promptTokens: z.promptTokens,
|
|
918
|
+
completionTokens: z.completionTokens,
|
|
919
|
+
totalTokens: z.totalTokens
|
|
920
920
|
} : null
|
|
921
|
-
})), h.current.delete(
|
|
921
|
+
})), h.current.delete(_.id);
|
|
922
922
|
},
|
|
923
|
-
onError: (
|
|
924
|
-
(
|
|
925
|
-
...
|
|
923
|
+
onError: (z) => {
|
|
924
|
+
(z.message.includes("401") || z.message.includes("API key")) && (Ie(), A.current = ""), o(_.id, (j) => ({
|
|
925
|
+
...j,
|
|
926
926
|
isStreaming: !1,
|
|
927
|
-
error:
|
|
928
|
-
})), h.current.delete(
|
|
927
|
+
error: z.message
|
|
928
|
+
})), h.current.delete(_.id);
|
|
929
929
|
},
|
|
930
|
-
signal:
|
|
930
|
+
signal: L.signal
|
|
931
931
|
}).catch(() => {
|
|
932
932
|
});
|
|
933
933
|
});
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
(
|
|
937
|
-
) && (clearInterval(
|
|
934
|
+
const b = setInterval(() => {
|
|
935
|
+
B.every(
|
|
936
|
+
(L) => !h.current.has(L.id)
|
|
937
|
+
) && (clearInterval(b), T(!1));
|
|
938
938
|
}, 200);
|
|
939
939
|
setTimeout(() => {
|
|
940
|
-
clearInterval(
|
|
940
|
+
clearInterval(b), T(!1);
|
|
941
941
|
}, 300 * 1e3);
|
|
942
|
-
}, [
|
|
943
|
-
h.current.forEach((r) => r.abort()), h.current.clear(), l((r) => r.map((p) => ({ ...p, isStreaming: !1 }))),
|
|
944
|
-
}, []), G =
|
|
942
|
+
}, [M, x, n, K, o, g]), F = q(() => {
|
|
943
|
+
h.current.forEach((r) => r.abort()), h.current.clear(), l((r) => r.map((p) => ({ ...p, isStreaming: !1 }))), T(!1);
|
|
944
|
+
}, []), G = q(() => {
|
|
945
945
|
var p;
|
|
946
946
|
if (n.length >= re) return;
|
|
947
|
-
const r = (p = i.find((
|
|
948
|
-
r && l((
|
|
949
|
-
}, [n, i]),
|
|
947
|
+
const r = (p = i.find((C) => !n.some((B) => B.model === C.modelName))) == null ? void 0 : p.modelName;
|
|
948
|
+
r && l((C) => [...C, ue(r)]);
|
|
949
|
+
}, [n, i]), H = q(() => {
|
|
950
950
|
h.current.forEach((r) => r.abort()), h.current.clear(), l(
|
|
951
951
|
(r) => r.map((p) => ({
|
|
952
952
|
...p,
|
|
@@ -956,16 +956,16 @@ function dt({ initialModels: a }) {
|
|
|
956
956
|
error: null,
|
|
957
957
|
usage: null
|
|
958
958
|
}))
|
|
959
|
-
),
|
|
960
|
-
}, [
|
|
959
|
+
), T(!1);
|
|
960
|
+
}, [x, n]), c = q((r) => {
|
|
961
961
|
const p = h.current.get(r);
|
|
962
|
-
p && p.abort(), h.current.delete(r), l((
|
|
963
|
-
}, []),
|
|
962
|
+
p && p.abort(), h.current.delete(r), l((C) => C.filter((B) => B.id !== r));
|
|
963
|
+
}, []), P = q(
|
|
964
964
|
(r, p) => {
|
|
965
|
-
o(r, (
|
|
965
|
+
o(r, (C) => ({ ...C, model: p }));
|
|
966
966
|
},
|
|
967
967
|
[o]
|
|
968
|
-
),
|
|
968
|
+
), I = i.map((r) => ({
|
|
969
969
|
label: r.modelName,
|
|
970
970
|
value: r.modelName
|
|
971
971
|
}));
|
|
@@ -985,12 +985,12 @@ function dt({ initialModels: a }) {
|
|
|
985
985
|
] })
|
|
986
986
|
] }),
|
|
987
987
|
/* @__PURE__ */ e(
|
|
988
|
-
|
|
988
|
+
R,
|
|
989
989
|
{
|
|
990
990
|
size: "small",
|
|
991
|
-
icon: /* @__PURE__ */ e(
|
|
992
|
-
onClick:
|
|
993
|
-
disabled:
|
|
991
|
+
icon: /* @__PURE__ */ e(De, {}),
|
|
992
|
+
onClick: H,
|
|
993
|
+
disabled: x || n.every((r) => r.messages.length === 0),
|
|
994
994
|
children: "清空重新来"
|
|
995
995
|
}
|
|
996
996
|
)
|
|
@@ -999,12 +999,12 @@ function dt({ initialModels: a }) {
|
|
|
999
999
|
n.map((r) => /* @__PURE__ */ s("div", { className: t.chatPanel, children: [
|
|
1000
1000
|
/* @__PURE__ */ s("div", { className: t.chatPanelHeader, children: [
|
|
1001
1001
|
/* @__PURE__ */ e(
|
|
1002
|
-
|
|
1002
|
+
Ge,
|
|
1003
1003
|
{
|
|
1004
1004
|
size: "small",
|
|
1005
1005
|
value: r.model,
|
|
1006
|
-
onChange: (p) =>
|
|
1007
|
-
options:
|
|
1006
|
+
onChange: (p) => P(r.id, p),
|
|
1007
|
+
options: I,
|
|
1008
1008
|
style: { minWidth: 140, flex: 1 },
|
|
1009
1009
|
showSearch: !0,
|
|
1010
1010
|
optionFilterProp: "label"
|
|
@@ -1015,7 +1015,7 @@ function dt({ initialModels: a }) {
|
|
|
1015
1015
|
{
|
|
1016
1016
|
className: t.chatPanelClose,
|
|
1017
1017
|
onClick: () => c(r.id),
|
|
1018
|
-
children: /* @__PURE__ */ e(
|
|
1018
|
+
children: /* @__PURE__ */ e(Le, {})
|
|
1019
1019
|
}
|
|
1020
1020
|
)
|
|
1021
1021
|
] }),
|
|
@@ -1027,28 +1027,28 @@ function dt({ initialModels: a }) {
|
|
|
1027
1027
|
d.current.set(r.id, p);
|
|
1028
1028
|
},
|
|
1029
1029
|
children: [
|
|
1030
|
-
r.messages.map((p,
|
|
1030
|
+
r.messages.map((p, C) => /* @__PURE__ */ s(
|
|
1031
1031
|
"div",
|
|
1032
1032
|
{
|
|
1033
1033
|
className: p.role === "user" ? t.chatMsgUser : t.chatMsgAI,
|
|
1034
1034
|
children: [
|
|
1035
|
-
p.role === "assistant" ?
|
|
1036
|
-
(
|
|
1035
|
+
p.role === "assistant" ? ct(p.content).map(
|
|
1036
|
+
(B, b) => B.type === "think" ? /* @__PURE__ */ s(
|
|
1037
1037
|
"details",
|
|
1038
1038
|
{
|
|
1039
1039
|
className: t.chatThinkBlock,
|
|
1040
1040
|
children: [
|
|
1041
1041
|
/* @__PURE__ */ e("summary", { children: "思考过程" }),
|
|
1042
|
-
/* @__PURE__ */ e("pre", { children:
|
|
1042
|
+
/* @__PURE__ */ e("pre", { children: B.text })
|
|
1043
1043
|
]
|
|
1044
1044
|
},
|
|
1045
|
-
|
|
1046
|
-
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children:
|
|
1045
|
+
b
|
|
1046
|
+
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: B.text }, b)
|
|
1047
1047
|
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: p.content }),
|
|
1048
|
-
r.isStreaming &&
|
|
1048
|
+
r.isStreaming && C === r.messages.length - 1 && p.role === "assistant" && /* @__PURE__ */ e("span", { className: t.chatStreamingCursor })
|
|
1049
1049
|
]
|
|
1050
1050
|
},
|
|
1051
|
-
|
|
1051
|
+
C
|
|
1052
1052
|
)),
|
|
1053
1053
|
r.error && /* @__PURE__ */ e("div", { className: t.chatMsgError, children: r.error }),
|
|
1054
1054
|
r.usage && /* @__PURE__ */ s("div", { className: t.chatUsageBar, children: [
|
|
@@ -1072,18 +1072,18 @@ function dt({ initialModels: a }) {
|
|
|
1072
1072
|
we.TextArea,
|
|
1073
1073
|
{
|
|
1074
1074
|
className: t.chatInput,
|
|
1075
|
-
value:
|
|
1076
|
-
onChange: (r) =>
|
|
1075
|
+
value: M,
|
|
1076
|
+
onChange: (r) => D(r.target.value),
|
|
1077
1077
|
placeholder: "输入消息,所有面板将同时收到并流式输出...",
|
|
1078
1078
|
autoSize: { minRows: 1, maxRows: 4 },
|
|
1079
1079
|
onPressEnter: (r) => {
|
|
1080
|
-
r.shiftKey || (r.preventDefault(),
|
|
1080
|
+
r.shiftKey || (r.preventDefault(), E());
|
|
1081
1081
|
},
|
|
1082
|
-
disabled:
|
|
1082
|
+
disabled: x
|
|
1083
1083
|
}
|
|
1084
1084
|
),
|
|
1085
|
-
|
|
1086
|
-
/* @__PURE__ */ e(
|
|
1085
|
+
x ? /* @__PURE__ */ e(R, { danger: !0, onClick: F, children: "停止" }) : /* @__PURE__ */ s(R, { type: "primary", onClick: E, disabled: !M.trim(), children: [
|
|
1086
|
+
/* @__PURE__ */ e(ze, {}),
|
|
1087
1087
|
" 发送"
|
|
1088
1088
|
] })
|
|
1089
1089
|
] })
|
|
@@ -1091,7 +1091,7 @@ function dt({ initialModels: a }) {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
function ue(a) {
|
|
1093
1093
|
return {
|
|
1094
|
-
id: ++
|
|
1094
|
+
id: ++dt,
|
|
1095
1095
|
model: a,
|
|
1096
1096
|
messages: [],
|
|
1097
1097
|
streamingContent: "",
|
|
@@ -1100,26 +1100,26 @@ function ue(a) {
|
|
|
1100
1100
|
usage: null
|
|
1101
1101
|
};
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1104
|
-
const [n, l] = S([]), [i, m] = S(!0), [N,
|
|
1105
|
-
m(!0),
|
|
1103
|
+
function ut({ onStartChat: a }) {
|
|
1104
|
+
const [n, l] = S([]), [i, m] = S(!0), [N, v] = S(null), [y, f] = S(/* @__PURE__ */ new Set()), M = () => {
|
|
1105
|
+
m(!0), v(null), ge().then((d) => {
|
|
1106
1106
|
l(d), m(!1);
|
|
1107
1107
|
}).catch((d) => {
|
|
1108
|
-
l([]),
|
|
1108
|
+
l([]), v(d instanceof Error ? d.message : "加载失败"), m(!1);
|
|
1109
1109
|
});
|
|
1110
1110
|
};
|
|
1111
1111
|
X(() => {
|
|
1112
|
-
|
|
1112
|
+
M();
|
|
1113
1113
|
}, []);
|
|
1114
|
-
const
|
|
1114
|
+
const D = (d) => {
|
|
1115
1115
|
f((g) => {
|
|
1116
1116
|
const o = new Set(g);
|
|
1117
1117
|
return o.has(d) ? o.delete(d) : o.add(d), o;
|
|
1118
1118
|
});
|
|
1119
|
-
},
|
|
1119
|
+
}, x = Array.from(y), T = (d) => {
|
|
1120
1120
|
a([d]);
|
|
1121
|
-
},
|
|
1122
|
-
|
|
1121
|
+
}, A = () => {
|
|
1122
|
+
x.length > 0 && a(x);
|
|
1123
1123
|
}, h = (d) => {
|
|
1124
1124
|
if (!d) return "default";
|
|
1125
1125
|
const g = d.toLowerCase();
|
|
@@ -1133,7 +1133,7 @@ function mt({ onStartChat: a }) {
|
|
|
1133
1133
|
/* @__PURE__ */ s("div", { className: t.akEmpty, children: [
|
|
1134
1134
|
"模型列表加载失败:",
|
|
1135
1135
|
N,
|
|
1136
|
-
/* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ e(
|
|
1136
|
+
/* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ e(R, { type: "primary", onClick: M, children: "重试" }) })
|
|
1137
1137
|
] })
|
|
1138
1138
|
] }) : /* @__PURE__ */ s("div", { children: [
|
|
1139
1139
|
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
@@ -1147,15 +1147,15 @@ function mt({ onStartChat: a }) {
|
|
|
1147
1147
|
"div",
|
|
1148
1148
|
{
|
|
1149
1149
|
className: `${t.modelCard} ${g ? t.modelCardSelected : ""}`,
|
|
1150
|
-
onClick: () =>
|
|
1150
|
+
onClick: () => D(d.modelName),
|
|
1151
1151
|
children: [
|
|
1152
1152
|
/* @__PURE__ */ e(
|
|
1153
|
-
|
|
1153
|
+
Je,
|
|
1154
1154
|
{
|
|
1155
1155
|
className: t.modelCheckbox,
|
|
1156
1156
|
checked: g,
|
|
1157
1157
|
onChange: (o) => {
|
|
1158
|
-
o.stopPropagation(),
|
|
1158
|
+
o.stopPropagation(), D(d.modelName);
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
1161
1161
|
),
|
|
@@ -1178,12 +1178,12 @@ function mt({ onStartChat: a }) {
|
|
|
1178
1178
|
] }),
|
|
1179
1179
|
/* @__PURE__ */ e("p", { className: t.modelEndpoint, children: d.endpoint }),
|
|
1180
1180
|
/* @__PURE__ */ e("div", { className: t.modelCardFooter, children: /* @__PURE__ */ e(
|
|
1181
|
-
|
|
1181
|
+
R,
|
|
1182
1182
|
{
|
|
1183
1183
|
type: "link",
|
|
1184
1184
|
size: "small",
|
|
1185
1185
|
onClick: (o) => {
|
|
1186
|
-
o.stopPropagation(),
|
|
1186
|
+
o.stopPropagation(), T(d.modelName);
|
|
1187
1187
|
},
|
|
1188
1188
|
children: "发起对话"
|
|
1189
1189
|
}
|
|
@@ -1193,39 +1193,39 @@ function mt({ onStartChat: a }) {
|
|
|
1193
1193
|
d.modelName
|
|
1194
1194
|
);
|
|
1195
1195
|
}) }),
|
|
1196
|
-
|
|
1196
|
+
x.length > 0 && /* @__PURE__ */ s("div", { className: t.modelActionBar, children: [
|
|
1197
1197
|
/* @__PURE__ */ s("span", { className: t.modelSelectionCount, children: [
|
|
1198
1198
|
"已选择 ",
|
|
1199
|
-
|
|
1199
|
+
x.length,
|
|
1200
1200
|
" 个模型"
|
|
1201
1201
|
] }),
|
|
1202
1202
|
/* @__PURE__ */ e(
|
|
1203
|
-
|
|
1203
|
+
R,
|
|
1204
1204
|
{
|
|
1205
1205
|
type: "primary",
|
|
1206
|
-
onClick:
|
|
1207
|
-
disabled:
|
|
1206
|
+
onClick: A,
|
|
1207
|
+
disabled: x.length === 0,
|
|
1208
1208
|
children: "批量对比"
|
|
1209
1209
|
}
|
|
1210
1210
|
)
|
|
1211
1211
|
] })
|
|
1212
1212
|
] });
|
|
1213
1213
|
}
|
|
1214
|
-
const
|
|
1215
|
-
container:
|
|
1216
|
-
page:
|
|
1217
|
-
kpiGrid:
|
|
1218
|
-
kpiCard:
|
|
1219
|
-
sectionCard:
|
|
1220
|
-
sectionHead:
|
|
1221
|
-
sectionHint:
|
|
1222
|
-
akList:
|
|
1223
|
-
errorState:
|
|
1224
|
-
errorTitle:
|
|
1225
|
-
errorDetail:
|
|
1226
|
-
},
|
|
1214
|
+
const ht = "_container_15pgq_5", pt = "_page_15pgq_10", gt = "_kpiGrid_15pgq_16", kt = "_kpiCard_15pgq_22", ft = "_sectionCard_15pgq_29", yt = "_sectionHead_15pgq_36", Nt = "_sectionHint_15pgq_42", vt = "_akList_15pgq_47", Tt = "_errorState_15pgq_54", St = "_errorTitle_15pgq_66", Ct = "_errorDetail_15pgq_72", O = {
|
|
1215
|
+
container: ht,
|
|
1216
|
+
page: pt,
|
|
1217
|
+
kpiGrid: gt,
|
|
1218
|
+
kpiCard: kt,
|
|
1219
|
+
sectionCard: ft,
|
|
1220
|
+
sectionHead: yt,
|
|
1221
|
+
sectionHint: Nt,
|
|
1222
|
+
akList: vt,
|
|
1223
|
+
errorState: Tt,
|
|
1224
|
+
errorTitle: St,
|
|
1225
|
+
errorDetail: Ct
|
|
1226
|
+
}, At = We(
|
|
1227
1227
|
() => import("@yuku123/z-agent-component").then((a) => ({ default: a.AgentDashboard }))
|
|
1228
|
-
)
|
|
1228
|
+
);
|
|
1229
1229
|
function te(a) {
|
|
1230
1230
|
return a >= 1e6 ? `${(a / 1e6).toFixed(2)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : String(a ?? 0);
|
|
1231
1231
|
}
|
|
@@ -1295,91 +1295,96 @@ function Kt(a) {
|
|
|
1295
1295
|
return ((n = a == null ? void 0 : a.stats) == null ? void 0 : n.recent) ?? [];
|
|
1296
1296
|
}
|
|
1297
1297
|
function Mt() {
|
|
1298
|
-
var g, o,
|
|
1299
|
-
const [a, n] = S(!0), [l, i] = S(null), [m, N] = S([]), [
|
|
1300
|
-
var
|
|
1301
|
-
return ((
|
|
1302
|
-
})),
|
|
1303
|
-
new Set([
|
|
1304
|
-
),
|
|
1298
|
+
var g, o, K, E, F, G, H;
|
|
1299
|
+
const [a, n] = S(!0), [l, i] = S(null), [m, N] = S([]), [v, y] = S(null), [f, M] = S(null), D = String(_e((c) => {
|
|
1300
|
+
var P;
|
|
1301
|
+
return ((P = c.currentUser) == null ? void 0 : P.id) ?? "";
|
|
1302
|
+
})), x = Array.from(
|
|
1303
|
+
new Set([D, be].filter((c) => c !== ""))
|
|
1304
|
+
), T = q(async () => {
|
|
1305
1305
|
n(!0), i(null);
|
|
1306
1306
|
try {
|
|
1307
1307
|
const c = await Promise.allSettled(
|
|
1308
|
-
|
|
1309
|
-
),
|
|
1310
|
-
let
|
|
1311
|
-
for (const
|
|
1312
|
-
|
|
1313
|
-
|
|
1308
|
+
x.map((b) => oe(b))
|
|
1309
|
+
), P = [], I = /* @__PURE__ */ new Set();
|
|
1310
|
+
let r = 0;
|
|
1311
|
+
for (const b of c)
|
|
1312
|
+
if (b.status === "fulfilled")
|
|
1313
|
+
for (const _ of b.value) {
|
|
1314
|
+
const L = String(_.id ?? _.akPrefix ?? "");
|
|
1315
|
+
I.has(L) || (I.add(L), P.push(_));
|
|
1316
|
+
}
|
|
1317
|
+
else r += 1;
|
|
1318
|
+
if (r === c.length)
|
|
1314
1319
|
throw new Error("网关不可达:无法获取 AK 列表");
|
|
1315
|
-
|
|
1316
|
-
let
|
|
1320
|
+
P.sort((b, _) => (b.id ?? 0) - (_.id ?? 0));
|
|
1321
|
+
let p = null, C = null;
|
|
1317
1322
|
try {
|
|
1318
|
-
|
|
1319
|
-
} catch (
|
|
1320
|
-
|
|
1323
|
+
p = await Pe(0);
|
|
1324
|
+
} catch (b) {
|
|
1325
|
+
C = b instanceof Error ? b.message : "获取用量失败";
|
|
1321
1326
|
}
|
|
1322
|
-
y(
|
|
1323
|
-
const
|
|
1324
|
-
key:
|
|
1325
|
-
stats:
|
|
1326
|
-
statsError:
|
|
1327
|
+
y(p);
|
|
1328
|
+
const B = P.map((b) => ({
|
|
1329
|
+
key: b,
|
|
1330
|
+
stats: p,
|
|
1331
|
+
statsError: C
|
|
1327
1332
|
}));
|
|
1328
|
-
N(
|
|
1333
|
+
N(B);
|
|
1329
1334
|
} catch (c) {
|
|
1330
1335
|
i(c instanceof Error ? c.message : "加载失败");
|
|
1331
1336
|
} finally {
|
|
1332
1337
|
n(!1);
|
|
1333
1338
|
}
|
|
1334
|
-
}, [
|
|
1339
|
+
}, [x.join(",")]);
|
|
1335
1340
|
X(() => {
|
|
1336
|
-
|
|
1337
|
-
}, [
|
|
1338
|
-
const
|
|
1339
|
-
const c =
|
|
1340
|
-
for (const [
|
|
1341
|
-
|
|
1341
|
+
T();
|
|
1342
|
+
}, [T]);
|
|
1343
|
+
const A = Me(() => {
|
|
1344
|
+
const c = v, P = {};
|
|
1345
|
+
for (const [I, r] of Object.entries((c == null ? void 0 : c.models) ?? {}))
|
|
1346
|
+
P[I] = [r[0] ?? 0, r[1] ?? 0, r[2] ?? 0];
|
|
1342
1347
|
return {
|
|
1343
1348
|
requests: (c == null ? void 0 : c.totalRequests) ?? 0,
|
|
1344
1349
|
tokens: (c == null ? void 0 : c.totalTokens) ?? 0,
|
|
1345
1350
|
avgLatency: (c == null ? void 0 : c.avgLatencyMs) ?? 0,
|
|
1346
1351
|
errors: (c == null ? void 0 : c.errorCount) ?? 0,
|
|
1347
|
-
models:
|
|
1352
|
+
models: P
|
|
1348
1353
|
};
|
|
1349
|
-
}, [
|
|
1350
|
-
/* @__PURE__ */ e("div", { className:
|
|
1351
|
-
/* @__PURE__ */ e("div", { className:
|
|
1352
|
-
/* @__PURE__ */ e(
|
|
1353
|
-
] }) : /* @__PURE__ */ s("div", { className:
|
|
1354
|
-
/* @__PURE__ */ s("div", { className:
|
|
1355
|
-
/* @__PURE__ */ e("div", { className:
|
|
1356
|
-
/* @__PURE__ */ e("div", { className:
|
|
1357
|
-
/* @__PURE__ */ e("div", { className:
|
|
1358
|
-
/* @__PURE__ */ e("div", { className:
|
|
1359
|
-
|
|
1354
|
+
}, [v]), h = m.reduce((c, P) => c + (P.key.tokenQuota || 0), 0), d = () => a ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(V, { tip: "加载监控数据..." }) }) : l ? /* @__PURE__ */ s("div", { className: O.errorState, children: [
|
|
1355
|
+
/* @__PURE__ */ e("div", { className: O.errorTitle, children: "模型监控数据加载失败" }),
|
|
1356
|
+
/* @__PURE__ */ e("div", { className: O.errorDetail, children: l }),
|
|
1357
|
+
/* @__PURE__ */ e(R, { icon: /* @__PURE__ */ e(Te, {}), onClick: T, type: "primary", children: "重试" })
|
|
1358
|
+
] }) : /* @__PURE__ */ s("div", { className: O.page, children: [
|
|
1359
|
+
/* @__PURE__ */ s("div", { className: O.kpiGrid, children: [
|
|
1360
|
+
/* @__PURE__ */ e("div", { className: O.kpiCard, children: /* @__PURE__ */ e($, { title: "总请求(近7天)", value: A.requests }) }),
|
|
1361
|
+
/* @__PURE__ */ e("div", { className: O.kpiCard, children: /* @__PURE__ */ e($, { title: "总 Tokens", value: te(A.tokens) }) }),
|
|
1362
|
+
/* @__PURE__ */ e("div", { className: O.kpiCard, children: /* @__PURE__ */ e($, { title: "平均延迟", value: A.avgLatency, suffix: "ms" }) }),
|
|
1363
|
+
/* @__PURE__ */ e("div", { className: O.kpiCard, children: /* @__PURE__ */ e(
|
|
1364
|
+
$,
|
|
1360
1365
|
{
|
|
1361
1366
|
title: "错误数",
|
|
1362
|
-
value:
|
|
1363
|
-
valueStyle:
|
|
1367
|
+
value: A.errors,
|
|
1368
|
+
valueStyle: A.errors > 0 ? { color: "#ff4d4f" } : void 0
|
|
1364
1369
|
}
|
|
1365
1370
|
) })
|
|
1366
1371
|
] }),
|
|
1367
|
-
/* @__PURE__ */ s("div", { className:
|
|
1368
|
-
/* @__PURE__ */ s("div", { className:
|
|
1372
|
+
/* @__PURE__ */ s("div", { className: O.sectionCard, children: [
|
|
1373
|
+
/* @__PURE__ */ s("div", { className: O.sectionHead, children: [
|
|
1369
1374
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "AK 用量" }),
|
|
1370
|
-
h > 0 && /* @__PURE__ */ s("span", { className:
|
|
1375
|
+
h > 0 && /* @__PURE__ */ s("span", { className: O.sectionHint, children: [
|
|
1371
1376
|
"合计额度 ",
|
|
1372
1377
|
te(h),
|
|
1373
1378
|
" tokens"
|
|
1374
1379
|
] })
|
|
1375
1380
|
] }),
|
|
1376
|
-
m.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: "网关下暂无 AK" }) : /* @__PURE__ */ e("div", { className:
|
|
1377
|
-
const
|
|
1381
|
+
m.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: "网关下暂无 AK" }) : /* @__PURE__ */ e("div", { className: O.akList, children: m.map((c) => {
|
|
1382
|
+
const P = c.key.totalTokens ?? 0, I = c.key.tokenQuota || 0, r = I > 0 ? Math.min(P / I * 100, 100) : 0;
|
|
1378
1383
|
return /* @__PURE__ */ s(
|
|
1379
1384
|
"div",
|
|
1380
1385
|
{
|
|
1381
1386
|
className: t.akCard,
|
|
1382
|
-
onClick: () =>
|
|
1387
|
+
onClick: () => M(c),
|
|
1383
1388
|
children: [
|
|
1384
1389
|
/* @__PURE__ */ s("div", { className: t.akCardRow, children: [
|
|
1385
1390
|
/* @__PURE__ */ e("span", { className: t.akTitle, children: c.key.description || c.key.userName || `AK #${c.key.id}` }),
|
|
@@ -1402,8 +1407,8 @@ function Mt() {
|
|
|
1402
1407
|
}
|
|
1403
1408
|
) }),
|
|
1404
1409
|
/* @__PURE__ */ s("span", { className: t.akUsageText, children: [
|
|
1405
|
-
te(
|
|
1406
|
-
|
|
1410
|
+
te(P),
|
|
1411
|
+
I > 0 ? ` / ${te(I)}` : "",
|
|
1407
1412
|
" tokens"
|
|
1408
1413
|
] }),
|
|
1409
1414
|
/* @__PURE__ */ e("span", { className: t.akMetaText, children: c.statsError ? c.statsError : c.key.lastUsedAt ? `最近使用 ${c.key.lastUsedAt}` : "尚未使用" })
|
|
@@ -1414,12 +1419,12 @@ function Mt() {
|
|
|
1414
1419
|
);
|
|
1415
1420
|
}) })
|
|
1416
1421
|
] }),
|
|
1417
|
-
/* @__PURE__ */ s("div", { className:
|
|
1422
|
+
/* @__PURE__ */ s("div", { className: O.sectionCard, children: [
|
|
1418
1423
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "模型用量分布(网关全局)" }),
|
|
1419
|
-
/* @__PURE__ */ e(ve, { models:
|
|
1424
|
+
/* @__PURE__ */ e(ve, { models: A.models })
|
|
1420
1425
|
] })
|
|
1421
1426
|
] });
|
|
1422
|
-
return /* @__PURE__ */ s("div", { className:
|
|
1427
|
+
return /* @__PURE__ */ s("div", { className: O.container, children: [
|
|
1423
1428
|
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
1424
1429
|
/* @__PURE__ */ e("h2", { className: t.modelMgmtTitle, children: "模型监控" }),
|
|
1425
1430
|
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "大模型网关管控视图 — 网关全局聚合调用量、Tokens 与延迟(近 7 天)" })
|
|
@@ -1433,7 +1438,7 @@ function Mt() {
|
|
|
1433
1438
|
{
|
|
1434
1439
|
key: "sessions",
|
|
1435
1440
|
label: "会话统计",
|
|
1436
|
-
children: /* @__PURE__ */ e(
|
|
1441
|
+
children: /* @__PURE__ */ e(Qe, { fallback: /* @__PURE__ */ e(V, { tip: "加载会话统计..." }), children: /* @__PURE__ */ e(At, {}) })
|
|
1437
1442
|
}
|
|
1438
1443
|
]
|
|
1439
1444
|
}
|
|
@@ -1444,29 +1449,29 @@ function Mt() {
|
|
|
1444
1449
|
title: f ? `AK 用量 — ${f.key.description || f.key.akPrefix}` : "",
|
|
1445
1450
|
width: 860,
|
|
1446
1451
|
open: !!f,
|
|
1447
|
-
onClose: () =>
|
|
1452
|
+
onClose: () => M(null),
|
|
1448
1453
|
destroyOnHidden: !0,
|
|
1449
1454
|
children: f && /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
|
|
1450
1455
|
/* @__PURE__ */ e("div", { style: { fontSize: 12, color: "#8c8c8c", marginBottom: 12 }, children: "调用监控是网关全局维度(不按 AK 留存),以下统计覆盖全部 AK; 该 AK 自身的累计消耗见「本 AK 累计 Token」。" }),
|
|
1451
1456
|
/* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
|
|
1452
|
-
/* @__PURE__ */ e(
|
|
1453
|
-
/* @__PURE__ */ e(
|
|
1454
|
-
/* @__PURE__ */ e(
|
|
1455
|
-
/* @__PURE__ */ e(
|
|
1456
|
-
/* @__PURE__ */ e(
|
|
1457
|
+
/* @__PURE__ */ e($, { title: "总请求", value: ((g = f.stats) == null ? void 0 : g.totalRequests) ?? 0 }),
|
|
1458
|
+
/* @__PURE__ */ e($, { title: "总 Tokens", value: ((o = f.stats) == null ? void 0 : o.totalTokens) ?? 0 }),
|
|
1459
|
+
/* @__PURE__ */ e($, { title: "平均延迟", value: ((K = f.stats) == null ? void 0 : K.avgLatencyMs) ?? 0, suffix: "ms" }),
|
|
1460
|
+
/* @__PURE__ */ e($, { title: "输入 Tokens", value: ((E = f.stats) == null ? void 0 : E.totalPromptTokens) ?? 0 }),
|
|
1461
|
+
/* @__PURE__ */ e($, { title: "输出 Tokens", value: ((F = f.stats) == null ? void 0 : F.totalCompletionTokens) ?? 0 }),
|
|
1457
1462
|
/* @__PURE__ */ e(
|
|
1458
|
-
|
|
1463
|
+
$,
|
|
1459
1464
|
{
|
|
1460
1465
|
title: "本 AK 累计 Token",
|
|
1461
1466
|
value: f.key.totalTokens ?? 0
|
|
1462
1467
|
}
|
|
1463
1468
|
),
|
|
1464
1469
|
/* @__PURE__ */ e(
|
|
1465
|
-
|
|
1470
|
+
$,
|
|
1466
1471
|
{
|
|
1467
1472
|
title: "错误数",
|
|
1468
1473
|
value: ((G = f.stats) == null ? void 0 : G.errorCount) ?? 0,
|
|
1469
|
-
valueStyle: (((
|
|
1474
|
+
valueStyle: (((H = f.stats) == null ? void 0 : H.errorCount) ?? 0) > 0 ? { color: "#ff4d4f" } : void 0
|
|
1470
1475
|
}
|
|
1471
1476
|
)
|
|
1472
1477
|
] }),
|
|
@@ -1501,25 +1506,25 @@ function Mt() {
|
|
|
1501
1506
|
)
|
|
1502
1507
|
] });
|
|
1503
1508
|
}
|
|
1504
|
-
const
|
|
1505
|
-
{ key: "model-management", label: "模型管理", icon: /* @__PURE__ */ e(
|
|
1506
|
-
{ key: "model-chat", label: "模型对话", icon: /* @__PURE__ */ e(
|
|
1507
|
-
{ key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(
|
|
1509
|
+
const _t = [
|
|
1510
|
+
{ key: "model-management", label: "模型管理", icon: /* @__PURE__ */ e(Re, {}) },
|
|
1511
|
+
{ key: "model-chat", label: "模型对话", icon: /* @__PURE__ */ e(Ue, {}) },
|
|
1512
|
+
{ key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(He, {}) },
|
|
1508
1513
|
{ key: "agent-app", label: "Agent 应用", icon: /* @__PURE__ */ e(Ce, {}) },
|
|
1509
|
-
{ key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(
|
|
1510
|
-
{ key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(
|
|
1511
|
-
{ key: "model-monitor", label: "模型监控", icon: /* @__PURE__ */ e(
|
|
1514
|
+
{ key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(je, {}) },
|
|
1515
|
+
{ key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(qe, {}) },
|
|
1516
|
+
{ key: "model-monitor", label: "模型监控", icon: /* @__PURE__ */ e(Fe, {}) }
|
|
1512
1517
|
];
|
|
1513
1518
|
function Dt() {
|
|
1514
1519
|
const [a, n] = S("model-management"), [l, i] = S([]), m = (y) => {
|
|
1515
1520
|
i(y), n("model-chat");
|
|
1516
|
-
}, N = Me(() =>
|
|
1521
|
+
}, N = Me(() => _t, []), v = (y, f, M = !1) => /* @__PURE__ */ e(
|
|
1517
1522
|
"div",
|
|
1518
1523
|
{
|
|
1519
1524
|
style: {
|
|
1520
|
-
display: a === y ?
|
|
1525
|
+
display: a === y ? M ? "flex" : "block" : "none",
|
|
1521
1526
|
height: "100%",
|
|
1522
|
-
...
|
|
1527
|
+
...M ? { flexDirection: "column" } : {}
|
|
1523
1528
|
},
|
|
1524
1529
|
children: f
|
|
1525
1530
|
}
|
|
@@ -1534,13 +1539,13 @@ function Dt() {
|
|
|
1534
1539
|
}
|
|
1535
1540
|
) }, y.key)) }) }),
|
|
1536
1541
|
/* @__PURE__ */ s("main", { className: t.panelArea, children: [
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1542
|
+
v("model-management", /* @__PURE__ */ e(ut, { onStartChat: m })),
|
|
1543
|
+
v("model-chat", /* @__PURE__ */ e(mt, { initialModels: l }), !0),
|
|
1544
|
+
v("ak-management", /* @__PURE__ */ e(it, {})),
|
|
1545
|
+
v("agent-app", /* @__PURE__ */ e(Ye, {})),
|
|
1546
|
+
v("mcp-service", /* @__PURE__ */ e(Ve, {})),
|
|
1547
|
+
v("skill-market", /* @__PURE__ */ e(Xe, {})),
|
|
1548
|
+
v("model-monitor", /* @__PURE__ */ e(Mt, {}))
|
|
1544
1549
|
] })
|
|
1545
1550
|
] });
|
|
1546
1551
|
}
|