@yuku123/z-team-component 0.2.21 → 0.2.23

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 (46) hide show
  1. package/dist/DebugPlayground-cxffrMgF.js +15 -0
  2. package/dist/{InvitationManagementPage-cXDD5J1f.js → InvitationManagementPage-BJ0izYip.js} +2 -2
  3. package/dist/{OnboardingPage-D7W1L7E7.js → OnboardingPage-Cde_2B_A.js} +2 -2
  4. package/dist/{ProjectApp-DgCJv9Qr.js → ProjectApp-CJfqACjb.js} +3 -3
  5. package/dist/SmartWorkbench.module-DzQskKT0.js +85 -0
  6. package/dist/SystemShell-Cm9eErqQ.js +593 -0
  7. package/dist/{admin-logs-96BMdLm3.js → admin-logs-C2V1ElH9.js} +34 -34
  8. package/dist/{api-DayyjL1e.js → api--Fg0hL9Y.js} +258 -258
  9. package/dist/{api-BzonkJ9O.js → api-DlnrjUut.js} +1 -1
  10. package/dist/{createWorkspaceWsHandler-Dgpag_y3.js → createWorkspaceWsHandler-CqGqcTh_.js} +27 -27
  11. package/dist/echarts-B1OU1xr4.js +16 -0
  12. package/dist/{index-BCnzwGPj.js → index-1xwvv2Q7.js} +3 -3
  13. package/dist/{index-BuGgpiDq.js → index-8V37FP9c.js} +4 -4
  14. package/dist/{index-gqKmHnTZ.js → index-B3ikipDf.js} +4 -4
  15. package/dist/{index-Cnw06MGB.js → index-BMRIUhOL.js} +3 -3
  16. package/dist/index-BaCiSbPR.js +956 -0
  17. package/dist/index-Bla8z6ok.js +6879 -0
  18. package/dist/index-Bsh58cwF.js +975 -0
  19. package/dist/index-C01UUprh.js +41705 -0
  20. package/dist/index-C0EIMJI2.js +112 -0
  21. package/dist/{index-BX-3TBsz.js → index-CGDpGIZC.js} +6 -6
  22. package/dist/index-CUVdeb8y.js +638 -0
  23. package/dist/{index-D3TdisV7.js → index-CW2B5_8f.js} +1616 -22092
  24. package/dist/{index-sGtg7MFg.js → index-D5u3BjCZ.js} +2 -2
  25. package/dist/{index-pJERGpTh.js → index-DK_aR-Vu.js} +5 -4
  26. package/dist/index-DKpz0o-l.js +1327 -0
  27. package/dist/index-DUbYCF9y.js +1171 -0
  28. package/dist/index-DvIHX7lZ.js +1657 -0
  29. package/dist/{index-BMOS7sE7.js → index-b1BIpgn7.js} +165 -163
  30. package/dist/{index-DHGvzWWQ.js → index-bbwTcNjB.js} +7 -7
  31. package/dist/index-hPzswwk2.js +5900 -0
  32. package/dist/index-pfzY68PH.js +1408 -0
  33. package/dist/index.js +1 -1
  34. package/dist/index.module-CAa-2T7m.js +72 -0
  35. package/dist/index.module-UI0iz8K0.js +42 -0
  36. package/dist/{instance-CNHJqTd1.js → instance-1QEDBRqA.js} +12 -12
  37. package/dist/pages.js +1 -1
  38. package/dist/schedule-C89oiqIR.js +239 -0
  39. package/dist/{send-default-agent-team-message-CRRwpv0q.js → send-default-agent-team-message-CxkWi3XC.js} +1 -1
  40. package/dist/{sso-user-D0JzsJeR.js → sso-user-BE1Ell5F.js} +1 -1
  41. package/dist/training-o-vSBkqP.js +450 -0
  42. package/dist/{useAppStore-BYXwTjW-.js → useAppStore-wgWaxcyc.js} +24 -24
  43. package/dist/webide-BxD6cYe-.js +8084 -0
  44. package/dist/z-team-component.css +2 -2
  45. package/package.json +1 -1
  46. package/dist/index-CJD6mLzs.js +0 -51451
