@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.
Files changed (56) hide show
  1. package/dist/{AdminModuleContent-9gH_G78B.js → AdminModuleContent-B1IJbLVN.js} +11463 -12034
  2. package/dist/{ChangeLogView-DzFmZVBw.js → ChangeLogView-BVKf3AZn.js} +1 -1
  3. package/dist/{index-BHfNKXIA.js → CollabPersonalHost-BY6RqeQJ.js} +3 -3
  4. package/dist/{ComponentDoc-KyD5wtuW.js → ComponentDoc-BIX-e69A.js} +204 -212
  5. package/dist/{index-DXA0r7Co.js → DevWorkbench-BtiPE_V4.js} +2 -2
  6. package/dist/{InvitationManagementPage-6-0uZNuO.js → InvitationManagementPage-DRC_8AiO.js} +1 -1
  7. package/dist/{index-C9NwYJh-.js → KnowledgeGraphTab-BfhDEyvW.js} +1 -1
  8. package/dist/{index-DC1fQH0J.js → Market-C2vkBzDr.js} +2 -2
  9. package/dist/{OnboardingPage-tLarxnp5.js → OnboardingPage-B4GQTFCS.js} +2 -2
  10. package/dist/{index-DZcMGMHV.js → OpsWorkbench-D8RF2p4X.js} +292 -292
  11. package/dist/{index-Cwptuq_d.js → ProductWorkspace-PSO7Q9m-.js} +7 -7
  12. package/dist/{ScheduledTasks-QGmD7Uhz.js → ScheduledTasks-CoaHVU6e.js} +3104 -3141
  13. package/dist/{index-CNmSLd0s.js → SmartWorkbench-BkdfSgqx.js} +611 -638
  14. package/dist/{SystemShell-CWawiWOn.js → SystemShell-CANwRSyW.js} +149 -148
  15. package/dist/SystemWorkbench.module-DpLM0zgA.js +36 -0
  16. package/dist/{index-BgdqkNkT.js → TrainingAdminShell-CgnQM4Nb.js} +3 -3
  17. package/dist/{index-BdEokzAv.js → WorkBuddyShell-DCrPpMd5.js} +6 -6
  18. package/dist/{admin-logs-DXjxD-y2.js → admin-logs-DK00NEUv.js} +1 -1
  19. package/dist/{index-4icVyiM3.js → admin-ryysUJ9z.js} +6 -6
  20. package/dist/{api-DOjASQ0k.js → api-C_9xZbZr.js} +1 -1
  21. package/dist/{api-Dzr8HLsU.js → api-DBemNteG.js} +1 -1
  22. package/dist/{index-0AjMJyFL.js → build-by-form-CXxXrXvw.js} +5 -5
  23. package/dist/{index-DarTFF-M.js → change-log-CcmXtywx.js} +1 -1
  24. package/dist/{index-4NOi2xz4.js → chat-DKwMolQV.js} +2 -2
  25. package/dist/{index-8VddM67M.js → common-Bcnlb4nY.js} +2 -2
  26. package/dist/{createWorkspaceWsHandler-DCokPv4M.js → createWorkspaceWsHandler-6xyLJ14H.js} +3417 -3479
  27. package/dist/{index-CjYmL2yJ.js → docs-A-g6sqaE.js} +2 -2
  28. package/dist/{index-CUOByyqy.js → from-scenario-D8CIJLDn.js} +5 -5
  29. package/dist/{index-Crzx3zh2.js → from-ticket-D0oQPEf1.js} +2 -2
  30. package/dist/{index-DGdtqBi4.js → index-BGAG77Nt.js} +4 -4
  31. package/dist/index-BM6KEb8k.js +576 -0
  32. package/dist/{index-B75TTql4.js → index-BgCxUeRF.js} +2 -2
  33. package/dist/{index-ZqDoLUxb.js → index-BlfOXOZM.js} +1 -1
  34. package/dist/index-Bs_WMKyt.js +9527 -0
  35. package/dist/{index-nj-cjKsf.js → index-Dlf6mERD.js} +1950 -1910
  36. package/dist/index.js +1 -1
  37. package/dist/{instance-CDA6R8yG.js → instance-B9ZKD5cL.js} +1 -1
  38. package/dist/{menuPermission-LCjN8Osm.js → menuPermission-C4EVCwjs.js} +3 -3
  39. package/dist/{menuTree-Ctcz41N8.js → menuTree-BjchjhUw.js} +25 -23
  40. package/dist/pages.js +1 -1
  41. package/dist/{index-CLP0LnEz.js → phone-BU4g7eHI.js} +5 -5
  42. package/dist/portal-QNpTaU--.js +237 -0
  43. package/dist/{index-VqKcDrn3.js → scenario-DOpFkfNV.js} +2 -2
  44. package/dist/{send-default-agent-team-message-3Uyy88s_.js → send-default-agent-team-message-1L9Jv1eJ.js} +1 -1
  45. package/dist/{sso-user-DX2FYQCh.js → sso-user-Co71Xi9I.js} +1 -1
  46. package/dist/{training-BgYM7EV-.js → training-BqYfINRR.js} +1 -1
  47. package/dist/{webide-BsF30aLX.js → webide-AknolY0B.js} +213 -213
  48. package/dist/{index-PJZV-bFc.js → welcome-BBLRGBWu.js} +1 -1
  49. package/dist/z-team-component.css +1 -1
  50. package/package.json +12 -4
  51. package/dist/SystemWorkbench.module-CZv_ruUa.js +0 -36
  52. package/dist/index-DhDdFRHC.js +0 -279
  53. package/dist/index-DxZEpsT6.js +0 -10339
  54. /package/dist/{index-DrDFy5jN.js → CognitionWorkbench-DrDFy5jN.js} +0 -0
  55. /package/dist/{index-C815hPWS.js → chatdemo-C815hPWS.js} +0 -0
  56. /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 Te, PlusOutlined as Ke, StopOutlined as Ye, DeleteOutlined as Xe, ClearOutlined as Ze, CloseOutlined as et, SendOutlined as tt, RobotOutlined as he, DownOutlined as at, RightOutlined as nt, CloudServerOutlined as be, MessageOutlined as st, BarChartOutlined as ot, KeyOutlined as Me, NodeIndexOutlined as rt, ApiOutlined as lt, ToolOutlined as ct } from "@ant-design/icons";
