@yuku123/z-team-component 0.2.53 → 0.2.55

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