@yuku123/z-team-component 0.2.53 → 0.2.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ChangeLogView-Dm7C3S14.js → ChangeLogView-R6boINWk.js} +1 -1
- package/dist/{ComponentDoc-y1NfPcHG.js → ComponentDoc-DTJyJAy-.js} +121 -121
- package/dist/{InvitationManagementPage-Btw9iVOl.js → InvitationManagementPage-BZOxuoM5.js} +1 -1
- package/dist/{OnboardingPage-wF0OrgfD.js → OnboardingPage-Be3MXW9i.js} +2 -2
- package/dist/{ScheduledTasks-CzzgG3n8.js → ScheduledTasks-CxDbixJe.js} +806 -809
- package/dist/{SystemShell-BSCmnOxf.js → SystemShell-BEKwj3WF.js} +1 -1
- package/dist/{admin-logs-vR556ORQ.js → admin-logs-DMF0dtG1.js} +2 -2
- package/dist/{api-Jfnj1ybB.js → api-DhuqONeb.js} +210 -227
- package/dist/{api-Bs0qYxjL.js → api-DqNgdbLm.js} +1 -1
- package/dist/{createWorkspaceWsHandler-obuYWncQ.js → createWorkspaceWsHandler-BKcAIc4B.js} +5359 -5145
- package/dist/{index-DqUOCs_a.js → index-8Qtz0IKN.js} +2 -2
- package/dist/{index-Pk7OkJrk.js → index-B30K72xQ.js} +517 -320
- package/dist/{index-CnEWSsKt.js → index-B7cZdoRq.js} +1 -1
- package/dist/{index-DroZE6Bv.js → index-B8eiFO_f.js} +3 -3
- package/dist/{index-CYViRXQo.js → index-BKVWW3ba.js} +1 -1
- package/dist/{index-JLtVgwZv.js → index-BM6XpIcw.js} +1 -1
- package/dist/{index-BbkE7r8M.js → index-BOcKPM37.js} +610 -529
- package/dist/{index-gxEdw4X4.js → index-BP97Ev-W.js} +4 -4
- package/dist/{index-BtWtVMgY.js → index-C5O0cK8A.js} +6 -6
- package/dist/index-C8Wkx3H_.js +8960 -0
- package/dist/{index-yS7XIUis.js → index-CZ9xxAL0.js} +3 -3
- package/dist/{index-BNShjps9.js → index-CZxihNo5.js} +7 -7
- package/dist/{index-DmZdGNnh.js → index-CbUsvCMy.js} +4 -4
- package/dist/{index-Ck_D109M.js → index-Ct9MzvZV.js} +2 -2
- package/dist/{index-B3LhKHBx.js → index-CzePRAbT.js} +41 -35
- package/dist/{index-tADa82Fa.js → index-DQk6Pt6U.js} +3 -3
- package/dist/{index-Onqu_VQO.js → index-DQmgOqd1.js} +7 -7
- package/dist/{index-Dj5_8ulz.js → index-DV8rmjvN.js} +5 -5
- package/dist/{index-Di_vaPxC.js → index-DpNZTqcn.js} +3 -3
- package/dist/{index-C5WSr14Z.js → index-Otx98G8z.js} +1 -1
- package/dist/{index-BXiuxhgz.js → index-TPTesErt.js} +2 -2
- package/dist/{index-CxrBnzg2.js → index-mXMdvUYD.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{instance-B0DZJnee.js → instance-Cr4_XM2r.js} +1 -1
- package/dist/pages.js +1 -1
- package/dist/{schedule-D3jTrI1R.js → schedule-BNLns-p4.js} +1 -1
- package/dist/{send-default-agent-team-message-CbqHaohM.js → send-default-agent-team-message-C9VWSWKJ.js} +1 -1
- package/dist/{sso-user-Dw_wwYa-.js → sso-user-Cme2tmGq.js} +1 -1
- package/dist/{training-CETtJBNQ.js → training-SjRAdtNQ.js} +1 -1
- package/dist/{useAppStore-s-CLa-nF.js → useAppStore-C63xiq3-.js} +1 -1
- package/dist/{webide-6j4OVoNA.js → webide-DDFxSedU.js} +4 -4
- package/dist/z-team-component.css +2 -2
- package/package.json +1 -1
- package/dist/SmartWorkbench.module-xRRmpTTw.js +0 -85
- package/dist/index-DUmgSTQu.js +0 -9179
- package/dist/index-DWsfQMp8.js +0 -208
- package/dist/index-WIsi8fln.js +0 -339
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { CopyOutlined as se, ReloadOutlined as
|
|
3
|
-
import { Tooltip as
|
|
4
|
-
import { useState as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const le = "ft_gateway_default_ak", _e = "system-default", Z = "", he = "";
|
|
2
|
+
import { CopyOutlined as se, ReloadOutlined as Ne, PlusOutlined as xe, DeleteOutlined as $e, ClearOutlined as Le, CloseOutlined as Oe, SendOutlined as Ue, RobotOutlined as ve, CloudServerOutlined as Re, MessageOutlined as De, KeyOutlined as He, ApiOutlined as Fe, ToolOutlined as je, BarChartOutlined as qe } from "@ant-design/icons";
|
|
3
|
+
import { Tooltip as Q, Tabs as Te, Button as R, Modal as de, Input as Se, Drawer as we, Spin as Y, Statistic as E, Table as Ae, message as G, Tag as J, Select as Ge, Checkbox as Je } from "antd";
|
|
4
|
+
import { useState as x, useEffect as X, useCallback as j, useRef as me, useMemo as Be, Suspense as We, lazy as Qe } from "react";
|
|
5
|
+
import { u as ze } from "./useAppStore-C63xiq3-.js";
|
|
6
|
+
import { AgentAppList as Ve, McpPage as Ye, SkillMarket as Xe } from "@yuku123/z-agent-component";
|
|
7
|
+
const re = "ft_gateway_default_ak", Me = "system-default", Z = "", he = "";
|
|
9
8
|
function ee(a = {}) {
|
|
10
9
|
const n = { Accept: "application/json", ...a };
|
|
11
10
|
try {
|
|
12
|
-
const
|
|
13
|
-
|
|
11
|
+
const r = localStorage.getItem("token");
|
|
12
|
+
r && (n.Authorization = `Bearer ${r}`);
|
|
14
13
|
} catch {
|
|
15
14
|
}
|
|
16
15
|
return n;
|
|
@@ -24,7 +23,7 @@ function Ze(a) {
|
|
|
24
23
|
apiType: String(a.apiType ?? a.api_type ?? "OpenAPI")
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
|
-
async function
|
|
26
|
+
async function pe() {
|
|
28
27
|
let a;
|
|
29
28
|
try {
|
|
30
29
|
a = await fetch(`${Z}/api/scenario-instances/0/models`, {
|
|
@@ -45,13 +44,13 @@ async function ge() {
|
|
|
45
44
|
} catch {
|
|
46
45
|
throw new Error("模型列表返回格式异常(非 JSON)");
|
|
47
46
|
}
|
|
48
|
-
const
|
|
49
|
-
if (!Array.isArray(
|
|
47
|
+
const r = n != null && n.success ? n.data : (n == null ? void 0 : n.data) ?? n;
|
|
48
|
+
if (!Array.isArray(r))
|
|
50
49
|
throw new Error("模型列表返回格式异常(非数组)");
|
|
51
|
-
return
|
|
50
|
+
return r.map(Ze);
|
|
52
51
|
}
|
|
53
|
-
async function et(a, n,
|
|
54
|
-
var
|
|
52
|
+
async function et(a, n, r, i) {
|
|
53
|
+
var B, L, w;
|
|
55
54
|
const m = await fetch(`${he}/v1/chat/completions`, {
|
|
56
55
|
method: "POST",
|
|
57
56
|
headers: {
|
|
@@ -61,35 +60,35 @@ async function et(a, n, l, o) {
|
|
|
61
60
|
},
|
|
62
61
|
body: JSON.stringify({
|
|
63
62
|
model: n,
|
|
64
|
-
messages:
|
|
63
|
+
messages: r,
|
|
65
64
|
stream: !0
|
|
66
65
|
}),
|
|
67
|
-
signal:
|
|
66
|
+
signal: i.signal
|
|
68
67
|
});
|
|
69
68
|
if (!m.ok || !m.body) {
|
|
70
|
-
const
|
|
71
|
-
if (/<!doctype html/i.test(
|
|
69
|
+
const N = await m.text().catch(() => "");
|
|
70
|
+
if (/<!doctype html/i.test(N.slice(0, 200)))
|
|
72
71
|
throw new Error("模型网关未接入(/v1/chat/completions 落到主壳 SPA,无网关响应)");
|
|
73
|
-
let
|
|
72
|
+
let T = `HTTP ${m.status}`;
|
|
74
73
|
try {
|
|
75
|
-
const h = JSON.parse(
|
|
76
|
-
|
|
74
|
+
const h = JSON.parse(N);
|
|
75
|
+
T = ((B = h == null ? void 0 : h.error) == null ? void 0 : B.message) ?? T;
|
|
77
76
|
} catch {
|
|
78
|
-
|
|
77
|
+
N && (T = N);
|
|
79
78
|
}
|
|
80
|
-
throw new Error(
|
|
79
|
+
throw new Error(T);
|
|
81
80
|
}
|
|
82
|
-
const
|
|
83
|
-
let
|
|
81
|
+
const y = m.body.getReader(), C = new TextDecoder();
|
|
82
|
+
let f = "", p;
|
|
84
83
|
try {
|
|
85
84
|
for (; ; ) {
|
|
86
|
-
const { done:
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
const h =
|
|
85
|
+
const { done: N, value: T } = await y.read();
|
|
86
|
+
if (N) break;
|
|
87
|
+
f += C.decode(T, { stream: !0 });
|
|
88
|
+
const h = f.split(`
|
|
90
89
|
|
|
91
90
|
`);
|
|
92
|
-
|
|
91
|
+
f = h.pop() ?? "";
|
|
93
92
|
for (const c of h) {
|
|
94
93
|
let k = "";
|
|
95
94
|
for (const d of c.split(`
|
|
@@ -97,48 +96,48 @@ async function et(a, n, l, o) {
|
|
|
97
96
|
d.startsWith("data:") && (k += d.slice(5).trim());
|
|
98
97
|
if (!k || k === "[DONE]") {
|
|
99
98
|
if (k === "[DONE]") {
|
|
100
|
-
|
|
99
|
+
i.onDone(p);
|
|
101
100
|
return;
|
|
102
101
|
}
|
|
103
102
|
continue;
|
|
104
103
|
}
|
|
105
104
|
try {
|
|
106
|
-
const d = JSON.parse(k),
|
|
105
|
+
const d = JSON.parse(k), A = d == null ? void 0 : d.choices;
|
|
107
106
|
if (d != null && d.usage) {
|
|
108
|
-
const
|
|
107
|
+
const M = {
|
|
109
108
|
promptTokens: d.usage.prompt_tokens ?? 0,
|
|
110
109
|
completionTokens: d.usage.completion_tokens ?? 0,
|
|
111
110
|
totalTokens: d.usage.total_tokens ?? 0
|
|
112
111
|
};
|
|
113
|
-
(!
|
|
112
|
+
(!p || M.totalTokens > 0) && (p = M);
|
|
114
113
|
}
|
|
115
|
-
if (Array.isArray(
|
|
116
|
-
const
|
|
117
|
-
|
|
114
|
+
if (Array.isArray(A) && A.length > 0) {
|
|
115
|
+
const M = (L = A[0]) == null ? void 0 : L.delta;
|
|
116
|
+
M != null && M.content && i.onDelta(M.content);
|
|
118
117
|
continue;
|
|
119
118
|
}
|
|
120
|
-
|
|
119
|
+
i.onDone(p);
|
|
121
120
|
return;
|
|
122
121
|
} catch {
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
|
-
|
|
127
|
-
} catch (
|
|
128
|
-
if ((
|
|
129
|
-
throw
|
|
125
|
+
i.onDone(p);
|
|
126
|
+
} catch (N) {
|
|
127
|
+
if ((w = i.signal) != null && w.aborted) return;
|
|
128
|
+
throw i.onError(N instanceof Error ? N : new Error(String(N))), N;
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
async function ae(a, n) {
|
|
133
|
-
const
|
|
132
|
+
const r = await a.text();
|
|
134
133
|
if (!a.ok)
|
|
135
|
-
throw new Error(`${n}失败 HTTP ${a.status}${
|
|
136
|
-
if (/<!doctype html/i.test(
|
|
134
|
+
throw new Error(`${n}失败 HTTP ${a.status}${r ? `: ${r.slice(0, 120)}` : ""}`);
|
|
135
|
+
if (/<!doctype html/i.test(r.slice(0, 200)))
|
|
137
136
|
throw new Error("AK 接口落到主壳 SPA(无后端响应)");
|
|
138
137
|
try {
|
|
139
|
-
return JSON.parse(
|
|
138
|
+
return JSON.parse(r);
|
|
140
139
|
} catch {
|
|
141
|
-
throw new Error(`${n}返回非 JSON:${
|
|
140
|
+
throw new Error(`${n}返回非 JSON:${r.slice(0, 120)}`);
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
function tt(a) {
|
|
@@ -163,27 +162,27 @@ function tt(a) {
|
|
|
163
162
|
secret: a.secret_key
|
|
164
163
|
};
|
|
165
164
|
}
|
|
166
|
-
async function
|
|
167
|
-
const
|
|
165
|
+
async function Ie(a, n, r) {
|
|
166
|
+
const i = await fetch(`${Z}/api/ak/create`, {
|
|
168
167
|
method: "POST",
|
|
169
168
|
headers: ee({ Accept: "application/json", "Content-Type": "application/json" }),
|
|
170
169
|
credentials: "include",
|
|
171
170
|
body: JSON.stringify({
|
|
172
|
-
akName:
|
|
173
|
-
description:
|
|
171
|
+
akName: r || `AK-${n || a}`,
|
|
172
|
+
description: r,
|
|
174
173
|
akType: "PERSONAL",
|
|
175
174
|
ownerUserId: a,
|
|
176
175
|
ownerUserName: n
|
|
177
176
|
})
|
|
178
|
-
}), m = await ae(
|
|
179
|
-
return
|
|
177
|
+
}), m = await ae(i, "创建 AK"), y = (m == null ? void 0 : m.data) ?? {}, C = y.accessKey ?? "", f = y.secretKey ?? "";
|
|
178
|
+
return C && f && ke(C, f), { apiKey: f, akPrefix: C, message: "AK 已创建,secretKey 仅创建时可见" };
|
|
180
179
|
}
|
|
181
|
-
async function
|
|
180
|
+
async function le(a) {
|
|
182
181
|
const n = await fetch(
|
|
183
182
|
`${Z}/api/ak/list`,
|
|
184
183
|
{ headers: ee({ Accept: "application/json" }), credentials: "include" }
|
|
185
|
-
),
|
|
186
|
-
return (a ?
|
|
184
|
+
), r = await ae(n, "获取 AK 列表"), i = Array.isArray(r == null ? void 0 : r.data) ? r.data : [];
|
|
185
|
+
return (a ? i.filter((y) => (y.owner_user_id == null || y.owner_user_id === "" ? Me : String(y.owner_user_id)) === String(a)) : i).filter((y) => (y.is_deleted ?? 0) === 0).map(tt);
|
|
187
186
|
}
|
|
188
187
|
async function at(a) {
|
|
189
188
|
const n = await fetch(`${Z}/api/ak/delete?id=${encodeURIComponent(String(a))}`, {
|
|
@@ -193,29 +192,29 @@ async function at(a) {
|
|
|
193
192
|
});
|
|
194
193
|
await ae(n, "吊销 AK");
|
|
195
194
|
}
|
|
196
|
-
async function
|
|
197
|
-
var
|
|
195
|
+
async function be(a) {
|
|
196
|
+
var N, T;
|
|
198
197
|
const n = await fetch(
|
|
199
198
|
`${Z}/api/admin/llm-call-monitor/stats?hours=168`,
|
|
200
199
|
{ headers: ee({ Accept: "application/json" }), credentials: "include" }
|
|
201
|
-
),
|
|
202
|
-
let
|
|
200
|
+
), r = await ae(n, "获取调用统计"), m = ((r == null ? void 0 : r.data) ?? {}).summary ?? {};
|
|
201
|
+
let y = [];
|
|
203
202
|
try {
|
|
204
203
|
const h = await fetch(
|
|
205
204
|
`${Z}/api/admin/llm-call-monitor/recent?page=1&size=20`,
|
|
206
205
|
{ headers: ee({ Accept: "application/json" }), credentials: "include" }
|
|
207
206
|
), c = await ae(h, "获取调用明细");
|
|
208
|
-
|
|
209
|
-
const
|
|
207
|
+
y = (Array.isArray((N = c == null ? void 0 : c.data) == null ? void 0 : N.records) ? c.data.records : []).map((d, A) => {
|
|
208
|
+
const M = Number(d.promptTokens ?? 0), q = Number(d.completionTokens ?? 0);
|
|
210
209
|
return {
|
|
211
|
-
id: Number(d.id ??
|
|
210
|
+
id: Number(d.id ?? A),
|
|
212
211
|
apiKeyId: a,
|
|
213
212
|
protocol: "chat/completions",
|
|
214
213
|
model: String(d.model ?? ""),
|
|
215
214
|
stream: Number(d.stream ?? 0),
|
|
216
|
-
promptTokens:
|
|
217
|
-
completionTokens:
|
|
218
|
-
totalTokens: Number(d.totalTokens ??
|
|
215
|
+
promptTokens: M,
|
|
216
|
+
completionTokens: q,
|
|
217
|
+
totalTokens: Number(d.totalTokens ?? M + q),
|
|
219
218
|
latencyMs: Number(d.durationMs ?? 0),
|
|
220
219
|
statusCode: d.success === !1 || d.success === 0 ? 500 : 200,
|
|
221
220
|
errorMsg: d.errorType ?? null,
|
|
@@ -224,86 +223,168 @@ async function Pe(a) {
|
|
|
224
223
|
});
|
|
225
224
|
} catch {
|
|
226
225
|
}
|
|
227
|
-
const
|
|
228
|
-
for (const h of
|
|
229
|
-
const c =
|
|
226
|
+
const C = {}, f = {};
|
|
227
|
+
for (const h of y) {
|
|
228
|
+
const c = C[T = h.model] || (C[T] = [0, 0, 0]);
|
|
230
229
|
c[0] += 1, c[1] += h.promptTokens, c[2] += h.completionTokens;
|
|
231
230
|
const k = (h.createTime || "").slice(0, 10);
|
|
232
231
|
if (k) {
|
|
233
|
-
const d =
|
|
232
|
+
const d = f[k] || (f[k] = [0, 0, 0]);
|
|
234
233
|
d[0] += 1, d[1] += h.promptTokens, d[2] += h.completionTokens;
|
|
235
234
|
}
|
|
236
235
|
}
|
|
237
|
-
const
|
|
236
|
+
const p = Number(m.totalTokens ?? 0), B = y.reduce((h, c) => h + c.totalTokens, 0), L = y.reduce((h, c) => h + c.promptTokens, 0), w = y.reduce((h, c) => h + c.completionTokens, 0);
|
|
238
237
|
return {
|
|
239
238
|
totalRequests: Number(m.totalCount ?? 0),
|
|
240
239
|
// 汇总口径优先用后端整窗合计(后端 selectStats 才有 token 合计),
|
|
241
240
|
// 明细只有最近一页 ⇒ 只在汇总缺失时用明细兜底。
|
|
242
|
-
totalPromptTokens: Number(m.totalPromptTokens ?? 0) ||
|
|
243
|
-
totalCompletionTokens: Number(m.totalCompletionTokens ?? 0) ||
|
|
244
|
-
totalTokens:
|
|
241
|
+
totalPromptTokens: Number(m.totalPromptTokens ?? 0) || L,
|
|
242
|
+
totalCompletionTokens: Number(m.totalCompletionTokens ?? 0) || w,
|
|
243
|
+
totalTokens: p || B,
|
|
245
244
|
avgLatencyMs: Number(m.avgDurationMs ?? 0),
|
|
246
245
|
errorCount: Number(m.failCount ?? 0),
|
|
247
|
-
daily:
|
|
248
|
-
models:
|
|
249
|
-
recent:
|
|
246
|
+
daily: f,
|
|
247
|
+
models: C,
|
|
248
|
+
recent: y
|
|
250
249
|
};
|
|
251
250
|
}
|
|
252
251
|
function nt() {
|
|
253
252
|
return typeof window < "u" ? `${window.location.origin}${he}` : he;
|
|
254
253
|
}
|
|
255
|
-
const
|
|
254
|
+
const ge = "ft_gateway_ak_cache";
|
|
256
255
|
function ke(a, n) {
|
|
257
256
|
try {
|
|
258
|
-
const
|
|
259
|
-
|
|
257
|
+
const r = JSON.parse(localStorage.getItem(ge) || "{}");
|
|
258
|
+
r[a] = n, localStorage.setItem(ge, JSON.stringify(r));
|
|
260
259
|
} catch {
|
|
261
260
|
}
|
|
262
261
|
}
|
|
263
262
|
function st(a) {
|
|
264
263
|
try {
|
|
265
|
-
return JSON.parse(localStorage.getItem(
|
|
264
|
+
return JSON.parse(localStorage.getItem(ge) || "{}")[a] || null;
|
|
266
265
|
} catch {
|
|
267
266
|
return null;
|
|
268
267
|
}
|
|
269
268
|
}
|
|
270
|
-
async function
|
|
269
|
+
async function ot() {
|
|
271
270
|
try {
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
271
|
+
const i = localStorage.getItem(re);
|
|
272
|
+
if (i) return i;
|
|
274
273
|
} catch {
|
|
275
274
|
}
|
|
276
|
-
const n = (await
|
|
275
|
+
const n = (await le("").catch(() => [])).find((i) => i.active && i.secret);
|
|
277
276
|
if (n != null && n.secret) {
|
|
278
277
|
try {
|
|
279
|
-
localStorage.setItem(
|
|
278
|
+
localStorage.setItem(re, n.secret);
|
|
280
279
|
} catch {
|
|
281
280
|
}
|
|
282
281
|
return n.akPrefix && ke(n.akPrefix, n.secret), n.secret;
|
|
283
282
|
}
|
|
284
|
-
const
|
|
283
|
+
const r = await Ie(
|
|
285
284
|
"system-default",
|
|
286
285
|
"系统默认",
|
|
287
286
|
"智能工作台默认AK(自动创建)"
|
|
288
287
|
);
|
|
289
|
-
if (!
|
|
288
|
+
if (!r.apiKey)
|
|
290
289
|
throw new Error("AK 创建成功但未返回 secretKey");
|
|
291
290
|
try {
|
|
292
|
-
localStorage.setItem(
|
|
291
|
+
localStorage.setItem(re, r.apiKey);
|
|
293
292
|
} catch {
|
|
294
293
|
}
|
|
295
|
-
return
|
|
294
|
+
return r.apiKey;
|
|
296
295
|
}
|
|
297
|
-
function
|
|
296
|
+
function Pe() {
|
|
298
297
|
try {
|
|
299
|
-
localStorage.removeItem(
|
|
298
|
+
localStorage.removeItem(re);
|
|
300
299
|
} catch {
|
|
301
300
|
}
|
|
302
301
|
}
|
|
303
|
-
|
|
302
|
+
const rt = "_container_16zxg_7", lt = "_sidebar_16zxg_16", it = "_menuList_16zxg_26", ct = "_menuItem_16zxg_35", dt = "_menuItemActive_16zxg_53", mt = "_menuIcon_16zxg_59", ut = "_panelArea_16zxg_66", ht = "_modelMgmtHeader_16zxg_78", gt = "_modelMgmtTitle_16zxg_82", pt = "_modelMgmtSubtitle_16zxg_89", kt = "_modelGrid_16zxg_95", _t = "_modelCard_16zxg_101", ft = "_modelCardSelected_16zxg_130", yt = "_modelCardHeader_16zxg_135", Ct = "_modelIconWrap_16zxg_142", Nt = "_modelCardInfo_16zxg_155", xt = "_modelName_16zxg_160", vt = "_modelTags_16zxg_169", Tt = "_modelEndpoint_16zxg_185", St = "_modelCardFooter_16zxg_194", wt = "_modelCheckbox_16zxg_202", At = "_modelActionBar_16zxg_209", Bt = "_modelSelectionCount_16zxg_223", zt = "_chatContainer_16zxg_232", Mt = "_chatHeader_16zxg_239", It = "_chatTitle_16zxg_247", bt = "_chatPanels_16zxg_254", Pt = "_chatPanel_16zxg_254", Kt = "_chatPanelHeader_16zxg_281", Et = "_chatPanelClose_16zxg_291", $t = "_chatPanelBody_16zxg_303", Lt = "_chatMsgUser_16zxg_312", Ot = "_chatMsgAI_16zxg_324", Ut = "_chatMsgError_16zxg_337", Rt = "_chatStreamingCursor_16zxg_347", Dt = "_chatUsageBar_16zxg_366", Ht = "_chatThinkBlock_16zxg_376", Ft = "_chatInputBar_16zxg_425", jt = "_chatInput_16zxg_425", qt = "_addPanelBtn_16zxg_438", Gt = "_akContainer_16zxg_467", Jt = "_akIntegrationPanel_16zxg_473", Wt = "_akIntegrationTitle_16zxg_480", Qt = "_akIntegrationGrid_16zxg_487", Vt = "_akCodeBlock_16zxg_493", Yt = "_akCodeLabel_16zxg_505", Xt = "_akCard_16zxg_512", Zt = "_akCardRow_16zxg_530", ea = "_akTitle_16zxg_537", ta = "_akPrefixSmall_16zxg_547", aa = "_akStatus_16zxg_553", na = "_akStatusActive_16zxg_559", sa = "_akStatusRevoked_16zxg_565", oa = "_akCardActions_16zxg_571", ra = "_akCardRow2_16zxg_578", la = "_akMiniBar_16zxg_584", ia = "_akMiniBarFill_16zxg_593", ca = "_akUsageText_16zxg_600", da = "_akMetaText_16zxg_607", ma = "_akEmpty_16zxg_613", ua = "_akBaseUrlRow_16zxg_621", ha = "_akBaseUrlItem_16zxg_627", ga = "_akBaseUrlLabel_16zxg_637", pa = "_akBaseUrlValue_16zxg_643", ka = "_akCopyIcon_16zxg_653", _a = "_usageDrawerContent_16zxg_667", fa = "_usageStatsGrid_16zxg_673", ya = "_usageSection_16zxg_679", Ca = "_usageSectionTitle_16zxg_683", Na = "_usageBarChart_16zxg_693", xa = "_usageBarCol_16zxg_702", va = "_usageBar_16zxg_693", Ta = "_usageBarLabel_16zxg_725", Sa = "_modelBreakdown_16zxg_733", wa = "_modelBreakdownRow_16zxg_739", Aa = "_modelBreakdownName_16zxg_745", Ba = "_modelBreakdownBar_16zxg_755", za = "_modelBreakdownFill_16zxg_763", Ma = "_modelBreakdownCount_16zxg_770", Ia = "_usageEmpty_16zxg_777", t = {
|
|
303
|
+
container: rt,
|
|
304
|
+
sidebar: lt,
|
|
305
|
+
menuList: it,
|
|
306
|
+
menuItem: ct,
|
|
307
|
+
menuItemActive: dt,
|
|
308
|
+
menuIcon: mt,
|
|
309
|
+
panelArea: ut,
|
|
310
|
+
modelMgmtHeader: ht,
|
|
311
|
+
modelMgmtTitle: gt,
|
|
312
|
+
modelMgmtSubtitle: pt,
|
|
313
|
+
modelGrid: kt,
|
|
314
|
+
modelCard: _t,
|
|
315
|
+
modelCardSelected: ft,
|
|
316
|
+
modelCardHeader: yt,
|
|
317
|
+
modelIconWrap: Ct,
|
|
318
|
+
modelCardInfo: Nt,
|
|
319
|
+
modelName: xt,
|
|
320
|
+
modelTags: vt,
|
|
321
|
+
modelEndpoint: Tt,
|
|
322
|
+
modelCardFooter: St,
|
|
323
|
+
modelCheckbox: wt,
|
|
324
|
+
modelActionBar: At,
|
|
325
|
+
modelSelectionCount: Bt,
|
|
326
|
+
chatContainer: zt,
|
|
327
|
+
chatHeader: Mt,
|
|
328
|
+
chatTitle: It,
|
|
329
|
+
chatPanels: bt,
|
|
330
|
+
chatPanel: Pt,
|
|
331
|
+
chatPanelHeader: Kt,
|
|
332
|
+
chatPanelClose: Et,
|
|
333
|
+
chatPanelBody: $t,
|
|
334
|
+
chatMsgUser: Lt,
|
|
335
|
+
chatMsgAI: Ot,
|
|
336
|
+
chatMsgError: Ut,
|
|
337
|
+
chatStreamingCursor: Rt,
|
|
338
|
+
chatUsageBar: Dt,
|
|
339
|
+
chatThinkBlock: Ht,
|
|
340
|
+
chatInputBar: Ft,
|
|
341
|
+
chatInput: jt,
|
|
342
|
+
addPanelBtn: qt,
|
|
343
|
+
akContainer: Gt,
|
|
344
|
+
akIntegrationPanel: Jt,
|
|
345
|
+
akIntegrationTitle: Wt,
|
|
346
|
+
akIntegrationGrid: Qt,
|
|
347
|
+
akCodeBlock: Vt,
|
|
348
|
+
akCodeLabel: Yt,
|
|
349
|
+
akCard: Xt,
|
|
350
|
+
akCardRow: Zt,
|
|
351
|
+
akTitle: ea,
|
|
352
|
+
akPrefixSmall: ta,
|
|
353
|
+
akStatus: aa,
|
|
354
|
+
akStatusActive: na,
|
|
355
|
+
akStatusRevoked: sa,
|
|
356
|
+
akCardActions: oa,
|
|
357
|
+
akCardRow2: ra,
|
|
358
|
+
akMiniBar: la,
|
|
359
|
+
akMiniBarFill: ia,
|
|
360
|
+
akUsageText: ca,
|
|
361
|
+
akMetaText: da,
|
|
362
|
+
akEmpty: ma,
|
|
363
|
+
akBaseUrlRow: ua,
|
|
364
|
+
akBaseUrlItem: ha,
|
|
365
|
+
akBaseUrlLabel: ga,
|
|
366
|
+
akBaseUrlValue: pa,
|
|
367
|
+
akCopyIcon: ka,
|
|
368
|
+
usageDrawerContent: _a,
|
|
369
|
+
usageStatsGrid: fa,
|
|
370
|
+
usageSection: ya,
|
|
371
|
+
usageSectionTitle: Ca,
|
|
372
|
+
usageBarChart: Na,
|
|
373
|
+
usageBarCol: xa,
|
|
374
|
+
usageBar: va,
|
|
375
|
+
usageBarLabel: Ta,
|
|
376
|
+
modelBreakdown: Sa,
|
|
377
|
+
modelBreakdownRow: wa,
|
|
378
|
+
modelBreakdownName: Aa,
|
|
379
|
+
modelBreakdownBar: Ba,
|
|
380
|
+
modelBreakdownFill: za,
|
|
381
|
+
modelBreakdownCount: Ma,
|
|
382
|
+
usageEmpty: Ia
|
|
383
|
+
};
|
|
384
|
+
function ye(a) {
|
|
304
385
|
return a >= 1e6 ? `${(a / 1e6).toFixed(1)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : `${a}`;
|
|
305
386
|
}
|
|
306
|
-
function
|
|
387
|
+
function ba(a, n) {
|
|
307
388
|
return `# OpenAI 兼容
|
|
308
389
|
curl -X POST ${a}/v1/chat/completions \\
|
|
309
390
|
-H "Content-Type: application/json" \\
|
|
@@ -314,7 +395,7 @@ curl -X POST ${a}/v1/chat/completions \\
|
|
|
314
395
|
"stream": true
|
|
315
396
|
}'`;
|
|
316
397
|
}
|
|
317
|
-
function
|
|
398
|
+
function Pa(a, n) {
|
|
318
399
|
return `# Anthropic 兼容
|
|
319
400
|
curl -X POST ${a}/v1/messages \\
|
|
320
401
|
-H "Content-Type: application/json" \\
|
|
@@ -324,56 +405,56 @@ curl -X POST ${a}/v1/messages \\
|
|
|
324
405
|
"messages": [{"role":"user","content":"你好"}]
|
|
325
406
|
}'`;
|
|
326
407
|
}
|
|
327
|
-
function
|
|
328
|
-
const [a, n] =
|
|
408
|
+
function Ka() {
|
|
409
|
+
const [a, n] = x("personal"), [r, i] = x([]), [m, y] = x([]), [C, f] = x(!0), [p, B] = x(!1), [L, w] = x(!1), [N, T] = x(""), [h, c] = x({ open: !1 }), [k, d] = x(null), [A, M] = x(null), [q, W] = x(!1), H = ze((u) => u.currentUser), l = String((H == null ? void 0 : H.id) ?? ""), b = (H == null ? void 0 : H.username) ?? "", P = nt(), [o, g] = x("<model-name>");
|
|
329
410
|
X(() => {
|
|
330
411
|
let u = !1;
|
|
331
|
-
return
|
|
332
|
-
!u &&
|
|
412
|
+
return pe().then((S) => {
|
|
413
|
+
!u && S.length > 0 && g(S[0].modelName);
|
|
333
414
|
}).catch(() => {
|
|
334
415
|
}), () => {
|
|
335
416
|
u = !0;
|
|
336
417
|
};
|
|
337
418
|
}, []);
|
|
338
|
-
const
|
|
339
|
-
|
|
419
|
+
const v = j(async () => {
|
|
420
|
+
f(!0);
|
|
340
421
|
try {
|
|
341
|
-
const u =
|
|
342
|
-
|
|
422
|
+
const u = l ? await le(l).catch(() => []) : [], [S] = await Promise.all([
|
|
423
|
+
le("system-default").catch(() => [])
|
|
343
424
|
]);
|
|
344
|
-
|
|
425
|
+
i(S), y(u);
|
|
345
426
|
} finally {
|
|
346
|
-
|
|
427
|
+
f(!1);
|
|
347
428
|
}
|
|
348
|
-
}, [
|
|
429
|
+
}, [l]);
|
|
349
430
|
X(() => {
|
|
350
|
-
|
|
351
|
-
}, [
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
},
|
|
355
|
-
if (!
|
|
431
|
+
v();
|
|
432
|
+
}, [v]);
|
|
433
|
+
const K = () => {
|
|
434
|
+
T(""), w(!0);
|
|
435
|
+
}, I = async () => {
|
|
436
|
+
if (!N.trim()) {
|
|
356
437
|
G.warning("请输入 AK 名称");
|
|
357
438
|
return;
|
|
358
439
|
}
|
|
359
|
-
if (!
|
|
440
|
+
if (!l) {
|
|
360
441
|
G.warning("登录态不可用,无法生成 AK");
|
|
361
442
|
return;
|
|
362
443
|
}
|
|
363
|
-
|
|
444
|
+
B(!0);
|
|
364
445
|
try {
|
|
365
|
-
const u = await
|
|
366
|
-
ke(u.akPrefix, u.apiKey),
|
|
446
|
+
const u = await Ie(l, b, N.trim());
|
|
447
|
+
ke(u.akPrefix, u.apiKey), w(!1), c({
|
|
367
448
|
open: !0,
|
|
368
449
|
apiKey: u.apiKey,
|
|
369
450
|
akPrefix: u.akPrefix
|
|
370
|
-
}),
|
|
451
|
+
}), v();
|
|
371
452
|
} catch (u) {
|
|
372
453
|
G.error(u instanceof Error ? u.message : "创建 AK 失败");
|
|
373
454
|
} finally {
|
|
374
|
-
|
|
455
|
+
B(!1);
|
|
375
456
|
}
|
|
376
|
-
},
|
|
457
|
+
}, z = (u) => {
|
|
377
458
|
de.confirm({
|
|
378
459
|
title: "确认吊销此 AK?",
|
|
379
460
|
content: "吊销后此 AK 将立即失效,无法恢复。",
|
|
@@ -382,69 +463,69 @@ function ot() {
|
|
|
382
463
|
cancelText: "取消",
|
|
383
464
|
onOk: async () => {
|
|
384
465
|
try {
|
|
385
|
-
await at(u), G.success("AK 已吊销"),
|
|
386
|
-
} catch (
|
|
387
|
-
G.error(
|
|
466
|
+
await at(u), G.success("AK 已吊销"), v(), Pe();
|
|
467
|
+
} catch (S) {
|
|
468
|
+
G.error(S instanceof Error ? S.message : "吊销失败");
|
|
388
469
|
}
|
|
389
470
|
}
|
|
390
471
|
});
|
|
391
|
-
},
|
|
472
|
+
}, O = (u) => {
|
|
392
473
|
navigator.clipboard.writeText(u).then(() => G.success("已复制到剪贴板")).catch(() => G.warning("复制失败,请手动复制"));
|
|
393
|
-
},
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
},
|
|
397
|
-
d(u),
|
|
474
|
+
}, ie = (u) => {
|
|
475
|
+
const S = st(u.akPrefix);
|
|
476
|
+
S ? O(S) : (O(u.akPrefix), G.info("完整 AK 未在本地缓存(可能在本设备外创建),已复制前缀"));
|
|
477
|
+
}, U = async (u) => {
|
|
478
|
+
d(u), W(!0), M(null);
|
|
398
479
|
try {
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
} catch (
|
|
402
|
-
G.error(
|
|
480
|
+
const S = await be(u.id);
|
|
481
|
+
M(S);
|
|
482
|
+
} catch (S) {
|
|
483
|
+
G.error(S instanceof Error ? S.message : "获取用量失败");
|
|
403
484
|
} finally {
|
|
404
|
-
|
|
485
|
+
W(!1);
|
|
405
486
|
}
|
|
406
|
-
},
|
|
407
|
-
d(null),
|
|
487
|
+
}, F = () => {
|
|
488
|
+
d(null), M(null);
|
|
408
489
|
}, ne = (u) => {
|
|
409
|
-
const
|
|
410
|
-
if (
|
|
490
|
+
const S = Object.entries(u);
|
|
491
|
+
if (S.length === 0)
|
|
411
492
|
return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
412
|
-
const
|
|
413
|
-
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children:
|
|
414
|
-
const
|
|
493
|
+
const V = Math.max(...S.map(([, _]) => _[1] + _[2]), 1);
|
|
494
|
+
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: S.map(([_, D]) => {
|
|
495
|
+
const fe = D[1] + D[2], Ee = fe / V * 100;
|
|
415
496
|
return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
|
|
416
|
-
/* @__PURE__ */ e(
|
|
497
|
+
/* @__PURE__ */ e(Q, { title: `${_}: ${D[0]}次 / ${fe} tokens`, children: /* @__PURE__ */ e(
|
|
417
498
|
"div",
|
|
418
499
|
{
|
|
419
500
|
className: t.usageBar,
|
|
420
|
-
style: { height: `${Math.max(
|
|
501
|
+
style: { height: `${Math.max(Ee, 2)}%` }
|
|
421
502
|
}
|
|
422
503
|
) }),
|
|
423
|
-
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children:
|
|
424
|
-
] },
|
|
504
|
+
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children: _ })
|
|
505
|
+
] }, _);
|
|
425
506
|
}) });
|
|
426
507
|
}, ce = (u) => {
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
508
|
+
const S = Object.entries(u);
|
|
509
|
+
if (S.length === 0)
|
|
429
510
|
return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
430
|
-
const
|
|
431
|
-
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children:
|
|
432
|
-
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children:
|
|
511
|
+
const V = Math.max(...S.map(([, _]) => _[0]), 1);
|
|
512
|
+
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: S.sort((_, D) => D[1][0] - _[1][0]).map(([_, D]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
|
|
513
|
+
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: _ }),
|
|
433
514
|
/* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
|
|
434
515
|
"div",
|
|
435
516
|
{
|
|
436
517
|
className: t.modelBreakdownFill,
|
|
437
|
-
style: { width: `${
|
|
518
|
+
style: { width: `${D[0] / V * 100}%` }
|
|
438
519
|
}
|
|
439
520
|
) }),
|
|
440
521
|
/* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
|
|
441
|
-
|
|
522
|
+
D[0],
|
|
442
523
|
"次 / ",
|
|
443
|
-
|
|
524
|
+
D[1] + (D[2] || 0),
|
|
444
525
|
"tokens"
|
|
445
526
|
] })
|
|
446
|
-
] },
|
|
447
|
-
},
|
|
527
|
+
] }, _)) });
|
|
528
|
+
}, Ke = [
|
|
448
529
|
{
|
|
449
530
|
title: "时间",
|
|
450
531
|
dataIndex: "createTime",
|
|
@@ -492,50 +573,50 @@ function ot() {
|
|
|
492
573
|
width: 60,
|
|
493
574
|
render: (u) => u ? /* @__PURE__ */ e(J, { color: u < 400 ? "green" : "red", children: u }) : "-"
|
|
494
575
|
}
|
|
495
|
-
],
|
|
496
|
-
const
|
|
497
|
-
return
|
|
576
|
+
], _e = (u, S) => {
|
|
577
|
+
const V = Array.isArray(u) ? u : [];
|
|
578
|
+
return C ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ e(Y, { tip: "加载中..." }) }) : V.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: S ? "暂无应用 AK" : "暂无个人 AK,点击上方按钮生成" }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: V.map((_) => /* @__PURE__ */ s(
|
|
498
579
|
"div",
|
|
499
580
|
{
|
|
500
581
|
className: t.akCard,
|
|
501
|
-
onClick: () =>
|
|
582
|
+
onClick: () => U(_),
|
|
502
583
|
children: [
|
|
503
584
|
/* @__PURE__ */ s("div", { className: t.akCardRow, children: [
|
|
504
|
-
/* @__PURE__ */ e("span", { className: t.akTitle, children:
|
|
505
|
-
/* @__PURE__ */ e("code", { className: t.akPrefixSmall, children:
|
|
585
|
+
/* @__PURE__ */ e("span", { className: t.akTitle, children: _.description || _.akPrefix.replace("...", "**") }),
|
|
586
|
+
/* @__PURE__ */ e("code", { className: t.akPrefixSmall, children: _.akPrefix.replace("...", "**") }),
|
|
506
587
|
/* @__PURE__ */ e(
|
|
507
588
|
"span",
|
|
508
589
|
{
|
|
509
|
-
className: `${t.akStatus} ${
|
|
510
|
-
children:
|
|
590
|
+
className: `${t.akStatus} ${_.active ? t.akStatusActive : t.akStatusRevoked}`,
|
|
591
|
+
children: _.active ? "活跃" : "已吊销"
|
|
511
592
|
}
|
|
512
593
|
),
|
|
513
|
-
|
|
594
|
+
_.defaultModel && /* @__PURE__ */ s(J, { style: { fontSize: 11 }, children: [
|
|
514
595
|
"默认: ",
|
|
515
|
-
|
|
596
|
+
_.defaultModel
|
|
516
597
|
] }),
|
|
517
598
|
/* @__PURE__ */ s(
|
|
518
599
|
"div",
|
|
519
600
|
{
|
|
520
601
|
className: t.akCardActions,
|
|
521
|
-
onClick: (
|
|
602
|
+
onClick: (D) => D.stopPropagation(),
|
|
522
603
|
children: [
|
|
523
|
-
/* @__PURE__ */ e(
|
|
604
|
+
/* @__PURE__ */ e(Q, { title: "复制完整 AK", children: /* @__PURE__ */ e(
|
|
524
605
|
R,
|
|
525
606
|
{
|
|
526
607
|
size: "small",
|
|
527
608
|
icon: /* @__PURE__ */ e(se, {}),
|
|
528
|
-
onClick: () =>
|
|
609
|
+
onClick: () => ie(_),
|
|
529
610
|
children: "复制"
|
|
530
611
|
}
|
|
531
612
|
) }),
|
|
532
|
-
!
|
|
613
|
+
!S && _.active && /* @__PURE__ */ e(
|
|
533
614
|
R,
|
|
534
615
|
{
|
|
535
616
|
size: "small",
|
|
536
617
|
danger: !0,
|
|
537
|
-
icon: /* @__PURE__ */ e(
|
|
538
|
-
onClick: () =>
|
|
618
|
+
icon: /* @__PURE__ */ e($e, {}),
|
|
619
|
+
onClick: () => z(_.id),
|
|
539
620
|
children: "吊销"
|
|
540
621
|
}
|
|
541
622
|
)
|
|
@@ -544,28 +625,28 @@ function ot() {
|
|
|
544
625
|
)
|
|
545
626
|
] }),
|
|
546
627
|
/* @__PURE__ */ s("div", { className: t.akCardRow2, children: [
|
|
547
|
-
|
|
628
|
+
_.tokenQuota > 0 && /* @__PURE__ */ e("div", { className: t.akMiniBar, children: /* @__PURE__ */ e(
|
|
548
629
|
"div",
|
|
549
630
|
{
|
|
550
631
|
className: t.akMiniBarFill,
|
|
551
632
|
style: {
|
|
552
633
|
width: `${Math.min(
|
|
553
|
-
(
|
|
634
|
+
(_.totalTokens || 0) / _.tokenQuota * 100,
|
|
554
635
|
100
|
|
555
636
|
)}%`
|
|
556
637
|
}
|
|
557
638
|
}
|
|
558
639
|
) }),
|
|
559
640
|
/* @__PURE__ */ s("span", { className: t.akUsageText, children: [
|
|
560
|
-
|
|
561
|
-
|
|
641
|
+
ye(_.totalTokens || 0),
|
|
642
|
+
_.tokenQuota > 0 ? ` / ${ye(_.tokenQuota)}` : " tokens"
|
|
562
643
|
] }),
|
|
563
|
-
/* @__PURE__ */ e("span", { className: t.akMetaText, children:
|
|
564
|
-
/* @__PURE__ */ e("span", { className: t.akMetaText, children: new Date(
|
|
644
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: _.lastUsedAt ? `最近使用 ${_.lastUsedAt}` : "尚未使用" }),
|
|
645
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: new Date(_.createTime).toLocaleDateString("zh-CN") })
|
|
565
646
|
] })
|
|
566
647
|
]
|
|
567
648
|
},
|
|
568
|
-
|
|
649
|
+
_.id
|
|
569
650
|
)) });
|
|
570
651
|
};
|
|
571
652
|
return /* @__PURE__ */ s("div", { className: t.akContainer, children: [
|
|
@@ -574,23 +655,23 @@ function ot() {
|
|
|
574
655
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlRow, children: [
|
|
575
656
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
|
|
576
657
|
/* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "OpenAI 兼容" }),
|
|
577
|
-
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children:
|
|
578
|
-
/* @__PURE__ */ e(
|
|
658
|
+
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: P }),
|
|
659
|
+
/* @__PURE__ */ e(Q, { title: "复制 Base URL", children: /* @__PURE__ */ e(
|
|
579
660
|
se,
|
|
580
661
|
{
|
|
581
662
|
className: t.akCopyIcon,
|
|
582
|
-
onClick: () =>
|
|
663
|
+
onClick: () => O(P)
|
|
583
664
|
}
|
|
584
665
|
) })
|
|
585
666
|
] }),
|
|
586
667
|
/* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
|
|
587
668
|
/* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "Anthropic 兼容" }),
|
|
588
|
-
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children:
|
|
589
|
-
/* @__PURE__ */ e(
|
|
669
|
+
/* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: P }),
|
|
670
|
+
/* @__PURE__ */ e(Q, { title: "复制 Base URL", children: /* @__PURE__ */ e(
|
|
590
671
|
se,
|
|
591
672
|
{
|
|
592
673
|
className: t.akCopyIcon,
|
|
593
|
-
onClick: () =>
|
|
674
|
+
onClick: () => O(P)
|
|
594
675
|
}
|
|
595
676
|
) })
|
|
596
677
|
] })
|
|
@@ -598,11 +679,11 @@ function ot() {
|
|
|
598
679
|
/* @__PURE__ */ s("div", { className: t.akIntegrationGrid, children: [
|
|
599
680
|
/* @__PURE__ */ s("div", { children: [
|
|
600
681
|
/* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "OpenAI 兼容 — curl 示例" }),
|
|
601
|
-
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children:
|
|
682
|
+
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: ba(P, o) })
|
|
602
683
|
] }),
|
|
603
684
|
/* @__PURE__ */ s("div", { children: [
|
|
604
685
|
/* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "Anthropic 兼容 — curl 示例" }),
|
|
605
|
-
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children:
|
|
686
|
+
/* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: Pa(P, o) })
|
|
606
687
|
] })
|
|
607
688
|
] })
|
|
608
689
|
] }),
|
|
@@ -618,7 +699,7 @@ function ot() {
|
|
|
618
699
|
},
|
|
619
700
|
children: [
|
|
620
701
|
/* @__PURE__ */ e(
|
|
621
|
-
|
|
702
|
+
Te,
|
|
622
703
|
{
|
|
623
704
|
activeKey: a,
|
|
624
705
|
onChange: (u) => n(u),
|
|
@@ -630,14 +711,14 @@ function ot() {
|
|
|
630
711
|
}
|
|
631
712
|
),
|
|
632
713
|
/* @__PURE__ */ s("div", { style: { display: "flex", gap: 8 }, children: [
|
|
633
|
-
/* @__PURE__ */ e(R, { icon: /* @__PURE__ */ e(
|
|
714
|
+
/* @__PURE__ */ e(R, { icon: /* @__PURE__ */ e(Ne, {}), onClick: v, size: "small", children: "刷新" }),
|
|
634
715
|
a === "personal" && /* @__PURE__ */ e(
|
|
635
716
|
R,
|
|
636
717
|
{
|
|
637
718
|
type: "primary",
|
|
638
|
-
icon: /* @__PURE__ */ e(
|
|
639
|
-
onClick:
|
|
640
|
-
loading:
|
|
719
|
+
icon: /* @__PURE__ */ e(xe, {}),
|
|
720
|
+
onClick: K,
|
|
721
|
+
loading: p,
|
|
641
722
|
children: "生成 AK"
|
|
642
723
|
}
|
|
643
724
|
)
|
|
@@ -645,18 +726,18 @@ function ot() {
|
|
|
645
726
|
]
|
|
646
727
|
}
|
|
647
728
|
),
|
|
648
|
-
a === "app" ?
|
|
729
|
+
a === "app" ? _e(r, !0) : _e(m, !1)
|
|
649
730
|
] }),
|
|
650
731
|
/* @__PURE__ */ s(
|
|
651
732
|
de,
|
|
652
733
|
{
|
|
653
|
-
open:
|
|
734
|
+
open: L,
|
|
654
735
|
title: "生成新 AK",
|
|
655
|
-
onCancel: () =>
|
|
656
|
-
onOk:
|
|
736
|
+
onCancel: () => w(!1),
|
|
737
|
+
onOk: I,
|
|
657
738
|
okText: "确认生成",
|
|
658
739
|
cancelText: "取消",
|
|
659
|
-
confirmLoading:
|
|
740
|
+
confirmLoading: p,
|
|
660
741
|
children: [
|
|
661
742
|
/* @__PURE__ */ e(
|
|
662
743
|
"div",
|
|
@@ -670,12 +751,12 @@ function ot() {
|
|
|
670
751
|
}
|
|
671
752
|
),
|
|
672
753
|
/* @__PURE__ */ e(
|
|
673
|
-
|
|
754
|
+
Se,
|
|
674
755
|
{
|
|
675
756
|
placeholder: "例如:测试用 AK、生产网关 AK",
|
|
676
|
-
value:
|
|
677
|
-
onChange: (u) =>
|
|
678
|
-
onPressEnter:
|
|
757
|
+
value: N,
|
|
758
|
+
onChange: (u) => T(u.target.value),
|
|
759
|
+
onPressEnter: I,
|
|
679
760
|
maxLength: 50,
|
|
680
761
|
autoFocus: !0
|
|
681
762
|
}
|
|
@@ -694,7 +775,7 @@ function ot() {
|
|
|
694
775
|
R,
|
|
695
776
|
{
|
|
696
777
|
icon: /* @__PURE__ */ e(se, {}),
|
|
697
|
-
onClick: () => h.apiKey &&
|
|
778
|
+
onClick: () => h.apiKey && O(h.apiKey),
|
|
698
779
|
children: "复制 AK"
|
|
699
780
|
},
|
|
700
781
|
"copy"
|
|
@@ -734,56 +815,56 @@ function ot() {
|
|
|
734
815
|
}
|
|
735
816
|
),
|
|
736
817
|
/* @__PURE__ */ e(
|
|
737
|
-
|
|
818
|
+
we,
|
|
738
819
|
{
|
|
739
820
|
title: k ? /* @__PURE__ */ s("span", { children: [
|
|
740
821
|
"AK 详情 — ",
|
|
741
822
|
/* @__PURE__ */ e("code", { children: k.akPrefix })
|
|
742
823
|
] }) : "AK 详情",
|
|
743
824
|
open: !!k,
|
|
744
|
-
onClose:
|
|
825
|
+
onClose: F,
|
|
745
826
|
size: "large",
|
|
746
|
-
children:
|
|
827
|
+
children: q ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Y, { tip: "加载用量数据..." }) }) : A ? /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
|
|
747
828
|
/* @__PURE__ */ e("div", { style: { fontSize: 12, color: "#8c8c8c", marginBottom: 12 }, children: "以下为网关全局调用统计(近 7 天窗口), 监控侧不按 AK 留存;该 AK 自身的累计消耗见下方「本 AK 累计 Token」。" }),
|
|
748
829
|
/* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
|
|
749
|
-
/* @__PURE__ */ e(
|
|
750
|
-
/* @__PURE__ */ e(
|
|
830
|
+
/* @__PURE__ */ e(E, { title: "总请求数", value: A.totalRequests }),
|
|
831
|
+
/* @__PURE__ */ e(E, { title: "总 Token", value: A.totalTokens }),
|
|
751
832
|
/* @__PURE__ */ e(
|
|
752
|
-
|
|
833
|
+
E,
|
|
753
834
|
{
|
|
754
835
|
title: "输入 Token",
|
|
755
|
-
value:
|
|
836
|
+
value: A.totalPromptTokens
|
|
756
837
|
}
|
|
757
838
|
),
|
|
758
839
|
/* @__PURE__ */ e(
|
|
759
|
-
|
|
840
|
+
E,
|
|
760
841
|
{
|
|
761
842
|
title: "输出 Token",
|
|
762
|
-
value:
|
|
843
|
+
value: A.totalCompletionTokens
|
|
763
844
|
}
|
|
764
845
|
),
|
|
765
846
|
/* @__PURE__ */ e(
|
|
766
|
-
|
|
847
|
+
E,
|
|
767
848
|
{
|
|
768
849
|
title: "平均耗时",
|
|
769
|
-
value:
|
|
850
|
+
value: A.avgLatencyMs,
|
|
770
851
|
suffix: "ms"
|
|
771
852
|
}
|
|
772
853
|
),
|
|
773
854
|
/* @__PURE__ */ e(
|
|
774
|
-
|
|
855
|
+
E,
|
|
775
856
|
{
|
|
776
857
|
title: "错误数",
|
|
777
|
-
value:
|
|
858
|
+
value: A.errorCount,
|
|
778
859
|
styles: {
|
|
779
860
|
content: {
|
|
780
|
-
color:
|
|
861
|
+
color: A.errorCount > 0 ? "#ff4d4f" : void 0
|
|
781
862
|
}
|
|
782
863
|
}
|
|
783
864
|
}
|
|
784
865
|
),
|
|
785
866
|
/* @__PURE__ */ e(
|
|
786
|
-
|
|
867
|
+
E,
|
|
787
868
|
{
|
|
788
869
|
title: "本 AK 累计 Token",
|
|
789
870
|
value: (k == null ? void 0 : k.totalTokens) ?? 0
|
|
@@ -792,19 +873,19 @@ function ot() {
|
|
|
792
873
|
] }),
|
|
793
874
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
794
875
|
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "每日调用曲线(按最近调用明细聚合)" }),
|
|
795
|
-
ne(
|
|
876
|
+
ne(A.daily)
|
|
796
877
|
] }),
|
|
797
878
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
798
879
|
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "模型用量分布" }),
|
|
799
|
-
ce(
|
|
880
|
+
ce(A.models)
|
|
800
881
|
] }),
|
|
801
882
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
802
883
|
/* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "最近调用记录" }),
|
|
803
884
|
/* @__PURE__ */ e(
|
|
804
|
-
|
|
885
|
+
Ae,
|
|
805
886
|
{
|
|
806
|
-
columns:
|
|
807
|
-
dataSource:
|
|
887
|
+
columns: Ke,
|
|
888
|
+
dataSource: A.recent,
|
|
808
889
|
rowKey: "id",
|
|
809
890
|
size: "small",
|
|
810
891
|
pagination: {
|
|
@@ -823,63 +904,63 @@ function ot() {
|
|
|
823
904
|
)
|
|
824
905
|
] });
|
|
825
906
|
}
|
|
826
|
-
function
|
|
907
|
+
function Ea(a) {
|
|
827
908
|
const n = [];
|
|
828
909
|
if (!a) return n;
|
|
829
|
-
const
|
|
830
|
-
let
|
|
831
|
-
for (; (m =
|
|
832
|
-
m.index >
|
|
833
|
-
return
|
|
910
|
+
const r = /<(think|thinking|reasoning)>([\s\S]*?)<\/\1>/gi;
|
|
911
|
+
let i = 0, m;
|
|
912
|
+
for (; (m = r.exec(a)) !== null; )
|
|
913
|
+
m.index > i && n.push({ type: "text", text: a.slice(i, m.index) }), n.push({ type: "think", text: m[2] }), i = m.index + m[0].length;
|
|
914
|
+
return i < a.length && n.push({ type: "text", text: a.slice(i) }), n;
|
|
834
915
|
}
|
|
835
|
-
const
|
|
836
|
-
let
|
|
837
|
-
function
|
|
838
|
-
const [n,
|
|
916
|
+
const oe = 4;
|
|
917
|
+
let $a = 0;
|
|
918
|
+
function La({ initialModels: a }) {
|
|
919
|
+
const [n, r] = x([]), [i, m] = x([]), [y, C] = x(!0), [f, p] = x(null), [B, L] = x(""), [w, N] = x(!1), T = me(""), h = me(/* @__PURE__ */ new Map()), c = me(/* @__PURE__ */ new Map());
|
|
839
920
|
X(() => {
|
|
840
921
|
(async () => {
|
|
841
922
|
try {
|
|
842
|
-
const
|
|
843
|
-
m(
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
} catch (
|
|
847
|
-
|
|
923
|
+
const o = await pe();
|
|
924
|
+
m(o), C(!1);
|
|
925
|
+
const g = a.length > 0 ? a : o.slice(0, 1).map((v) => v.modelName);
|
|
926
|
+
r(g.slice(0, oe).map((v) => ue(v)));
|
|
927
|
+
} catch (o) {
|
|
928
|
+
C(!1), p(o instanceof Error ? o.message : "模型列表加载失败");
|
|
848
929
|
}
|
|
849
930
|
})();
|
|
850
931
|
}, []), X(() => {
|
|
851
|
-
if (a.length > 0 &&
|
|
852
|
-
const
|
|
853
|
-
|
|
932
|
+
if (a.length > 0 && i.length > 0) {
|
|
933
|
+
const o = a.slice(0, oe).map((g) => ue(g));
|
|
934
|
+
r(o);
|
|
854
935
|
}
|
|
855
936
|
}, [a.join(",")]);
|
|
856
|
-
const k =
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
}, []), d =
|
|
860
|
-
(
|
|
861
|
-
|
|
937
|
+
const k = j((o) => {
|
|
938
|
+
const g = c.current.get(o);
|
|
939
|
+
g && (g.scrollTop = g.scrollHeight);
|
|
940
|
+
}, []), d = j(
|
|
941
|
+
(o, g) => {
|
|
942
|
+
r((v) => v.map((K) => K.id === o ? g(K) : K));
|
|
862
943
|
},
|
|
863
944
|
[]
|
|
864
|
-
),
|
|
865
|
-
if (
|
|
866
|
-
const
|
|
867
|
-
return
|
|
868
|
-
}, []),
|
|
869
|
-
const
|
|
870
|
-
if (!
|
|
871
|
-
let
|
|
945
|
+
), A = j(async () => {
|
|
946
|
+
if (T.current) return T.current;
|
|
947
|
+
const o = await ot();
|
|
948
|
+
return T.current = o, o;
|
|
949
|
+
}, []), M = j(async () => {
|
|
950
|
+
const o = B.trim();
|
|
951
|
+
if (!o || w) return;
|
|
952
|
+
let g;
|
|
872
953
|
try {
|
|
873
|
-
|
|
954
|
+
g = await A();
|
|
874
955
|
} catch {
|
|
875
956
|
return;
|
|
876
957
|
}
|
|
877
|
-
|
|
878
|
-
const
|
|
879
|
-
...
|
|
958
|
+
L(""), N(!0);
|
|
959
|
+
const v = n.map((z) => ({
|
|
960
|
+
...z,
|
|
880
961
|
messages: [
|
|
881
|
-
...
|
|
882
|
-
{ role: "user", content:
|
|
962
|
+
...z.messages,
|
|
963
|
+
{ role: "user", content: o },
|
|
883
964
|
{ role: "assistant", content: "" }
|
|
884
965
|
],
|
|
885
966
|
streamingContent: "",
|
|
@@ -887,87 +968,87 @@ function mt({ initialModels: a }) {
|
|
|
887
968
|
error: null,
|
|
888
969
|
usage: null
|
|
889
970
|
}));
|
|
890
|
-
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
h.current.set(
|
|
895
|
-
const
|
|
896
|
-
et(
|
|
897
|
-
onDelta: (
|
|
898
|
-
d(
|
|
899
|
-
...
|
|
900
|
-
streamingContent:
|
|
901
|
-
messages:
|
|
902
|
-
(ne, ce) => ce ===
|
|
971
|
+
r(v);
|
|
972
|
+
const K = v;
|
|
973
|
+
K.forEach((z) => {
|
|
974
|
+
const O = new AbortController();
|
|
975
|
+
h.current.set(z.id, O);
|
|
976
|
+
const ie = z.messages.slice(0, -1);
|
|
977
|
+
et(g, z.model, ie, {
|
|
978
|
+
onDelta: (U) => {
|
|
979
|
+
d(z.id, (F) => ({
|
|
980
|
+
...F,
|
|
981
|
+
streamingContent: F.streamingContent + U,
|
|
982
|
+
messages: F.messages.map(
|
|
983
|
+
(ne, ce) => ce === F.messages.length - 1 ? { ...ne, content: F.streamingContent + U } : ne
|
|
903
984
|
)
|
|
904
|
-
})), k(
|
|
985
|
+
})), k(z.id);
|
|
905
986
|
},
|
|
906
|
-
onDone: (
|
|
907
|
-
d(
|
|
908
|
-
...
|
|
987
|
+
onDone: (U) => {
|
|
988
|
+
d(z.id, (F) => ({
|
|
989
|
+
...F,
|
|
909
990
|
isStreaming: !1,
|
|
910
|
-
usage:
|
|
911
|
-
promptTokens:
|
|
912
|
-
completionTokens:
|
|
913
|
-
totalTokens:
|
|
991
|
+
usage: U ? {
|
|
992
|
+
promptTokens: U.promptTokens,
|
|
993
|
+
completionTokens: U.completionTokens,
|
|
994
|
+
totalTokens: U.totalTokens
|
|
914
995
|
} : null
|
|
915
|
-
})), h.current.delete(
|
|
996
|
+
})), h.current.delete(z.id);
|
|
916
997
|
},
|
|
917
|
-
onError: (
|
|
918
|
-
(
|
|
919
|
-
...
|
|
998
|
+
onError: (U) => {
|
|
999
|
+
(U.message.includes("401") || U.message.includes("API key")) && (Pe(), T.current = ""), d(z.id, (F) => ({
|
|
1000
|
+
...F,
|
|
920
1001
|
isStreaming: !1,
|
|
921
|
-
error:
|
|
922
|
-
})), h.current.delete(
|
|
1002
|
+
error: U.message
|
|
1003
|
+
})), h.current.delete(z.id);
|
|
923
1004
|
},
|
|
924
|
-
signal:
|
|
1005
|
+
signal: O.signal
|
|
925
1006
|
}).catch(() => {
|
|
926
1007
|
});
|
|
927
1008
|
});
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
(
|
|
931
|
-
) && (clearInterval(
|
|
1009
|
+
const I = setInterval(() => {
|
|
1010
|
+
K.every(
|
|
1011
|
+
(O) => !h.current.has(O.id)
|
|
1012
|
+
) && (clearInterval(I), N(!1));
|
|
932
1013
|
}, 200);
|
|
933
1014
|
setTimeout(() => {
|
|
934
|
-
clearInterval(
|
|
1015
|
+
clearInterval(I), N(!1);
|
|
935
1016
|
}, 300 * 1e3);
|
|
936
|
-
}, [
|
|
937
|
-
h.current.forEach((
|
|
938
|
-
}, []),
|
|
939
|
-
var
|
|
940
|
-
if (n.length >=
|
|
941
|
-
const
|
|
942
|
-
|
|
943
|
-
}, [n,
|
|
944
|
-
h.current.forEach((
|
|
945
|
-
(
|
|
946
|
-
...
|
|
1017
|
+
}, [B, w, n, A, d, k]), q = j(() => {
|
|
1018
|
+
h.current.forEach((o) => o.abort()), h.current.clear(), r((o) => o.map((g) => ({ ...g, isStreaming: !1 }))), N(!1);
|
|
1019
|
+
}, []), W = j(() => {
|
|
1020
|
+
var g;
|
|
1021
|
+
if (n.length >= oe) return;
|
|
1022
|
+
const o = (g = i.find((v) => !n.some((K) => K.model === v.modelName))) == null ? void 0 : g.modelName;
|
|
1023
|
+
o && r((v) => [...v, ue(o)]);
|
|
1024
|
+
}, [n, i]), H = j(() => {
|
|
1025
|
+
h.current.forEach((o) => o.abort()), h.current.clear(), r(
|
|
1026
|
+
(o) => o.map((g) => ({
|
|
1027
|
+
...g,
|
|
947
1028
|
messages: [],
|
|
948
1029
|
streamingContent: "",
|
|
949
1030
|
isStreaming: !1,
|
|
950
1031
|
error: null,
|
|
951
1032
|
usage: null
|
|
952
1033
|
}))
|
|
953
|
-
),
|
|
954
|
-
}, [
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
}, []),
|
|
958
|
-
(
|
|
959
|
-
d(
|
|
1034
|
+
), N(!1);
|
|
1035
|
+
}, [w, n]), l = j((o) => {
|
|
1036
|
+
const g = h.current.get(o);
|
|
1037
|
+
g && g.abort(), h.current.delete(o), r((v) => v.filter((K) => K.id !== o));
|
|
1038
|
+
}, []), b = j(
|
|
1039
|
+
(o, g) => {
|
|
1040
|
+
d(o, (v) => ({ ...v, model: g }));
|
|
960
1041
|
},
|
|
961
1042
|
[d]
|
|
962
|
-
),
|
|
963
|
-
label:
|
|
964
|
-
value:
|
|
1043
|
+
), P = i.map((o) => ({
|
|
1044
|
+
label: o.modelName,
|
|
1045
|
+
value: o.modelName
|
|
965
1046
|
}));
|
|
966
|
-
return
|
|
1047
|
+
return y ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Y, { tip: "加载模型列表..." }) }) : f ? /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
|
|
967
1048
|
/* @__PURE__ */ e("div", { className: t.chatHeader, children: /* @__PURE__ */ e("h3", { className: t.chatTitle, children: "模型对话" }) }),
|
|
968
1049
|
/* @__PURE__ */ s("div", { className: t.akEmpty, children: [
|
|
969
1050
|
"模型列表加载失败:",
|
|
970
|
-
|
|
1051
|
+
f
|
|
971
1052
|
] })
|
|
972
1053
|
] }) : /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
|
|
973
1054
|
/* @__PURE__ */ s("div", { className: t.chatHeader, children: [
|
|
@@ -982,23 +1063,23 @@ function mt({ initialModels: a }) {
|
|
|
982
1063
|
R,
|
|
983
1064
|
{
|
|
984
1065
|
size: "small",
|
|
985
|
-
icon: /* @__PURE__ */ e(
|
|
1066
|
+
icon: /* @__PURE__ */ e(Le, {}),
|
|
986
1067
|
onClick: H,
|
|
987
|
-
disabled:
|
|
1068
|
+
disabled: w || n.every((o) => o.messages.length === 0),
|
|
988
1069
|
children: "清空重新来"
|
|
989
1070
|
}
|
|
990
1071
|
)
|
|
991
1072
|
] }),
|
|
992
1073
|
/* @__PURE__ */ s("div", { className: t.chatPanels, children: [
|
|
993
|
-
n.map((
|
|
1074
|
+
n.map((o) => /* @__PURE__ */ s("div", { className: t.chatPanel, children: [
|
|
994
1075
|
/* @__PURE__ */ s("div", { className: t.chatPanelHeader, children: [
|
|
995
1076
|
/* @__PURE__ */ e(
|
|
996
1077
|
Ge,
|
|
997
1078
|
{
|
|
998
1079
|
size: "small",
|
|
999
|
-
value:
|
|
1000
|
-
onChange: (
|
|
1001
|
-
options:
|
|
1080
|
+
value: o.model,
|
|
1081
|
+
onChange: (g) => b(o.id, g),
|
|
1082
|
+
options: P,
|
|
1002
1083
|
style: { minWidth: 140, flex: 1 },
|
|
1003
1084
|
showSearch: !0,
|
|
1004
1085
|
optionFilterProp: "label"
|
|
@@ -1008,8 +1089,8 @@ function mt({ initialModels: a }) {
|
|
|
1008
1089
|
"span",
|
|
1009
1090
|
{
|
|
1010
1091
|
className: t.chatPanelClose,
|
|
1011
|
-
onClick: () =>
|
|
1012
|
-
children: /* @__PURE__ */ e(
|
|
1092
|
+
onClick: () => l(o.id),
|
|
1093
|
+
children: /* @__PURE__ */ e(Oe, {})
|
|
1013
1094
|
}
|
|
1014
1095
|
)
|
|
1015
1096
|
] }),
|
|
@@ -1017,67 +1098,67 @@ function mt({ initialModels: a }) {
|
|
|
1017
1098
|
"div",
|
|
1018
1099
|
{
|
|
1019
1100
|
className: t.chatPanelBody,
|
|
1020
|
-
ref: (
|
|
1021
|
-
c.current.set(
|
|
1101
|
+
ref: (g) => {
|
|
1102
|
+
c.current.set(o.id, g);
|
|
1022
1103
|
},
|
|
1023
1104
|
children: [
|
|
1024
|
-
|
|
1105
|
+
o.messages.map((g, v) => /* @__PURE__ */ s(
|
|
1025
1106
|
"div",
|
|
1026
1107
|
{
|
|
1027
|
-
className:
|
|
1108
|
+
className: g.role === "user" ? t.chatMsgUser : t.chatMsgAI,
|
|
1028
1109
|
children: [
|
|
1029
|
-
|
|
1030
|
-
(
|
|
1110
|
+
g.role === "assistant" ? Ea(g.content).map(
|
|
1111
|
+
(K, I) => K.type === "think" ? /* @__PURE__ */ s(
|
|
1031
1112
|
"details",
|
|
1032
1113
|
{
|
|
1033
1114
|
className: t.chatThinkBlock,
|
|
1034
1115
|
children: [
|
|
1035
1116
|
/* @__PURE__ */ e("summary", { children: "思考过程" }),
|
|
1036
|
-
/* @__PURE__ */ e("pre", { children:
|
|
1117
|
+
/* @__PURE__ */ e("pre", { children: K.text })
|
|
1037
1118
|
]
|
|
1038
1119
|
},
|
|
1039
|
-
|
|
1040
|
-
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children:
|
|
1041
|
-
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children:
|
|
1042
|
-
|
|
1120
|
+
I
|
|
1121
|
+
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: K.text }, I)
|
|
1122
|
+
) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: g.content }),
|
|
1123
|
+
o.isStreaming && v === o.messages.length - 1 && g.role === "assistant" && /* @__PURE__ */ e("span", { className: t.chatStreamingCursor })
|
|
1043
1124
|
]
|
|
1044
1125
|
},
|
|
1045
|
-
|
|
1126
|
+
v
|
|
1046
1127
|
)),
|
|
1047
|
-
|
|
1048
|
-
|
|
1128
|
+
o.error && /* @__PURE__ */ e("div", { className: t.chatMsgError, children: o.error }),
|
|
1129
|
+
o.usage && /* @__PURE__ */ s("div", { className: t.chatUsageBar, children: [
|
|
1049
1130
|
/* @__PURE__ */ s("span", { children: [
|
|
1050
1131
|
"输入: ",
|
|
1051
|
-
|
|
1132
|
+
o.usage.promptTokens
|
|
1052
1133
|
] }),
|
|
1053
1134
|
/* @__PURE__ */ s("span", { children: [
|
|
1054
1135
|
"输出: ",
|
|
1055
|
-
|
|
1136
|
+
o.usage.completionTokens
|
|
1056
1137
|
] })
|
|
1057
1138
|
] })
|
|
1058
1139
|
]
|
|
1059
1140
|
}
|
|
1060
1141
|
)
|
|
1061
|
-
] },
|
|
1062
|
-
n.length <
|
|
1142
|
+
] }, o.id)),
|
|
1143
|
+
n.length < oe && /* @__PURE__ */ e(Q, { title: "添加面板", children: /* @__PURE__ */ e("div", { className: t.addPanelBtn, onClick: W, children: /* @__PURE__ */ e(xe, {}) }) })
|
|
1063
1144
|
] }),
|
|
1064
1145
|
/* @__PURE__ */ s("div", { className: t.chatInputBar, children: [
|
|
1065
1146
|
/* @__PURE__ */ e(
|
|
1066
|
-
|
|
1147
|
+
Se.TextArea,
|
|
1067
1148
|
{
|
|
1068
1149
|
className: t.chatInput,
|
|
1069
|
-
value:
|
|
1070
|
-
onChange: (
|
|
1150
|
+
value: B,
|
|
1151
|
+
onChange: (o) => L(o.target.value),
|
|
1071
1152
|
placeholder: "输入消息,所有面板将同时收到并流式输出...",
|
|
1072
1153
|
autoSize: { minRows: 1, maxRows: 4 },
|
|
1073
|
-
onPressEnter: (
|
|
1074
|
-
|
|
1154
|
+
onPressEnter: (o) => {
|
|
1155
|
+
o.shiftKey || (o.preventDefault(), M());
|
|
1075
1156
|
},
|
|
1076
|
-
disabled:
|
|
1157
|
+
disabled: w
|
|
1077
1158
|
}
|
|
1078
1159
|
),
|
|
1079
|
-
|
|
1080
|
-
/* @__PURE__ */ e(
|
|
1160
|
+
w ? /* @__PURE__ */ e(R, { danger: !0, onClick: q, children: "停止" }) : /* @__PURE__ */ s(R, { type: "primary", onClick: M, disabled: !B.trim(), children: [
|
|
1161
|
+
/* @__PURE__ */ e(Ue, {}),
|
|
1081
1162
|
" 发送"
|
|
1082
1163
|
] })
|
|
1083
1164
|
] })
|
|
@@ -1085,7 +1166,7 @@ function mt({ initialModels: a }) {
|
|
|
1085
1166
|
}
|
|
1086
1167
|
function ue(a) {
|
|
1087
1168
|
return {
|
|
1088
|
-
id:
|
|
1169
|
+
id: ++$a,
|
|
1089
1170
|
model: a,
|
|
1090
1171
|
messages: [],
|
|
1091
1172
|
streamingContent: "",
|
|
@@ -1094,40 +1175,40 @@ function ue(a) {
|
|
|
1094
1175
|
usage: null
|
|
1095
1176
|
};
|
|
1096
1177
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const [n,
|
|
1099
|
-
m(!0),
|
|
1100
|
-
|
|
1178
|
+
function Oa({ onStartChat: a }) {
|
|
1179
|
+
const [n, r] = x([]), [i, m] = x(!0), [y, C] = x(null), [f, p] = x(/* @__PURE__ */ new Set()), B = () => {
|
|
1180
|
+
m(!0), C(null), pe().then((c) => {
|
|
1181
|
+
r(c), m(!1);
|
|
1101
1182
|
}).catch((c) => {
|
|
1102
|
-
|
|
1183
|
+
r([]), C(c instanceof Error ? c.message : "加载失败"), m(!1);
|
|
1103
1184
|
});
|
|
1104
1185
|
};
|
|
1105
1186
|
X(() => {
|
|
1106
|
-
|
|
1187
|
+
B();
|
|
1107
1188
|
}, []);
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1189
|
+
const L = (c) => {
|
|
1190
|
+
p((k) => {
|
|
1110
1191
|
const d = new Set(k);
|
|
1111
1192
|
return d.has(c) ? d.delete(c) : d.add(c), d;
|
|
1112
1193
|
});
|
|
1113
|
-
},
|
|
1194
|
+
}, w = Array.from(f), N = (c) => {
|
|
1114
1195
|
a([c]);
|
|
1115
|
-
},
|
|
1116
|
-
|
|
1196
|
+
}, T = () => {
|
|
1197
|
+
w.length > 0 && a(w);
|
|
1117
1198
|
}, h = (c) => {
|
|
1118
1199
|
if (!c) return "default";
|
|
1119
1200
|
const k = c.toLowerCase();
|
|
1120
1201
|
return k.includes("aliyun") || k.includes("ali") ? "blue" : k.includes("zhipu") || k.includes("glm") ? "purple" : k.includes("moonshot") || k.includes("kimi") ? "cyan" : k.includes("minimax") ? "orange" : "default";
|
|
1121
1202
|
};
|
|
1122
|
-
return
|
|
1203
|
+
return i ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Y, { tip: "加载模型列表..." }) }) : y ? /* @__PURE__ */ s("div", { children: [
|
|
1123
1204
|
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
1124
1205
|
/* @__PURE__ */ e("h3", { className: t.modelMgmtTitle, children: "模型管理" }),
|
|
1125
1206
|
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "数据库管理的可用模型,可选择单个或多个模型发起对话对比" })
|
|
1126
1207
|
] }),
|
|
1127
1208
|
/* @__PURE__ */ s("div", { className: t.akEmpty, children: [
|
|
1128
1209
|
"模型列表加载失败:",
|
|
1129
|
-
|
|
1130
|
-
/* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ e(R, { type: "primary", onClick:
|
|
1210
|
+
y,
|
|
1211
|
+
/* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ e(R, { type: "primary", onClick: B, children: "重试" }) })
|
|
1131
1212
|
] })
|
|
1132
1213
|
] }) : /* @__PURE__ */ s("div", { children: [
|
|
1133
1214
|
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
@@ -1136,12 +1217,12 @@ function ut({ onStartChat: a }) {
|
|
|
1136
1217
|
] }),
|
|
1137
1218
|
n.length === 0 && /* @__PURE__ */ e("div", { className: t.akEmpty, children: "后端暂无启用模型(z_team_model_config 中 enable=1 的行),请先在数据库或网关配置中启用" }),
|
|
1138
1219
|
/* @__PURE__ */ e("div", { className: t.modelGrid, children: n.map((c) => {
|
|
1139
|
-
const k =
|
|
1220
|
+
const k = f.has(c.modelName);
|
|
1140
1221
|
return /* @__PURE__ */ s(
|
|
1141
1222
|
"div",
|
|
1142
1223
|
{
|
|
1143
1224
|
className: `${t.modelCard} ${k ? t.modelCardSelected : ""}`,
|
|
1144
|
-
onClick: () =>
|
|
1225
|
+
onClick: () => L(c.modelName),
|
|
1145
1226
|
children: [
|
|
1146
1227
|
/* @__PURE__ */ e(
|
|
1147
1228
|
Je,
|
|
@@ -1149,12 +1230,12 @@ function ut({ onStartChat: a }) {
|
|
|
1149
1230
|
className: t.modelCheckbox,
|
|
1150
1231
|
checked: k,
|
|
1151
1232
|
onChange: (d) => {
|
|
1152
|
-
d.stopPropagation(),
|
|
1233
|
+
d.stopPropagation(), L(c.modelName);
|
|
1153
1234
|
}
|
|
1154
1235
|
}
|
|
1155
1236
|
),
|
|
1156
1237
|
/* @__PURE__ */ s("div", { className: t.modelCardHeader, children: [
|
|
1157
|
-
/* @__PURE__ */ e("div", { className: t.modelIconWrap, children: /* @__PURE__ */ e(
|
|
1238
|
+
/* @__PURE__ */ e("div", { className: t.modelIconWrap, children: /* @__PURE__ */ e(ve, {}) }),
|
|
1158
1239
|
/* @__PURE__ */ s("div", { className: t.modelCardInfo, children: [
|
|
1159
1240
|
/* @__PURE__ */ e("h4", { className: t.modelName, children: c.modelName }),
|
|
1160
1241
|
/* @__PURE__ */ s("div", { className: t.modelTags, children: [
|
|
@@ -1177,7 +1258,7 @@ function ut({ onStartChat: a }) {
|
|
|
1177
1258
|
type: "link",
|
|
1178
1259
|
size: "small",
|
|
1179
1260
|
onClick: (d) => {
|
|
1180
|
-
d.stopPropagation(),
|
|
1261
|
+
d.stopPropagation(), N(c.modelName);
|
|
1181
1262
|
},
|
|
1182
1263
|
children: "发起对话"
|
|
1183
1264
|
}
|
|
@@ -1187,71 +1268,71 @@ function ut({ onStartChat: a }) {
|
|
|
1187
1268
|
c.modelName
|
|
1188
1269
|
);
|
|
1189
1270
|
}) }),
|
|
1190
|
-
|
|
1271
|
+
w.length > 0 && /* @__PURE__ */ s("div", { className: t.modelActionBar, children: [
|
|
1191
1272
|
/* @__PURE__ */ s("span", { className: t.modelSelectionCount, children: [
|
|
1192
1273
|
"已选择 ",
|
|
1193
|
-
|
|
1274
|
+
w.length,
|
|
1194
1275
|
" 个模型"
|
|
1195
1276
|
] }),
|
|
1196
1277
|
/* @__PURE__ */ e(
|
|
1197
1278
|
R,
|
|
1198
1279
|
{
|
|
1199
1280
|
type: "primary",
|
|
1200
|
-
onClick:
|
|
1201
|
-
disabled:
|
|
1281
|
+
onClick: T,
|
|
1282
|
+
disabled: w.length === 0,
|
|
1202
1283
|
children: "批量对比"
|
|
1203
1284
|
}
|
|
1204
1285
|
)
|
|
1205
1286
|
] })
|
|
1206
1287
|
] });
|
|
1207
1288
|
}
|
|
1208
|
-
const
|
|
1209
|
-
container:
|
|
1210
|
-
page:
|
|
1211
|
-
kpiGrid:
|
|
1212
|
-
kpiCard:
|
|
1213
|
-
sectionCard:
|
|
1214
|
-
sectionHead:
|
|
1215
|
-
sectionHint:
|
|
1216
|
-
akList:
|
|
1217
|
-
errorState:
|
|
1218
|
-
errorTitle:
|
|
1219
|
-
errorDetail:
|
|
1220
|
-
},
|
|
1289
|
+
const Ua = "_container_15pgq_5", Ra = "_page_15pgq_10", Da = "_kpiGrid_15pgq_16", Ha = "_kpiCard_15pgq_22", Fa = "_sectionCard_15pgq_29", ja = "_sectionHead_15pgq_36", qa = "_sectionHint_15pgq_42", Ga = "_akList_15pgq_47", Ja = "_errorState_15pgq_54", Wa = "_errorTitle_15pgq_66", Qa = "_errorDetail_15pgq_72", $ = {
|
|
1290
|
+
container: Ua,
|
|
1291
|
+
page: Ra,
|
|
1292
|
+
kpiGrid: Da,
|
|
1293
|
+
kpiCard: Ha,
|
|
1294
|
+
sectionCard: Fa,
|
|
1295
|
+
sectionHead: ja,
|
|
1296
|
+
sectionHint: qa,
|
|
1297
|
+
akList: Ga,
|
|
1298
|
+
errorState: Ja,
|
|
1299
|
+
errorTitle: Wa,
|
|
1300
|
+
errorDetail: Qa
|
|
1301
|
+
}, Va = Qe(
|
|
1221
1302
|
() => import("@yuku123/z-agent-component").then((a) => ({ default: a.AgentDashboard }))
|
|
1222
1303
|
);
|
|
1223
1304
|
function te(a) {
|
|
1224
1305
|
return a >= 1e6 ? `${(a / 1e6).toFixed(2)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : String(a ?? 0);
|
|
1225
1306
|
}
|
|
1226
|
-
function
|
|
1307
|
+
function Ya({ daily: a }) {
|
|
1227
1308
|
const n = Object.entries(a);
|
|
1228
1309
|
if (n.length === 0) return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
1229
|
-
const
|
|
1230
|
-
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: n.map(([
|
|
1231
|
-
const
|
|
1310
|
+
const r = Math.max(...n.map(([, i]) => i[1] + i[2]), 1);
|
|
1311
|
+
return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: n.map(([i, m]) => {
|
|
1312
|
+
const y = m[1] + m[2];
|
|
1232
1313
|
return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
|
|
1233
|
-
/* @__PURE__ */ e(
|
|
1314
|
+
/* @__PURE__ */ e(Q, { title: `${i}: ${m[0]}次 / ${y} tokens`, children: /* @__PURE__ */ e(
|
|
1234
1315
|
"div",
|
|
1235
1316
|
{
|
|
1236
1317
|
className: t.usageBar,
|
|
1237
|
-
style: { height: `${Math.max(
|
|
1318
|
+
style: { height: `${Math.max(y / r * 100, 2)}%` }
|
|
1238
1319
|
}
|
|
1239
1320
|
) }),
|
|
1240
|
-
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children:
|
|
1241
|
-
] },
|
|
1321
|
+
/* @__PURE__ */ e("span", { className: t.usageBarLabel, children: i })
|
|
1322
|
+
] }, i);
|
|
1242
1323
|
}) });
|
|
1243
1324
|
}
|
|
1244
|
-
function
|
|
1325
|
+
function Ce({ models: a }) {
|
|
1245
1326
|
const n = Object.entries(a);
|
|
1246
1327
|
if (n.length === 0) return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
|
|
1247
|
-
const
|
|
1248
|
-
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: n.sort((
|
|
1249
|
-
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children:
|
|
1328
|
+
const r = Math.max(...n.map(([, i]) => i[0]), 1);
|
|
1329
|
+
return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: n.sort((i, m) => m[1][0] - i[1][0]).map(([i, m]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
|
|
1330
|
+
/* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: i }),
|
|
1250
1331
|
/* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
|
|
1251
1332
|
"div",
|
|
1252
1333
|
{
|
|
1253
1334
|
className: t.modelBreakdownFill,
|
|
1254
|
-
style: { width: `${m[0] /
|
|
1335
|
+
style: { width: `${m[0] / r * 100}%` }
|
|
1255
1336
|
}
|
|
1256
1337
|
) }),
|
|
1257
1338
|
/* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
|
|
@@ -1260,9 +1341,9 @@ function ve({ models: a }) {
|
|
|
1260
1341
|
te(m[1] + (m[2] || 0)),
|
|
1261
1342
|
"tokens"
|
|
1262
1343
|
] })
|
|
1263
|
-
] },
|
|
1344
|
+
] }, i)) });
|
|
1264
1345
|
}
|
|
1265
|
-
const
|
|
1346
|
+
const Xa = [
|
|
1266
1347
|
{
|
|
1267
1348
|
title: "时间",
|
|
1268
1349
|
dataIndex: "createTime",
|
|
@@ -1284,147 +1365,147 @@ const xt = [
|
|
|
1284
1365
|
render: (a) => a ? /* @__PURE__ */ e(J, { color: a < 400 ? "green" : "red", children: a }) : "-"
|
|
1285
1366
|
}
|
|
1286
1367
|
];
|
|
1287
|
-
function
|
|
1368
|
+
function Za(a) {
|
|
1288
1369
|
var n;
|
|
1289
1370
|
return ((n = a == null ? void 0 : a.stats) == null ? void 0 : n.recent) ?? [];
|
|
1290
1371
|
}
|
|
1291
|
-
function
|
|
1292
|
-
var k, d,
|
|
1293
|
-
const [a, n] =
|
|
1294
|
-
var
|
|
1295
|
-
return ((
|
|
1296
|
-
})),
|
|
1297
|
-
new Set([
|
|
1298
|
-
),
|
|
1299
|
-
n(!0),
|
|
1372
|
+
function en() {
|
|
1373
|
+
var k, d, A, M, q, W, H;
|
|
1374
|
+
const [a, n] = x(!0), [r, i] = x(null), [m, y] = x([]), [C, f] = x(null), [p, B] = x(null), L = String(ze((l) => {
|
|
1375
|
+
var b;
|
|
1376
|
+
return ((b = l.currentUser) == null ? void 0 : b.id) ?? "";
|
|
1377
|
+
})), w = Array.from(
|
|
1378
|
+
new Set([L, Me].filter((l) => l !== ""))
|
|
1379
|
+
), N = j(async () => {
|
|
1380
|
+
n(!0), i(null);
|
|
1300
1381
|
try {
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
),
|
|
1304
|
-
let
|
|
1305
|
-
for (const
|
|
1306
|
-
if (
|
|
1307
|
-
for (const
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1382
|
+
const l = await Promise.allSettled(
|
|
1383
|
+
w.map((I) => le(I))
|
|
1384
|
+
), b = [], P = /* @__PURE__ */ new Set();
|
|
1385
|
+
let o = 0;
|
|
1386
|
+
for (const I of l)
|
|
1387
|
+
if (I.status === "fulfilled")
|
|
1388
|
+
for (const z of I.value) {
|
|
1389
|
+
const O = String(z.id ?? z.akPrefix ?? "");
|
|
1390
|
+
P.has(O) || (P.add(O), b.push(z));
|
|
1310
1391
|
}
|
|
1311
|
-
else
|
|
1312
|
-
if (
|
|
1392
|
+
else o += 1;
|
|
1393
|
+
if (o === l.length)
|
|
1313
1394
|
throw new Error("网关不可达:无法获取 AK 列表");
|
|
1314
|
-
|
|
1315
|
-
let
|
|
1395
|
+
b.sort((I, z) => (I.id ?? 0) - (z.id ?? 0));
|
|
1396
|
+
let g = null, v = null;
|
|
1316
1397
|
try {
|
|
1317
|
-
|
|
1318
|
-
} catch (
|
|
1319
|
-
|
|
1398
|
+
g = await be(0);
|
|
1399
|
+
} catch (I) {
|
|
1400
|
+
v = I instanceof Error ? I.message : "获取用量失败";
|
|
1320
1401
|
}
|
|
1321
|
-
|
|
1322
|
-
const
|
|
1323
|
-
key:
|
|
1324
|
-
stats:
|
|
1325
|
-
statsError:
|
|
1402
|
+
f(g);
|
|
1403
|
+
const K = b.map((I) => ({
|
|
1404
|
+
key: I,
|
|
1405
|
+
stats: g,
|
|
1406
|
+
statsError: v
|
|
1326
1407
|
}));
|
|
1327
|
-
|
|
1328
|
-
} catch (
|
|
1329
|
-
|
|
1408
|
+
y(K);
|
|
1409
|
+
} catch (l) {
|
|
1410
|
+
i(l instanceof Error ? l.message : "加载失败");
|
|
1330
1411
|
} finally {
|
|
1331
1412
|
n(!1);
|
|
1332
1413
|
}
|
|
1333
|
-
}, [
|
|
1414
|
+
}, [w.join(",")]);
|
|
1334
1415
|
X(() => {
|
|
1335
|
-
|
|
1336
|
-
}, [
|
|
1337
|
-
const
|
|
1338
|
-
const
|
|
1339
|
-
for (const [
|
|
1340
|
-
P
|
|
1416
|
+
N();
|
|
1417
|
+
}, [N]);
|
|
1418
|
+
const T = Be(() => {
|
|
1419
|
+
const l = C, b = {};
|
|
1420
|
+
for (const [P, o] of Object.entries((l == null ? void 0 : l.models) ?? {}))
|
|
1421
|
+
b[P] = [o[0] ?? 0, o[1] ?? 0, o[2] ?? 0];
|
|
1341
1422
|
return {
|
|
1342
|
-
requests: (
|
|
1343
|
-
tokens: (
|
|
1344
|
-
avgLatency: (
|
|
1345
|
-
errors: (
|
|
1346
|
-
models:
|
|
1423
|
+
requests: (l == null ? void 0 : l.totalRequests) ?? 0,
|
|
1424
|
+
tokens: (l == null ? void 0 : l.totalTokens) ?? 0,
|
|
1425
|
+
avgLatency: (l == null ? void 0 : l.avgLatencyMs) ?? 0,
|
|
1426
|
+
errors: (l == null ? void 0 : l.errorCount) ?? 0,
|
|
1427
|
+
models: b
|
|
1347
1428
|
};
|
|
1348
|
-
}, [
|
|
1349
|
-
/* @__PURE__ */ e("div", { className:
|
|
1350
|
-
/* @__PURE__ */ e("div", { className:
|
|
1351
|
-
/* @__PURE__ */ e(R, { icon: /* @__PURE__ */ e(
|
|
1352
|
-
] }) : /* @__PURE__ */ s("div", { className:
|
|
1353
|
-
/* @__PURE__ */ s("div", { className:
|
|
1354
|
-
/* @__PURE__ */ e("div", { className:
|
|
1355
|
-
/* @__PURE__ */ e("div", { className:
|
|
1356
|
-
/* @__PURE__ */ e("div", { className:
|
|
1357
|
-
/* @__PURE__ */ e("div", { className:
|
|
1358
|
-
|
|
1429
|
+
}, [C]), h = m.reduce((l, b) => l + (b.key.tokenQuota || 0), 0), c = () => a ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Y, { tip: "加载监控数据..." }) }) : r ? /* @__PURE__ */ s("div", { className: $.errorState, children: [
|
|
1430
|
+
/* @__PURE__ */ e("div", { className: $.errorTitle, children: "模型监控数据加载失败" }),
|
|
1431
|
+
/* @__PURE__ */ e("div", { className: $.errorDetail, children: r }),
|
|
1432
|
+
/* @__PURE__ */ e(R, { icon: /* @__PURE__ */ e(Ne, {}), onClick: N, type: "primary", children: "重试" })
|
|
1433
|
+
] }) : /* @__PURE__ */ s("div", { className: $.page, children: [
|
|
1434
|
+
/* @__PURE__ */ s("div", { className: $.kpiGrid, children: [
|
|
1435
|
+
/* @__PURE__ */ e("div", { className: $.kpiCard, children: /* @__PURE__ */ e(E, { title: "总请求(近7天)", value: T.requests }) }),
|
|
1436
|
+
/* @__PURE__ */ e("div", { className: $.kpiCard, children: /* @__PURE__ */ e(E, { title: "总 Tokens", value: te(T.tokens) }) }),
|
|
1437
|
+
/* @__PURE__ */ e("div", { className: $.kpiCard, children: /* @__PURE__ */ e(E, { title: "平均延迟", value: T.avgLatency, suffix: "ms" }) }),
|
|
1438
|
+
/* @__PURE__ */ e("div", { className: $.kpiCard, children: /* @__PURE__ */ e(
|
|
1439
|
+
E,
|
|
1359
1440
|
{
|
|
1360
1441
|
title: "错误数",
|
|
1361
|
-
value:
|
|
1362
|
-
valueStyle:
|
|
1442
|
+
value: T.errors,
|
|
1443
|
+
valueStyle: T.errors > 0 ? { color: "#ff4d4f" } : void 0
|
|
1363
1444
|
}
|
|
1364
1445
|
) })
|
|
1365
1446
|
] }),
|
|
1366
|
-
/* @__PURE__ */ s("div", { className:
|
|
1367
|
-
/* @__PURE__ */ s("div", { className:
|
|
1447
|
+
/* @__PURE__ */ s("div", { className: $.sectionCard, children: [
|
|
1448
|
+
/* @__PURE__ */ s("div", { className: $.sectionHead, children: [
|
|
1368
1449
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "AK 用量" }),
|
|
1369
|
-
h > 0 && /* @__PURE__ */ s("span", { className:
|
|
1450
|
+
h > 0 && /* @__PURE__ */ s("span", { className: $.sectionHint, children: [
|
|
1370
1451
|
"合计额度 ",
|
|
1371
1452
|
te(h),
|
|
1372
1453
|
" tokens"
|
|
1373
1454
|
] })
|
|
1374
1455
|
] }),
|
|
1375
|
-
m.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: "网关下暂无 AK" }) : /* @__PURE__ */ e("div", { className:
|
|
1376
|
-
const
|
|
1456
|
+
m.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: "网关下暂无 AK" }) : /* @__PURE__ */ e("div", { className: $.akList, children: m.map((l) => {
|
|
1457
|
+
const b = l.key.totalTokens ?? 0, P = l.key.tokenQuota || 0, o = P > 0 ? Math.min(b / P * 100, 100) : 0;
|
|
1377
1458
|
return /* @__PURE__ */ s(
|
|
1378
1459
|
"div",
|
|
1379
1460
|
{
|
|
1380
1461
|
className: t.akCard,
|
|
1381
|
-
onClick: () =>
|
|
1462
|
+
onClick: () => B(l),
|
|
1382
1463
|
children: [
|
|
1383
1464
|
/* @__PURE__ */ s("div", { className: t.akCardRow, children: [
|
|
1384
|
-
/* @__PURE__ */ e("span", { className: t.akTitle, children:
|
|
1385
|
-
/* @__PURE__ */ e("span", { className: t.akPrefixSmall, children:
|
|
1465
|
+
/* @__PURE__ */ e("span", { className: t.akTitle, children: l.key.description || l.key.userName || `AK #${l.key.id}` }),
|
|
1466
|
+
/* @__PURE__ */ e("span", { className: t.akPrefixSmall, children: l.key.akPrefix }),
|
|
1386
1467
|
/* @__PURE__ */ e(
|
|
1387
1468
|
"span",
|
|
1388
1469
|
{
|
|
1389
|
-
className: `${t.akStatus} ${
|
|
1390
|
-
children:
|
|
1470
|
+
className: `${t.akStatus} ${l.key.active ? t.akStatusActive : t.akStatusRevoked}`,
|
|
1471
|
+
children: l.key.active ? "启用" : "吊销"
|
|
1391
1472
|
}
|
|
1392
1473
|
),
|
|
1393
|
-
/* @__PURE__ */ e("span", { className: t.akMetaText, children:
|
|
1474
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: l.key.userId === "system-default" ? "系统对话" : l.key.userId })
|
|
1394
1475
|
] }),
|
|
1395
1476
|
/* @__PURE__ */ s("div", { className: t.akCardRow2, children: [
|
|
1396
1477
|
/* @__PURE__ */ e("div", { className: t.akMiniBar, children: /* @__PURE__ */ e(
|
|
1397
1478
|
"div",
|
|
1398
1479
|
{
|
|
1399
1480
|
className: t.akMiniBarFill,
|
|
1400
|
-
style: { width: `${
|
|
1481
|
+
style: { width: `${o}%` }
|
|
1401
1482
|
}
|
|
1402
1483
|
) }),
|
|
1403
1484
|
/* @__PURE__ */ s("span", { className: t.akUsageText, children: [
|
|
1404
|
-
te(
|
|
1405
|
-
|
|
1485
|
+
te(b),
|
|
1486
|
+
P > 0 ? ` / ${te(P)}` : "",
|
|
1406
1487
|
" tokens"
|
|
1407
1488
|
] }),
|
|
1408
|
-
/* @__PURE__ */ e("span", { className: t.akMetaText, children:
|
|
1489
|
+
/* @__PURE__ */ e("span", { className: t.akMetaText, children: l.statsError ? l.statsError : l.key.lastUsedAt ? `最近使用 ${l.key.lastUsedAt}` : "尚未使用" })
|
|
1409
1490
|
] })
|
|
1410
1491
|
]
|
|
1411
1492
|
},
|
|
1412
|
-
|
|
1493
|
+
l.key.id
|
|
1413
1494
|
);
|
|
1414
1495
|
}) })
|
|
1415
1496
|
] }),
|
|
1416
|
-
/* @__PURE__ */ s("div", { className:
|
|
1497
|
+
/* @__PURE__ */ s("div", { className: $.sectionCard, children: [
|
|
1417
1498
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "模型用量分布(网关全局)" }),
|
|
1418
|
-
/* @__PURE__ */ e(
|
|
1499
|
+
/* @__PURE__ */ e(Ce, { models: T.models })
|
|
1419
1500
|
] })
|
|
1420
1501
|
] });
|
|
1421
|
-
return /* @__PURE__ */ s("div", { className:
|
|
1502
|
+
return /* @__PURE__ */ s("div", { className: $.container, children: [
|
|
1422
1503
|
/* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
|
|
1423
1504
|
/* @__PURE__ */ e("h2", { className: t.modelMgmtTitle, children: "模型监控" }),
|
|
1424
1505
|
/* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "大模型网关管控视图 — 网关全局聚合调用量、Tokens 与延迟(近 7 天)" })
|
|
1425
1506
|
] }),
|
|
1426
1507
|
/* @__PURE__ */ e(
|
|
1427
|
-
|
|
1508
|
+
Te,
|
|
1428
1509
|
{
|
|
1429
1510
|
defaultActiveKey: "usage",
|
|
1430
1511
|
items: [
|
|
@@ -1432,65 +1513,65 @@ function Mt() {
|
|
|
1432
1513
|
{
|
|
1433
1514
|
key: "sessions",
|
|
1434
1515
|
label: "会话统计",
|
|
1435
|
-
children: /* @__PURE__ */ e(
|
|
1516
|
+
children: /* @__PURE__ */ e(We, { fallback: /* @__PURE__ */ e(Y, { tip: "加载会话统计..." }), children: /* @__PURE__ */ e(Va, {}) })
|
|
1436
1517
|
}
|
|
1437
1518
|
]
|
|
1438
1519
|
}
|
|
1439
1520
|
),
|
|
1440
1521
|
/* @__PURE__ */ e(
|
|
1441
|
-
|
|
1522
|
+
we,
|
|
1442
1523
|
{
|
|
1443
|
-
title:
|
|
1524
|
+
title: p ? `AK 用量 — ${p.key.description || p.key.akPrefix}` : "",
|
|
1444
1525
|
width: 860,
|
|
1445
|
-
open: !!
|
|
1446
|
-
onClose: () =>
|
|
1526
|
+
open: !!p,
|
|
1527
|
+
onClose: () => B(null),
|
|
1447
1528
|
destroyOnHidden: !0,
|
|
1448
|
-
children:
|
|
1529
|
+
children: p && /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
|
|
1449
1530
|
/* @__PURE__ */ e("div", { style: { fontSize: 12, color: "#8c8c8c", marginBottom: 12 }, children: "调用监控是网关全局维度(不按 AK 留存),以下统计覆盖全部 AK; 该 AK 自身的累计消耗见「本 AK 累计 Token」。" }),
|
|
1450
1531
|
/* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
|
|
1451
|
-
/* @__PURE__ */ e(
|
|
1452
|
-
/* @__PURE__ */ e(
|
|
1453
|
-
/* @__PURE__ */ e(
|
|
1454
|
-
/* @__PURE__ */ e(
|
|
1455
|
-
/* @__PURE__ */ e(
|
|
1532
|
+
/* @__PURE__ */ e(E, { title: "总请求", value: ((k = p.stats) == null ? void 0 : k.totalRequests) ?? 0 }),
|
|
1533
|
+
/* @__PURE__ */ e(E, { title: "总 Tokens", value: ((d = p.stats) == null ? void 0 : d.totalTokens) ?? 0 }),
|
|
1534
|
+
/* @__PURE__ */ e(E, { title: "平均延迟", value: ((A = p.stats) == null ? void 0 : A.avgLatencyMs) ?? 0, suffix: "ms" }),
|
|
1535
|
+
/* @__PURE__ */ e(E, { title: "输入 Tokens", value: ((M = p.stats) == null ? void 0 : M.totalPromptTokens) ?? 0 }),
|
|
1536
|
+
/* @__PURE__ */ e(E, { title: "输出 Tokens", value: ((q = p.stats) == null ? void 0 : q.totalCompletionTokens) ?? 0 }),
|
|
1456
1537
|
/* @__PURE__ */ e(
|
|
1457
|
-
|
|
1538
|
+
E,
|
|
1458
1539
|
{
|
|
1459
1540
|
title: "本 AK 累计 Token",
|
|
1460
|
-
value:
|
|
1541
|
+
value: p.key.totalTokens ?? 0
|
|
1461
1542
|
}
|
|
1462
1543
|
),
|
|
1463
1544
|
/* @__PURE__ */ e(
|
|
1464
|
-
|
|
1545
|
+
E,
|
|
1465
1546
|
{
|
|
1466
1547
|
title: "错误数",
|
|
1467
|
-
value: ((
|
|
1468
|
-
valueStyle: (((H =
|
|
1548
|
+
value: ((W = p.stats) == null ? void 0 : W.errorCount) ?? 0,
|
|
1549
|
+
valueStyle: (((H = p.stats) == null ? void 0 : H.errorCount) ?? 0) > 0 ? { color: "#ff4d4f" } : void 0
|
|
1469
1550
|
}
|
|
1470
1551
|
)
|
|
1471
1552
|
] }),
|
|
1472
1553
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1473
1554
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "每日用量(按最近调用明细聚合)" }),
|
|
1474
|
-
|
|
1555
|
+
p.stats ? /* @__PURE__ */ e(Ya, { daily: p.stats.daily ?? {} }) : /* @__PURE__ */ e("span", { className: t.usageEmpty, children: p.statsError ?? "暂无数据" })
|
|
1475
1556
|
] }),
|
|
1476
1557
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1477
1558
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "模型用量分布(按最近调用明细聚合)" }),
|
|
1478
|
-
|
|
1559
|
+
p.stats ? /* @__PURE__ */ e(Ce, { models: p.stats.models ?? {} }) : /* @__PURE__ */ e("span", { className: t.usageEmpty, children: p.statsError ?? "暂无数据" })
|
|
1479
1560
|
] }),
|
|
1480
1561
|
/* @__PURE__ */ s("div", { className: t.usageSection, children: [
|
|
1481
1562
|
/* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "最近调用" }),
|
|
1482
1563
|
/* @__PURE__ */ e(
|
|
1483
|
-
|
|
1564
|
+
Ae,
|
|
1484
1565
|
{
|
|
1485
1566
|
size: "small",
|
|
1486
|
-
columns:
|
|
1487
|
-
dataSource:
|
|
1567
|
+
columns: Xa,
|
|
1568
|
+
dataSource: Za(p),
|
|
1488
1569
|
rowKey: "id",
|
|
1489
1570
|
pagination: {
|
|
1490
1571
|
pageSize: 8,
|
|
1491
1572
|
showSizeChanger: !0,
|
|
1492
1573
|
pageSizeOptions: ["8", "20", "50", "100"],
|
|
1493
|
-
showTotal: (
|
|
1574
|
+
showTotal: (l) => `共 ${l} 条`
|
|
1494
1575
|
}
|
|
1495
1576
|
}
|
|
1496
1577
|
)
|
|
@@ -1500,49 +1581,49 @@ function Mt() {
|
|
|
1500
1581
|
)
|
|
1501
1582
|
] });
|
|
1502
1583
|
}
|
|
1503
|
-
const
|
|
1584
|
+
const tn = [
|
|
1504
1585
|
{ key: "model-management", label: "模型管理", icon: /* @__PURE__ */ e(Re, {}) },
|
|
1505
|
-
{ key: "model-chat", label: "模型对话", icon: /* @__PURE__ */ e(
|
|
1586
|
+
{ key: "model-chat", label: "模型对话", icon: /* @__PURE__ */ e(De, {}) },
|
|
1506
1587
|
{ key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(He, {}) },
|
|
1507
|
-
{ key: "agent-app", label: "Agent 应用", icon: /* @__PURE__ */ e(
|
|
1508
|
-
{ key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(
|
|
1509
|
-
{ key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(
|
|
1510
|
-
{ key: "model-monitor", label: "模型监控", icon: /* @__PURE__ */ e(
|
|
1588
|
+
{ key: "agent-app", label: "Agent 应用", icon: /* @__PURE__ */ e(ve, {}) },
|
|
1589
|
+
{ key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(Fe, {}) },
|
|
1590
|
+
{ key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(je, {}) },
|
|
1591
|
+
{ key: "model-monitor", label: "模型监控", icon: /* @__PURE__ */ e(qe, {}) }
|
|
1511
1592
|
];
|
|
1512
|
-
function
|
|
1513
|
-
const [a, n] =
|
|
1514
|
-
|
|
1515
|
-
},
|
|
1593
|
+
function cn() {
|
|
1594
|
+
const [a, n] = x("model-management"), [r, i] = x([]), m = (f) => {
|
|
1595
|
+
i(f), n("model-chat");
|
|
1596
|
+
}, y = Be(() => tn, []), C = (f, p, B = !1) => /* @__PURE__ */ e(
|
|
1516
1597
|
"div",
|
|
1517
1598
|
{
|
|
1518
1599
|
style: {
|
|
1519
|
-
display: a ===
|
|
1600
|
+
display: a === f ? B ? "flex" : "block" : "none",
|
|
1520
1601
|
height: "100%",
|
|
1521
|
-
...
|
|
1602
|
+
...B ? { flexDirection: "column" } : {}
|
|
1522
1603
|
},
|
|
1523
|
-
children:
|
|
1604
|
+
children: p
|
|
1524
1605
|
}
|
|
1525
1606
|
);
|
|
1526
1607
|
return /* @__PURE__ */ s("div", { className: t.container, children: [
|
|
1527
|
-
/* @__PURE__ */ e("aside", { className: t.sidebar, children: /* @__PURE__ */ e("nav", { className: t.menuList, children:
|
|
1608
|
+
/* @__PURE__ */ e("aside", { className: t.sidebar, children: /* @__PURE__ */ e("nav", { className: t.menuList, children: y.map((f) => /* @__PURE__ */ e(Q, { title: f.label, placement: "right", children: /* @__PURE__ */ e(
|
|
1528
1609
|
"div",
|
|
1529
1610
|
{
|
|
1530
|
-
className: `${t.menuItem} ${a ===
|
|
1531
|
-
onClick: () => n(
|
|
1532
|
-
children: /* @__PURE__ */ e("span", { className: t.menuIcon, children:
|
|
1611
|
+
className: `${t.menuItem} ${a === f.key ? t.menuItemActive : ""}`,
|
|
1612
|
+
onClick: () => n(f.key),
|
|
1613
|
+
children: /* @__PURE__ */ e("span", { className: t.menuIcon, children: f.icon })
|
|
1533
1614
|
}
|
|
1534
|
-
) },
|
|
1615
|
+
) }, f.key)) }) }),
|
|
1535
1616
|
/* @__PURE__ */ s("main", { className: t.panelArea, children: [
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1617
|
+
C("model-management", /* @__PURE__ */ e(Oa, { onStartChat: m })),
|
|
1618
|
+
C("model-chat", /* @__PURE__ */ e(La, { initialModels: r }), !0),
|
|
1619
|
+
C("ak-management", /* @__PURE__ */ e(Ka, {})),
|
|
1620
|
+
C("agent-app", /* @__PURE__ */ e(Ve, {})),
|
|
1621
|
+
C("mcp-service", /* @__PURE__ */ e(Ye, {})),
|
|
1622
|
+
C("skill-market", /* @__PURE__ */ e(Xe, {})),
|
|
1623
|
+
C("model-monitor", /* @__PURE__ */ e(en, {}))
|
|
1543
1624
|
] })
|
|
1544
1625
|
] });
|
|
1545
1626
|
}
|
|
1546
1627
|
export {
|
|
1547
|
-
|
|
1628
|
+
cn as default
|
|
1548
1629
|
};
|