@yuku123/z-team-component 0.2.102 → 0.2.104

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