@yuku123/z-team-component 0.2.32 → 0.2.33

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