3
- import { useState as N, useEffect as V, useCallback as G, useRef as ye, useMemo as Ee, Suspense as it, lazy as dt } from "react";
4
- import { Table as ce, Tooltip as oe, Tabs as $e, Input as Ne, Button as z, Modal as fe, Drawer as Oe, Spin as se, Statistic as P, message as q, Tag as Z, Select as mt, Checkbox as ut } from "antd";
5
- import { u as Le } from "./ComponentDoc-KyD5wtuW.js";
6
- import { s as U } from "./SystemWorkbench.module-CZv_ruUa.js";
7
- import { AgentAppList as ht, AgentInstanceManager as pt, McpPage as kt, SkillMarket as gt } from "@yuku123/z-agent-component";
8
- const ue = "ft_gateway_default_ak", Ue = "system-default", ee = "", Ce = "";
9
- function te(a = {}) {
10
- const n = { Accept: "application/json", ...a };
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 yt(a) {
19
+ function _t(t) {
19
20
  return {
20
- modelName: String(a.modelName ?? a.model_name ?? a.service ?? ""),
21
- service: String(a.service ?? a.modelName ?? ""),
22
- endpoint: String(a.endpoint ?? ""),
23
- modelProvider: a.modelProvider ?? a.model_provider ?? null,
24
- apiType: String(a.apiType ?? a.api_type ?? "OpenAPI")
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 we() {
28
- let a;
28
+ async function Te() {
29
+ let t;
29
30
  try {
30
- a = await fetch(`${ee}/api/scenario-instances/0/models`, {
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 (!a.ok)
41
- throw new Error(`模型列表获取失败(HTTP ${a.status})`);
41
+ if (!t.ok)
42
+ throw new Error(`模型列表获取失败(HTTP ${t.status})`);
42
43
  let n;
43
44
  try {
44
- n = await a.json();
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(yt);
52
+ return o.map(_t);
52
53
  }
53
- async function ft(a, n, o, i) {
54
- var A, C, g;
55
- const c = await fetch(`${Ce}/v1/chat/completions`, {
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 ${a}`,
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 = ((A = p == null ? void 0 : p.error) == null ? void 0 : A.message) ?? 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 T = c.body.getReader(), B = new TextDecoder();
83
- let S = "", f;
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 T.read();
87
+ const { done: m, value: k } = await w.read();
87
88
  if (m) break;
88
- S += B.decode(k, { stream: !0 });
89
- const p = S.split(`
89
+ A += B.decode(k, { stream: !0 });
90
+ const p = A.split(`
90
91
 
91
92
  `);
92
- S = p.pop() ?? "";
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(_), b = h == null ? void 0 : h.choices;
107
+ const h = JSON.parse(_), P = h == null ? void 0 : h.choices;
107
108
  if (h != null && h.usage) {
108
- const E = {
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 || E.totalTokens > 0) && (f = E);
114
+ (!f || M.totalTokens > 0) && (f = M);
114
115
  }
115
- if (Array.isArray(b) && b.length > 0) {
116
- const E = (C = b[0]) == null ? void 0 : C.delta;
117
- E != null && E.content && i.onDelta(E.content);
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(a, n) {
133
- const o = await a.text();
134
- if (!a.ok)
135
- throw new Error(`${n}失败 HTTP ${a.status}${o ? `: ${o.slice(0, 120)}` : ""}`);
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 _t(a) {
145
- const n = a.status === 1;
145
+ function Nt(t) {
146
+ const n = t.status === 1;
146
147
  return {
147
- id: Number(a.id),
148
- akPrefix: a.access_key ?? "",
149
- userId: a.owner_user_id ?? "",
150
- userName: a.owner_user_name ?? "",
151
- description: a.description || a.ak_name || "",
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: a.is_deleted ?? 0,
155
+ isDeleted: t.is_deleted ?? 0,
155
156
  totalRequests: 0,
156
- totalTokens: Number(a.total_tokens ?? 0),
157
+ totalTokens: Number(t.total_tokens ?? 0),
157
158
  tokenQuota: 0,
158
159
  rateLimitRpm: 0,
159
160
  defaultModel: null,
160
- lastUsedAt: a.last_used_time ?? null,
161
- createTime: (a.created_time ?? "").replace("T", " ").slice(0, 19),
162
- updateTime: (a.updated_time ?? "").replace("T", " ").slice(0, 19),
163
- secret: a.secret_key
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(a, n, o) {
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 || a}`,
173
+ akName: o || `AK-${n || t}`,
173
174
  description: o,
174
175
  akType: "PERSONAL",
175
- ownerUserId: a,
176
+ ownerUserId: t,
176
177
  ownerUserName: n
177
178
  })
178
- }), c = await re(i, "创建 AK"), T = (c == null ? void 0 : c.data) ?? {}, B = T.accessKey ?? "", S = T.secretKey ?? "";
179
- return B && S && Ae(B, S), { apiKey: S, akPrefix: B, message: "AK 已创建,secretKey 仅创建时可见" };
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 pe(a) {
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 (a ? i.filter((T) => (T.owner_user_id == null || T.owner_user_id === "" ? Ue : String(T.owner_user_id)) === String(a)) : i).filter((T) => (T.is_deleted ?? 0) === 0).map(_t);
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 Nt(a) {
189
- const n = await fetch(`${ee}/api/ak/delete?id=${encodeURIComponent(String(a))}`, {
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 Ct(a, n) {
197
+ async function wt(t, n) {
197
198
  const o = await fetch(
198
- `${ee}/api/ak/toggle?id=${encodeURIComponent(String(a))}&status=${n ? 1 : 0}`,
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(a) {
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 T = [];
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
- T = (Array.isArray((m = d == null ? void 0 : d.data) == null ? void 0 : m.records) ? d.data.records : []).map((h, b) => {
220
- const E = Number(h.promptTokens ?? 0), F = Number(h.completionTokens ?? 0);
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 ?? b),
223
- apiKeyId: a,
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: E,
228
- completionTokens: F,
229
- totalTokens: Number(h.totalTokens ?? E + F),
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 = {}, S = {};
239
- for (const p of T) {
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 = S[_] || (S[_] = [0, 0, 0]);
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), A = T.reduce((p, d) => p + d.totalTokens, 0), C = T.reduce((p, d) => p + d.promptTokens, 0), g = T.reduce((p, d) => p + d.completionTokens, 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) || C,
254
+ totalPromptTokens: Number(c.totalPromptTokens ?? 0) || N,
254
255
  totalCompletionTokens: Number(c.totalCompletionTokens ?? 0) || g,
255
- totalTokens: f || A,
256
+ totalTokens: f || S,
256
257
  avgLatencyMs: Number(c.avgDurationMs ?? 0),
257
258
  errorCount: Number(c.failCount ?? 0),
258
- daily: S,
259
+ daily: A,
259
260
  models: B,
260
- recent: T
261
+ recent: w
261
262
  };
262
263
  }
263
- function vt() {
264
- return typeof window < "u" ? `${window.location.origin}${Ce}` : Ce;
264
+ function Tt() {
265
+ return typeof window < "u" ? `${window.location.origin}${Ne}` : Ne;
265
266
  }
266
- async function Se(a) {
267
- const n = await fetch(`${ee}${a}`, {
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 Tt() {
281
+ async function St() {
281
282
  return Se("/z-llm/admin/health");
282
283
  }
283
- async function He() {
284
- const a = await Se("/z-llm/admin/usage");
285
- return (Array.isArray(a == null ? void 0 : a.byTenant) ? a.byTenant : []).map((o) => ({
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(a, n) {
295
+ function Ae(t, n) {
295
296
  try {
296
297
  const o = JSON.parse(localStorage.getItem(ve) || "{}");
297
- o[a] = n, localStorage.setItem(ve, JSON.stringify(o));
298
+ o[t] = n, localStorage.setItem(ve, JSON.stringify(o));
298
299
  } catch {
299
300
  }
300
301
  }
301
- function wt(a) {
302
+ function At(t) {
302
303
  try {
303
- return JSON.parse(localStorage.getItem(ve) || "{}")[a] || null;
304
+ return JSON.parse(localStorage.getItem(ve) || "{}")[t] || null;
304
305
  } catch {
305
306
  return null;
306
307
  }
307
308
  }
308
- async function St() {
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 pe("").catch(() => [])).find((i) => i.active && i.secret);
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 Ge() {
336
+ function He() {
336
337
  try {
337
338
  localStorage.removeItem(ue);
338
339
  } catch {
339
340
  }
340
341
  }
341
- const At = "_container_1ctyd_7", xt = "_panelArea_1ctyd_16", Bt = "_modelMgmtHeader_1ctyd_28", It = "_modelMgmtTitle_1ctyd_32", bt = "_modelMgmtSubtitle_1ctyd_39", Mt = "_modelGrid_1ctyd_45", Pt = "_modelCard_1ctyd_51", Kt = "_modelCardSelected_1ctyd_80", Et = "_modelCardHeader_1ctyd_85", $t = "_modelIconWrap_1ctyd_92", Ot = "_modelCardInfo_1ctyd_105", Lt = "_modelName_1ctyd_110", Ut = "_modelTags_1ctyd_119", zt = "_modelEndpoint_1ctyd_135", Rt = "_modelCardFooter_1ctyd_144", Dt = "_modelCheckbox_1ctyd_152", Ht = "_modelActionBar_1ctyd_159", Gt = "_modelSelectionCount_1ctyd_173", jt = "_chatContainer_1ctyd_182", qt = "_chatHeader_1ctyd_189", Ft = "_chatTitle_1ctyd_197", Jt = "_chatPanels_1ctyd_204", Wt = "_chatPanel_1ctyd_204", Qt = "_chatPanelHeader_1ctyd_231", Vt = "_chatPanelClose_1ctyd_241", Yt = "_chatPanelBody_1ctyd_253", Xt = "_chatMsgUser_1ctyd_262", Zt = "_chatMsgAI_1ctyd_274", ea = "_chatMsgError_1ctyd_287", ta = "_chatStreamingCursor_1ctyd_297", aa = "_chatUsageBar_1ctyd_316", na = "_chatThinkBlock_1ctyd_326", sa = "_chatInputBar_1ctyd_375", oa = "_chatInput_1ctyd_375", ra = "_addPanelBtn_1ctyd_388", la = "_akContainer_1ctyd_417", ca = "_akIntegrationPanel_1ctyd_423", ia = "_akIntegrationTitle_1ctyd_430", da = "_akIntegrationGrid_1ctyd_437", ma = "_akCodeBlock_1ctyd_443", ua = "_akCodeLabel_1ctyd_455", ha = "_akCard_1ctyd_462", pa = "_akCardRow_1ctyd_480", ka = "_akTitle_1ctyd_487", ga = "_akPrefixSmall_1ctyd_497", ya = "_akStatus_1ctyd_503", fa = "_akStatusActive_1ctyd_509", _a = "_akStatusRevoked_1ctyd_515", Na = "_akCardActions_1ctyd_521", Ca = "_akCardRow2_1ctyd_528", va = "_akMiniBar_1ctyd_534", Ta = "_akMiniBarFill_1ctyd_543", wa = "_akUsageText_1ctyd_550", Sa = "_akMetaText_1ctyd_557", Aa = "_akEmpty_1ctyd_563", xa = "_akBaseUrlRow_1ctyd_571", Ba = "_akBaseUrlItem_1ctyd_577", Ia = "_akBaseUrlLabel_1ctyd_587", ba = "_akBaseUrlValue_1ctyd_593", Ma = "_akCopyIcon_1ctyd_603", Pa = "_usageDrawerContent_1ctyd_617", Ka = "_usageStatsGrid_1ctyd_623", Ea = "_usageSection_1ctyd_629", $a = "_usageSectionTitle_1ctyd_633", Oa = "_usageBarChart_1ctyd_643", La = "_usageBarCol_1ctyd_652", Ua = "_usageBar_1ctyd_643", za = "_usageBarLabel_1ctyd_675", Ra = "_modelBreakdown_1ctyd_683", Da = "_modelBreakdownRow_1ctyd_689", Ha = "_modelBreakdownName_1ctyd_695", Ga = "_modelBreakdownBar_1ctyd_705", ja = "_modelBreakdownFill_1ctyd_713", qa = "_modelBreakdownCount_1ctyd_720", Fa = "_usageEmpty_1ctyd_727", t = {
342
- container: At,
343
- panelArea: xt,
344
- modelMgmtHeader: Bt,
345
- modelMgmtTitle: It,
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: $t,
352
- modelCardInfo: Ot,
353
- modelName: Lt,
349
+ modelIconWrap: Mt,
350
+ modelCardInfo: $t,
351
+ modelName: Ot,
354
352
  modelTags: Ut,
355
- modelEndpoint: zt,
356
- modelCardFooter: Rt,
357
- modelCheckbox: Dt,
358
- modelActionBar: Ht,
353
+ modelEndpoint: Lt,
354
+ modelCardFooter: zt,
355
+ modelCheckbox: Rt,
356
+ modelActionBar: Dt,
359
357
  modelSelectionCount: Gt,
360
- chatContainer: jt,
361
- chatHeader: qt,
362
- chatTitle: Ft,
363
- chatPanels: Jt,
364
- chatPanel: Wt,
365
- chatPanelHeader: Qt,
366
- chatPanelClose: Vt,
367
- chatPanelBody: Yt,
368
- chatMsgUser: Xt,
369
- chatMsgAI: Zt,
370
- chatMsgError: ea,
371
- chatStreamingCursor: ta,
372
- chatUsageBar: aa,
373
- chatThinkBlock: na,
374
- chatInputBar: sa,
375
- chatInput: oa,
376
- addPanelBtn: ra,
377
- akContainer: la,
378
- akIntegrationPanel: ca,
379
- akIntegrationTitle: ia,
380
- akIntegrationGrid: da,
381
- akCodeBlock: ma,
382
- akCodeLabel: ua,
383
- akCard: ha,
384
- akCardRow: pa,
385
- akTitle: ka,
386
- akPrefixSmall: ga,
387
- akStatus: ya,
388
- akStatusActive: fa,
389
- akStatusRevoked: _a,
390
- akCardActions: Na,
391
- akCardRow2: Ca,
392
- akMiniBar: va,
393
- akMiniBarFill: Ta,
394
- akUsageText: wa,
395
- akMetaText: Sa,
396
- akEmpty: Aa,
397
- akBaseUrlRow: xa,
398
- akBaseUrlItem: Ba,
399
- akBaseUrlLabel: Ia,
400
- akBaseUrlValue: ba,
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: Ka,
404
- usageSection: Ea,
405
- usageSectionTitle: $a,
406
- usageBarChart: Oa,
407
- usageBarCol: La,
408
- usageBar: Ua,
409
- usageBarLabel: za,
410
- modelBreakdown: Ra,
411
- modelBreakdownRow: Da,
412
- modelBreakdownName: Ha,
413
- modelBreakdownBar: Ga,
414
- modelBreakdownFill: ja,
415
- modelBreakdownCount: qa,
416
- usageEmpty: Fa
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(a) {
419
- return a >= 1e6 ? `${(a / 1e6).toFixed(1)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : `${a}`;
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 Ja(a, n) {
418
+ function Fa(t, n) {
422
419
  return `# OpenAI 兼容
423
- curl -X POST ${a}/v1/chat/completions \\
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 Wa(a, n) {
429
+ function qa(t, n) {
433
430
  return `# Anthropic 兼容
434
- curl -X POST ${a}/v1/messages \\
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 Qa() {
443
- const [a, n] = N("personal"), [o, i] = N([]), [c, T] = N([]), [B, S] = N(!0), [f, A] = N(!1), [C, g] = N(!1), [m, k] = N(""), [p, d] = N({ open: !1 }), [_, h] = N(null), [b, E] = N(null), [F, ae] = N(!1), [Y, u] = N(null), [$, R] = N([]), [r, y] = N(""), x = Le((l) => l.currentUser), M = String((x == null ? void 0 : x.id) ?? ""), O = (x == null ? void 0 : x.username) ?? "", [K, J] = N(""), X = vt(), [D, j] = N("<model-name>");
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 we().then((v) => {
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(), He()]).then(([v, Q]) => {
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 = G(async () => {
463
- S(!0);
459
+ const W = H(async () => {
460
+ A(!0);
464
461
  try {
465
- const l = M ? await pe(M).catch(() => []) : [], [v] = await Promise.all([
466
- pe("system-default").catch(() => [])
462
+ const l = b ? await he(b).catch(() => []) : [], [v] = await Promise.all([
463
+ he("system-default").catch(() => [])
467
464
  ]);
468
- i(v), T(l);
465
+ i(v), w(l);
469
466
  } finally {
470
- S(!1);
467
+ A(!1);
471
468
  }
472
- }, [M]);
469
+ }, [b]);
473
470
  V(() => {
474
471
  W();
475
472
  }, [W]);
476
- const ke = () => {
473
+ const pe = () => {
477
474
  k(""), g(!0);
478
475
  }, xe = async () => {
479
476
  if (!m.trim()) {
480
- q.warning("请输入 AK 名称");
477
+ F.warning("请输入 AK 名称");
481
478
  return;
482
479
  }
483
- if (!M) {
484
- q.warning("登录态不可用,无法生成 AK");
480
+ if (!b) {
481
+ F.warning("登录态不可用,无法生成 AK");
485
482
  return;
486
483
  }
487
- A(!0);
484
+ S(!0);
488
485
  try {
489
- const l = await ze(M, O, m.trim());
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
- q.error(l instanceof Error ? l.message : "创建 AK 失败");
493
+ F.error(l instanceof Error ? l.message : "创建 AK 失败");
497
494
  } finally {
498
- A(!1);
495
+ S(!1);
499
496
  }
500
497
  }, je = (l) => {
501
- fe.confirm({
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 Nt(l), q.success("AK 已吊销"), W(), Ge();
506
+ await vt(l), F.success("AK 已吊销"), W(), He();
510
507
  } catch (v) {
511
- q.error(v instanceof Error ? v.message : "吊销失败");
508
+ F.error(v instanceof Error ? v.message : "吊销失败");
512
509
  }
513
510
  }
514
511
  });
515
512
  }, Be = async (l) => {
516
513
  try {
517
- await Ct(l.id, !l.active), q.success(l.active ? "AK 已停用" : "AK 已启用"), W();
514
+ await wt(l.id, !l.active), F.success(l.active ? "AK 已停用" : "AK 已启用"), W();
518
515
  } catch (v) {
519
- q.error(v instanceof Error ? v.message : "操作失败");
516
+ F.error(v instanceof Error ? v.message : "操作失败");
520
517
  }
521
518
  }, le = (l) => {
522
- navigator.clipboard.writeText(l).then(() => q.success("已复制到剪贴板")).catch(() => q.warning("复制失败,请手动复制"));
523
- }, qe = (l) => {
524
- const v = wt(l.akPrefix);
525
- v ? le(v) : (le(l.akPrefix), q.info("完整 AK 未在本地缓存(可能在本设备外创建),已复制前缀"));
526
- }, Fe = async (l) => {
527
- h(l), ae(!0), E(null);
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
- E(v);
527
+ M(v);
531
528
  } catch (v) {
532
- q.error(v instanceof Error ? v.message : "获取用量失败");
529
+ F.error(v instanceof Error ? v.message : "获取用量失败");
533
530
  } finally {
534
531
  ae(!1);
535
532
  }
536
533
  }, Je = () => {
537
- h(null), E(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: t.usageEmpty, children: "暂无数据" });
542
- const Q = Math.max(...v.map(([, L]) => L[1] + L[2]), 1);
543
- return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: v.map(([L, H]) => {
544
- const w = H[1] + H[2], ge = w / Q * 100;
545
- return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
546
- /* @__PURE__ */ e(oe, { title: `${L}: ${H[0]}次 / ${w} tokens`, children: /* @__PURE__ */ e(
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: t.usageBar,
550
- style: { height: `${Math.max(ge, 2)}%` }
546
+ className: a.usageBar,
547
+ style: { height: `${Math.max(ke, 2)}%` }
551
548
  }
552
549
  ) }),
553
- /* @__PURE__ */ e("span", { className: t.usageBarLabel, children: L })
554
- ] }, L);
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: t.usageEmpty, children: "暂无数据" });
560
- const Q = Math.max(...v.map(([, L]) => L[0]), 1);
561
- return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: v.sort((L, H) => H[1][0] - L[1][0]).map(([L, H]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
562
- /* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: L }),
563
- /* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
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: t.modelBreakdownFill,
567
- style: { width: `${H[0] / Q * 100}%` }
563
+ className: a.modelBreakdownFill,
564
+ style: { width: `${G[0] / Q * 100}%` }
568
565
  }
569
566
  ) }),
570
- /* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
571
- H[0],
567
+ /* @__PURE__ */ s("span", { className: a.modelBreakdownCount, children: [
568
+ G[0],
572
569
  "次 / ",
573
- H[1] + (H[2] || 0),
570
+ G[1] + (G[2] || 0),
574
571
  "tokens"
575
572
  ] })
576
- ] }, L)) });
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 : [], L = K.trim().toLowerCase(), H = L ? Q.filter(
627
- (w) => `${w.description || ""} ${w.akPrefix || ""} ${w.defaultModel || ""}`.toLowerCase().includes(L)
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: t.akEmpty, children: v ? "暂无应用 AK" : "暂无个人 AK,点击上方按钮生成" }) : H.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: "无匹配 AK" }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: H.map((w) => /* @__PURE__ */ s(
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: t.akCard,
633
- onClick: () => Fe(w),
629
+ className: a.akCard,
630
+ onClick: () => qe(T),
634
631
  children: [
635
- /* @__PURE__ */ s("div", { className: t.akCardRow, children: [
636
- /* @__PURE__ */ e("span", { className: t.akTitle, children: w.description || w.akPrefix.replace("...", "**") }),
637
- /* @__PURE__ */ e("code", { className: t.akPrefixSmall, children: w.akPrefix.replace("...", "**") }),
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: `${t.akStatus} ${w.active ? t.akStatusActive : t.akStatusRevoked}`,
642
- children: w.active ? "活跃" : "已吊销"
638
+ className: `${a.akStatus} ${T.active ? a.akStatusActive : a.akStatusRevoked}`,
639
+ children: T.active ? "活跃" : "已吊销"
643
640
  }
644
641
  ),
645
- w.defaultModel && /* @__PURE__ */ s(Z, { style: { fontSize: 11 }, children: [
642
+ T.defaultModel && /* @__PURE__ */ s(Z, { style: { fontSize: 11 }, children: [
646
643
  "默认: ",
647
- w.defaultModel
644
+ T.defaultModel
648
645
  ] }),
649
646
  /* @__PURE__ */ s(
650
647
  "div",
651
648
  {
652
- className: t.akCardActions,
653
- onClick: (ge) => ge.stopPropagation(),
649
+ className: a.akCardActions,
650
+ onClick: (ke) => ke.stopPropagation(),
654
651
  children: [
655
652
  /* @__PURE__ */ e(oe, { title: "复制完整 AK", children: /* @__PURE__ */ e(
656
- z,
653
+ L,
657
654
  {
658
655
  size: "small",
659
656
  icon: /* @__PURE__ */ e(ie, {}),
660
- onClick: () => qe(w),
657
+ onClick: () => Fe(T),
661
658
  children: "复制"
662
659
  }
663
660
  ) }),
664
- !v && w.active && /* @__PURE__ */ e(
665
- z,
661
+ !v && T.active && /* @__PURE__ */ e(
662
+ L,
666
663
  {
667
664
  size: "small",
668
665
  icon: /* @__PURE__ */ e(Ye, {}),
669
- onClick: () => void Be(w),
666
+ onClick: () => void Be(T),
670
667
  children: "停用"
671
668
  }
672
669
  ),
673
- !v && !w.active && /* @__PURE__ */ e(
674
- z,
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(w),
676
+ onClick: () => void Be(T),
680
677
  children: "启用"
681
678
  }
682
679
  ),
683
- !v && w.active && /* @__PURE__ */ e(
684
- z,
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(w.id),
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: t.akCardRow2, children: [
698
- w.tokenQuota > 0 && /* @__PURE__ */ e("div", { className: t.akMiniBar, children: /* @__PURE__ */ e(
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: t.akMiniBarFill,
698
+ className: a.akMiniBarFill,
702
699
  style: {
703
700
  width: `${Math.min(
704
- (w.totalTokens || 0) / w.tokenQuota * 100,
701
+ (T.totalTokens || 0) / T.tokenQuota * 100,
705
702
  100
706
703
  )}%`
707
704
  }
708
705
  }
709
706
  ) }),
710
- /* @__PURE__ */ s("span", { className: t.akUsageText, children: [
711
- de(w.totalTokens || 0),
712
- w.tokenQuota > 0 ? ` / ${de(w.tokenQuota)}` : " tokens"
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: t.akMetaText, children: w.lastUsedAt ? `最近使用 ${w.lastUsedAt}` : "尚未使用" }),
715
- /* @__PURE__ */ e("span", { className: t.akMetaText, children: new Date(w.createTime).toLocaleDateString("zh-CN") })
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
- w.id
716
+ T.id
720
717
  )) });
721
718
  };
722
- return /* @__PURE__ */ s("div", { className: t.akContainer, children: [
723
- (Y || $.length > 0 || r) && /* @__PURE__ */ s("div", { className: t.akIntegrationPanel, children: [
724
- /* @__PURE__ */ s("h4", { className: t.akIntegrationTitle, children: [
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: t.akIntegrationPanel, children: [
764
- /* @__PURE__ */ e("h4", { className: t.akIntegrationTitle, children: "协议接入地址" }),
765
- /* @__PURE__ */ s("div", { className: t.akBaseUrlRow, children: [
766
- /* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
767
- /* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "OpenAI 兼容" }),
768
- /* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: X }),
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: t.akCopyIcon,
769
+ className: a.akCopyIcon,
773
770
  onClick: () => le(X)
774
771
  }
775
772
  ) })
776
773
  ] }),
777
- /* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
778
- /* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "Anthropic 兼容" }),
779
- /* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: X }),
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: t.akCopyIcon,
780
+ className: a.akCopyIcon,
784
781
  onClick: () => le(X)
785
782
  }
786
783
  ) })
787
784
  ] })
788
785
  ] }),
789
- /* @__PURE__ */ s("div", { className: t.akIntegrationGrid, children: [
786
+ /* @__PURE__ */ s("div", { className: a.akIntegrationGrid, children: [
790
787
  /* @__PURE__ */ s("div", { children: [
791
- /* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "OpenAI 兼容 — curl 示例" }),
792
- /* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: Ja(X, D) })
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: t.akCodeLabel, children: "Anthropic 兼容 — curl 示例" }),
796
- /* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: Wa(X, D) })
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: a,
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
- Ne.Search,
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(z, { icon: /* @__PURE__ */ e(Te, {}), onClick: W, size: "small", children: "刷新" }),
834
- a === "personal" && /* @__PURE__ */ e(
835
- z,
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(Ke, {}),
839
- onClick: ke,
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
- a === "app" ? Ie(o, !0) : Ie(c, !1)
845
+ t === "app" ? Ie(o, !0) : Ie(c, !1)
849
846
  ] }),
850
847
  /* @__PURE__ */ s(
851
- fe,
848
+ ye,
852
849
  {
853
- open: C,
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
- Ne,
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
- fe,
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
- z,
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
- z,
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: F ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载用量数据..." }) }) : b ? /* @__PURE__ */ s("div", { className: t.usageDrawerContent, 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: t.usageStatsGrid, children: [
949
- /* @__PURE__ */ e(P, { title: "总请求数", value: b.totalRequests }),
950
- /* @__PURE__ */ e(P, { title: "总 Token", value: b.totalTokens }),
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
- P,
949
+ K,
953
950
  {
954
951
  title: "输入 Token",
955
- value: b.totalPromptTokens
952
+ value: P.totalPromptTokens
956
953
  }
957
954
  ),
958
955
  /* @__PURE__ */ e(
959
- P,
956
+ K,
960
957
  {
961
958
  title: "输出 Token",
962
- value: b.totalCompletionTokens
959
+ value: P.totalCompletionTokens
963
960
  }
964
961
  ),
965
962
  /* @__PURE__ */ e(
966
- P,
963
+ K,
967
964
  {
968
965
  title: "平均耗时",
969
- value: b.avgLatencyMs,
966
+ value: P.avgLatencyMs,
970
967
  suffix: "ms"
971
968
  }
972
969
  ),
973
970
  /* @__PURE__ */ e(
974
- P,
971
+ K,
975
972
  {
976
973
  title: "错误数",
977
- value: b.errorCount,
974
+ value: P.errorCount,
978
975
  styles: {
979
976
  content: {
980
- color: b.errorCount > 0 ? "#ff4d4f" : void 0
977
+ color: P.errorCount > 0 ? "#ff4d4f" : void 0
981
978
  }
982
979
  }
983
980
  }
984
981
  ),
985
982
  /* @__PURE__ */ e(
986
- P,
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: t.usageSection, children: [
994
- /* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "每日调用曲线(按最近调用明细聚合)" }),
995
- We(b.daily)
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: t.usageSection, children: [
998
- /* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "模型用量分布" }),
999
- Qe(b.models)
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: t.usageSection, children: [
1002
- /* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "最近调用记录" }),
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: b.recent,
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: t.usageEmpty, children: "暂无用量数据" })
1018
+ ] }) : /* @__PURE__ */ e("div", { className: a.usageEmpty, children: "暂无用量数据" })
1022
1019
  }
1023
1020
  )
1024
1021
  ] });
1025
1022
  }
1026
- function Va(a) {
1023
+ function Wa(t) {
1027
1024
  const n = [];
1028
- if (!a) return n;
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(a)) !== null; )
1032
- c.index > i && n.push({ type: "text", text: a.slice(i, c.index) }), n.push({ type: "think", text: c[2] }), i = c.index + c[0].length;
1033
- return i < a.length && n.push({ type: "text", text: a.slice(i) }), n;
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 Ya = 0;
1037
- function Xa({ initialModels: a }) {
1038
- const [n, o] = N([]), [i, c] = N([]), [T, B] = N(!0), [S, f] = N(null), [A, C] = N(""), [g, m] = N(!1), k = ye(""), p = ye(/* @__PURE__ */ new Map()), d = ye(/* @__PURE__ */ new Map());
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 we();
1039
+ const r = await Te();
1043
1040
  c(r), B(!1);
1044
- const y = a.length > 0 ? a : r.slice(0, 1).map((x) => x.modelName);
1045
- o(y.slice(0, me).map((x) => _e(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 (a.length > 0 && i.length > 0) {
1052
- const r = a.slice(0, me).map((y) => _e(y));
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
- }, [a.join(",")]);
1056
- const _ = G((r) => {
1052
+ }, [t.join(",")]);
1053
+ const _ = H((r) => {
1057
1054
  const y = d.current.get(r);
1058
1055
  y && (y.scrollTop = y.scrollHeight);
1059
- }, []), h = G(
1056
+ }, []), h = H(
1060
1057
  (r, y) => {
1061
- o((x) => x.map((M) => M.id === r ? y(M) : M));
1058
+ o((x) => x.map((b) => b.id === r ? y(b) : b));
1062
1059
  },
1063
1060
  []
1064
- ), b = G(async () => {
1061
+ ), P = H(async () => {
1065
1062
  if (k.current) return k.current;
1066
- const r = await St();
1063
+ const r = await xt();
1067
1064
  return k.current = r, r;
1068
- }, []), E = G(async () => {
1069
- const r = A.trim();
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 b();
1070
+ y = await P();
1074
1071
  } catch {
1075
1072
  return;
1076
1073
  }
1077
- C(""), m(!0);
1078
- const x = n.map((K) => ({
1079
- ...K,
1074
+ N(""), m(!0);
1075
+ const x = n.map((E) => ({
1076
+ ...E,
1080
1077
  messages: [
1081
- ...K.messages,
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 M = x;
1092
- M.forEach((K) => {
1088
+ const b = x;
1089
+ b.forEach((E) => {
1093
1090
  const J = new AbortController();
1094
- p.current.set(K.id, J);
1095
- const X = K.messages.slice(0, -1);
1096
- ft(y, K.model, X, {
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(K.id, (j) => ({
1095
+ h(E.id, (j) => ({
1099
1096
  ...j,
1100
1097
  streamingContent: j.streamingContent + D,
1101
1098
  messages: j.messages.map(
1102
- (W, ke) => ke === j.messages.length - 1 ? { ...W, content: j.streamingContent + D } : W
1099
+ (W, pe) => pe === j.messages.length - 1 ? { ...W, content: j.streamingContent + D } : W
1103
1100
  )
1104
- })), _(K.id);
1101
+ })), _(E.id);
1105
1102
  },
1106
1103
  onDone: (D) => {
1107
- h(K.id, (j) => ({
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(K.id);
1112
+ })), p.current.delete(E.id);
1116
1113
  },
1117
1114
  onError: (D) => {
1118
- (D.message.includes("401") || D.message.includes("API key")) && (Ge(), k.current = ""), h(K.id, (j) => ({
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(K.id);
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
- M.every(
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
- }, [A, g, n, b, h, _]), F = G(() => {
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 = G(() => {
1135
+ }, []), ae = H(() => {
1139
1136
  var y;
1140
1137
  if (n.length >= me) return;
1141
- const r = (y = i.find((x) => !n.some((M) => M.model === x.modelName))) == null ? void 0 : y.modelName;
1142
- r && o((x) => [...x, _e(r)]);
1143
- }, [n, i]), Y = G(() => {
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 = G((r) => {
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((M) => M.id !== r));
1157
- }, []), $ = G(
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 T ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载模型列表..." }) }) : S ? /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
1167
- /* @__PURE__ */ e("div", { className: t.chatHeader, children: /* @__PURE__ */ e("h3", { className: t.chatTitle, children: "模型对话" }) }),
1168
- /* @__PURE__ */ s("div", { className: t.akEmpty, children: [
1169
- "模型列表加载失败:",
1170
- S
1171
- ] })
1172
- ] }) : /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
1173
- /* @__PURE__ */ s("div", { className: t.chatHeader, children: [
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
- z,
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: t.chatPanels, children: [
1193
- n.map((r) => /* @__PURE__ */ s("div", { className: t.chatPanel, children: [
1194
- /* @__PURE__ */ s("div", { className: t.chatPanelHeader, children: [
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
- mt,
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: t.chatPanelClose,
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: t.chatPanelBody,
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" ? t.chatMsgUser : t.chatMsgAI,
1218
+ className: y.role === "user" ? a.chatMsgUser : a.chatMsgAI,
1228
1219
  children: [
1229
- y.role === "assistant" ? Va(y.content).map(
1230
- (M, O) => M.type === "think" ? /* @__PURE__ */ s(
1220
+ y.role === "assistant" ? Wa(y.content).map(
1221
+ (b, O) => b.type === "think" ? /* @__PURE__ */ s(
1231
1222
  "details",
1232
1223
  {
1233
- className: t.chatThinkBlock,
1224
+ className: a.chatThinkBlock,
1234
1225
  children: [
1235
1226
  /* @__PURE__ */ e("summary", { children: "思考过程" }),
1236
- /* @__PURE__ */ e("pre", { children: M.text })
1227
+ /* @__PURE__ */ e("pre", { children: b.text })
1237
1228
  ]
1238
1229
  },
1239
1230
  O
1240
- ) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: M.text }, O)
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: t.chatStreamingCursor })
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: t.chatMsgError, children: r.error }),
1248
- r.usage && /* @__PURE__ */ s("div", { className: t.chatUsageBar, children: [
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: t.addPanelBtn, onClick: ae, children: /* @__PURE__ */ e(Ke, {}) }) })
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: t.chatInputBar, children: [
1255
+ /* @__PURE__ */ s("div", { className: a.chatInputBar, children: [
1265
1256
  /* @__PURE__ */ e(
1266
- Ne.TextArea,
1257
+ Ce.TextArea,
1267
1258
  {
1268
- className: t.chatInput,
1269
- value: A,
1270
- onChange: (r) => C(r.target.value),
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(), E());
1265
+ r.shiftKey || (r.preventDefault(), M());
1275
1266
  },
1276
1267
  disabled: g
1277
1268
  }
1278
1269
  ),
1279
- g ? /* @__PURE__ */ e(z, { danger: !0, onClick: F, children: "停止" }) : /* @__PURE__ */ s(z, { type: "primary", onClick: E, disabled: !A.trim(), children: [
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 _e(a) {
1277
+ function fe(t) {
1287
1278
  return {
1288
- id: ++Ya,
1289
- model: a,
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 Za({ onStartChat: a }) {
1298
- const [n, o] = N([]), [i, c] = N(!0), [T, B] = N(null), [S, f] = N(/* @__PURE__ */ new Set()), A = () => {
1299
- c(!0), B(null), we().then((d) => {
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
- A();
1297
+ S();
1307
1298
  }, []);
1308
- const C = (d) => {
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(S), m = (d) => {
1314
- a([d]);
1304
+ }, g = Array.from(A), m = (d) => {
1305
+ t([d]);
1315
1306
  }, k = () => {
1316
- g.length > 0 && a(g);
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: "加载模型列表..." }) }) : T ? /* @__PURE__ */ s("div", { children: [
1323
- /* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
1324
- /* @__PURE__ */ e("h3", { className: t.modelMgmtTitle, children: "模型管理" }),
1325
- /* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "数据库管理的可用模型,可选择单个或多个模型发起对话对比" })
1326
- ] }),
1327
- /* @__PURE__ */ s("div", { className: t.akEmpty, children: [
1328
- "模型列表加载失败:",
1329
- T,
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: `${t.modelCard} ${_ ? t.modelCardSelected : ""}`,
1344
- onClick: () => C(d.modelName),
1324
+ className: `${a.modelCard} ${_ ? a.modelCardSelected : ""}`,
1325
+ onClick: () => N(d.modelName),
1345
1326
  children: [
1346
1327
  /* @__PURE__ */ e(
1347
- ut,
1328
+ ht,
1348
1329
  {
1349
- className: t.modelCheckbox,
1330
+ className: a.modelCheckbox,
1350
1331
  checked: _,
1351
1332
  onChange: (h) => {
1352
- h.stopPropagation(), C(d.modelName);
1333
+ h.stopPropagation(), N(d.modelName);
1353
1334
  }
1354
1335
  }
1355
1336
  ),
1356
- /* @__PURE__ */ s("div", { className: t.modelCardHeader, children: [
1357
- /* @__PURE__ */ e("div", { className: t.modelIconWrap, children: /* @__PURE__ */ e(he, {}) }),
1358
- /* @__PURE__ */ s("div", { className: t.modelCardInfo, children: [
1359
- /* @__PURE__ */ e("h4", { className: t.modelName, children: d.modelName }),
1360
- /* @__PURE__ */ s("div", { className: t.modelTags, children: [
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: t.modelEndpoint, children: d.endpoint }),
1374
- /* @__PURE__ */ e("div", { className: t.modelCardFooter, children: /* @__PURE__ */ e(
1375
- z,
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: t.modelActionBar, children: [
1391
- /* @__PURE__ */ s("span", { className: t.modelSelectionCount, children: [
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
- z,
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 en = "_container_15pgq_5", tn = "_page_15pgq_10", an = "_kpiGrid_15pgq_16", nn = "_kpiCard_15pgq_22", sn = "_sectionCard_15pgq_29", on = "_sectionHead_15pgq_36", rn = "_sectionHint_15pgq_42", ln = "_akList_15pgq_47", cn = "_errorState_15pgq_54", dn = "_errorTitle_15pgq_66", mn = "_errorDetail_15pgq_72", I = {
1409
- container: en,
1410
- page: tn,
1411
- kpiGrid: an,
1412
- kpiCard: nn,
1413
- sectionCard: sn,
1414
- sectionHead: on,
1415
- sectionHint: rn,
1416
- akList: ln,
1417
- errorState: cn,
1418
- errorTitle: dn,
1419
- errorDetail: mn
1420
- }, un = dt(
1421
- () => import("@yuku123/z-agent-component").then((a) => ({ default: a.AgentDashboard }))
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(a) {
1424
- return a >= 1e6 ? `${(a / 1e6).toFixed(2)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : String(a ?? 0);
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 hn({ daily: a }) {
1427
- const n = Object.entries(a);
1428
- if (n.length === 0) return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
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: t.usageBarChart, children: n.map(([i, c]) => {
1431
- const T = c[1] + c[2];
1432
- return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
1433
- /* @__PURE__ */ e(oe, { title: `${i}: ${c[0]}次 / ${T} tokens`, children: /* @__PURE__ */ e(
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: t.usageBar,
1437
- style: { height: `${Math.max(T / o * 100, 2)}%` }
1417
+ className: a.usageBar,
1418
+ style: { height: `${Math.max(w / o * 100, 2)}%` }
1438
1419
  }
1439
1420
  ) }),
1440
- /* @__PURE__ */ e("span", { className: t.usageBarLabel, children: i })
1421
+ /* @__PURE__ */ e("span", { className: a.usageBarLabel, children: i })
1441
1422
  ] }, i);
1442
1423
  }) });
1443
1424
  }
1444
- function Pe({ models: a }) {
1445
- const n = Object.entries(a);
1446
- if (n.length === 0) return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
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: t.modelBreakdown, children: n.sort((i, c) => c[1][0] - i[1][0]).map(([i, c]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
1449
- /* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: i }),
1450
- /* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
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: t.modelBreakdownFill,
1434
+ className: a.modelBreakdownFill,
1454
1435
  style: { width: `${c[0] / o * 100}%` }
1455
1436
  }
1456
1437
  ) }),
1457
- /* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
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 pn = [
1446
+ const un = [
1466
1447
  {
1467
1448
  title: "时间",
1468
1449
  dataIndex: "createTime",
1469
1450
  key: "createTime",
1470
1451
  width: 160,
1471
- render: (a) => a ? new Date(a).toLocaleString("zh-CN") : "-"
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: (a) => /* @__PURE__ */ e(Z, { children: a }) },
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: (a) => a ? `${a}ms` : "-" },
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: (a) => a ? /* @__PURE__ */ e(Z, { color: a < 400 ? "green" : "red", children: a }) : "-"
1465
+ render: (t) => t ? /* @__PURE__ */ e(Z, { color: t < 400 ? "green" : "red", children: t }) : "-"
1485
1466
  }
1486
1467
  ];
1487
- function kn(a) {
1468
+ function hn(t) {
1488
1469
  var n;
1489
- return ((n = a == null ? void 0 : a.stats) == null ? void 0 : n.recent) ?? [];
1470
+ return ((n = t == null ? void 0 : t.stats) == null ? void 0 : n.recent) ?? [];
1490
1471
  }
1491
- function gn() {
1472
+ function pn() {
1492
1473
  var g;
1493
- const [a, n] = N(!0), [o, i] = N(null), [c, T] = N(null), [B, S] = N([]), [f, A] = N(null), C = G(async () => {
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
- He(),
1498
- Tt()
1478
+ Ge(),
1479
+ St()
1499
1480
  ]), [k, p, d] = m;
1500
- k.status === "fulfilled" && T(k.value), p.status === "fulfilled" && S(p.value), d.status === "fulfilled" && A(d.value), m.every((_) => _.status === "rejected") && i(
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
- C();
1506
- }, [C]), a ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载网关控制面..." }) }) : o && !c ? /* @__PURE__ */ s("div", { className: I.errorState, children: [
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(z, { icon: /* @__PURE__ */ e(Te, {}), onClick: () => void C(), type: "primary", children: "重试" })
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
- P,
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(P, { title: "上游厂商", value: ((g = c == null ? void 0 : c.vendors) == null ? void 0 : g.length) ?? 0 }) }),
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
- P,
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(P, { title: "网关 AK 数", value: (c == null ? void 0 : c.activeApiKeys) ?? "—" }) })
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: t.usageSection, style: { marginTop: 16 }, children: [
1547
- /* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "租户用量台账(网关 UsageLedger,按租户维度)" }),
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 yn() {
1574
- var _, h, b, E, F, ae, Y;
1575
- const [a, n] = N(!0), [o, i] = N(null), [c, T] = N([]), [B, S] = N(null), [f, A] = N(null), C = String(Le((u) => {
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([C, Ue].filter((u) => u !== ""))
1580
- ), m = G(async () => {
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) => pe(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 K of O.value) {
1590
- const J = String(K.id ?? K.akPrefix ?? "");
1591
- R.has(J) || (R.add(J), $.push(K));
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, K) => (O.id ?? 0) - (K.id ?? 0));
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
- S(y);
1604
- const M = $.map((O) => ({
1584
+ A(y);
1585
+ const b = $.map((O) => ({
1605
1586
  key: O,
1606
1587
  stats: y,
1607
1588
  statsError: x
1608
1589
  }));
1609
- T(M);
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 = Ee(() => {
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 = () => a ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(se, { tip: "加载监控数据..." }) }) : o ? /* @__PURE__ */ s("div", { className: I.errorState, children: [
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(z, { icon: /* @__PURE__ */ e(Te, {}), onClick: m, type: "primary", children: "重试" })
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(P, { title: "总请求(近7天)", value: k.requests }) }),
1637
- /* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(P, { title: "总 Tokens", value: ne(k.tokens) }) }),
1638
- /* @__PURE__ */ e("div", { className: I.kpiCard, children: /* @__PURE__ */ e(P, { title: "平均延迟", value: k.avgLatency, suffix: "ms" }) }),
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
- P,
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: t.usageSectionTitle, children: "AK 用量" }),
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: t.akEmpty, children: "网关下暂无 AK" }) : /* @__PURE__ */ e("div", { className: I.akList, children: c.map((u) => {
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: t.akCard,
1663
- onClick: () => A(u),
1643
+ className: a.akCard,
1644
+ onClick: () => S(u),
1664
1645
  children: [
1665
- /* @__PURE__ */ s("div", { className: t.akCardRow, children: [
1666
- /* @__PURE__ */ e("span", { className: t.akTitle, children: u.key.description || u.key.userName || `AK #${u.key.id}` }),
1667
- /* @__PURE__ */ e("span", { className: t.akPrefixSmall, children: u.key.akPrefix }),
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: `${t.akStatus} ${u.key.active ? t.akStatusActive : t.akStatusRevoked}`,
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: t.akMetaText, children: u.key.userId === "system-default" ? "系统对话" : u.key.userId })
1656
+ /* @__PURE__ */ e("span", { className: a.akMetaText, children: u.key.userId === "system-default" ? "系统对话" : u.key.userId })
1676
1657
  ] }),
1677
- /* @__PURE__ */ s("div", { className: t.akCardRow2, children: [
1678
- /* @__PURE__ */ e("div", { className: t.akMiniBar, children: /* @__PURE__ */ e(
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: t.akMiniBarFill,
1662
+ className: a.akMiniBarFill,
1682
1663
  style: { width: `${r}%` }
1683
1664
  }
1684
1665
  ) }),
1685
- /* @__PURE__ */ s("span", { className: t.akUsageText, children: [
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: t.akMetaText, children: u.statsError ? u.statsError : u.key.lastUsedAt ? `最近使用 ${u.key.lastUsedAt}` : "尚未使用" })
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: t.usageSectionTitle, children: "模型用量分布(网关全局)" }),
1700
- /* @__PURE__ */ e(Pe, { models: k.models })
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(it, { fallback: /* @__PURE__ */ e(se, { tip: "加载会话统计..." }), children: /* @__PURE__ */ e(un, {}) })
1694
+ children: /* @__PURE__ */ e(dt, { fallback: /* @__PURE__ */ e(se, { tip: "加载会话统计..." }), children: /* @__PURE__ */ e(dn, {}) })
1718
1695
  },
1719
- { key: "gateway", label: "网关控制面", children: /* @__PURE__ */ e(gn, {}) }
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: () => A(null),
1706
+ onClose: () => S(null),
1730
1707
  destroyOnHidden: !0,
1731
- children: f && /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
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: t.usageStatsGrid, children: [
1734
- /* @__PURE__ */ e(P, { title: "总请求", value: ((_ = f.stats) == null ? void 0 : _.totalRequests) ?? 0 }),
1735
- /* @__PURE__ */ e(P, { title: "总 Tokens", value: ((h = f.stats) == null ? void 0 : h.totalTokens) ?? 0 }),
1736
- /* @__PURE__ */ e(P, { title: "平均延迟", value: ((b = f.stats) == null ? void 0 : b.avgLatencyMs) ?? 0, suffix: "ms" }),
1737
- /* @__PURE__ */ e(P, { title: "输入 Tokens", value: ((E = f.stats) == null ? void 0 : E.totalPromptTokens) ?? 0 }),
1738
- /* @__PURE__ */ e(P, { title: "输出 Tokens", value: ((F = f.stats) == null ? void 0 : F.totalCompletionTokens) ?? 0 }),
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
- P,
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
- P,
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: t.usageSection, children: [
1756
- /* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "每日用量(按最近调用明细聚合)" }),
1757
- f.stats ? /* @__PURE__ */ e(hn, { daily: f.stats.daily ?? {} }) : /* @__PURE__ */ e("span", { className: t.usageEmpty, children: f.statsError ?? "暂无数据" })
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: t.usageSection, children: [
1760
- /* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "模型用量分布(按最近调用明细聚合)" }),
1761
- f.stats ? /* @__PURE__ */ e(Pe, { models: f.stats.models ?? {} }) : /* @__PURE__ */ e("span", { className: t.usageEmpty, children: f.statsError ?? "暂无数据" })
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: t.usageSection, children: [
1764
- /* @__PURE__ */ e("span", { className: t.usageSectionTitle, children: "最近调用" }),
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: pn,
1770
- dataSource: kn(f),
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 fn = [
1763
+ const gn = [
1787
1764
  {
1788
1765
  title: "模型",
1789
- icon: /* @__PURE__ */ e(be, {}),
1766
+ icon: /* @__PURE__ */ e(Pe, {}),
1790
1767
  items: [
1791
- { key: "model-management", label: "模型管理", icon: /* @__PURE__ */ e(be, {}) },
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(Me, {}),
1775
+ icon: /* @__PURE__ */ e(be, {}),
1799
1776
  items: [
1800
- { key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(Me, {}) }
1777
+ { key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(be, {}) }
1801
1778
  ]
1802
1779
  },
1803
1780
  {
1804
1781
  title: "智能体",
1805
- icon: /* @__PURE__ */ e(he, {}),
1782
+ icon: /* @__PURE__ */ e(_e, {}),
1806
1783
  items: [
1807
- { key: "agent-app", label: "Agent 应用", icon: /* @__PURE__ */ e(he, {}) },
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 An() {
1815
- const [a, n] = N("model-management"), [o, i] = N([]), [c, T] = N(/* @__PURE__ */ new Set()), B = (C) => {
1816
- i(C), n("model-chat");
1817
- }, S = Ee(() => fn, []);
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
- a && S.forEach((C) => {
1820
- C.items.some((g) => g.key === a) && T(
1821
- (g) => g.has(C.title) ? g : new Set(g).add(C.title)
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
- }, [a, S]);
1825
- const f = (C) => {
1826
- T((g) => {
1802
+ }, [t, A]);
1803
+ const f = (N) => {
1804
+ w((g) => {
1827
1805
  const m = new Set(g);
1828
- return m.has(C) ? m.delete(C) : m.add(C), m;
1806
+ return m.has(N) ? m.delete(N) : m.add(N), m;
1829
1807
  });
1830
- }, A = (C, g, m = !1) => /* @__PURE__ */ e(
1808
+ }, S = (N, g, m = !1) => /* @__PURE__ */ e(
1831
1809
  "div",
1832
1810
  {
1833
1811
  style: {
1834
- display: a === C ? m ? "flex" : "block" : "none",
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: t.container, children: [
1842
- /* @__PURE__ */ s("aside", { className: U.sidebar, children: [
1843
- /* @__PURE__ */ s("div", { className: U.sidebarHeader, children: [
1844
- /* @__PURE__ */ e(he, {}),
1845
- /* @__PURE__ */ e("span", { children: "智能" })
1846
- ] }),
1847
- /* @__PURE__ */ e("nav", { className: U.menuList, children: S.map((C) => {
1848
- const g = c.has(C.title), m = C.items.findIndex((k) => k.key === a);
1849
- return /* @__PURE__ */ s("div", { className: U.menuGroup, children: [
1850
- /* @__PURE__ */ s(
1851
- "div",
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: `${U.menuGroupHeader} ${g ? U.menuGroupHeaderOpen : ""} ${m >= 0 ? U.menuGroupHeaderActive : ""}`,
1854
- onClick: () => f(C.title),
1855
- children: [
1856
- /* @__PURE__ */ e("span", { className: U.menuGroupIcon, children: C.icon }),
1857
- /* @__PURE__ */ e("span", { className: U.menuGroupLabel, children: C.title }),
1858
- /* @__PURE__ */ e("span", { className: U.menuGroupArrow, children: g ? /* @__PURE__ */ e(at, {}) : /* @__PURE__ */ e(nt, {}) })
1859
- ]
1860
- }
1861
- ),
1862
- g && /* @__PURE__ */ e("ul", { className: U.menuSubList, children: C.items.map((k, p) => {
1863
- const d = m >= 0 && p <= m;
1864
- return /* @__PURE__ */ e(
1865
- "li",
1866
- {
1867
- className: `${U.menuSubItem} ${d ? U.menuItemOnPath : ""} ${a === k.key ? U.menuSubItemActive : ""}`,
1868
- onClick: () => n(k.key),
1869
- children: /* @__PURE__ */ s("div", { className: U.menuSubItemPill, children: [
1870
- /* @__PURE__ */ e("span", { className: U.menuSubItemIcon, children: k.icon }),
1871
- /* @__PURE__ */ e("span", { children: k.label })
1872
- ] })
1873
- },
1874
- k.key
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
- An as default
1866
+ Sn as default
1894
1867
  };