@yuku123/z-team-component 0.2.42 → 0.2.45
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-C-MpAQB6.js → ComponentDoc-DtDTj8G-.js} +1 -1
- package/dist/{InvitationManagementPage-DyHiVHXs.js → InvitationManagementPage-C3e8FONl.js} +1 -1
- package/dist/{OnboardingPage-LqTT4gFG.js → OnboardingPage-JJTsN4II.js} +2 -2
- package/dist/{SystemShell-B0PhX-cr.js → SystemShell-BBK1x8og.js} +1 -1
- package/dist/{api-DYG7gCR2.js → api-DLT_RIhW.js} +1 -1
- package/dist/{index-Cx9Yfc6I.js → index-C66-7XZO.js} +500 -478
- package/dist/{index-DUxnVFCC.js → index-CK695ZYz.js} +1 -1
- package/dist/{index-qhzl9hrX.js → index-CVXAthwM.js} +2 -2
- package/dist/{index-CHDQ81hx.js → index-Co97c_ul.js} +2 -2
- package/dist/{index-D_ykYu_g.js → index-Cr1LrASF.js} +2 -2
- package/dist/{index-CMgpbpLA.js → index-CtxZJJXW.js} +1 -1
- package/dist/{index-BD4wbX3d.js → index-D_j2Qydx.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/pages.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { CopyOutlined as se, ReloadOutlined as Ne, PlusOutlined as ve, DeleteOutlined as Pe, ClearOutlined as Ie, CloseOutlined as Be, SendOutlined as $e, RobotOutlined as Te, CloudServerOutlined as Oe, MessageOutlined as De, KeyOutlined as Le, ApiOutlined as
|
|
3
|
-
import { Tooltip as Q, Tabs as Ce, Button as z, Modal as ce, Input as Se, Drawer as
|
|
4
|
-
import { useState as
|
|
2
|
+
import { CopyOutlined as se, ReloadOutlined as Ne, PlusOutlined as ve, DeleteOutlined as Pe, ClearOutlined as Ie, CloseOutlined as Be, SendOutlined as $e, RobotOutlined as Te, CloudServerOutlined as Oe, MessageOutlined as De, KeyOutlined as Le, ApiOutlined as ze, ToolOutlined as Re, BarChartOutlined as Ue } from "@ant-design/icons";
|
|
3
|
+
import { Tooltip as Q, Tabs as Ce, Button as z, Modal as ce, Input as Se, Drawer as Ae, Spin as V, Statistic as P, Table as we, message as F, Tag as G, Select as He, Checkbox as qe } from "antd";
|
|
4
|
+
import { useState as S, useCallback as H, useEffect as ae, useRef as de, useMemo as xe, Suspense as je, lazy as Fe } from "react";
|
|
5
5
|
import { s as t } from "./SmartWorkbench.module-xRRmpTTw.js";
|
|
6
6
|
import { AgentAppList as Ge, McpPage as Je, SkillMarket as Qe } from "@yuku123/z-agent-component";
|
|
7
7
|
const le = "ft_gateway_default_ak", X = "", ue = "";
|
|
@@ -23,7 +23,7 @@ function We(a) {
|
|
|
23
23
|
apiType: String(a.apiType ?? a.api_type ?? "OpenAPI")
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
async function
|
|
26
|
+
async function Ke() {
|
|
27
27
|
let a;
|
|
28
28
|
try {
|
|
29
29
|
a = await fetch(`${X}/api/scenario-instances/0/models`, {
|
|
@@ -49,9 +49,9 @@ async function Me() {
|
|
|
49
49
|
throw new Error("模型列表返回格式异常(非数组)");
|
|
50
50
|
return l.map(We);
|
|
51
51
|
}
|
|
52
|
-
async function Ye(a, n, l,
|
|
53
|
-
var K,
|
|
54
|
-
const
|
|
52
|
+
async function Ye(a, n, l, o) {
|
|
53
|
+
var k, K, B, C;
|
|
54
|
+
const d = await fetch(`${ue}/v1/chat/completions`, {
|
|
55
55
|
method: "POST",
|
|
56
56
|
headers: {
|
|
57
57
|
"Content-Type": "application/json",
|
|
@@ -63,75 +63,75 @@ async function Ye(a, n, l, i) {
|
|
|
63
63
|
messages: l,
|
|
64
64
|
stream: !0
|
|
65
65
|
}),
|
|
66
|
-
signal:
|
|
66
|
+
signal: o.signal
|
|
67
67
|
});
|
|
68
|
-
if (!
|
|
69
|
-
const T = await
|
|
68
|
+
if (!d.ok || !d.body) {
|
|
69
|
+
const T = await d.text().catch(() => "");
|
|
70
70
|
if (/<!doctype html/i.test(T.slice(0, 200)))
|
|
71
71
|
throw new Error("模型网关未接入(/v1/chat/completions 落到主壳 SPA,无网关响应)");
|
|
72
|
-
let
|
|
72
|
+
let _ = `HTTP ${d.status}`;
|
|
73
73
|
try {
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const p = JSON.parse(T);
|
|
75
|
+
_ = ((k = p == null ? void 0 : p.error) == null ? void 0 : k.message) ?? _;
|
|
76
76
|
} catch {
|
|
77
|
-
T && (
|
|
77
|
+
T && (_ = T);
|
|
78
78
|
}
|
|
79
|
-
throw new Error(
|
|
79
|
+
throw new Error(_);
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
let
|
|
81
|
+
const N = d.body.getReader(), v = new TextDecoder();
|
|
82
|
+
let f = "";
|
|
83
83
|
try {
|
|
84
84
|
for (; ; ) {
|
|
85
|
-
const { done: T, value:
|
|
85
|
+
const { done: T, value: _ } = await N.read();
|
|
86
86
|
if (T) break;
|
|
87
|
-
|
|
88
|
-
const
|
|
87
|
+
f += v.decode(_, { stream: !0 });
|
|
88
|
+
const p = f.split(`
|
|
89
89
|
|
|
90
90
|
`);
|
|
91
|
-
|
|
92
|
-
for (const
|
|
93
|
-
let
|
|
94
|
-
for (const
|
|
91
|
+
f = p.pop() ?? "";
|
|
92
|
+
for (const c of p) {
|
|
93
|
+
let g = "";
|
|
94
|
+
for (const i of c.split(`
|
|
95
95
|
`))
|
|
96
|
-
|
|
97
|
-
if (!
|
|
98
|
-
if (
|
|
99
|
-
|
|
96
|
+
i.startsWith("data:") && (g += i.slice(5).trim());
|
|
97
|
+
if (!g || g === "[DONE]") {
|
|
98
|
+
if (g === "[DONE]") {
|
|
99
|
+
o.onDone();
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
continue;
|
|
103
103
|
}
|
|
104
104
|
try {
|
|
105
|
-
const
|
|
106
|
-
if (Array.isArray(
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
const
|
|
110
|
-
promptTokens:
|
|
111
|
-
completionTokens:
|
|
112
|
-
totalTokens:
|
|
105
|
+
const i = JSON.parse(g), A = i == null ? void 0 : i.choices;
|
|
106
|
+
if (Array.isArray(A) && A.length > 0) {
|
|
107
|
+
const b = (K = A[0]) == null ? void 0 : K.delta;
|
|
108
|
+
if (b != null && b.content && o.onDelta(b.content), (B = A[0]) == null ? void 0 : B.finish_reason) {
|
|
109
|
+
const m = i != null && i.usage ? {
|
|
110
|
+
promptTokens: i.usage.prompt_tokens ?? 0,
|
|
111
|
+
completionTokens: i.usage.completion_tokens ?? 0,
|
|
112
|
+
totalTokens: i.usage.total_tokens ?? 0
|
|
113
113
|
} : void 0;
|
|
114
|
-
|
|
114
|
+
o.onDone(m);
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
120
|
-
promptTokens:
|
|
121
|
-
completionTokens:
|
|
122
|
-
totalTokens:
|
|
118
|
+
if (i != null && i.usage) {
|
|
119
|
+
const b = {
|
|
120
|
+
promptTokens: i.usage.prompt_tokens ?? 0,
|
|
121
|
+
completionTokens: i.usage.completion_tokens ?? 0,
|
|
122
|
+
totalTokens: i.usage.total_tokens ?? 0
|
|
123
123
|
};
|
|
124
|
-
|
|
124
|
+
o.onDone(b);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
} catch {
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
o.onDone();
|
|
132
132
|
} catch (T) {
|
|
133
|
-
if ((
|
|
134
|
-
throw
|
|
133
|
+
if ((C = o.signal) != null && C.aborted) return;
|
|
134
|
+
throw o.onError(T instanceof Error ? T : new Error(String(T))), T;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
async function ne(a, n) {
|
|
@@ -169,7 +169,7 @@ function Ve(a) {
|
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
async function _e(a, n, l) {
|
|
172
|
-
const
|
|
172
|
+
const o = await fetch(`${X}/api/ak/create`, {
|
|
173
173
|
method: "POST",
|
|
174
174
|
headers: Z({ Accept: "application/json", "Content-Type": "application/json" }),
|
|
175
175
|
credentials: "include",
|
|
@@ -180,15 +180,15 @@ async function _e(a, n, l) {
|
|
|
180
180
|
ownerUserId: a,
|
|
181
181
|
ownerUserName: n
|
|
182
182
|
})
|
|
183
|
-
}),
|
|
184
|
-
return
|
|
183
|
+
}), d = await ne(o, "创建 AK"), N = (d == null ? void 0 : d.data) ?? {}, v = N.accessKey ?? "", f = N.secretKey ?? "";
|
|
184
|
+
return v && f && pe(v, f), { apiKey: f, akPrefix: v, message: "AK 已创建,secretKey 仅创建时可见" };
|
|
185
185
|
}
|
|
186
186
|
async function ie(a) {
|
|
187
187
|
const n = await fetch(
|
|
188
188
|
`${X}/api/ak/list`,
|
|
189
189
|
{ headers: Z({ Accept: "application/json" }), credentials: "include" }
|
|
190
|
-
), l = await ne(n, "获取 AK 列表"),
|
|
191
|
-
return (a ?
|
|
190
|
+
), l = await ne(n, "获取 AK 列表"), o = Array.isArray(l == null ? void 0 : l.data) ? l.data : [];
|
|
191
|
+
return (a ? o.filter((N) => !N.owner_user_id || String(N.owner_user_id) === String(a)) : o).filter((N) => (N.is_deleted ?? 0) === 0).map(Ve);
|
|
192
192
|
}
|
|
193
193
|
async function Xe(a) {
|
|
194
194
|
const n = await fetch(`${X}/api/ak/delete?id=${encodeURIComponent(String(a))}`, {
|
|
@@ -198,44 +198,60 @@ async function Xe(a) {
|
|
|
198
198
|
});
|
|
199
199
|
await ne(n, "吊销 AK");
|
|
200
200
|
}
|
|
201
|
-
async function
|
|
202
|
-
var
|
|
201
|
+
async function Me(a) {
|
|
202
|
+
var T, _;
|
|
203
203
|
const n = await fetch(
|
|
204
|
-
`${X}/api/admin/llm-call-monitor/stats?hours=
|
|
204
|
+
`${X}/api/admin/llm-call-monitor/stats?hours=168`,
|
|
205
205
|
{ headers: Z({ Accept: "application/json" }), credentials: "include" }
|
|
206
|
-
), l = await ne(n, "获取调用统计"),
|
|
207
|
-
let
|
|
206
|
+
), l = await ne(n, "获取调用统计"), d = ((l == null ? void 0 : l.data) ?? {}).summary ?? {};
|
|
207
|
+
let N = [];
|
|
208
208
|
try {
|
|
209
|
-
const
|
|
209
|
+
const p = await fetch(
|
|
210
210
|
`${X}/api/admin/llm-call-monitor/recent?page=1&size=20`,
|
|
211
211
|
{ headers: Z({ Accept: "application/json" }), credentials: "include" }
|
|
212
|
-
),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
212
|
+
), c = await ne(p, "获取调用明细");
|
|
213
|
+
N = (Array.isArray((T = c == null ? void 0 : c.data) == null ? void 0 : T.records) ? c.data.records : []).map((i, A) => {
|
|
214
|
+
const b = Number(i.promptTokens ?? 0), q = Number(i.completionTokens ?? 0);
|
|
215
|
+
return {
|
|
216
|
+
id: Number(i.id ?? A),
|
|
217
|
+
apiKeyId: a,
|
|
218
|
+
protocol: "chat/completions",
|
|
219
|
+
model: String(i.model ?? ""),
|
|
220
|
+
stream: Number(i.stream ?? 0),
|
|
221
|
+
promptTokens: b,
|
|
222
|
+
completionTokens: q,
|
|
223
|
+
totalTokens: Number(i.totalTokens ?? b + q),
|
|
224
|
+
latencyMs: Number(i.durationMs ?? 0),
|
|
225
|
+
statusCode: i.success === !1 || i.success === 0 ? 500 : 200,
|
|
226
|
+
errorMsg: i.errorType ?? null,
|
|
227
|
+
createTime: String(i.createTime ?? "").replace("T", " ").slice(0, 19)
|
|
228
|
+
};
|
|
229
|
+
});
|
|
227
230
|
} catch {
|
|
228
231
|
}
|
|
232
|
+
const v = {}, f = {};
|
|
233
|
+
for (const p of N) {
|
|
234
|
+
const c = v[_ = p.model] || (v[_] = [0, 0, 0]);
|
|
235
|
+
c[0] += 1, c[1] += p.promptTokens, c[2] += p.completionTokens;
|
|
236
|
+
const g = (p.createTime || "").slice(0, 10);
|
|
237
|
+
if (g) {
|
|
238
|
+
const i = f[g] || (f[g] = [0, 0, 0]);
|
|
239
|
+
i[0] += 1, i[1] += p.promptTokens, i[2] += p.completionTokens;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const k = Number(d.totalTokens ?? 0), K = N.reduce((p, c) => p + c.totalTokens, 0), B = N.reduce((p, c) => p + c.promptTokens, 0), C = N.reduce((p, c) => p + c.completionTokens, 0);
|
|
229
243
|
return {
|
|
230
|
-
totalRequests: Number(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
244
|
+
totalRequests: Number(d.totalCount ?? 0),
|
|
245
|
+
// 汇总口径优先用后端整窗合计(后端 selectStats 才有 token 合计),
|
|
246
|
+
// 明细只有最近一页 ⇒ 只在汇总缺失时用明细兜底。
|
|
247
|
+
totalPromptTokens: Number(d.totalPromptTokens ?? 0) || B,
|
|
248
|
+
totalCompletionTokens: Number(d.totalCompletionTokens ?? 0) || C,
|
|
249
|
+
totalTokens: k || K,
|
|
250
|
+
avgLatencyMs: Number(d.avgDurationMs ?? 0),
|
|
251
|
+
errorCount: Number(d.failCount ?? 0),
|
|
252
|
+
daily: f,
|
|
253
|
+
models: v,
|
|
254
|
+
recent: N
|
|
239
255
|
};
|
|
240
256
|
}
|
|
241
257
|
function Ze() {
|
|
@@ -258,11 +274,11 @@ function et(a) {
|
|
|
258
274
|
}
|
|
259
275
|
async function tt() {
|
|
260
276
|
try {
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
277
|
+
const o = localStorage.getItem(le);
|
|
278
|
+
if (o) return o;
|
|
263
279
|
} catch {
|
|
264
280
|
}
|
|
265
|
-
const n = (await ie("").catch(() => [])).find((
|
|
281
|
+
const n = (await ie("").catch(() => [])).find((o) => o.active && o.secret);
|
|
266
282
|
if (n != null && n.secret) {
|
|
267
283
|
try {
|
|
268
284
|
localStorage.setItem(le, n.secret);
|
|
@@ -283,7 +299,7 @@ async function tt() {
|
|
|
283
299
|
}
|
|
284
300
|
return l.apiKey;
|
|
285
301
|
}
|
|
286
|
-
function
|
|
302
|
+
function be() {
|
|
287
303
|
try {
|
|
288
304
|
localStorage.removeItem(le);
|
|
289
305
|
} catch {
|
|
@@ -315,42 +331,42 @@ curl -X POST ${a}/v1/messages \\
|
|
|
315
331
|
}'`;
|
|
316
332
|
}
|
|
317
333
|
function st() {
|
|
318
|
-
const [a, n] =
|
|
319
|
-
|
|
334
|
+
const [a, n] = S("personal"), [l, o] = S([]), [d, N] = S([]), [v, f] = S(!0), [k, K] = S(!1), [B, C] = S(!1), [T, _] = S(""), [p, c] = S({ open: !1 }), [g, i] = S(null), [A, b] = S(null), [q, m] = S(!1), I = "zifang", D = "zifang", E = Ze(), j = H(async () => {
|
|
335
|
+
f(!0);
|
|
320
336
|
try {
|
|
321
|
-
const [
|
|
337
|
+
const [h, x] = await Promise.all([
|
|
322
338
|
ie("system-default").catch(() => []),
|
|
323
|
-
ie(
|
|
339
|
+
ie(I).catch(() => [])
|
|
324
340
|
]);
|
|
325
|
-
|
|
341
|
+
o(h), N(x);
|
|
326
342
|
} finally {
|
|
327
|
-
|
|
343
|
+
f(!1);
|
|
328
344
|
}
|
|
329
|
-
}, [
|
|
345
|
+
}, [I]);
|
|
330
346
|
ae(() => {
|
|
331
347
|
j();
|
|
332
348
|
}, [j]);
|
|
333
349
|
const r = () => {
|
|
334
|
-
|
|
335
|
-
},
|
|
350
|
+
_(""), C(!0);
|
|
351
|
+
}, u = async () => {
|
|
336
352
|
if (!T.trim()) {
|
|
337
353
|
F.warning("请输入 AK 名称");
|
|
338
354
|
return;
|
|
339
355
|
}
|
|
340
|
-
|
|
356
|
+
K(!0);
|
|
341
357
|
try {
|
|
342
|
-
const
|
|
343
|
-
pe(
|
|
358
|
+
const h = await _e(I, D, T.trim());
|
|
359
|
+
pe(h.akPrefix, h.apiKey), C(!1), c({
|
|
344
360
|
open: !0,
|
|
345
|
-
apiKey:
|
|
346
|
-
akPrefix:
|
|
361
|
+
apiKey: h.apiKey,
|
|
362
|
+
akPrefix: h.akPrefix
|
|
347
363
|
}), j();
|
|
348
|
-
} catch (
|
|
349
|
-
F.error(
|
|
364
|
+
} catch (h) {
|
|
365
|
+
F.error(h instanceof Error ? h.message : "创建 AK 失败");
|
|
350
366
|
} finally {
|
|
351
|
-
|
|
367
|
+
K(!1);
|
|
352
368
|
}
|
|
353
|
-
}, w = (
|
|
369
|
+
}, w = (h) => {
|
|
354
370
|
ce.confirm({
|
|
355
371
|
title: "确认吊销此 AK?",
|
|
356
372
|
content: "吊销后此 AK 将立即失效,无法恢复。",
|
|
@@ -359,75 +375,75 @@ function st() {
|
|
|
359
375
|
cancelText: "取消",
|
|
360
376
|
onOk: async () => {
|
|
361
377
|
try {
|
|
362
|
-
await Xe(
|
|
363
|
-
} catch (
|
|
364
|
-
F.error(
|
|
378
|
+
await Xe(h), F.success("AK 已吊销"), j(), be();
|
|
379
|
+
} catch (x) {
|
|
380
|
+
F.error(x instanceof Error ? x.message : "吊销失败");
|
|
365
381
|
}
|
|
366
382
|
}
|
|
367
383
|
});
|
|
368
|
-
},
|
|
369
|
-
navigator.clipboard.writeText(
|
|
370
|
-
}, J = (
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
},
|
|
374
|
-
|
|
384
|
+
}, M = (h) => {
|
|
385
|
+
navigator.clipboard.writeText(h).then(() => F.success("已复制到剪贴板")).catch(() => F.warning("复制失败,请手动复制"));
|
|
386
|
+
}, J = (h) => {
|
|
387
|
+
const x = et(h.akPrefix);
|
|
388
|
+
x ? M(x) : (M(h.akPrefix), F.info("完整 AK 未在本地缓存(可能在本设备外创建),已复制前缀"));
|
|
389
|
+
}, $ = async (h) => {
|
|
390
|
+
i(h), m(!0), b(null);
|
|
375
391
|
try {
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
} catch (
|
|
379
|
-
F.error(
|
|
392
|
+
const x = await Me(h.id);
|
|
393
|
+
b(x);
|
|
394
|
+
} catch (x) {
|
|
395
|
+
F.error(x instanceof Error ? x.message : "获取用量失败");
|
|
380
396
|
} finally {
|
|
381
|
-
|
|
397
|
+
m(!1);
|
|
382
398
|
}
|
|
383
399
|
}, W = () => {
|
|
384
|
-
|
|
385
|
-
}, oe = (
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
400
|
+
i(null), b(null);
|
|
401
|
+
}, oe = (h) => {
|
|
402
|
+
const x = Object.entries(h);
|
|
403
|
+
if (x.length === 0)
|
|
388
404
|
return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
389
|
-
const Y = Math.max(...
|
|
390
|
-
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children:
|
|
391
|
-
const ge =
|
|
405
|
+
const Y = Math.max(...x.map(([, y]) => y[1] + y[2]), 1);
|
|
406
|
+
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: x.map(([y, R]) => {
|
|
407
|
+
const ge = R[1] + R[2], Ee = ge / Y * 100;
|
|
392
408
|
return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
|
|
393
|
-
/* @__PURE__ */ e(Q, { title: `${
|
|
409
|
+
/* @__PURE__ */ e(Q, { title: `${y}: ${R[0]}次 / ${ge} tokens`, children: /* @__PURE__ */ e(
|
|
394
410
|
"div",
|
|
395
411
|
{
|
|
396
412
|
className: t.usageBar,
|
|
397
|
-
style: { height: `${Math.max(
|
|
413
|
+
style: { height: `${Math.max(Ee, 2)}%` }
|
|
398
414
|
}
|
|
399
415
|
) }),
|
|
400
|
-
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children:
|
|
401
|
-
] },
|
|
416
|
+
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children: y })
|
|
417
|
+
] }, y);
|
|
402
418
|
}) });
|
|
403
|
-
},
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
419
|
+
}, L = (h) => {
|
|
420
|
+
const x = Object.entries(h);
|
|
421
|
+
if (x.length === 0)
|
|
406
422
|
return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
407
|
-
const Y = Math.max(...
|
|
408
|
-
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children:
|
|
409
|
-
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children:
|
|
423
|
+
const Y = Math.max(...x.map(([, y]) => y[0]), 1);
|
|
424
|
+
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: x.sort((y, R) => R[1][0] - y[1][0]).map(([y, R]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
|
|
425
|
+
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: y }),
|
|
410
426
|
/* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
|
|
411
427
|
"div",
|
|
412
428
|
{
|
|
413
429
|
className: t.modelBreakdownFill,
|
|
414
|
-
style: { width: `${
|
|
430
|
+
style: { width: `${R[0] / Y * 100}%` }
|
|
415
431
|
}
|
|
416
432
|
) }),
|
|
417
433
|
/* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
|
|
418
|
-
|
|
434
|
+
R[0],
|
|
419
435
|
"次 / ",
|
|
420
|
-
|
|
436
|
+
R[1] + (R[2] || 0),
|
|
421
437
|
"tokens"
|
|
422
438
|
] })
|
|
423
|
-
] },
|
|
424
|
-
},
|
|
439
|
+
] }, y)) });
|
|
440
|
+
}, U = [
|
|
425
441
|
{
|
|
426
442
|
title: "时间",
|
|
427
443
|
dataIndex: "createTime",
|
|
428
444
|
key: "createTime",
|
|
429
445
|
width: 160,
|
|
430
|
-
render: (
|
|
446
|
+
render: (h) => h ? new Date(h).toLocaleString("zh-CN") : "-"
|
|
431
447
|
},
|
|
432
448
|
{ title: "模型", dataIndex: "model", key: "model", width: 140 },
|
|
433
449
|
{
|
|
@@ -435,7 +451,7 @@ function st() {
|
|
|
435
451
|
dataIndex: "protocol",
|
|
436
452
|
key: "protocol",
|
|
437
453
|
width: 90,
|
|
438
|
-
render: (
|
|
454
|
+
render: (h) => /* @__PURE__ */ e(G, { children: h })
|
|
439
455
|
},
|
|
440
456
|
{
|
|
441
457
|
title: "输入",
|
|
@@ -460,59 +476,59 @@ function st() {
|
|
|
460
476
|
dataIndex: "latencyMs",
|
|
461
477
|
key: "latencyMs",
|
|
462
478
|
width: 70,
|
|
463
|
-
render: (
|
|
479
|
+
render: (h) => h ? `${h}ms` : "-"
|
|
464
480
|
},
|
|
465
481
|
{
|
|
466
482
|
title: "状态",
|
|
467
483
|
dataIndex: "statusCode",
|
|
468
484
|
key: "statusCode",
|
|
469
485
|
width: 60,
|
|
470
|
-
render: (
|
|
486
|
+
render: (h) => h ? /* @__PURE__ */ e(G, { color: h < 400 ? "green" : "red", children: h }) : "-"
|
|
471
487
|
}
|
|
472
|
-
], ee = (
|
|
473
|
-
const Y = Array.isArray(
|
|
474
|
-
return
|
|
488
|
+
], ee = (h, x) => {
|
|
489
|
+
const Y = Array.isArray(h) ? h : [];
|
|
490
|
+
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: x ? "暂无应用 AK" : "暂无个人 AK,点击上方按钮生成" }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: Y.map((y) => /* @__PURE__ */ s(
|
|
475
491
|
"div",
|
|
476
492
|
{
|
|
477
493
|
className: t.akCard,
|
|
478
|
-
onClick: () =>
|
|
494
|
+
onClick: () => $(y),
|
|
479
495
|
children: [
|
|
480
496
|
/* @__PURE__ */ s("div", { className: t.akCardRow, children: [
|
|
481
|
-
/* @__PURE__ */ e("span", { className: t.akTitle, children:
|
|
482
|
-
/* @__PURE__ */ e("code", { className: t.akPrefixSmall, children:
|
|
497
|
+
/* @__PURE__ */ e("span", { className: t.akTitle, children: y.description || y.akPrefix.replace("...", "**") }),
|
|
498
|
+
/* @__PURE__ */ e("code", { className: t.akPrefixSmall, children: y.akPrefix.replace("...", "**") }),
|
|
483
499
|
/* @__PURE__ */ e(
|
|
484
500
|
"span",
|
|
485
501
|
{
|
|
486
|
-
className: `${t.akStatus} ${
|
|
487
|
-
children:
|
|
502
|
+
className: `${t.akStatus} ${y.active ? t.akStatusActive : t.akStatusRevoked}`,
|
|
503
|
+
children: y.active ? "活跃" : "已吊销"
|
|
488
504
|
}
|
|
489
505
|
),
|
|
490
|
-
|
|
506
|
+
y.defaultModel && /* @__PURE__ */ s(G, { style: { fontSize: 11 }, children: [
|
|
491
507
|
"默认: ",
|
|
492
|
-
|
|
508
|
+
y.defaultModel
|
|
493
509
|
] }),
|
|
494
510
|
/* @__PURE__ */ s(
|
|
495
511
|
"div",
|
|
496
512
|
{
|
|
497
513
|
className: t.akCardActions,
|
|
498
|
-
onClick: (
|
|
514
|
+
onClick: (R) => R.stopPropagation(),
|
|
499
515
|
children: [
|
|
500
516
|
/* @__PURE__ */ e(Q, { title: "复制完整 AK", children: /* @__PURE__ */ e(
|
|
501
517
|
z,
|
|
502
518
|
{
|
|
503
519
|
size: "small",
|
|
504
520
|
icon: /* @__PURE__ */ e(se, {}),
|
|
505
|
-
onClick: () => J(
|
|
521
|
+
onClick: () => J(y),
|
|
506
522
|
children: "复制"
|
|
507
523
|
}
|
|
508
524
|
) }),
|
|
509
|
-
!
|
|
525
|
+
!x && y.active && /* @__PURE__ */ e(
|
|
510
526
|
z,
|
|
511
527
|
{
|
|
512
528
|
size: "small",
|
|
513
529
|
danger: !0,
|
|
514
530
|
icon: /* @__PURE__ */ e(Pe, {}),
|
|
515
|
-
onClick: () => w(
|
|
531
|
+
onClick: () => w(y.id),
|
|
516
532
|
children: "吊销"
|
|
517
533
|
}
|
|
518
534
|
)
|
|
@@ -527,27 +543,27 @@ function st() {
|
|
|
527
543
|
className: t.akMiniBarFill,
|
|
528
544
|
style: {
|
|
529
545
|
width: `${Math.min(
|
|
530
|
-
(
|
|
546
|
+
(y.totalTokens || 0) / (y.tokenQuota || ke) * 100,
|
|
531
547
|
100
|
|
532
548
|
)}%`
|
|
533
549
|
}
|
|
534
550
|
}
|
|
535
551
|
) }),
|
|
536
552
|
/* @__PURE__ */ s("span", { className: t.akUsageText, children: [
|
|
537
|
-
fe(
|
|
553
|
+
fe(y.totalTokens || 0),
|
|
538
554
|
" /",
|
|
539
555
|
" ",
|
|
540
|
-
fe(
|
|
556
|
+
fe(y.tokenQuota || ke)
|
|
541
557
|
] }),
|
|
542
558
|
/* @__PURE__ */ s("span", { className: t.akMetaText, children: [
|
|
543
|
-
|
|
559
|
+
y.totalRequests || 0,
|
|
544
560
|
" 次请求"
|
|
545
561
|
] }),
|
|
546
|
-
/* @__PURE__ */ e("span", { className: t.akMetaText, children: new Date(
|
|
562
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: new Date(y.createTime).toLocaleDateString("zh-CN") })
|
|
547
563
|
] })
|
|
548
564
|
]
|
|
549
565
|
},
|
|
550
|
-
|
|
566
|
+
y.id
|
|
551
567
|
)) });
|
|
552
568
|
};
|
|
553
569
|
return /* @__PURE__ */ s("div", { className: t.akContainer, children: [
|
|
@@ -556,23 +572,23 @@ function st() {
|
|
|
556
572
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlRow, children: [
|
|
557
573
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
|
|
558
574
|
/* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "OpenAI 兼容" }),
|
|
559
|
-
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children:
|
|
575
|
+
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: E }),
|
|
560
576
|
/* @__PURE__ */ e(Q, { title: "复制 Base URL", children: /* @__PURE__ */ e(
|
|
561
577
|
se,
|
|
562
578
|
{
|
|
563
579
|
className: t.akCopyIcon,
|
|
564
|
-
onClick: () =>
|
|
580
|
+
onClick: () => M(E)
|
|
565
581
|
}
|
|
566
582
|
) })
|
|
567
583
|
] }),
|
|
568
584
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
|
|
569
585
|
/* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "Anthropic 兼容" }),
|
|
570
|
-
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children:
|
|
586
|
+
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: E }),
|
|
571
587
|
/* @__PURE__ */ e(Q, { title: "复制 Base URL", children: /* @__PURE__ */ e(
|
|
572
588
|
se,
|
|
573
589
|
{
|
|
574
590
|
className: t.akCopyIcon,
|
|
575
|
-
onClick: () =>
|
|
591
|
+
onClick: () => M(E)
|
|
576
592
|
}
|
|
577
593
|
) })
|
|
578
594
|
] })
|
|
@@ -580,11 +596,11 @@ function st() {
|
|
|
580
596
|
/* @__PURE__ */ s("div", { className: t.akIntegrationGrid, children: [
|
|
581
597
|
/* @__PURE__ */ s("div", { children: [
|
|
582
598
|
/* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "OpenAI 兼容 — curl 示例" }),
|
|
583
|
-
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: at(
|
|
599
|
+
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: at(E) })
|
|
584
600
|
] }),
|
|
585
601
|
/* @__PURE__ */ s("div", { children: [
|
|
586
602
|
/* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "Anthropic 兼容 — curl 示例" }),
|
|
587
|
-
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: nt(
|
|
603
|
+
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: nt(E) })
|
|
588
604
|
] })
|
|
589
605
|
] })
|
|
590
606
|
] }),
|
|
@@ -603,7 +619,7 @@ function st() {
|
|
|
603
619
|
Ce,
|
|
604
620
|
{
|
|
605
621
|
activeKey: a,
|
|
606
|
-
onChange: (
|
|
622
|
+
onChange: (h) => n(h),
|
|
607
623
|
items: [
|
|
608
624
|
{ key: "app", label: "应用 AK" },
|
|
609
625
|
{ key: "personal", label: "个人 AK" }
|
|
@@ -619,7 +635,7 @@ function st() {
|
|
|
619
635
|
type: "primary",
|
|
620
636
|
icon: /* @__PURE__ */ e(ve, {}),
|
|
621
637
|
onClick: r,
|
|
622
|
-
loading:
|
|
638
|
+
loading: k,
|
|
623
639
|
children: "生成 AK"
|
|
624
640
|
}
|
|
625
641
|
)
|
|
@@ -627,18 +643,18 @@ function st() {
|
|
|
627
643
|
]
|
|
628
644
|
}
|
|
629
645
|
),
|
|
630
|
-
a === "app" ? ee(l, !0) : ee(
|
|
646
|
+
a === "app" ? ee(l, !0) : ee(d, !1)
|
|
631
647
|
] }),
|
|
632
648
|
/* @__PURE__ */ s(
|
|
633
649
|
ce,
|
|
634
650
|
{
|
|
635
|
-
open:
|
|
651
|
+
open: B,
|
|
636
652
|
title: "生成新 AK",
|
|
637
|
-
onCancel: () =>
|
|
638
|
-
onOk:
|
|
653
|
+
onCancel: () => C(!1),
|
|
654
|
+
onOk: u,
|
|
639
655
|
okText: "确认生成",
|
|
640
656
|
cancelText: "取消",
|
|
641
|
-
confirmLoading:
|
|
657
|
+
confirmLoading: k,
|
|
642
658
|
children: [
|
|
643
659
|
/* @__PURE__ */ e(
|
|
644
660
|
"div",
|
|
@@ -656,8 +672,8 @@ function st() {
|
|
|
656
672
|
{
|
|
657
673
|
placeholder: "例如:测试用 AK、生产网关 AK",
|
|
658
674
|
value: T,
|
|
659
|
-
onChange: (
|
|
660
|
-
onPressEnter:
|
|
675
|
+
onChange: (h) => _(h.target.value),
|
|
676
|
+
onPressEnter: u,
|
|
661
677
|
maxLength: 50,
|
|
662
678
|
autoFocus: !0
|
|
663
679
|
}
|
|
@@ -668,15 +684,15 @@ function st() {
|
|
|
668
684
|
/* @__PURE__ */ s(
|
|
669
685
|
ce,
|
|
670
686
|
{
|
|
671
|
-
open:
|
|
687
|
+
open: p.open,
|
|
672
688
|
title: "AK 创建成功",
|
|
673
|
-
onCancel: () =>
|
|
689
|
+
onCancel: () => c({ open: !1 }),
|
|
674
690
|
footer: [
|
|
675
691
|
/* @__PURE__ */ e(
|
|
676
692
|
z,
|
|
677
693
|
{
|
|
678
694
|
icon: /* @__PURE__ */ e(se, {}),
|
|
679
|
-
onClick: () =>
|
|
695
|
+
onClick: () => p.apiKey && M(p.apiKey),
|
|
680
696
|
children: "复制 AK"
|
|
681
697
|
},
|
|
682
698
|
"copy"
|
|
@@ -685,7 +701,7 @@ function st() {
|
|
|
685
701
|
z,
|
|
686
702
|
{
|
|
687
703
|
type: "primary",
|
|
688
|
-
onClick: () =>
|
|
704
|
+
onClick: () => c({ open: !1 }),
|
|
689
705
|
children: "我已保存"
|
|
690
706
|
},
|
|
691
707
|
"close"
|
|
@@ -705,80 +721,88 @@ function st() {
|
|
|
705
721
|
wordBreak: "break-all",
|
|
706
722
|
userSelect: "all"
|
|
707
723
|
},
|
|
708
|
-
children:
|
|
724
|
+
children: p.apiKey
|
|
709
725
|
}
|
|
710
726
|
),
|
|
711
727
|
/* @__PURE__ */ s("div", { style: { marginTop: 8, fontSize: 12, color: "var(--text-muted)" }, children: [
|
|
712
728
|
"前缀: ",
|
|
713
|
-
|
|
729
|
+
p.akPrefix
|
|
714
730
|
] })
|
|
715
731
|
]
|
|
716
732
|
}
|
|
717
733
|
),
|
|
718
734
|
/* @__PURE__ */ e(
|
|
719
|
-
|
|
735
|
+
Ae,
|
|
720
736
|
{
|
|
721
|
-
title:
|
|
737
|
+
title: g ? /* @__PURE__ */ s("span", { children: [
|
|
722
738
|
"AK 详情 — ",
|
|
723
|
-
/* @__PURE__ */ e("code", { children:
|
|
739
|
+
/* @__PURE__ */ e("code", { children: g.akPrefix })
|
|
724
740
|
] }) : "AK 详情",
|
|
725
|
-
open: !!
|
|
741
|
+
open: !!g,
|
|
726
742
|
onClose: W,
|
|
727
743
|
size: "large",
|
|
728
|
-
children:
|
|
744
|
+
children: q ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(V, { tip: "加载用量数据..." }) }) : A ? /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
|
|
745
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 12, color: "#8c8c8c", marginBottom: 12 }, children: "以下为网关全局调用统计(近 7 天窗口), 监控侧不按 AK 留存;该 AK 自身的累计消耗见下方「本 AK 累计 Token」。" }),
|
|
729
746
|
/* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
|
|
730
|
-
/* @__PURE__ */ e(
|
|
731
|
-
/* @__PURE__ */ e(
|
|
747
|
+
/* @__PURE__ */ e(P, { title: "总请求数", value: A.totalRequests }),
|
|
748
|
+
/* @__PURE__ */ e(P, { title: "总 Token", value: A.totalTokens }),
|
|
732
749
|
/* @__PURE__ */ e(
|
|
733
|
-
|
|
750
|
+
P,
|
|
734
751
|
{
|
|
735
752
|
title: "输入 Token",
|
|
736
|
-
value:
|
|
753
|
+
value: A.totalPromptTokens
|
|
737
754
|
}
|
|
738
755
|
),
|
|
739
756
|
/* @__PURE__ */ e(
|
|
740
|
-
|
|
757
|
+
P,
|
|
741
758
|
{
|
|
742
759
|
title: "输出 Token",
|
|
743
|
-
value:
|
|
760
|
+
value: A.totalCompletionTokens
|
|
744
761
|
}
|
|
745
762
|
),
|
|
746
763
|
/* @__PURE__ */ e(
|
|
747
|
-
|
|
764
|
+
P,
|
|
748
765
|
{
|
|
749
766
|
title: "平均耗时",
|
|
750
|
-
value:
|
|
767
|
+
value: A.avgLatencyMs,
|
|
751
768
|
suffix: "ms"
|
|
752
769
|
}
|
|
753
770
|
),
|
|
754
771
|
/* @__PURE__ */ e(
|
|
755
|
-
|
|
772
|
+
P,
|
|
756
773
|
{
|
|
757
774
|
title: "错误数",
|
|
758
|
-
value:
|
|
775
|
+
value: A.errorCount,
|
|
759
776
|
styles: {
|
|
760
777
|
content: {
|
|
761
|
-
color:
|
|
778
|
+
color: A.errorCount > 0 ? "#ff4d4f" : void 0
|
|
762
779
|
}
|
|
763
780
|
}
|
|
764
781
|
}
|
|
782
|
+
),
|
|
783
|
+
/* @__PURE__ */ e(
|
|
784
|
+
P,
|
|
785
|
+
{
|
|
786
|
+
title: "本 AK 累计 Token",
|
|
787
|
+
value: (g == null ? void 0 : g.totalTokens) ?? 0
|
|
788
|
+
}
|
|
765
789
|
)
|
|
766
790
|
] }),
|
|
767
791
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
768
|
-
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "
|
|
769
|
-
oe(
|
|
792
|
+
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "每日调用曲线(按最近调用明细聚合)" }),
|
|
793
|
+
oe(A.daily)
|
|
770
794
|
] }),
|
|
771
795
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
772
796
|
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "模型用量分布" }),
|
|
773
|
-
|
|
797
|
+
L(A.models)
|
|
774
798
|
] }),
|
|
775
799
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
776
800
|
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "最近调用记录" }),
|
|
777
801
|
/* @__PURE__ */ e(
|
|
778
|
-
|
|
802
|
+
we,
|
|
779
803
|
{
|
|
780
|
-
columns:
|
|
781
|
-
dataSource:
|
|
804
|
+
columns: U,
|
|
805
|
+
dataSource: A.recent,
|
|
782
806
|
rowKey: "id",
|
|
783
807
|
size: "small",
|
|
784
808
|
pagination: {
|
|
@@ -786,7 +810,7 @@ function st() {
|
|
|
786
810
|
size: "small",
|
|
787
811
|
showSizeChanger: !0,
|
|
788
812
|
pageSizeOptions: ["10", "20", "50", "100"],
|
|
789
|
-
showTotal: (
|
|
813
|
+
showTotal: (h) => `共 ${h} 条`
|
|
790
814
|
},
|
|
791
815
|
scroll: { x: 760 }
|
|
792
816
|
}
|
|
@@ -801,58 +825,58 @@ function rt(a) {
|
|
|
801
825
|
const n = [];
|
|
802
826
|
if (!a) return n;
|
|
803
827
|
const l = /<(think|thinking|reasoning)>([\s\S]*?)<\/\1>/gi;
|
|
804
|
-
let
|
|
805
|
-
for (; (
|
|
806
|
-
|
|
807
|
-
return
|
|
828
|
+
let o = 0, d;
|
|
829
|
+
for (; (d = l.exec(a)) !== null; )
|
|
830
|
+
d.index > o && n.push({ type: "text", text: a.slice(o, d.index) }), n.push({ type: "think", text: d[2] }), o = d.index + d[0].length;
|
|
831
|
+
return o < a.length && n.push({ type: "text", text: a.slice(o) }), n;
|
|
808
832
|
}
|
|
809
833
|
const re = 4;
|
|
810
834
|
let lt = 0;
|
|
811
835
|
function it({ initialModels: a }) {
|
|
812
|
-
const [n, l] =
|
|
836
|
+
const [n, l] = S([]), [o, d] = S([]), [N, v] = S(!0), [f, k] = S(null), [K, B] = S(""), [C, T] = S(!1), _ = de(""), p = de(/* @__PURE__ */ new Map()), c = de(/* @__PURE__ */ new Map());
|
|
813
837
|
ae(() => {
|
|
814
838
|
(async () => {
|
|
815
839
|
try {
|
|
816
|
-
const r = await
|
|
817
|
-
|
|
818
|
-
const
|
|
819
|
-
l(
|
|
840
|
+
const r = await Ke();
|
|
841
|
+
d(r), v(!1);
|
|
842
|
+
const u = a.length > 0 ? a : r.slice(0, 1).map((w) => w.modelName);
|
|
843
|
+
l(u.slice(0, re).map((w) => me(w)));
|
|
820
844
|
} catch (r) {
|
|
821
|
-
|
|
845
|
+
v(!1), k(r instanceof Error ? r.message : "模型列表加载失败");
|
|
822
846
|
}
|
|
823
847
|
})();
|
|
824
848
|
}, []), ae(() => {
|
|
825
|
-
if (a.length > 0 &&
|
|
826
|
-
const r = a.slice(0, re).map((
|
|
849
|
+
if (a.length > 0 && o.length > 0) {
|
|
850
|
+
const r = a.slice(0, re).map((u) => me(u));
|
|
827
851
|
l(r);
|
|
828
852
|
}
|
|
829
853
|
}, [a.join(",")]);
|
|
830
|
-
const
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
}, []),
|
|
834
|
-
(r,
|
|
835
|
-
l((w) => w.map((
|
|
854
|
+
const g = H((r) => {
|
|
855
|
+
const u = c.current.get(r);
|
|
856
|
+
u && (u.scrollTop = u.scrollHeight);
|
|
857
|
+
}, []), i = H(
|
|
858
|
+
(r, u) => {
|
|
859
|
+
l((w) => w.map((M) => M.id === r ? u(M) : M));
|
|
836
860
|
},
|
|
837
861
|
[]
|
|
838
|
-
),
|
|
839
|
-
if (
|
|
862
|
+
), A = H(async () => {
|
|
863
|
+
if (_.current) return _.current;
|
|
840
864
|
const r = await tt();
|
|
841
|
-
return
|
|
842
|
-
}, []),
|
|
843
|
-
const r =
|
|
844
|
-
if (!r ||
|
|
845
|
-
let
|
|
865
|
+
return _.current = r, r;
|
|
866
|
+
}, []), b = H(async () => {
|
|
867
|
+
const r = K.trim();
|
|
868
|
+
if (!r || C) return;
|
|
869
|
+
let u;
|
|
846
870
|
try {
|
|
847
|
-
|
|
871
|
+
u = await A();
|
|
848
872
|
} catch {
|
|
849
873
|
return;
|
|
850
874
|
}
|
|
851
|
-
|
|
852
|
-
const w = n.map((
|
|
853
|
-
|
|
875
|
+
B(""), T(!0);
|
|
876
|
+
const w = n.map(($) => ({
|
|
877
|
+
...$,
|
|
854
878
|
messages: [
|
|
855
|
-
|
|
879
|
+
...$.messages,
|
|
856
880
|
{ role: "user", content: r },
|
|
857
881
|
{ role: "assistant", content: "" }
|
|
858
882
|
],
|
|
@@ -862,62 +886,62 @@ function it({ initialModels: a }) {
|
|
|
862
886
|
usage: null
|
|
863
887
|
}));
|
|
864
888
|
l(w);
|
|
865
|
-
const
|
|
866
|
-
|
|
889
|
+
const M = w;
|
|
890
|
+
M.forEach(($) => {
|
|
867
891
|
const W = new AbortController();
|
|
868
|
-
|
|
869
|
-
const oe =
|
|
870
|
-
Ye(
|
|
871
|
-
onDelta: (
|
|
872
|
-
|
|
873
|
-
...
|
|
874
|
-
streamingContent:
|
|
875
|
-
messages:
|
|
876
|
-
(ee,
|
|
892
|
+
p.current.set($.id, W);
|
|
893
|
+
const oe = $.messages.slice(0, -1);
|
|
894
|
+
Ye(u, $.model, oe, {
|
|
895
|
+
onDelta: (L) => {
|
|
896
|
+
i($.id, (U) => ({
|
|
897
|
+
...U,
|
|
898
|
+
streamingContent: U.streamingContent + L,
|
|
899
|
+
messages: U.messages.map(
|
|
900
|
+
(ee, h) => h === U.messages.length - 1 ? { ...ee, content: U.streamingContent + L } : ee
|
|
877
901
|
)
|
|
878
|
-
})),
|
|
902
|
+
})), g($.id);
|
|
879
903
|
},
|
|
880
|
-
onDone: (
|
|
881
|
-
|
|
882
|
-
...
|
|
904
|
+
onDone: (L) => {
|
|
905
|
+
i($.id, (U) => ({
|
|
906
|
+
...U,
|
|
883
907
|
isStreaming: !1,
|
|
884
|
-
usage:
|
|
885
|
-
promptTokens:
|
|
886
|
-
completionTokens:
|
|
887
|
-
totalTokens:
|
|
908
|
+
usage: L ? {
|
|
909
|
+
promptTokens: L.promptTokens,
|
|
910
|
+
completionTokens: L.completionTokens,
|
|
911
|
+
totalTokens: L.totalTokens
|
|
888
912
|
} : null
|
|
889
|
-
})),
|
|
913
|
+
})), p.current.delete($.id);
|
|
890
914
|
},
|
|
891
|
-
onError: (
|
|
892
|
-
(
|
|
893
|
-
...
|
|
915
|
+
onError: (L) => {
|
|
916
|
+
(L.message.includes("401") || L.message.includes("API key")) && (be(), _.current = ""), i($.id, (U) => ({
|
|
917
|
+
...U,
|
|
894
918
|
isStreaming: !1,
|
|
895
|
-
error:
|
|
896
|
-
})),
|
|
919
|
+
error: L.message
|
|
920
|
+
})), p.current.delete($.id);
|
|
897
921
|
},
|
|
898
922
|
signal: W.signal
|
|
899
923
|
}).catch(() => {
|
|
900
924
|
});
|
|
901
925
|
});
|
|
902
926
|
const J = setInterval(() => {
|
|
903
|
-
|
|
904
|
-
(W) => !
|
|
927
|
+
M.every(
|
|
928
|
+
(W) => !p.current.has(W.id)
|
|
905
929
|
) && (clearInterval(J), T(!1));
|
|
906
930
|
}, 200);
|
|
907
931
|
setTimeout(() => {
|
|
908
932
|
clearInterval(J), T(!1);
|
|
909
933
|
}, 300 * 1e3);
|
|
910
|
-
}, [
|
|
911
|
-
|
|
912
|
-
}, []),
|
|
913
|
-
var
|
|
934
|
+
}, [K, C, n, A, i, g]), q = H(() => {
|
|
935
|
+
p.current.forEach((r) => r.abort()), p.current.clear(), l((r) => r.map((u) => ({ ...u, isStreaming: !1 }))), T(!1);
|
|
936
|
+
}, []), m = H(() => {
|
|
937
|
+
var u;
|
|
914
938
|
if (n.length >= re) return;
|
|
915
|
-
const r = (
|
|
939
|
+
const r = (u = o.find((w) => !n.some((M) => M.model === w.modelName))) == null ? void 0 : u.modelName;
|
|
916
940
|
r && l((w) => [...w, me(r)]);
|
|
917
|
-
}, [n,
|
|
918
|
-
|
|
919
|
-
(r) => r.map((
|
|
920
|
-
...
|
|
941
|
+
}, [n, o]), I = H(() => {
|
|
942
|
+
p.current.forEach((r) => r.abort()), p.current.clear(), l(
|
|
943
|
+
(r) => r.map((u) => ({
|
|
944
|
+
...u,
|
|
921
945
|
messages: [],
|
|
922
946
|
streamingContent: "",
|
|
923
947
|
isStreaming: !1,
|
|
@@ -925,23 +949,23 @@ function it({ initialModels: a }) {
|
|
|
925
949
|
usage: null
|
|
926
950
|
}))
|
|
927
951
|
), T(!1);
|
|
928
|
-
}, [
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
}, []),
|
|
932
|
-
(r,
|
|
933
|
-
|
|
952
|
+
}, [C, n]), D = H((r) => {
|
|
953
|
+
const u = p.current.get(r);
|
|
954
|
+
u && u.abort(), p.current.delete(r), l((w) => w.filter((M) => M.id !== r));
|
|
955
|
+
}, []), E = H(
|
|
956
|
+
(r, u) => {
|
|
957
|
+
i(r, (w) => ({ ...w, model: u }));
|
|
934
958
|
},
|
|
935
|
-
[
|
|
936
|
-
), j =
|
|
959
|
+
[i]
|
|
960
|
+
), j = o.map((r) => ({
|
|
937
961
|
label: r.modelName,
|
|
938
962
|
value: r.modelName
|
|
939
963
|
}));
|
|
940
|
-
return
|
|
964
|
+
return N ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(V, { tip: "加载模型列表..." }) }) : f ? /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
|
|
941
965
|
/* @__PURE__ */ e("div", { className: t.chatHeader, children: /* @__PURE__ */ e("h3", { className: t.chatTitle, children: "模型对话" }) }),
|
|
942
966
|
/* @__PURE__ */ s("div", { className: t.akEmpty, children: [
|
|
943
967
|
"模型列表加载失败:",
|
|
944
|
-
|
|
968
|
+
f
|
|
945
969
|
] })
|
|
946
970
|
] }) : /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
|
|
947
971
|
/* @__PURE__ */ s("div", { className: t.chatHeader, children: [
|
|
@@ -957,8 +981,8 @@ function it({ initialModels: a }) {
|
|
|
957
981
|
{
|
|
958
982
|
size: "small",
|
|
959
983
|
icon: /* @__PURE__ */ e(Ie, {}),
|
|
960
|
-
onClick:
|
|
961
|
-
disabled:
|
|
984
|
+
onClick: I,
|
|
985
|
+
disabled: C || n.every((r) => r.messages.length === 0),
|
|
962
986
|
children: "清空重新来"
|
|
963
987
|
}
|
|
964
988
|
)
|
|
@@ -967,11 +991,11 @@ function it({ initialModels: a }) {
|
|
|
967
991
|
n.map((r) => /* @__PURE__ */ s("div", { className: t.chatPanel, children: [
|
|
968
992
|
/* @__PURE__ */ s("div", { className: t.chatPanelHeader, children: [
|
|
969
993
|
/* @__PURE__ */ e(
|
|
970
|
-
|
|
994
|
+
He,
|
|
971
995
|
{
|
|
972
996
|
size: "small",
|
|
973
997
|
value: r.model,
|
|
974
|
-
onChange: (
|
|
998
|
+
onChange: (u) => E(r.id, u),
|
|
975
999
|
options: j,
|
|
976
1000
|
style: { minWidth: 140, flex: 1 },
|
|
977
1001
|
showSearch: !0,
|
|
@@ -982,7 +1006,7 @@ function it({ initialModels: a }) {
|
|
|
982
1006
|
"span",
|
|
983
1007
|
{
|
|
984
1008
|
className: t.chatPanelClose,
|
|
985
|
-
onClick: () =>
|
|
1009
|
+
onClick: () => D(r.id),
|
|
986
1010
|
children: /* @__PURE__ */ e(Be, {})
|
|
987
1011
|
}
|
|
988
1012
|
)
|
|
@@ -991,29 +1015,29 @@ function it({ initialModels: a }) {
|
|
|
991
1015
|
"div",
|
|
992
1016
|
{
|
|
993
1017
|
className: t.chatPanelBody,
|
|
994
|
-
ref: (
|
|
995
|
-
|
|
1018
|
+
ref: (u) => {
|
|
1019
|
+
c.current.set(r.id, u);
|
|
996
1020
|
},
|
|
997
1021
|
children: [
|
|
998
|
-
r.messages.map((
|
|
1022
|
+
r.messages.map((u, w) => /* @__PURE__ */ s(
|
|
999
1023
|
"div",
|
|
1000
1024
|
{
|
|
1001
|
-
className:
|
|
1025
|
+
className: u.role === "user" ? t.chatMsgUser : t.chatMsgAI,
|
|
1002
1026
|
children: [
|
|
1003
|
-
|
|
1004
|
-
(
|
|
1027
|
+
u.role === "assistant" ? rt(u.content).map(
|
|
1028
|
+
(M, J) => M.type === "think" ? /* @__PURE__ */ s(
|
|
1005
1029
|
"details",
|
|
1006
1030
|
{
|
|
1007
1031
|
className: t.chatThinkBlock,
|
|
1008
1032
|
children: [
|
|
1009
1033
|
/* @__PURE__ */ e("summary", { children: "思考过程" }),
|
|
1010
|
-
/* @__PURE__ */ e("pre", { children:
|
|
1034
|
+
/* @__PURE__ */ e("pre", { children: M.text })
|
|
1011
1035
|
]
|
|
1012
1036
|
},
|
|
1013
1037
|
J
|
|
1014
|
-
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children:
|
|
1015
|
-
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children:
|
|
1016
|
-
r.isStreaming && w === r.messages.length - 1 &&
|
|
1038
|
+
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: M.text }, J)
|
|
1039
|
+
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: u.content }),
|
|
1040
|
+
r.isStreaming && w === r.messages.length - 1 && u.role === "assistant" && /* @__PURE__ */ e("span", { className: t.chatStreamingCursor })
|
|
1017
1041
|
]
|
|
1018
1042
|
},
|
|
1019
1043
|
w
|
|
@@ -1033,24 +1057,24 @@ function it({ initialModels: a }) {
|
|
|
1033
1057
|
}
|
|
1034
1058
|
)
|
|
1035
1059
|
] }, r.id)),
|
|
1036
|
-
n.length < re && /* @__PURE__ */ e(Q, { title: "添加面板", children: /* @__PURE__ */ e("div", { className: t.addPanelBtn, onClick:
|
|
1060
|
+
n.length < re && /* @__PURE__ */ e(Q, { title: "添加面板", children: /* @__PURE__ */ e("div", { className: t.addPanelBtn, onClick: m, children: /* @__PURE__ */ e(ve, {}) }) })
|
|
1037
1061
|
] }),
|
|
1038
1062
|
/* @__PURE__ */ s("div", { className: t.chatInputBar, children: [
|
|
1039
1063
|
/* @__PURE__ */ e(
|
|
1040
1064
|
Se.TextArea,
|
|
1041
1065
|
{
|
|
1042
1066
|
className: t.chatInput,
|
|
1043
|
-
value:
|
|
1044
|
-
onChange: (r) =>
|
|
1067
|
+
value: K,
|
|
1068
|
+
onChange: (r) => B(r.target.value),
|
|
1045
1069
|
placeholder: "输入消息,所有面板将同时收到并流式输出...",
|
|
1046
1070
|
autoSize: { minRows: 1, maxRows: 4 },
|
|
1047
1071
|
onPressEnter: (r) => {
|
|
1048
|
-
r.shiftKey || (r.preventDefault(),
|
|
1072
|
+
r.shiftKey || (r.preventDefault(), b());
|
|
1049
1073
|
},
|
|
1050
|
-
disabled:
|
|
1074
|
+
disabled: C
|
|
1051
1075
|
}
|
|
1052
1076
|
),
|
|
1053
|
-
|
|
1077
|
+
C ? /* @__PURE__ */ e(z, { danger: !0, onClick: q, children: "停止" }) : /* @__PURE__ */ s(z, { type: "primary", onClick: b, disabled: !K.trim(), children: [
|
|
1054
1078
|
/* @__PURE__ */ e($e, {}),
|
|
1055
1079
|
" 发送"
|
|
1056
1080
|
] })
|
|
@@ -1069,39 +1093,39 @@ function me(a) {
|
|
|
1069
1093
|
};
|
|
1070
1094
|
}
|
|
1071
1095
|
function ot({ onStartChat: a }) {
|
|
1072
|
-
const [n, l] =
|
|
1073
|
-
|
|
1074
|
-
l(
|
|
1075
|
-
}).catch((
|
|
1076
|
-
l([]),
|
|
1096
|
+
const [n, l] = S([]), [o, d] = S(!0), [N, v] = S(null), [f, k] = S(/* @__PURE__ */ new Set()), K = () => {
|
|
1097
|
+
d(!0), v(null), Ke().then((c) => {
|
|
1098
|
+
l(c), d(!1);
|
|
1099
|
+
}).catch((c) => {
|
|
1100
|
+
l([]), v(c instanceof Error ? c.message : "加载失败"), d(!1);
|
|
1077
1101
|
});
|
|
1078
1102
|
};
|
|
1079
1103
|
ae(() => {
|
|
1080
|
-
|
|
1104
|
+
K();
|
|
1081
1105
|
}, []);
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
const
|
|
1085
|
-
return
|
|
1106
|
+
const B = (c) => {
|
|
1107
|
+
k((g) => {
|
|
1108
|
+
const i = new Set(g);
|
|
1109
|
+
return i.has(c) ? i.delete(c) : i.add(c), i;
|
|
1086
1110
|
});
|
|
1087
|
-
},
|
|
1088
|
-
a([
|
|
1089
|
-
},
|
|
1090
|
-
|
|
1091
|
-
},
|
|
1092
|
-
if (!
|
|
1093
|
-
const
|
|
1094
|
-
return
|
|
1111
|
+
}, C = Array.from(f), T = (c) => {
|
|
1112
|
+
a([c]);
|
|
1113
|
+
}, _ = () => {
|
|
1114
|
+
C.length > 0 && a(C);
|
|
1115
|
+
}, p = (c) => {
|
|
1116
|
+
if (!c) return "default";
|
|
1117
|
+
const g = c.toLowerCase();
|
|
1118
|
+
return g.includes("aliyun") || g.includes("ali") ? "blue" : g.includes("zhipu") || g.includes("glm") ? "purple" : g.includes("moonshot") || g.includes("kimi") ? "cyan" : g.includes("minimax") ? "orange" : "default";
|
|
1095
1119
|
};
|
|
1096
|
-
return
|
|
1120
|
+
return o ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(V, { tip: "加载模型列表..." }) }) : N ? /* @__PURE__ */ s("div", { children: [
|
|
1097
1121
|
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
1098
1122
|
/* @__PURE__ */ e("h3", { className: t.modelMgmtTitle, children: "模型管理" }),
|
|
1099
1123
|
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "数据库管理的可用模型,可选择单个或多个模型发起对话对比" })
|
|
1100
1124
|
] }),
|
|
1101
1125
|
/* @__PURE__ */ s("div", { className: t.akEmpty, children: [
|
|
1102
1126
|
"模型列表加载失败:",
|
|
1103
|
-
|
|
1104
|
-
/* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ e(z, { type: "primary", onClick:
|
|
1127
|
+
N,
|
|
1128
|
+
/* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ e(z, { type: "primary", onClick: K, children: "重试" }) })
|
|
1105
1129
|
] })
|
|
1106
1130
|
] }) : /* @__PURE__ */ s("div", { children: [
|
|
1107
1131
|
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
@@ -1109,77 +1133,77 @@ function ot({ onStartChat: a }) {
|
|
|
1109
1133
|
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "数据库管理的可用模型,可选择单个或多个模型发起对话对比" })
|
|
1110
1134
|
] }),
|
|
1111
1135
|
n.length === 0 && /* @__PURE__ */ e("div", { className: t.akEmpty, children: "后端暂无启用模型(z_team_model_config 中 enable=1 的行),请先在数据库或网关配置中启用" }),
|
|
1112
|
-
/* @__PURE__ */ e("div", { className: t.modelGrid, children: n.map((
|
|
1113
|
-
const
|
|
1136
|
+
/* @__PURE__ */ e("div", { className: t.modelGrid, children: n.map((c) => {
|
|
1137
|
+
const g = f.has(c.modelName);
|
|
1114
1138
|
return /* @__PURE__ */ s(
|
|
1115
1139
|
"div",
|
|
1116
1140
|
{
|
|
1117
|
-
className: `${t.modelCard} ${
|
|
1118
|
-
onClick: () =>
|
|
1141
|
+
className: `${t.modelCard} ${g ? t.modelCardSelected : ""}`,
|
|
1142
|
+
onClick: () => B(c.modelName),
|
|
1119
1143
|
children: [
|
|
1120
1144
|
/* @__PURE__ */ e(
|
|
1121
|
-
|
|
1145
|
+
qe,
|
|
1122
1146
|
{
|
|
1123
1147
|
className: t.modelCheckbox,
|
|
1124
|
-
checked:
|
|
1125
|
-
onChange: (
|
|
1126
|
-
|
|
1148
|
+
checked: g,
|
|
1149
|
+
onChange: (i) => {
|
|
1150
|
+
i.stopPropagation(), B(c.modelName);
|
|
1127
1151
|
}
|
|
1128
1152
|
}
|
|
1129
1153
|
),
|
|
1130
1154
|
/* @__PURE__ */ s("div", { className: t.modelCardHeader, children: [
|
|
1131
1155
|
/* @__PURE__ */ e("div", { className: t.modelIconWrap, children: /* @__PURE__ */ e(Te, {}) }),
|
|
1132
1156
|
/* @__PURE__ */ s("div", { className: t.modelCardInfo, children: [
|
|
1133
|
-
/* @__PURE__ */ e("h4", { className: t.modelName, children:
|
|
1157
|
+
/* @__PURE__ */ e("h4", { className: t.modelName, children: c.modelName }),
|
|
1134
1158
|
/* @__PURE__ */ s("div", { className: t.modelTags, children: [
|
|
1135
|
-
|
|
1159
|
+
c.modelProvider && /* @__PURE__ */ e(
|
|
1136
1160
|
G,
|
|
1137
1161
|
{
|
|
1138
|
-
color:
|
|
1162
|
+
color: p(c.modelProvider),
|
|
1139
1163
|
style: { fontSize: 11, margin: 0 },
|
|
1140
|
-
children:
|
|
1164
|
+
children: c.modelProvider
|
|
1141
1165
|
}
|
|
1142
1166
|
),
|
|
1143
|
-
/* @__PURE__ */ e(G, { style: { fontSize: 11, margin: 0 }, children:
|
|
1167
|
+
/* @__PURE__ */ e(G, { style: { fontSize: 11, margin: 0 }, children: c.apiType })
|
|
1144
1168
|
] })
|
|
1145
1169
|
] })
|
|
1146
1170
|
] }),
|
|
1147
|
-
/* @__PURE__ */ e("p", { className: t.modelEndpoint, children:
|
|
1171
|
+
/* @__PURE__ */ e("p", { className: t.modelEndpoint, children: c.endpoint }),
|
|
1148
1172
|
/* @__PURE__ */ e("div", { className: t.modelCardFooter, children: /* @__PURE__ */ e(
|
|
1149
1173
|
z,
|
|
1150
1174
|
{
|
|
1151
1175
|
type: "link",
|
|
1152
1176
|
size: "small",
|
|
1153
|
-
onClick: (
|
|
1154
|
-
|
|
1177
|
+
onClick: (i) => {
|
|
1178
|
+
i.stopPropagation(), T(c.modelName);
|
|
1155
1179
|
},
|
|
1156
1180
|
children: "发起对话"
|
|
1157
1181
|
}
|
|
1158
1182
|
) })
|
|
1159
1183
|
]
|
|
1160
1184
|
},
|
|
1161
|
-
|
|
1185
|
+
c.modelName
|
|
1162
1186
|
);
|
|
1163
1187
|
}) }),
|
|
1164
|
-
|
|
1188
|
+
C.length > 0 && /* @__PURE__ */ s("div", { className: t.modelActionBar, children: [
|
|
1165
1189
|
/* @__PURE__ */ s("span", { className: t.modelSelectionCount, children: [
|
|
1166
1190
|
"已选择 ",
|
|
1167
|
-
|
|
1191
|
+
C.length,
|
|
1168
1192
|
" 个模型"
|
|
1169
1193
|
] }),
|
|
1170
1194
|
/* @__PURE__ */ e(
|
|
1171
1195
|
z,
|
|
1172
1196
|
{
|
|
1173
1197
|
type: "primary",
|
|
1174
|
-
onClick:
|
|
1175
|
-
disabled:
|
|
1198
|
+
onClick: _,
|
|
1199
|
+
disabled: C.length === 0,
|
|
1176
1200
|
children: "批量对比"
|
|
1177
1201
|
}
|
|
1178
1202
|
)
|
|
1179
1203
|
] })
|
|
1180
1204
|
] });
|
|
1181
1205
|
}
|
|
1182
|
-
const ct = "_container_15pgq_5", dt = "_page_15pgq_10", mt = "_kpiGrid_15pgq_16", ut = "_kpiCard_15pgq_22", ht = "_sectionCard_15pgq_29", pt = "_sectionHead_15pgq_36", gt = "_sectionHint_15pgq_42", kt = "_akList_15pgq_47", ft = "_errorState_15pgq_54", yt = "_errorTitle_15pgq_66", Nt = "_errorDetail_15pgq_72",
|
|
1206
|
+
const ct = "_container_15pgq_5", dt = "_page_15pgq_10", mt = "_kpiGrid_15pgq_16", ut = "_kpiCard_15pgq_22", ht = "_sectionCard_15pgq_29", pt = "_sectionHead_15pgq_36", gt = "_sectionHint_15pgq_42", kt = "_akList_15pgq_47", ft = "_errorState_15pgq_54", yt = "_errorTitle_15pgq_66", Nt = "_errorDetail_15pgq_72", O = {
|
|
1183
1207
|
container: ct,
|
|
1184
1208
|
page: dt,
|
|
1185
1209
|
kpiGrid: mt,
|
|
@@ -1200,41 +1224,41 @@ function te(a) {
|
|
|
1200
1224
|
function Ct({ daily: a }) {
|
|
1201
1225
|
const n = Object.entries(a);
|
|
1202
1226
|
if (n.length === 0) return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
1203
|
-
const l = Math.max(...n.map(([,
|
|
1204
|
-
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: n.map(([
|
|
1205
|
-
const
|
|
1227
|
+
const l = Math.max(...n.map(([, o]) => o[1] + o[2]), 1);
|
|
1228
|
+
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: n.map(([o, d]) => {
|
|
1229
|
+
const N = d[1] + d[2];
|
|
1206
1230
|
return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
|
|
1207
|
-
/* @__PURE__ */ e(Q, { title: `${
|
|
1231
|
+
/* @__PURE__ */ e(Q, { title: `${o}: ${d[0]}次 / ${N} tokens`, children: /* @__PURE__ */ e(
|
|
1208
1232
|
"div",
|
|
1209
1233
|
{
|
|
1210
1234
|
className: t.usageBar,
|
|
1211
|
-
style: { height: `${Math.max(
|
|
1235
|
+
style: { height: `${Math.max(N / l * 100, 2)}%` }
|
|
1212
1236
|
}
|
|
1213
1237
|
) }),
|
|
1214
|
-
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children:
|
|
1215
|
-
] },
|
|
1238
|
+
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children: o })
|
|
1239
|
+
] }, o);
|
|
1216
1240
|
}) });
|
|
1217
1241
|
}
|
|
1218
1242
|
function ye({ models: a }) {
|
|
1219
1243
|
const n = Object.entries(a);
|
|
1220
1244
|
if (n.length === 0) return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
1221
|
-
const l = Math.max(...n.map(([,
|
|
1222
|
-
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: n.sort((
|
|
1223
|
-
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children:
|
|
1245
|
+
const l = Math.max(...n.map(([, o]) => o[0]), 1);
|
|
1246
|
+
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: n.sort((o, d) => d[1][0] - o[1][0]).map(([o, d]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
|
|
1247
|
+
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: o }),
|
|
1224
1248
|
/* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
|
|
1225
1249
|
"div",
|
|
1226
1250
|
{
|
|
1227
1251
|
className: t.modelBreakdownFill,
|
|
1228
|
-
style: { width: `${
|
|
1252
|
+
style: { width: `${d[0] / l * 100}%` }
|
|
1229
1253
|
}
|
|
1230
1254
|
) }),
|
|
1231
1255
|
/* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
|
|
1232
|
-
|
|
1256
|
+
d[0],
|
|
1233
1257
|
"次 / ",
|
|
1234
|
-
te(
|
|
1258
|
+
te(d[1] + (d[2] || 0)),
|
|
1235
1259
|
"tokens"
|
|
1236
1260
|
] })
|
|
1237
|
-
] },
|
|
1261
|
+
] }, o)) });
|
|
1238
1262
|
}
|
|
1239
1263
|
const St = [
|
|
1240
1264
|
{
|
|
@@ -1258,101 +1282,91 @@ const St = [
|
|
|
1258
1282
|
render: (a) => a ? /* @__PURE__ */ e(G, { color: a < 400 ? "green" : "red", children: a }) : "-"
|
|
1259
1283
|
}
|
|
1260
1284
|
];
|
|
1261
|
-
function
|
|
1285
|
+
function At(a) {
|
|
1262
1286
|
var n;
|
|
1263
1287
|
return ((n = a == null ? void 0 : a.stats) == null ? void 0 : n.recent) ?? [];
|
|
1264
1288
|
}
|
|
1265
|
-
function
|
|
1266
|
-
var
|
|
1267
|
-
const [a, n] =
|
|
1268
|
-
n(!0),
|
|
1289
|
+
function wt() {
|
|
1290
|
+
var p, c, g, i, A, b, q;
|
|
1291
|
+
const [a, n] = S(!0), [l, o] = S(null), [d, N] = S([]), [v, f] = S(null), [k, K] = S(null), B = H(async () => {
|
|
1292
|
+
n(!0), o(null);
|
|
1269
1293
|
try {
|
|
1270
1294
|
const m = await Promise.allSettled(
|
|
1271
|
-
Tt.map((
|
|
1272
|
-
),
|
|
1273
|
-
let
|
|
1274
|
-
for (const
|
|
1275
|
-
|
|
1276
|
-
if (
|
|
1295
|
+
Tt.map((u) => ie(u))
|
|
1296
|
+
), I = [];
|
|
1297
|
+
let D = 0;
|
|
1298
|
+
for (const u of m)
|
|
1299
|
+
u.status === "fulfilled" ? I.push(...u.value) : D += 1;
|
|
1300
|
+
if (D === m.length)
|
|
1277
1301
|
throw new Error("网关不可达:无法获取 AK 列表");
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
);
|
|
1292
|
-
v(L);
|
|
1302
|
+
I.sort((u, w) => (u.id ?? 0) - (w.id ?? 0));
|
|
1303
|
+
let E = null, j = null;
|
|
1304
|
+
try {
|
|
1305
|
+
E = await Me(0);
|
|
1306
|
+
} catch (u) {
|
|
1307
|
+
j = u instanceof Error ? u.message : "获取用量失败";
|
|
1308
|
+
}
|
|
1309
|
+
f(E);
|
|
1310
|
+
const r = I.map((u) => ({
|
|
1311
|
+
key: u,
|
|
1312
|
+
stats: E,
|
|
1313
|
+
statsError: j
|
|
1314
|
+
}));
|
|
1315
|
+
N(r);
|
|
1293
1316
|
} catch (m) {
|
|
1294
|
-
|
|
1317
|
+
o(m instanceof Error ? m.message : "加载失败");
|
|
1295
1318
|
} finally {
|
|
1296
1319
|
n(!1);
|
|
1297
1320
|
}
|
|
1298
1321
|
}, []);
|
|
1299
1322
|
ae(() => {
|
|
1300
|
-
|
|
1301
|
-
}, [
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1304
|
-
const
|
|
1305
|
-
|
|
1306
|
-
const r = j.stats;
|
|
1307
|
-
if (r) {
|
|
1308
|
-
m += r.totalRequests ?? 0, B += r.totalTokens ?? 0, r.avgLatencyMs != null && r.totalRequests > 0 && (b += r.avgLatencyMs * r.totalRequests, L += r.totalRequests), P += r.errorCount ?? 0;
|
|
1309
|
-
for (const [h, w] of Object.entries(r.models ?? {})) {
|
|
1310
|
-
const A = I[h] ?? [0, 0];
|
|
1311
|
-
A[0] += w[0], A[1] += w[1], I[h] = A;
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1323
|
+
B();
|
|
1324
|
+
}, [B]);
|
|
1325
|
+
const C = xe(() => {
|
|
1326
|
+
const m = v, I = {};
|
|
1327
|
+
for (const [D, E] of Object.entries((m == null ? void 0 : m.models) ?? {}))
|
|
1328
|
+
I[D] = [E[0] ?? 0, E[1] ?? 0, E[2] ?? 0];
|
|
1315
1329
|
return {
|
|
1316
|
-
requests: m,
|
|
1317
|
-
tokens:
|
|
1318
|
-
avgLatency:
|
|
1319
|
-
errors:
|
|
1330
|
+
requests: (m == null ? void 0 : m.totalRequests) ?? 0,
|
|
1331
|
+
tokens: (m == null ? void 0 : m.totalTokens) ?? 0,
|
|
1332
|
+
avgLatency: (m == null ? void 0 : m.avgLatencyMs) ?? 0,
|
|
1333
|
+
errors: (m == null ? void 0 : m.errorCount) ?? 0,
|
|
1320
1334
|
models: I
|
|
1321
1335
|
};
|
|
1322
|
-
}, [
|
|
1323
|
-
/* @__PURE__ */ e("div", { className:
|
|
1324
|
-
/* @__PURE__ */ e("div", { className:
|
|
1325
|
-
/* @__PURE__ */ e(z, { icon: /* @__PURE__ */ e(Ne, {}), onClick:
|
|
1326
|
-
] }) : /* @__PURE__ */ s("div", { className:
|
|
1327
|
-
/* @__PURE__ */ s("div", { className:
|
|
1328
|
-
/* @__PURE__ */ e("div", { className:
|
|
1329
|
-
/* @__PURE__ */ e("div", { className:
|
|
1330
|
-
/* @__PURE__ */ e("div", { className:
|
|
1331
|
-
/* @__PURE__ */ e("div", { className:
|
|
1332
|
-
|
|
1336
|
+
}, [v]), T = d.reduce((m, I) => m + (I.key.tokenQuota || 0), 0), _ = () => a ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(V, { tip: "加载监控数据..." }) }) : l ? /* @__PURE__ */ s("div", { className: O.errorState, children: [
|
|
1337
|
+
/* @__PURE__ */ e("div", { className: O.errorTitle, children: "模型监控数据加载失败" }),
|
|
1338
|
+
/* @__PURE__ */ e("div", { className: O.errorDetail, children: l }),
|
|
1339
|
+
/* @__PURE__ */ e(z, { icon: /* @__PURE__ */ e(Ne, {}), onClick: B, type: "primary", children: "重试" })
|
|
1340
|
+
] }) : /* @__PURE__ */ s("div", { className: O.page, children: [
|
|
1341
|
+
/* @__PURE__ */ s("div", { className: O.kpiGrid, children: [
|
|
1342
|
+
/* @__PURE__ */ e("div", { className: O.kpiCard, children: /* @__PURE__ */ e(P, { title: "总请求(近7天)", value: C.requests }) }),
|
|
1343
|
+
/* @__PURE__ */ e("div", { className: O.kpiCard, children: /* @__PURE__ */ e(P, { title: "总 Tokens", value: te(C.tokens) }) }),
|
|
1344
|
+
/* @__PURE__ */ e("div", { className: O.kpiCard, children: /* @__PURE__ */ e(P, { title: "平均延迟", value: C.avgLatency, suffix: "ms" }) }),
|
|
1345
|
+
/* @__PURE__ */ e("div", { className: O.kpiCard, children: /* @__PURE__ */ e(
|
|
1346
|
+
P,
|
|
1333
1347
|
{
|
|
1334
1348
|
title: "错误数",
|
|
1335
|
-
value:
|
|
1336
|
-
valueStyle:
|
|
1349
|
+
value: C.errors,
|
|
1350
|
+
valueStyle: C.errors > 0 ? { color: "#ff4d4f" } : void 0
|
|
1337
1351
|
}
|
|
1338
1352
|
) })
|
|
1339
1353
|
] }),
|
|
1340
|
-
/* @__PURE__ */ s("div", { className:
|
|
1341
|
-
/* @__PURE__ */ s("div", { className:
|
|
1354
|
+
/* @__PURE__ */ s("div", { className: O.sectionCard, children: [
|
|
1355
|
+
/* @__PURE__ */ s("div", { className: O.sectionHead, children: [
|
|
1342
1356
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "AK 用量" }),
|
|
1343
|
-
|
|
1357
|
+
T > 0 && /* @__PURE__ */ s("span", { className: O.sectionHint, children: [
|
|
1344
1358
|
"合计额度 ",
|
|
1345
|
-
te(
|
|
1359
|
+
te(T),
|
|
1346
1360
|
" tokens"
|
|
1347
1361
|
] })
|
|
1348
1362
|
] }),
|
|
1349
|
-
|
|
1350
|
-
const
|
|
1363
|
+
d.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: "网关下暂无 AK" }) : /* @__PURE__ */ e("div", { className: O.akList, children: d.map((m) => {
|
|
1364
|
+
const I = m.key.totalTokens ?? 0, D = m.key.tokenQuota || 0, E = D > 0 ? Math.min(I / D * 100, 100) : 0;
|
|
1351
1365
|
return /* @__PURE__ */ s(
|
|
1352
1366
|
"div",
|
|
1353
1367
|
{
|
|
1354
1368
|
className: t.akCard,
|
|
1355
|
-
onClick: () =>
|
|
1369
|
+
onClick: () => K(m),
|
|
1356
1370
|
children: [
|
|
1357
1371
|
/* @__PURE__ */ s("div", { className: t.akCardRow, children: [
|
|
1358
1372
|
/* @__PURE__ */ e("span", { className: t.akTitle, children: m.key.description || m.key.userName || `AK #${m.key.id}` }),
|
|
@@ -1371,15 +1385,15 @@ function At() {
|
|
|
1371
1385
|
"div",
|
|
1372
1386
|
{
|
|
1373
1387
|
className: t.akMiniBarFill,
|
|
1374
|
-
style: { width: `${
|
|
1388
|
+
style: { width: `${E}%` }
|
|
1375
1389
|
}
|
|
1376
1390
|
) }),
|
|
1377
1391
|
/* @__PURE__ */ s("span", { className: t.akUsageText, children: [
|
|
1378
|
-
te(
|
|
1379
|
-
|
|
1392
|
+
te(I),
|
|
1393
|
+
D > 0 ? ` / ${te(D)}` : "",
|
|
1380
1394
|
" tokens"
|
|
1381
1395
|
] }),
|
|
1382
|
-
/* @__PURE__ */ e("span", { className: t.akMetaText, children: m.
|
|
1396
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: m.statsError ? m.statsError : m.key.lastUsedAt ? `最近使用 ${m.key.lastUsedAt}` : "尚未使用" })
|
|
1383
1397
|
] })
|
|
1384
1398
|
]
|
|
1385
1399
|
},
|
|
@@ -1387,22 +1401,22 @@ function At() {
|
|
|
1387
1401
|
);
|
|
1388
1402
|
}) })
|
|
1389
1403
|
] }),
|
|
1390
|
-
/* @__PURE__ */ s("div", { className:
|
|
1391
|
-
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "
|
|
1392
|
-
/* @__PURE__ */ e(ye, { models:
|
|
1404
|
+
/* @__PURE__ */ s("div", { className: O.sectionCard, children: [
|
|
1405
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "模型用量分布(网关全局)" }),
|
|
1406
|
+
/* @__PURE__ */ e(ye, { models: C.models })
|
|
1393
1407
|
] })
|
|
1394
1408
|
] });
|
|
1395
|
-
return /* @__PURE__ */ s("div", { className:
|
|
1409
|
+
return /* @__PURE__ */ s("div", { className: O.container, children: [
|
|
1396
1410
|
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
1397
1411
|
/* @__PURE__ */ e("h2", { className: t.modelMgmtTitle, children: "模型监控" }),
|
|
1398
|
-
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "大模型网关管控视图 —
|
|
1412
|
+
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "大模型网关管控视图 — 网关全局聚合调用量、Tokens 与延迟(近 7 天)" })
|
|
1399
1413
|
] }),
|
|
1400
1414
|
/* @__PURE__ */ e(
|
|
1401
1415
|
Ce,
|
|
1402
1416
|
{
|
|
1403
1417
|
defaultActiveKey: "usage",
|
|
1404
1418
|
items: [
|
|
1405
|
-
{ key: "usage", label: "模型用量", children:
|
|
1419
|
+
{ key: "usage", label: "模型用量", children: _() },
|
|
1406
1420
|
{
|
|
1407
1421
|
key: "sessions",
|
|
1408
1422
|
label: "会话统计",
|
|
@@ -1412,45 +1426,53 @@ function At() {
|
|
|
1412
1426
|
}
|
|
1413
1427
|
),
|
|
1414
1428
|
/* @__PURE__ */ e(
|
|
1415
|
-
|
|
1429
|
+
Ae,
|
|
1416
1430
|
{
|
|
1417
|
-
title:
|
|
1431
|
+
title: k ? `AK 用量 — ${k.key.description || k.key.akPrefix}` : "",
|
|
1418
1432
|
width: 860,
|
|
1419
|
-
open: !!
|
|
1420
|
-
onClose: () =>
|
|
1433
|
+
open: !!k,
|
|
1434
|
+
onClose: () => K(null),
|
|
1421
1435
|
destroyOnHidden: !0,
|
|
1422
|
-
children:
|
|
1436
|
+
children: k && /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
|
|
1437
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 12, color: "#8c8c8c", marginBottom: 12 }, children: "调用监控是网关全局维度(不按 AK 留存),以下统计覆盖全部 AK; 该 AK 自身的累计消耗见「本 AK 累计 Token」。" }),
|
|
1423
1438
|
/* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
|
|
1424
|
-
/* @__PURE__ */ e(
|
|
1425
|
-
/* @__PURE__ */ e(
|
|
1426
|
-
/* @__PURE__ */ e(
|
|
1427
|
-
/* @__PURE__ */ e(
|
|
1428
|
-
/* @__PURE__ */ e(
|
|
1439
|
+
/* @__PURE__ */ e(P, { title: "总请求", value: ((p = k.stats) == null ? void 0 : p.totalRequests) ?? 0 }),
|
|
1440
|
+
/* @__PURE__ */ e(P, { title: "总 Tokens", value: ((c = k.stats) == null ? void 0 : c.totalTokens) ?? 0 }),
|
|
1441
|
+
/* @__PURE__ */ e(P, { title: "平均延迟", value: ((g = k.stats) == null ? void 0 : g.avgLatencyMs) ?? 0, suffix: "ms" }),
|
|
1442
|
+
/* @__PURE__ */ e(P, { title: "输入 Tokens", value: ((i = k.stats) == null ? void 0 : i.totalPromptTokens) ?? 0 }),
|
|
1443
|
+
/* @__PURE__ */ e(P, { title: "输出 Tokens", value: ((A = k.stats) == null ? void 0 : A.totalCompletionTokens) ?? 0 }),
|
|
1444
|
+
/* @__PURE__ */ e(
|
|
1445
|
+
P,
|
|
1446
|
+
{
|
|
1447
|
+
title: "本 AK 累计 Token",
|
|
1448
|
+
value: k.key.totalTokens ?? 0
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1429
1451
|
/* @__PURE__ */ e(
|
|
1430
|
-
|
|
1452
|
+
P,
|
|
1431
1453
|
{
|
|
1432
1454
|
title: "错误数",
|
|
1433
|
-
value: ((
|
|
1434
|
-
valueStyle: (((
|
|
1455
|
+
value: ((b = k.stats) == null ? void 0 : b.errorCount) ?? 0,
|
|
1456
|
+
valueStyle: (((q = k.stats) == null ? void 0 : q.errorCount) ?? 0) > 0 ? { color: "#ff4d4f" } : void 0
|
|
1435
1457
|
}
|
|
1436
1458
|
)
|
|
1437
1459
|
] }),
|
|
1438
1460
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1439
|
-
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "
|
|
1440
|
-
|
|
1461
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "每日用量(按最近调用明细聚合)" }),
|
|
1462
|
+
k.stats ? /* @__PURE__ */ e(Ct, { daily: k.stats.daily ?? {} }) : /* @__PURE__ */ e("span", { className: t.usageEmpty, children: k.statsError ?? "暂无数据" })
|
|
1441
1463
|
] }),
|
|
1442
1464
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1443
|
-
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "
|
|
1444
|
-
|
|
1465
|
+
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "模型用量分布(按最近调用明细聚合)" }),
|
|
1466
|
+
k.stats ? /* @__PURE__ */ e(ye, { models: k.stats.models ?? {} }) : /* @__PURE__ */ e("span", { className: t.usageEmpty, children: k.statsError ?? "暂无数据" })
|
|
1445
1467
|
] }),
|
|
1446
1468
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1447
1469
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "最近调用" }),
|
|
1448
1470
|
/* @__PURE__ */ e(
|
|
1449
|
-
|
|
1471
|
+
we,
|
|
1450
1472
|
{
|
|
1451
1473
|
size: "small",
|
|
1452
1474
|
columns: St,
|
|
1453
|
-
dataSource:
|
|
1475
|
+
dataSource: At(k),
|
|
1454
1476
|
rowKey: "id",
|
|
1455
1477
|
pagination: {
|
|
1456
1478
|
pageSize: 8,
|
|
@@ -1471,41 +1493,41 @@ const xt = [
|
|
|
1471
1493
|
{ key: "model-chat", label: "模型对话", icon: /* @__PURE__ */ e(De, {}) },
|
|
1472
1494
|
{ key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(Le, {}) },
|
|
1473
1495
|
{ key: "agent-app", label: "Agent 应用", icon: /* @__PURE__ */ e(Te, {}) },
|
|
1474
|
-
{ key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(
|
|
1475
|
-
{ key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(
|
|
1476
|
-
{ key: "model-monitor", label: "模型监控", icon: /* @__PURE__ */ e(
|
|
1496
|
+
{ key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(ze, {}) },
|
|
1497
|
+
{ key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(Re, {}) },
|
|
1498
|
+
{ key: "model-monitor", label: "模型监控", icon: /* @__PURE__ */ e(Ue, {}) }
|
|
1477
1499
|
];
|
|
1478
1500
|
function It() {
|
|
1479
|
-
const [a, n] =
|
|
1480
|
-
|
|
1481
|
-
},
|
|
1501
|
+
const [a, n] = S("model-management"), [l, o] = S([]), d = (f) => {
|
|
1502
|
+
o(f), n("model-chat");
|
|
1503
|
+
}, N = xe(() => xt, []), v = (f, k, K = !1) => /* @__PURE__ */ e(
|
|
1482
1504
|
"div",
|
|
1483
1505
|
{
|
|
1484
1506
|
style: {
|
|
1485
|
-
display: a ===
|
|
1507
|
+
display: a === f ? K ? "flex" : "block" : "none",
|
|
1486
1508
|
height: "100%",
|
|
1487
|
-
...
|
|
1509
|
+
...K ? { flexDirection: "column" } : {}
|
|
1488
1510
|
},
|
|
1489
|
-
children:
|
|
1511
|
+
children: k
|
|
1490
1512
|
}
|
|
1491
1513
|
);
|
|
1492
1514
|
return /* @__PURE__ */ s("div", { className: t.container, children: [
|
|
1493
|
-
/* @__PURE__ */ e("aside", { className: t.sidebar, children: /* @__PURE__ */ e("nav", { className: t.menuList, children:
|
|
1515
|
+
/* @__PURE__ */ e("aside", { className: t.sidebar, children: /* @__PURE__ */ e("nav", { className: t.menuList, children: N.map((f) => /* @__PURE__ */ e(Q, { title: f.label, placement: "right", children: /* @__PURE__ */ e(
|
|
1494
1516
|
"div",
|
|
1495
1517
|
{
|
|
1496
|
-
className: `${t.menuItem} ${a ===
|
|
1497
|
-
onClick: () => n(
|
|
1498
|
-
children: /* @__PURE__ */ e("span", { className: t.menuIcon, children:
|
|
1518
|
+
className: `${t.menuItem} ${a === f.key ? t.menuItemActive : ""}`,
|
|
1519
|
+
onClick: () => n(f.key),
|
|
1520
|
+
children: /* @__PURE__ */ e("span", { className: t.menuIcon, children: f.icon })
|
|
1499
1521
|
}
|
|
1500
|
-
) },
|
|
1522
|
+
) }, f.key)) }) }),
|
|
1501
1523
|
/* @__PURE__ */ s("main", { className: t.panelArea, children: [
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1524
|
+
v("model-management", /* @__PURE__ */ e(ot, { onStartChat: d })),
|
|
1525
|
+
v("model-chat", /* @__PURE__ */ e(it, { initialModels: l }), !0),
|
|
1526
|
+
v("ak-management", /* @__PURE__ */ e(st, {})),
|
|
1527
|
+
v("agent-app", /* @__PURE__ */ e(Ge, {})),
|
|
1528
|
+
v("mcp-service", /* @__PURE__ */ e(Je, {})),
|
|
1529
|
+
v("skill-market", /* @__PURE__ */ e(Qe, {})),
|
|
1530
|
+
v("model-monitor", /* @__PURE__ */ e(wt, {}))
|
|
1509
1531
|
] })
|
|
1510
1532
|
] });
|
|
1511
1533
|
}
|