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