@@ -0,0 +1,1327 @@
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
+ import { CopyOutlined as Y, ReloadOutlined as Ne, PlusOutlined as pe, DeleteOutlined as Ae, ClearOutlined as we, CloseOutlined as Te, SendOutlined as Ce, RobotOutlined as he, CloudServerOutlined as xe, MessageOutlined as Pe, KeyOutlined as Se, AppstoreOutlined as be, GiftOutlined as Ie, ApiOutlined as Me, ToolOutlined as Ke, BarChartOutlined as Oe, DesktopOutlined as Ee } from "@ant-design/icons";
3
+ import { useState as k, useCallback as $, useEffect as X, useRef as ne, useMemo as Be } from "react";
4
+ import { Tooltip as G, Tabs as De, Button as B, Modal as se, Input as ue, Drawer as $e, Spin as Q, Statistic as j, Table as Le, message as _, Tag as F, Select as _e, Checkbox as ze } from "antd";
5
+ import { s as t } from "./SmartWorkbench.module-DzQskKT0.js";
6
+ import { AgentAppList as Re, AgentInstanceManager as Ue, TemplateMarket as qe, McpPage as je, SkillMarket as Fe, AgentDashboard as He } from "@yuku123/z-agent-component";
7
+ import "@yuku123/z-frontend-common";
8
+ import "./ProjectApp-CJfqACjb.js";
9
+ import { D as Ge } from "./DebugPlayground-cxffrMgF.js";
10
+ const oe = "ft_gateway_default_ak", Je = typeof window < "u" && window.ZTEAM_USE_KAPI === !0, ge = Je, We = `${ge ? "/kapi" : ""}/z-team`, z = ge ? "/kapi/z-team-agent-gateway" : "/gateway-api";
11
+ function Ye(a) {
12
+ return {
13
+ modelName: String(a.modelName ?? a.model_name ?? a.service ?? ""),
14
+ service: String(a.service ?? a.modelName ?? ""),
15
+ endpoint: String(a.endpoint ?? ""),
16
+ modelProvider: a.modelProvider ?? a.model_provider ?? null,
17
+ apiType: String(a.apiType ?? a.api_type ?? "OpenAPI")
18
+ };
19
+ }
20
+ async function fe() {
21
+ try {
22
+ const a = await fetch(`${We}/api/scenario-instances/0/models`, {
23
+ credentials: "include",
24
+ headers: {
25
+ Accept: "application/json",
26
+ "project-env": window.ENV_TYPE ?? "local"
27
+ }
28
+ });
29
+ if (a.ok) {
30
+ const o = await a.json(), c = o != null && o.success ? o.data : (o == null ? void 0 : o.data) ?? o;
31
+ if (Array.isArray(c) && c.length > 0)
32
+ return c.map(Ye);
33
+ }
34
+ } catch {
35
+ }
36
+ return [...Ze];
37
+ }
38
+ const Ze = [
39
+ {
40
+ modelName: "qwen3.6-flash",
41
+ service: "qwen3.6-flash",
42
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
43
+ modelProvider: "Aliyun",
44
+ apiType: "OpenAPI"
45
+ },
46
+ {
47
+ modelName: "qwen3.6-plus",
48
+ service: "qwen3.6-plus",
49
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
50
+ modelProvider: "Aliyun",
51
+ apiType: "OpenAPI"
52
+ },
53
+ {
54
+ modelName: "qwen3.7-plus",
55
+ service: "qwen3.7-plus",
56
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
57
+ modelProvider: "Aliyun",
58
+ apiType: "OpenAPI"
59
+ },
60
+ {
61
+ modelName: "qwen3.7-flash",
62
+ service: "qwen3.7-flash",
63
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
64
+ modelProvider: null,
65
+ apiType: "OpenAPI"
66
+ },
67
+ {
68
+ modelName: "qwen3.7-max",
69
+ service: "qwen3.7-max",
70
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
71
+ modelProvider: "Aliyun",
72
+ apiType: "OpenAPI"
73
+ },
74
+ {
75
+ modelName: "qwen3.8-max",
76
+ service: "qwen3.8-max",
77
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
78
+ modelProvider: "Aliyun",
79
+ apiType: "OpenAPI"
80
+ },
81
+ {
82
+ modelName: "deepseek-v4-flash",
83
+ service: "deepseek-v4-flash",
84
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
85
+ modelProvider: "Aliyun",
86
+ apiType: "OpenAPI"
87
+ },
88
+ {
89
+ modelName: "deepseek-v4-flash-0731",
90
+ service: "deepseek-v4-flash-0731",
91
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
92
+ modelProvider: "Aliyun",
93
+ apiType: "OpenAPI"
94
+ },
95
+ {
96
+ modelName: "deepseek-v4-pro",
97
+ service: "deepseek-v4-pro",
98
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
99
+ modelProvider: "Aliyun",
100
+ apiType: "OpenAPI"
101
+ },
102
+ {
103
+ modelName: "deepseek-v3.2",
104
+ service: "deepseek-v3.2",
105
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
106
+ modelProvider: "Aliyun",
107
+ apiType: "OpenAPI"
108
+ },
109
+ {
110
+ modelName: "glm-5",
111
+ service: "glm-5",
112
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
113
+ modelProvider: "ZhipuAI",
114
+ apiType: "OpenAPI"
115
+ },
116
+ {
117
+ modelName: "glm-5.1",
118
+ service: "glm-5.1",
119
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
120
+ modelProvider: "ZhipuAI",
121
+ apiType: "OpenAPI"
122
+ },
123
+ {
124
+ modelName: "glm-5.2",
125
+ service: "glm-5.2",
126
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
127
+ modelProvider: "ZhipuAI",
128
+ apiType: "OpenAPI"
129
+ },
130
+ {
131
+ modelName: "kimi-k2.5",
132
+ service: "kimi-k2.5",
133
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
134
+ modelProvider: "MoonshotAI",
135
+ apiType: "OpenAPI"
136
+ },
137
+ {
138
+ modelName: "kimi-k2.6",
139
+ service: "kimi-k2.6",
140
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
141
+ modelProvider: "MoonshotAI",
142
+ apiType: "OpenAPI"
143
+ },
144
+ {
145
+ modelName: "kimi-k2.7-code",
146
+ service: "kimi-k2.7-code",
147
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
148
+ modelProvider: "MoonshotAI",
149
+ apiType: "OpenAPI"
150
+ },
151
+ {
152
+ modelName: "MiniMax-M2.5",
153
+ service: "MiniMax-M2.5",
154
+ endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1",
155
+ modelProvider: "MiniMax",
156
+ apiType: "OpenAPI"
157
+ }
158
+ ];
159
+ async function Ve(a, o, c, d) {
160
+ var C, x, b, P;
161
+ const g = await fetch(`${z}/v1/chat/completions`, {
162
+ method: "POST",
163
+ headers: {
164
+ "Content-Type": "application/json",
165
+ Authorization: `Bearer ${a}`,
166
+ Accept: "text/event-stream"
167
+ },
168
+ body: JSON.stringify({
169
+ model: o,
170
+ messages: c,
171
+ stream: !0
172
+ }),
173
+ signal: d.signal
174
+ });
175
+ if (!g.ok || !g.body) {
176
+ const l = await g.text().catch(() => "");
177
+ let p = `HTTP ${g.status}`;
178
+ try {
179
+ const h = JSON.parse(l);
180
+ p = ((C = h == null ? void 0 : h.error) == null ? void 0 : C.message) ?? p;
181
+ } catch {
182
+ l && (p = l);
183
+ }
184
+ throw new Error(p);
185
+ }
186
+ const D = g.body.getReader(), w = new TextDecoder();
187
+ let T = "";
188
+ try {
189
+ for (; ; ) {
190
+ const { done: l, value: p } = await D.read();
191
+ if (l) break;
192
+ T += w.decode(p, { stream: !0 });
193
+ const h = T.split(`
194
+
195
+ `);
196
+ T = h.pop() ?? "";
197
+ for (const I of h) {
198
+ let M = "";
199
+ for (const u of I.split(`
200
+ `))
201
+ u.startsWith("data:") && (M += u.slice(5).trim());
202
+ if (!M || M === "[DONE]") {
203
+ if (M === "[DONE]") {
204
+ d.onDone();
205
+ return;
206
+ }
207
+ continue;
208
+ }
209
+ try {
210
+ const u = JSON.parse(M), N = u == null ? void 0 : u.choices;
211
+ if (Array.isArray(N) && N.length > 0) {
212
+ const K = (x = N[0]) == null ? void 0 : x.delta;
213
+ if (K != null && K.content && d.onDelta(K.content), (b = N[0]) == null ? void 0 : b.finish_reason) {
214
+ const R = u != null && u.usage ? {
215
+ promptTokens: u.usage.prompt_tokens ?? 0,
216
+ completionTokens: u.usage.completion_tokens ?? 0,
217
+ totalTokens: u.usage.total_tokens ?? 0
218
+ } : void 0;
219
+ d.onDone(R);
220
+ return;
221
+ }
222
+ }
223
+ if (u != null && u.usage) {
224
+ const K = {
225
+ promptTokens: u.usage.prompt_tokens ?? 0,
226
+ completionTokens: u.usage.completion_tokens ?? 0,
227
+ totalTokens: u.usage.total_tokens ?? 0
228
+ };
229
+ d.onDone(K);
230
+ return;
231
+ }
232
+ } catch {
233
+ }
234
+ }
235
+ }
236
+ d.onDone();
237
+ } catch (l) {
238
+ if ((P = d.signal) != null && P.aborted) return;
239
+ throw d.onError(l instanceof Error ? l : new Error(String(l))), l;
240
+ }
241
+ }
242
+ async function ye(a, o, c) {
243
+ const d = await fetch(`${z}/v1/api-keys`, {
244
+ method: "POST",
245
+ headers: { "Content-Type": "application/json" },
246
+ body: JSON.stringify({ userId: a, userName: o, description: c })
247
+ });
248
+ if (!d.ok) {
249
+ const g = await d.text().catch(() => "");
250
+ throw new Error(`创建 AK 失败: ${g || d.status}`);
251
+ }
252
+ return d.json();
253
+ }
254
+ async function ce(a) {
255
+ const o = await fetch(
256
+ `${z}/v1/api-keys?userId=${encodeURIComponent(a)}`,
257
+ { headers: { "Content-Type": "application/json" } }
258
+ );
259
+ if (!o.ok) throw new Error(`获取 AK 列表失败 HTTP ${o.status}`);
260
+ const c = await o.json(), d = (c == null ? void 0 : c.apiKeys) ?? c;
261
+ return Array.isArray(d) ? d : [];
262
+ }
263
+ async function Xe(a) {
264
+ const o = await fetch(`${z}/v1/api-keys/${a}`, {
265
+ method: "DELETE"
266
+ });
267
+ if (!o.ok) throw new Error(`吊销 AK 失败 HTTP ${o.status}`);
268
+ }
269
+ async function Qe(a) {
270
+ const o = await fetch(`${z}/v1/api-keys/${a}/usage`);
271
+ if (!o.ok) throw new Error(`获取用量统计失败 HTTP ${o.status}`);
272
+ const c = await o.json();
273
+ return (c == null ? void 0 : c.data) ?? c;
274
+ }
275
+ function et() {
276
+ return typeof window < "u" ? `${window.location.origin}${z}` : z;
277
+ }
278
+ const le = "ft_gateway_ak_cache";
279
+ function tt(a, o) {
280
+ try {
281
+ const c = JSON.parse(localStorage.getItem(le) || "{}");
282
+ c[a] = o, localStorage.setItem(le, JSON.stringify(c));
283
+ } catch {
284
+ }
285
+ }
286
+ function at(a) {
287
+ try {
288
+ return JSON.parse(localStorage.getItem(le) || "{}")[a] || null;
289
+ } catch {
290
+ return null;
291
+ }
292
+ }
293
+ async function nt() {
294
+ try {
295
+ const o = localStorage.getItem(oe);
296
+ if (o) return o;
297
+ } catch {
298
+ }
299
+ const a = await ye(
300
+ "system-default",
301
+ "系统默认",
302
+ "智能工作台默认AK(自动创建)"
303
+ );
304
+ try {
305
+ localStorage.setItem(oe, a.apiKey);
306
+ } catch {
307
+ }
308
+ return a.apiKey;
309
+ }
310
+ function ke() {
311
+ try {
312
+ localStorage.removeItem(oe);
313
+ } catch {
314
+ }
315
+ }
316
+ const de = 1e7;
317
+ function me(a) {
318
+ return a >= 1e6 ? `${(a / 1e6).toFixed(1)}M` : a >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : `${a}`;
319
+ }
320
+ function st(a) {
321
+ return `# OpenAI 兼容
322
+ curl -X POST ${a}/v1/chat/completions \\
323
+ -H "Content-Type: application/json" \\
324
+ -H "Authorization: Bearer ft-xxx" \\
325
+ -d '{
326
+ "model": "qwen3.6-flash",
327
+ "messages": [{"role":"user","content":"你好"}],
328
+ "stream": true
329
+ }'`;
330
+ }
331
+ function ot(a) {
332
+ return `# Anthropic 兼容
333
+ curl -X POST ${a}/v1/messages \\
334
+ -H "Content-Type: application/json" \\
335
+ -H "x-api-key: ft-xxx" \\
336
+ -d '{
337
+ "model": "qwen3.6-flash",
338
+ "messages": [{"role":"user","content":"你好"}]
339
+ }'`;
340
+ }
341
+ function lt() {
342
+ const [a, o] = k("personal"), [c, d] = k([]), [g, D] = k([]), [w, T] = k(!0), [C, x] = k(!1), [b, P] = k(!1), [l, p] = k(""), [h, I] = k({ open: !1 }), [M, u] = k(null), [N, K] = k(null), [J, R] = k(!1), H = "zifang", ee = "zifang", n = et(), r = $(async () => {
343
+ T(!0);
344
+ try {
345
+ const [i, f] = await Promise.all([
346
+ ce("system-default").catch(() => []),
347
+ ce(H).catch(() => [])
348
+ ]);
349
+ d(i), D(f);
350
+ } finally {
351
+ T(!1);
352
+ }
353
+ }, [H]);
354
+ X(() => {
355
+ r();
356
+ }, [r]);
357
+ const A = () => {
358
+ p(""), P(!0);
359
+ }, y = async () => {
360
+ if (!l.trim()) {
361
+ _.warning("请输入 AK 名称");
362
+ return;
363
+ }
364
+ x(!0);
365
+ try {
366
+ const i = await ye(H, ee, l.trim());
367
+ tt(i.akPrefix, i.apiKey), P(!1), I({
368
+ open: !0,
369
+ apiKey: i.apiKey,
370
+ akPrefix: i.akPrefix
371
+ }), r();
372
+ } catch (i) {
373
+ _.error(i instanceof Error ? i.message : "创建 AK 失败");
374
+ } finally {
375
+ x(!1);
376
+ }
377
+ }, L = (i) => {
378
+ se.confirm({
379
+ title: "确认吊销此 AK?",
380
+ content: "吊销后此 AK 将立即失效,无法恢复。",
381
+ okText: "确认吊销",
382
+ okType: "danger",
383
+ cancelText: "取消",
384
+ onOk: async () => {
385
+ try {
386
+ await Xe(i), _.success("AK 已吊销"), r(), ke();
387
+ } catch (f) {
388
+ _.error(f instanceof Error ? f.message : "吊销失败");
389
+ }
390
+ }
391
+ });
392
+ }, v = (i) => {
393
+ navigator.clipboard.writeText(i).then(() => _.success("已复制到剪贴板")).catch(() => _.warning("复制失败,请手动复制"));
394
+ }, U = (i) => {
395
+ const f = at(i.akPrefix);
396
+ f ? v(f) : (v(i.akPrefix), _.info("完整 AK 未在本地缓存(可能在本设备外创建),已复制前缀"));
397
+ }, te = async (i) => {
398
+ u(i), R(!0), K(null);
399
+ try {
400
+ const f = await Qe(i.id);
401
+ K(f);
402
+ } catch (f) {
403
+ _.error(f instanceof Error ? f.message : "获取用量失败");
404
+ } finally {
405
+ R(!1);
406
+ }
407
+ }, S = () => {
408
+ u(null), K(null);
409
+ }, O = (i) => {
410
+ const f = Object.entries(i);
411
+ if (f.length === 0)
412
+ return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
413
+ const q = Math.max(...f.map(([, m]) => m[1] + m[2]), 1);
414
+ return /* @__PURE__ */ e("div", { className: t.usageBarChart, children: f.map(([m, E]) => {
415
+ const re = E[1] + E[2], ve = re / q * 100;
416
+ return /* @__PURE__ */ s("div", { className: t.usageBarCol, children: [
417
+ /* @__PURE__ */ e(G, { title: `${m}: ${E[0]}次 / ${re} tokens`, children: /* @__PURE__ */ e(
418
+ "div",
419
+ {
420
+ className: t.usageBar,
421
+ style: { height: `${Math.max(ve, 2)}%` }
422
+ }
423
+ ) }),
424
+ /* @__PURE__ */ e("span", { className: t.usageBarLabel, children: m })
425
+ ] }, m);
426
+ }) });
427
+ }, W = (i) => {
428
+ const f = Object.entries(i);
429
+ if (f.length === 0)
430
+ return /* @__PURE__ */ e("span", { className: t.usageEmpty, children: "暂无数据" });
431
+ const q = Math.max(...f.map(([, m]) => m[0]), 1);
432
+ return /* @__PURE__ */ e("div", { className: t.modelBreakdown, children: f.sort((m, E) => E[1][0] - m[1][0]).map(([m, E]) => /* @__PURE__ */ s("div", { className: t.modelBreakdownRow, children: [
433
+ /* @__PURE__ */ e("span", { className: t.modelBreakdownName, children: m }),
434
+ /* @__PURE__ */ e("div", { className: t.modelBreakdownBar, children: /* @__PURE__ */ e(
435
+ "div",
436
+ {
437
+ className: t.modelBreakdownFill,
438
+ style: { width: `${E[0] / q * 100}%` }
439
+ }
440
+ ) }),
441
+ /* @__PURE__ */ s("span", { className: t.modelBreakdownCount, children: [
442
+ E[0],
443
+ "次 / ",
444
+ E[1],
445
+ "tokens"
446
+ ] })
447
+ ] }, m)) });
448
+ }, ae = [
449
+ {
450
+ title: "时间",
451
+ dataIndex: "createTime",
452
+ key: "createTime",
453
+ width: 160,
454
+ render: (i) => i ? new Date(i).toLocaleString("zh-CN") : "-"
455
+ },
456
+ { title: "模型", dataIndex: "model", key: "model", width: 140 },
457
+ {
458
+ title: "协议",
459
+ dataIndex: "protocol",
460
+ key: "protocol",
461
+ width: 90,
462
+ render: (i) => /* @__PURE__ */ e(F, { children: i })
463
+ },
464
+ {
465
+ title: "输入",
466
+ dataIndex: "promptTokens",
467
+ key: "promptTokens",
468
+ width: 70
469
+ },
470
+ {
471
+ title: "输出",
472
+ dataIndex: "completionTokens",
473
+ key: "completionTokens",
474
+ width: 70
475
+ },
476
+ {
477
+ title: "总Token",
478
+ dataIndex: "totalTokens",
479
+ key: "totalTokens",
480
+ width: 80
481
+ },
482
+ {
483
+ title: "耗时",
484
+ dataIndex: "latencyMs",
485
+ key: "latencyMs",
486
+ width: 70,
487
+ render: (i) => i ? `${i}ms` : "-"
488
+ },
489
+ {
490
+ title: "状态",
491
+ dataIndex: "statusCode",
492
+ key: "statusCode",
493
+ width: 60,
494
+ render: (i) => i ? /* @__PURE__ */ e(F, { color: i < 400 ? "green" : "red", children: i }) : "-"
495
+ }
496
+ ], ie = (i, f) => {
497
+ const q = Array.isArray(i) ? i : [];
498
+ return w ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ e(Q, { description: "加载中..." }) }) : q.length === 0 ? /* @__PURE__ */ e("div", { className: t.akEmpty, children: f ? "暂无应用 AK" : "暂无个人 AK,点击上方按钮生成" }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: q.map((m) => /* @__PURE__ */ s(
499
+ "div",
500
+ {
501
+ className: t.akCard,
502
+ onClick: () => te(m),
503
+ children: [
504
+ /* @__PURE__ */ s("div", { className: t.akCardRow, children: [
505
+ /* @__PURE__ */ e("span", { className: t.akTitle, children: m.description || m.akPrefix.replace("...", "**") }),
506
+ /* @__PURE__ */ e("code", { className: t.akPrefixSmall, children: m.akPrefix.replace("...", "**") }),
507
+ /* @__PURE__ */ e(
508
+ "span",
509
+ {
510
+ className: `${t.akStatus} ${m.active ? t.akStatusActive : t.akStatusRevoked}`,
511
+ children: m.active ? "活跃" : "已吊销"
512
+ }
513
+ ),
514
+ m.defaultModel && /* @__PURE__ */ s(F, { style: { fontSize: 11 }, children: [
515
+ "默认: ",
516
+ m.defaultModel
517
+ ] }),
518
+ /* @__PURE__ */ s(
519
+ "div",
520
+ {
521
+ className: t.akCardActions,
522
+ onClick: (E) => E.stopPropagation(),
523
+ children: [
524
+ /* @__PURE__ */ e(G, { title: "复制完整 AK", children: /* @__PURE__ */ e(
525
+ B,
526
+ {
527
+ size: "small",
528
+ icon: /* @__PURE__ */ e(Y, {}),
529
+ onClick: () => U(m),
530
+ children: "复制"
531
+ }
532
+ ) }),
533
+ !f && m.active && /* @__PURE__ */ e(
534
+ B,
535
+ {
536
+ size: "small",
537
+ danger: !0,
538
+ icon: /* @__PURE__ */ e(Ae, {}),
539
+ onClick: () => L(m.id),
540
+ children: "吊销"
541
+ }
542
+ )
543
+ ]
544
+ }
545
+ )
546
+ ] }),
547
+ /* @__PURE__ */ s("div", { className: t.akCardRow2, children: [
548
+ /* @__PURE__ */ e("div", { className: t.akMiniBar, children: /* @__PURE__ */ e(
549
+ "div",
550
+ {
551
+ className: t.akMiniBarFill,
552
+ style: {
553
+ width: `${Math.min(
554
+ (m.totalTokens || 0) / (m.tokenQuota || de) * 100,
555
+ 100
556
+ )}%`
557
+ }
558
+ }
559
+ ) }),
560
+ /* @__PURE__ */ s("span", { className: t.akUsageText, children: [
561
+ me(m.totalTokens || 0),
562
+ " /",
563
+ " ",
564
+ me(m.tokenQuota || de)
565
+ ] }),
566
+ /* @__PURE__ */ s("span", { className: t.akMetaText, children: [
567
+ m.totalRequests || 0,
568
+ " 次请求"
569
+ ] }),
570
+ /* @__PURE__ */ e("span", { className: t.akMetaText, children: new Date(m.createTime).toLocaleDateString("zh-CN") })
571
+ ] })
572
+ ]
573
+ },
574
+ m.id
575
+ )) });
576
+ };
577
+ return /* @__PURE__ */ s("div", { className: t.akContainer, children: [
578
+ /* @__PURE__ */ s("div", { className: t.akIntegrationPanel, children: [
579
+ /* @__PURE__ */ e("h4", { className: t.akIntegrationTitle, children: "协议接入地址" }),
580
+ /* @__PURE__ */ s("div", { className: t.akBaseUrlRow, children: [
581
+ /* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
582
+ /* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "OpenAI 兼容" }),
583
+ /* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: n }),
584
+ /* @__PURE__ */ e(G, { title: "复制 Base URL", children: /* @__PURE__ */ e(
585
+ Y,
586
+ {
587
+ className: t.akCopyIcon,
588
+ onClick: () => v(n)
589
+ }
590
+ ) })
591
+ ] }),
592
+ /* @__PURE__ */ s("div", { className: t.akBaseUrlItem, children: [
593
+ /* @__PURE__ */ e("span", { className: t.akBaseUrlLabel, children: "Anthropic 兼容" }),
594
+ /* @__PURE__ */ e("code", { className: t.akBaseUrlValue, children: n }),
595
+ /* @__PURE__ */ e(G, { title: "复制 Base URL", children: /* @__PURE__ */ e(
596
+ Y,
597
+ {
598
+ className: t.akCopyIcon,
599
+ onClick: () => v(n)
600
+ }
601
+ ) })
602
+ ] })
603
+ ] }),
604
+ /* @__PURE__ */ s("div", { className: t.akIntegrationGrid, children: [
605
+ /* @__PURE__ */ s("div", { children: [
606
+ /* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "OpenAI 兼容 — curl 示例" }),
607
+ /* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: st(n) })
608
+ ] }),
609
+ /* @__PURE__ */ s("div", { children: [
610
+ /* @__PURE__ */ e("p", { className: t.akCodeLabel, children: "Anthropic 兼容 — curl 示例" }),
611
+ /* @__PURE__ */ e("pre", { className: t.akCodeBlock, children: ot(n) })
612
+ ] })
613
+ ] })
614
+ ] }),
615
+ /* @__PURE__ */ s("div", { children: [
616
+ /* @__PURE__ */ s(
617
+ "div",
618
+ {
619
+ style: {
620
+ display: "flex",
621
+ justifyContent: "space-between",
622
+ alignItems: "center",
623
+ marginBottom: 12
624
+ },
625
+ children: [
626
+ /* @__PURE__ */ e(
627
+ De,
628
+ {
629
+ activeKey: a,
630
+ onChange: (i) => o(i),
631
+ items: [
632
+ { key: "app", label: "应用 AK" },
633
+ { key: "personal", label: "个人 AK" }
634
+ ],
635
+ style: { flex: 1 }
636
+ }
637
+ ),
638
+ /* @__PURE__ */ s("div", { style: { display: "flex", gap: 8 }, children: [
639
+ /* @__PURE__ */ e(B, { icon: /* @__PURE__ */ e(Ne, {}), onClick: r, size: "small", children: "刷新" }),
640
+ a === "personal" && /* @__PURE__ */ e(
641
+ B,
642
+ {
643
+ type: "primary",
644
+ icon: /* @__PURE__ */ e(pe, {}),
645
+ onClick: A,
646
+ loading: C,
647
+ children: "生成 AK"
648
+ }
649
+ )
650
+ ] })
651
+ ]
652
+ }
653
+ ),
654
+ a === "app" ? ie(c, !0) : ie(g, !1)
655
+ ] }),
656
+ /* @__PURE__ */ s(
657
+ se,
658
+ {
659
+ open: b,
660
+ title: "生成新 AK",
661
+ onCancel: () => P(!1),
662
+ onOk: y,
663
+ okText: "确认生成",
664
+ cancelText: "取消",
665
+ confirmLoading: C,
666
+ children: [
667
+ /* @__PURE__ */ e(
668
+ "div",
669
+ {
670
+ style: {
671
+ marginBottom: 8,
672
+ color: "var(--text-secondary)",
673
+ fontSize: 13
674
+ },
675
+ children: "请输入 AK 名称(用于标识此密钥的用途)"
676
+ }
677
+ ),
678
+ /* @__PURE__ */ e(
679
+ ue,
680
+ {
681
+ placeholder: "例如:测试用 AK、生产网关 AK",
682
+ value: l,
683
+ onChange: (i) => p(i.target.value),
684
+ onPressEnter: y,
685
+ maxLength: 50,
686
+ autoFocus: !0
687
+ }
688
+ )
689
+ ]
690
+ }
691
+ ),
692
+ /* @__PURE__ */ s(
693
+ se,
694
+ {
695
+ open: h.open,
696
+ title: "AK 创建成功",
697
+ onCancel: () => I({ open: !1 }),
698
+ footer: [
699
+ /* @__PURE__ */ e(
700
+ B,
701
+ {
702
+ icon: /* @__PURE__ */ e(Y, {}),
703
+ onClick: () => h.apiKey && v(h.apiKey),
704
+ children: "复制 AK"
705
+ },
706
+ "copy"
707
+ ),
708
+ /* @__PURE__ */ e(
709
+ B,
710
+ {
711
+ type: "primary",
712
+ onClick: () => I({ open: !1 }),
713
+ children: "我已保存"
714
+ },
715
+ "close"
716
+ )
717
+ ],
718
+ children: [
719
+ /* @__PURE__ */ e("div", { style: { marginBottom: 8, color: "#faad14", fontSize: 14 }, children: "请立即保存此 AK,关闭后将无法再次查看完整密钥。" }),
720
+ /* @__PURE__ */ e(
721
+ "div",
722
+ {
723
+ style: {
724
+ background: "var(--bg-tertiary, #f6f8fa)",
725
+ padding: "12px 14px",
726
+ borderRadius: 8,
727
+ fontFamily: "SF Mono, Fira Code, monospace",
728
+ fontSize: 13,
729
+ wordBreak: "break-all",
730
+ userSelect: "all"
731
+ },
732
+ children: h.apiKey
733
+ }
734
+ ),
735
+ /* @__PURE__ */ s("div", { style: { marginTop: 8, fontSize: 12, color: "var(--text-muted)" }, children: [
736
+ "前缀: ",
737
+ h.akPrefix
738
+ ] })
739
+ ]
740
+ }
741
+ ),
742
+ /* @__PURE__ */ e(
743
+ $e,
744
+ {
745
+ title: M ? /* @__PURE__ */ s("span", { children: [
746
+ "AK 详情 — ",
747
+ /* @__PURE__ */ e("code", { children: M.akPrefix })
748
+ ] }) : "AK 详情",
749
+ open: !!M,
750
+ onClose: S,
751
+ size: "large",
752
+ children: J ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Q, { description: "加载用量数据..." }) }) : N ? /* @__PURE__ */ s("div", { className: t.usageDrawerContent, children: [
753
+ /* @__PURE__ */ s("div", { className: t.usageStatsGrid, children: [
754
+ /* @__PURE__ */ e(j, { title: "总请求数", value: N.totalRequests }),
755
+ /* @__PURE__ */ e(j, { title: "总 Token", value: N.totalTokens }),
756
+ /* @__PURE__ */ e(
757
+ j,
758
+ {
759
+ title: "输入 Token",
760
+ value: N.totalPromptTokens
761
+ }
762
+ ),
763
+ /* @__PURE__ */ e(
764
+ j,
765
+ {
766
+ title: "输出 Token",
767
+ value: N.totalCompletionTokens
768
+ }
769
+ ),
770
+ /* @__PURE__ */ e(
771
+ j,
772
+ {
773
+ title: "平均耗时",
774
+ value: N.avgLatencyMs,
775
+ suffix: "ms"
776
+ }
777
+ ),
778
+ /* @__PURE__ */ e(
779
+ j,
780
+ {
781
+ title: "错误数",
782
+ value: N.errorCount,
783
+ styles: {
784
+ content: {
785
+ color: N.errorCount > 0 ? "#ff4d4f" : void 0
786
+ }
787
+ }
788
+ }
789
+ )
790
+ ] }),
791
+ /* @__PURE__ */ s("div", { className: t.usageSection, children: [
792
+ /* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "每日调用曲线(近 30 天)" }),
793
+ O(N.daily)
794
+ ] }),
795
+ /* @__PURE__ */ s("div", { className: t.usageSection, children: [
796
+ /* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "模型用量分布" }),
797
+ W(N.models)
798
+ ] }),
799
+ /* @__PURE__ */ s("div", { className: t.usageSection, children: [
800
+ /* @__PURE__ */ e("h4", { className: t.usageSectionTitle, children: "最近调用记录" }),
801
+ /* @__PURE__ */ e(
802
+ Le,
803
+ {
804
+ columns: ae,
805
+ dataSource: N.recent,
806
+ rowKey: "id",
807
+ size: "small",
808
+ pagination: { pageSize: 10, size: "small" },
809
+ scroll: { x: 760 }
810
+ }
811
+ )
812
+ ] })
813
+ ] }) : /* @__PURE__ */ e("div", { className: t.usageEmpty, children: "暂无用量数据" })
814
+ }
815
+ )
816
+ ] });
817
+ }
818
+ function it(a) {
819
+ const o = [];
820
+ if (!a) return o;
821
+ const c = /<(think|thinking|reasoning)>([\s\S]*?)<\/\1>/gi;
822
+ let d = 0, g;
823
+ for (; (g = c.exec(a)) !== null; )
824
+ g.index > d && o.push({ type: "text", text: a.slice(d, g.index) }), o.push({ type: "think", text: g[2] }), d = g.index + g[0].length;
825
+ return d < a.length && o.push({ type: "text", text: a.slice(d) }), o;
826
+ }
827
+ const Z = 4;
828
+ let rt = 0;
829
+ function ct({ initialModels: a }) {
830
+ const [o, c] = k([]), [d, g] = k([]), [D, w] = k(!0), [T, C] = k(""), [x, b] = k(!1), P = ne(""), l = ne(/* @__PURE__ */ new Map()), p = ne(/* @__PURE__ */ new Map());
831
+ X(() => {
832
+ (async () => {
833
+ try {
834
+ const n = await fe();
835
+ g(n), w(!1);
836
+ const A = (a.length > 0 ? a : n.length > 0 ? [n[0].modelName] : ["qwen3.6-flash"]).slice(0, Z).map((y) => V(y));
837
+ c(A);
838
+ } catch {
839
+ w(!1), c([V(a[0] || "qwen3.6-flash")]);
840
+ }
841
+ })();
842
+ }, []), X(() => {
843
+ if (a.length > 0 && d.length > 0) {
844
+ const n = a.slice(0, Z).map((r) => V(r));
845
+ c(n);
846
+ }
847
+ }, [a.join(",")]);
848
+ const h = $((n) => {
849
+ const r = p.current.get(n);
850
+ r && (r.scrollTop = r.scrollHeight);
851
+ }, []), I = $(
852
+ (n, r) => {
853
+ c((A) => A.map((y) => y.id === n ? r(y) : y));
854
+ },
855
+ []
856
+ ), M = $(async () => {
857
+ if (P.current) return P.current;
858
+ const n = await nt();
859
+ return P.current = n, n;
860
+ }, []), u = $(async () => {
861
+ const n = T.trim();
862
+ if (!n || x) return;
863
+ let r;
864
+ try {
865
+ r = await M();
866
+ } catch {
867
+ return;
868
+ }
869
+ C(""), b(!0);
870
+ const A = o.map((v) => ({
871
+ ...v,
872
+ messages: [
873
+ ...v.messages,
874
+ { role: "user", content: n },
875
+ { role: "assistant", content: "" }
876
+ ],
877
+ streamingContent: "",
878
+ isStreaming: !0,
879
+ error: null,
880
+ usage: null
881
+ }));
882
+ c(A);
883
+ const y = A;
884
+ y.forEach((v) => {
885
+ const U = new AbortController();
886
+ l.current.set(v.id, U);
887
+ const te = v.messages.slice(0, -1);
888
+ Ve(r, v.model, te, {
889
+ onDelta: (S) => {
890
+ I(v.id, (O) => ({
891
+ ...O,
892
+ streamingContent: O.streamingContent + S,
893
+ messages: O.messages.map(
894
+ (W, ae) => ae === O.messages.length - 1 ? { ...W, content: O.streamingContent + S } : W
895
+ )
896
+ })), h(v.id);
897
+ },
898
+ onDone: (S) => {
899
+ I(v.id, (O) => ({
900
+ ...O,
901
+ isStreaming: !1,
902
+ usage: S ? {
903
+ promptTokens: S.promptTokens,
904
+ completionTokens: S.completionTokens,
905
+ totalTokens: S.totalTokens
906
+ } : null
907
+ })), l.current.delete(v.id);
908
+ },
909
+ onError: (S) => {
910
+ (S.message.includes("401") || S.message.includes("API key")) && (ke(), P.current = ""), I(v.id, (O) => ({
911
+ ...O,
912
+ isStreaming: !1,
913
+ error: S.message
914
+ })), l.current.delete(v.id);
915
+ },
916
+ signal: U.signal
917
+ }).catch(() => {
918
+ });
919
+ });
920
+ const L = setInterval(() => {
921
+ y.every(
922
+ (U) => !l.current.has(U.id)
923
+ ) && (clearInterval(L), b(!1));
924
+ }, 200);
925
+ setTimeout(() => {
926
+ clearInterval(L), b(!1);
927
+ }, 300 * 1e3);
928
+ }, [T, x, o, M, I, h]), N = $(() => {
929
+ l.current.forEach((n) => n.abort()), l.current.clear(), c((n) => n.map((r) => ({ ...r, isStreaming: !1 }))), b(!1);
930
+ }, []), K = $(() => {
931
+ var r, A;
932
+ if (o.length >= Z) return;
933
+ const n = ((r = d.find((y) => !o.some((L) => L.model === y.modelName))) == null ? void 0 : r.modelName) || ((A = d[0]) == null ? void 0 : A.modelName) || "qwen3.6-flash";
934
+ c((y) => [...y, V(n)]);
935
+ }, [o, d]), J = $(() => {
936
+ l.current.forEach((n) => n.abort()), l.current.clear(), c(
937
+ (n) => n.map((r) => ({
938
+ ...r,
939
+ messages: [],
940
+ streamingContent: "",
941
+ isStreaming: !1,
942
+ error: null,
943
+ usage: null
944
+ }))
945
+ ), b(!1);
946
+ }, [x, o]), R = $((n) => {
947
+ const r = l.current.get(n);
948
+ r && r.abort(), l.current.delete(n), c((A) => A.filter((y) => y.id !== n));
949
+ }, []), H = $(
950
+ (n, r) => {
951
+ I(n, (A) => ({ ...A, model: r }));
952
+ },
953
+ [I]
954
+ ), ee = d.map((n) => ({
955
+ label: n.modelName,
956
+ value: n.modelName
957
+ }));
958
+ return D ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Q, { description: "加载模型列表..." }) }) : /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
959
+ /* @__PURE__ */ s("div", { className: t.chatHeader, children: [
960
+ /* @__PURE__ */ s("h3", { className: t.chatTitle, children: [
961
+ "模型对话",
962
+ o.length > 1 && /* @__PURE__ */ s(F, { color: "blue", style: { marginLeft: 12, fontSize: 12 }, children: [
963
+ o.length,
964
+ " 个模型对比"
965
+ ] })
966
+ ] }),
967
+ /* @__PURE__ */ e(
968
+ B,
969
+ {
970
+ size: "small",
971
+ icon: /* @__PURE__ */ e(we, {}),
972
+ onClick: J,
973
+ disabled: x || o.every((n) => n.messages.length === 0),
974
+ children: "清空重新来"
975
+ }
976
+ )
977
+ ] }),
978
+ /* @__PURE__ */ s("div", { className: t.chatPanels, children: [
979
+ o.map((n) => /* @__PURE__ */ s("div", { className: t.chatPanel, children: [
980
+ /* @__PURE__ */ s("div", { className: t.chatPanelHeader, children: [
981
+ /* @__PURE__ */ e(
982
+ _e,
983
+ {
984
+ size: "small",
985
+ value: n.model,
986
+ onChange: (r) => H(n.id, r),
987
+ options: ee,
988
+ style: { minWidth: 140, flex: 1 },
989
+ showSearch: !0,
990
+ optionFilterProp: "label"
991
+ }
992
+ ),
993
+ o.length > 1 && /* @__PURE__ */ e(
994
+ "span",
995
+ {
996
+ className: t.chatPanelClose,
997
+ onClick: () => R(n.id),
998
+ children: /* @__PURE__ */ e(Te, {})
999
+ }
1000
+ )
1001
+ ] }),
1002
+ /* @__PURE__ */ s(
1003
+ "div",
1004
+ {
1005
+ className: t.chatPanelBody,
1006
+ ref: (r) => {
1007
+ p.current.set(n.id, r);
1008
+ },
1009
+ children: [
1010
+ n.messages.map((r, A) => /* @__PURE__ */ s(
1011
+ "div",
1012
+ {
1013
+ className: r.role === "user" ? t.chatMsgUser : t.chatMsgAI,
1014
+ children: [
1015
+ r.role === "assistant" ? it(r.content).map(
1016
+ (y, L) => y.type === "think" ? /* @__PURE__ */ s(
1017
+ "details",
1018
+ {
1019
+ className: t.chatThinkBlock,
1020
+ children: [
1021
+ /* @__PURE__ */ e("summary", { children: "思考过程" }),
1022
+ /* @__PURE__ */ e("pre", { children: y.text })
1023
+ ]
1024
+ },
1025
+ L
1026
+ ) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: y.text }, L)
1027
+ ) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: r.content }),
1028
+ n.isStreaming && A === n.messages.length - 1 && r.role === "assistant" && /* @__PURE__ */ e("span", { className: t.chatStreamingCursor })
1029
+ ]
1030
+ },
1031
+ A
1032
+ )),
1033
+ n.error && /* @__PURE__ */ e("div", { className: t.chatMsgError, children: n.error }),
1034
+ n.usage && /* @__PURE__ */ s("div", { className: t.chatUsageBar, children: [
1035
+ /* @__PURE__ */ s("span", { children: [
1036
+ "输入: ",
1037
+ n.usage.promptTokens
1038
+ ] }),
1039
+ /* @__PURE__ */ s("span", { children: [
1040
+ "输出: ",
1041
+ n.usage.completionTokens
1042
+ ] })
1043
+ ] })
1044
+ ]
1045
+ }
1046
+ )
1047
+ ] }, n.id)),
1048
+ o.length < Z && /* @__PURE__ */ e(G, { title: "添加面板", children: /* @__PURE__ */ e("div", { className: t.addPanelBtn, onClick: K, children: /* @__PURE__ */ e(pe, {}) }) })
1049
+ ] }),
1050
+ /* @__PURE__ */ s("div", { className: t.chatInputBar, children: [
1051
+ /* @__PURE__ */ e(
1052
+ ue.TextArea,
1053
+ {
1054
+ className: t.chatInput,
1055
+ value: T,
1056
+ onChange: (n) => C(n.target.value),
1057
+ placeholder: "输入消息,所有面板将同时收到并流式输出...",
1058
+ autoSize: { minRows: 1, maxRows: 4 },
1059
+ onPressEnter: (n) => {
1060
+ n.shiftKey || (n.preventDefault(), u());
1061
+ },
1062
+ disabled: x
1063
+ }
1064
+ ),
1065
+ x ? /* @__PURE__ */ e(B, { danger: !0, onClick: N, children: "停止" }) : /* @__PURE__ */ s(B, { type: "primary", onClick: u, disabled: !T.trim(), children: [
1066
+ /* @__PURE__ */ e(Ce, {}),
1067
+ " 发送"
1068
+ ] })
1069
+ ] })
1070
+ ] });
1071
+ }
1072
+ function V(a) {
1073
+ return {
1074
+ id: ++rt,
1075
+ model: a,
1076
+ messages: [],
1077
+ streamingContent: "",
1078
+ isStreaming: !1,
1079
+ error: null,
1080
+ usage: null
1081
+ };
1082
+ }
1083
+ function dt({ onStartChat: a }) {
1084
+ const [o, c] = k([]), [d, g] = k(!0), [D, w] = k(/* @__PURE__ */ new Set());
1085
+ X(() => {
1086
+ let l = !1;
1087
+ return (async () => {
1088
+ try {
1089
+ const p = await fe();
1090
+ l || (c(p), g(!1));
1091
+ } catch {
1092
+ l || g(!1);
1093
+ }
1094
+ })(), () => {
1095
+ l = !0;
1096
+ };
1097
+ }, []);
1098
+ const T = (l) => {
1099
+ w((p) => {
1100
+ const h = new Set(p);
1101
+ return h.has(l) ? h.delete(l) : h.add(l), h;
1102
+ });
1103
+ }, C = Array.from(D), x = (l) => {
1104
+ a([l]);
1105
+ }, b = () => {
1106
+ C.length > 0 && a(C);
1107
+ }, P = (l) => {
1108
+ if (!l) return "default";
1109
+ const p = l.toLowerCase();
1110
+ return p.includes("aliyun") || p.includes("ali") ? "blue" : p.includes("zhipu") || p.includes("glm") ? "purple" : p.includes("moonshot") || p.includes("kimi") ? "cyan" : p.includes("minimax") ? "orange" : "default";
1111
+ };
1112
+ return d ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Q, { description: "加载模型列表..." }) }) : /* @__PURE__ */ s("div", { children: [
1113
+ /* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
1114
+ /* @__PURE__ */ e("h3", { className: t.modelMgmtTitle, children: "模型管理" }),
1115
+ /* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "数据库管理的可用模型,可选择单个或多个模型发起对话对比" })
1116
+ ] }),
1117
+ /* @__PURE__ */ e("div", { className: t.modelGrid, children: o.map((l) => {
1118
+ const p = D.has(l.modelName);
1119
+ return /* @__PURE__ */ s(
1120
+ "div",
1121
+ {
1122
+ className: `${t.modelCard} ${p ? t.modelCardSelected : ""}`,
1123
+ onClick: () => T(l.modelName),
1124
+ children: [
1125
+ /* @__PURE__ */ e(
1126
+ ze,
1127
+ {
1128
+ className: t.modelCheckbox,
1129
+ checked: p,
1130
+ onChange: (h) => {
1131
+ h.stopPropagation(), T(l.modelName);
1132
+ }
1133
+ }
1134
+ ),
1135
+ /* @__PURE__ */ s("div", { className: t.modelCardHeader, children: [
1136
+ /* @__PURE__ */ e("div", { className: t.modelIconWrap, children: /* @__PURE__ */ e(he, {}) }),
1137
+ /* @__PURE__ */ s("div", { className: t.modelCardInfo, children: [
1138
+ /* @__PURE__ */ e("h4", { className: t.modelName, children: l.modelName }),
1139
+ /* @__PURE__ */ s("div", { className: t.modelTags, children: [
1140
+ l.modelProvider && /* @__PURE__ */ e(
1141
+ F,
1142
+ {
1143
+ color: P(l.modelProvider),
1144
+ style: { fontSize: 11, margin: 0 },
1145
+ children: l.modelProvider
1146
+ }
1147
+ ),
1148
+ /* @__PURE__ */ e(F, { style: { fontSize: 11, margin: 0 }, children: l.apiType })
1149
+ ] })
1150
+ ] })
1151
+ ] }),
1152
+ /* @__PURE__ */ e("p", { className: t.modelEndpoint, children: l.endpoint }),
1153
+ /* @__PURE__ */ e("div", { className: t.modelCardFooter, children: /* @__PURE__ */ e(
1154
+ B,
1155
+ {
1156
+ type: "link",
1157
+ size: "small",
1158
+ onClick: (h) => {
1159
+ h.stopPropagation(), x(l.modelName);
1160
+ },
1161
+ children: "发起对话"
1162
+ }
1163
+ ) })
1164
+ ]
1165
+ },
1166
+ l.modelName
1167
+ );
1168
+ }) }),
1169
+ C.length > 0 && /* @__PURE__ */ s("div", { className: t.modelActionBar, children: [
1170
+ /* @__PURE__ */ s("span", { className: t.modelSelectionCount, children: [
1171
+ "已选择 ",
1172
+ C.length,
1173
+ " 个模型"
1174
+ ] }),
1175
+ /* @__PURE__ */ e(
1176
+ B,
1177
+ {
1178
+ type: "primary",
1179
+ onClick: b,
1180
+ disabled: C.length === 0,
1181
+ children: "批量对比"
1182
+ }
1183
+ )
1184
+ ] })
1185
+ ] });
1186
+ }
1187
+ const mt = [
1188
+ // 模型与对话
1189
+ { key: "model-management", label: "模型管理", icon: /* @__PURE__ */ e(xe, {}) },
1190
+ { key: "model-chat", label: "模型对话", icon: /* @__PURE__ */ e(Pe, {}) },
1191
+ { key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(Se, {}) },
1192
+ // Agent 应用
1193
+ { key: "agent-app", label: "Agent 应用", icon: /* @__PURE__ */ e(he, {}) },
1194
+ { key: "agent-instance", label: "多 Agent 实例", icon: /* @__PURE__ */ e(be, {}) },
1195
+ { key: "template-market", label: "模板市场", icon: /* @__PURE__ */ e(Ie, {}) },
1196
+ // 协议与扩展
1197
+ { key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(Me, {}) },
1198
+ { key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(Ke, {}) },
1199
+ // 监控与调试
1200
+ { key: "agent-dashboard", label: "Agent 监控", icon: /* @__PURE__ */ e(Oe, {}) },
1201
+ { key: "debug-console", label: "Debug 调试台", icon: /* @__PURE__ */ e(Ee, {}) }
1202
+ ];
1203
+ function At() {
1204
+ const [a, o] = k("model-management"), [c, d] = k([]), g = (w) => {
1205
+ d(w), o("model-chat");
1206
+ }, D = Be(() => mt, []);
1207
+ return /* @__PURE__ */ s("div", { className: t.container, children: [
1208
+ /* @__PURE__ */ e("aside", { className: t.sidebar, children: /* @__PURE__ */ e("nav", { className: t.menuList, children: D.map((w) => /* @__PURE__ */ s(
1209
+ "div",
1210
+ {
1211
+ className: `${t.menuItem} ${a === w.key ? t.menuItemActive : ""}`,
1212
+ onClick: () => o(w.key),
1213
+ children: [
1214
+ /* @__PURE__ */ e("span", { className: t.menuIcon, children: w.icon }),
1215
+ /* @__PURE__ */ e("span", { children: w.label })
1216
+ ]
1217
+ },
1218
+ w.key
1219
+ )) }) }),
1220
+ /* @__PURE__ */ s("main", { className: t.panelArea, children: [
1221
+ /* @__PURE__ */ e(
1222
+ "div",
1223
+ {
1224
+ style: {
1225
+ display: a === "model-management" ? "block" : "none",
1226
+ height: "100%"
1227
+ },
1228
+ children: /* @__PURE__ */ e(dt, { onStartChat: g })
1229
+ }
1230
+ ),
1231
+ /* @__PURE__ */ e(
1232
+ "div",
1233
+ {
1234
+ style: {
1235
+ display: a === "model-chat" ? "flex" : "none",
1236
+ height: "100%",
1237
+ flexDirection: "column"
1238
+ },
1239
+ children: /* @__PURE__ */ e(ct, { initialModels: c })
1240
+ }
1241
+ ),
1242
+ /* @__PURE__ */ e(
1243
+ "div",
1244
+ {
1245
+ style: {
1246
+ display: a === "ak-management" ? "block" : "none",
1247
+ height: "100%"
1248
+ },
1249
+ children: /* @__PURE__ */ e(lt, {})
1250
+ }
1251
+ ),
1252
+ /* @__PURE__ */ e(
1253
+ "div",
1254
+ {
1255
+ style: {
1256
+ display: a === "agent-app" ? "block" : "none",
1257
+ height: "100%"
1258
+ },
1259
+ children: /* @__PURE__ */ e(Re, {})
1260
+ }
1261
+ ),
1262
+ /* @__PURE__ */ e(
1263
+ "div",
1264
+ {
1265
+ style: {
1266
+ display: a === "agent-instance" ? "block" : "none",
1267
+ height: "100%"
1268
+ },
1269
+ children: /* @__PURE__ */ e(Ue, {})
1270
+ }
1271
+ ),
1272
+ /* @__PURE__ */ e(
1273
+ "div",
1274
+ {
1275
+ style: {
1276
+ display: a === "template-market" ? "block" : "none",
1277
+ height: "100%"
1278
+ },
1279
+ children: /* @__PURE__ */ e(qe, {})
1280
+ }
1281
+ ),
1282
+ /* @__PURE__ */ e(
1283
+ "div",
1284
+ {
1285
+ style: {
1286
+ display: a === "mcp-service" ? "block" : "none",
1287
+ height: "100%"
1288
+ },
1289
+ children: /* @__PURE__ */ e(je, {})
1290
+ }
1291
+ ),
1292
+ /* @__PURE__ */ e(
1293
+ "div",
1294
+ {
1295
+ style: {
1296
+ display: a === "skill-market" ? "block" : "none",
1297
+ height: "100%"
1298
+ },
1299
+ children: /* @__PURE__ */ e(Fe, {})
1300
+ }
1301
+ ),
1302
+ /* @__PURE__ */ e(
1303
+ "div",
1304
+ {
1305
+ style: {
1306
+ display: a === "agent-dashboard" ? "block" : "none",
1307
+ height: "100%"
1308
+ },
1309
+ children: /* @__PURE__ */ e(He, {})
1310
+ }
1311
+ ),
1312
+ /* @__PURE__ */ e(
1313
+ "div",
1314
+ {
1315
+ style: {
1316
+ display: a === "debug-console" ? "block" : "none",
1317
+ height: "100%"
1318
+ },
1319
+ children: /* @__PURE__ */ e(Ge, {})
1320
+ }
1321
+ )
1322
+ ] })
1323
+ ] });
1324
+ }
1325
+ export {
1326
+ At as default
1327
+ };