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