@yuku123/z-team-component 0.2.29 → 0.2.30

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-CG-o5YP1.js → ChangeLogView-FLd1wS8H.js} +1 -1
  2. package/dist/DebugPlayground-cxffrMgF.js +15 -0
  3. package/dist/{InvitationManagementPage-ByJuWwA_.js → InvitationManagementPage-CttWZdu8.js} +90 -85
  4. package/dist/{OnboardingPage-D58h1JK_.js → OnboardingPage-CAI-P20Q.js} +2 -2
  5. package/dist/{ProjectApp-oUbzb0Io.js → ProjectApp-ZR_QUlPs.js} +1486 -1465
  6. package/dist/SmartWorkbench.module-DzQskKT0.js +85 -0
  7. package/dist/{SystemShell-D4mGsT0X.js → SystemShell-BKNdXqXt.js} +151 -153
  8. package/dist/{admin-logs-C2V1ElH9.js → admin-logs-Dv86pFvY.js} +2 -2
  9. package/dist/{api--Fg0hL9Y.js → api-19TXED_O.js} +52 -39
  10. package/dist/api-BNwdLozd.js +20 -0
  11. package/dist/{createWorkspaceWsHandler-CqGqcTh_.js → createWorkspaceWsHandler-CBk4DqP4.js} +6 -5
  12. package/dist/{index-CDKg_qI5.js → index-B5_xKK08.js} +1140 -1153
  13. package/dist/{index-D5u3BjCZ.js → index-BIJnjJd5.js} +2 -2
  14. package/dist/index-BKwpQ-HW.js +1329 -0
  15. package/dist/{index-bbwTcNjB.js → index-BTLD5gUt.js} +3 -3
  16. package/dist/{index-Dky6GVc1.js → index-BTaLAs80.js} +9 -9
  17. package/dist/{index-CiMxCTOS.js → index-B_EBV24V.js} +1 -1
  18. package/dist/{index-BafC42Cl.js → index-Bd57t_yF.js} +1 -1
  19. package/dist/{index-C2aPiQSz.js → index-BjqYiZpC.js} +3 -3
  20. package/dist/{index-BaCiSbPR.js → index-BoGVJ0hC.js} +1 -1
  21. package/dist/{index-C01UUprh.js → index-BpuJ9Njb.js} +7016 -6946
  22. package/dist/{index-CcFJEYgr.js → index-C815hPWS.js} +55 -52
  23. package/dist/{index-D2S8FrNc.js → index-C8GK1bOQ.js} +358 -347
  24. package/dist/{index-DvIHX7lZ.js → index-CcpWacSZ.js} +243 -236
  25. package/dist/{index-Da7ls5q6.js → index-DOPkM2W8.js} +6 -6
  26. package/dist/index-DQNZE7Go.js +169 -0
  27. package/dist/{index-DOVOWiGU.js → index-DR_FCf71.js} +1134 -1132
  28. package/dist/{index-CTD7k9dP.js → index-DYgD6BuB.js} +4 -4
  29. package/dist/{index-BwFEDHy3.js → index-DdN9Apqq.js} +5 -5
  30. package/dist/{index-CRac8IT2.js → index-DuGWlMWm.js} +3 -3
  31. package/dist/{index-Da3doGtf.js → index-JMzBzwiO.js} +57 -54
  32. package/dist/{index-Dao4uqQd.js → index-x4-W5ClM.js} +4 -4
  33. package/dist/index.js +1 -1
  34. package/dist/{instance-1QEDBRqA.js → instance-D951fRuD.js} +1 -1
  35. package/dist/pages.js +1 -1
  36. package/dist/{schedule-C89oiqIR.js → schedule-DD50-7cs.js} +1 -1
  37. package/dist/{send-default-agent-team-message-CxkWi3XC.js → send-default-agent-team-message-Bbs2rMNf.js} +1 -1
  38. package/dist/{sso-user-BE1Ell5F.js → sso-user-BEY5ICaR.js} +1 -1
  39. package/dist/{training-o-vSBkqP.js → training-B-9tNFQw.js} +1 -1
  40. package/dist/{useAppStore-wgWaxcyc.js → useAppStore-BQN-26ns.js} +1 -1
  41. package/dist/{webide-BxD6cYe-.js → webide-P867RFZi.js} +4 -4
  42. package/dist/z-team-component.css +1 -1
  43. package/package.json +2 -2
  44. package/dist/SmartWorkbench.module-xRRmpTTw.js +0 -85
  45. package/dist/api-3-Ykp2ll.js +0 -19
  46. package/dist/index-B8mNsH88.js +0 -1411
  47. package/dist/index-DYDba1NC.js +0 -187
@@ -0,0 +1,1329 @@
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 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 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 "./ProjectApp-ZR_QUlPs.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, x, b, P;
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 K = (x = A[0]) == null ? void 0 : x.delta;
214
+ if (K != null && K.content && d.onDelta(K.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 K = {
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(K);
231
+ return;
232
+ }
233
+ } catch {
234
+ }
235
+ }
236
+ }
237
+ d.onDone();
238
+ } catch (i) {
239
+ if ((P = d.signal) != null && P.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, x] = k(!1), [b, P] = k(!1), [i, p] = k(""), [h, I] = k({ open: !1 }), [M, u] = k(null), [A, K] = 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(""), P(!0);
361
+ }, y = async () => {
362
+ if (!i.trim()) {
363
+ _.warning("请输入 AK 名称");
364
+ return;
365
+ }
366
+ x(!0);
367
+ try {
368
+ const l = await ye(H, ee, i.trim());
369
+ tt(l.akPrefix, l.apiKey), P(!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
+ x(!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), K(null);
401
+ try {
402
+ const f = await Qe(l.id);
403
+ K(f);
404
+ } catch (f) {
405
+ _.error(f instanceof Error ? f.message : "获取用量失败");
406
+ } finally {
407
+ R(!1);
408
+ }
409
+ }, S = () => {
410
+ u(null), K(null);
411
+ }, O = (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: () => P(!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: S,
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
+ O(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: { pageSize: 10, size: "small" },
811
+ scroll: { x: 760 }
812
+ }
813
+ )
814
+ ] })
815
+ ] }) : /* @__PURE__ */ e("div", { className: t.usageEmpty, children: "暂无用量数据" })
816
+ }
817
+ )
818
+ ] });
819
+ }
820
+ function lt(a) {
821
+ const o = [];
822
+ if (!a) return o;
823
+ const c = /<(think|thinking|reasoning)>([\s\S]*?)<\/\1>/gi;
824
+ let d = 0, g;
825
+ for (; (g = c.exec(a)) !== null; )
826
+ 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;
827
+ return d < a.length && o.push({ type: "text", text: a.slice(d) }), o;
828
+ }
829
+ const Z = 4;
830
+ let rt = 0;
831
+ function ct({ initialModels: a }) {
832
+ const [o, c] = k([]), [d, g] = k([]), [D, w] = k(!0), [T, C] = k(""), [x, b] = k(!1), P = ne(""), i = ne(/* @__PURE__ */ new Map()), p = ne(/* @__PURE__ */ new Map());
833
+ X(() => {
834
+ (async () => {
835
+ try {
836
+ const n = await fe();
837
+ g(n), w(!1);
838
+ const N = (a.length > 0 ? a : n.length > 0 ? [n[0].modelName] : ["qwen3.6-flash"]).slice(0, Z).map((y) => V(y));
839
+ c(N);
840
+ } catch {
841
+ w(!1), c([V(a[0] || "qwen3.6-flash")]);
842
+ }
843
+ })();
844
+ }, []), X(() => {
845
+ if (a.length > 0 && d.length > 0) {
846
+ const n = a.slice(0, Z).map((r) => V(r));
847
+ c(n);
848
+ }
849
+ }, [a.join(",")]);
850
+ const h = $((n) => {
851
+ const r = p.current.get(n);
852
+ r && (r.scrollTop = r.scrollHeight);
853
+ }, []), I = $(
854
+ (n, r) => {
855
+ c((N) => N.map((y) => y.id === n ? r(y) : y));
856
+ },
857
+ []
858
+ ), M = $(async () => {
859
+ if (P.current) return P.current;
860
+ const n = await nt();
861
+ return P.current = n, n;
862
+ }, []), u = $(async () => {
863
+ const n = T.trim();
864
+ if (!n || x) return;
865
+ let r;
866
+ try {
867
+ r = await M();
868
+ } catch {
869
+ return;
870
+ }
871
+ C(""), b(!0);
872
+ const N = o.map((v) => ({
873
+ ...v,
874
+ messages: [
875
+ ...v.messages,
876
+ { role: "user", content: n },
877
+ { role: "assistant", content: "" }
878
+ ],
879
+ streamingContent: "",
880
+ isStreaming: !0,
881
+ error: null,
882
+ usage: null
883
+ }));
884
+ c(N);
885
+ const y = N;
886
+ y.forEach((v) => {
887
+ const U = new AbortController();
888
+ i.current.set(v.id, U);
889
+ const te = v.messages.slice(0, -1);
890
+ Ve(r, v.model, te, {
891
+ onDelta: (S) => {
892
+ I(v.id, (O) => ({
893
+ ...O,
894
+ streamingContent: O.streamingContent + S,
895
+ messages: O.messages.map(
896
+ (W, ae) => ae === O.messages.length - 1 ? { ...W, content: O.streamingContent + S } : W
897
+ )
898
+ })), h(v.id);
899
+ },
900
+ onDone: (S) => {
901
+ I(v.id, (O) => ({
902
+ ...O,
903
+ isStreaming: !1,
904
+ usage: S ? {
905
+ promptTokens: S.promptTokens,
906
+ completionTokens: S.completionTokens,
907
+ totalTokens: S.totalTokens
908
+ } : null
909
+ })), i.current.delete(v.id);
910
+ },
911
+ onError: (S) => {
912
+ (S.message.includes("401") || S.message.includes("API key")) && (ke(), P.current = ""), I(v.id, (O) => ({
913
+ ...O,
914
+ isStreaming: !1,
915
+ error: S.message
916
+ })), i.current.delete(v.id);
917
+ },
918
+ signal: U.signal
919
+ }).catch(() => {
920
+ });
921
+ });
922
+ const L = setInterval(() => {
923
+ y.every(
924
+ (U) => !i.current.has(U.id)
925
+ ) && (clearInterval(L), b(!1));
926
+ }, 200);
927
+ setTimeout(() => {
928
+ clearInterval(L), b(!1);
929
+ }, 300 * 1e3);
930
+ }, [T, x, o, M, I, h]), A = $(() => {
931
+ i.current.forEach((n) => n.abort()), i.current.clear(), c((n) => n.map((r) => ({ ...r, isStreaming: !1 }))), b(!1);
932
+ }, []), K = $(() => {
933
+ var r, N;
934
+ if (o.length >= Z) return;
935
+ 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";
936
+ c((y) => [...y, V(n)]);
937
+ }, [o, d]), J = $(() => {
938
+ i.current.forEach((n) => n.abort()), i.current.clear(), c(
939
+ (n) => n.map((r) => ({
940
+ ...r,
941
+ messages: [],
942
+ streamingContent: "",
943
+ isStreaming: !1,
944
+ error: null,
945
+ usage: null
946
+ }))
947
+ ), b(!1);
948
+ }, [x, o]), R = $((n) => {
949
+ const r = i.current.get(n);
950
+ r && r.abort(), i.current.delete(n), c((N) => N.filter((y) => y.id !== n));
951
+ }, []), H = $(
952
+ (n, r) => {
953
+ I(n, (N) => ({ ...N, model: r }));
954
+ },
955
+ [I]
956
+ ), ee = d.map((n) => ({
957
+ label: n.modelName,
958
+ value: n.modelName
959
+ }));
960
+ return D ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Q, { description: "加载模型列表..." }) }) : /* @__PURE__ */ s("div", { className: t.chatContainer, children: [
961
+ /* @__PURE__ */ s("div", { className: t.chatHeader, children: [
962
+ /* @__PURE__ */ s("h3", { className: t.chatTitle, children: [
963
+ "模型对话",
964
+ o.length > 1 && /* @__PURE__ */ s(F, { color: "blue", style: { marginLeft: 12, fontSize: 12 }, children: [
965
+ o.length,
966
+ " 个模型对比"
967
+ ] })
968
+ ] }),
969
+ /* @__PURE__ */ e(
970
+ B,
971
+ {
972
+ size: "small",
973
+ icon: /* @__PURE__ */ e(we, {}),
974
+ onClick: J,
975
+ disabled: x || o.every((n) => n.messages.length === 0),
976
+ children: "清空重新来"
977
+ }
978
+ )
979
+ ] }),
980
+ /* @__PURE__ */ s("div", { className: t.chatPanels, children: [
981
+ o.map((n) => /* @__PURE__ */ s("div", { className: t.chatPanel, children: [
982
+ /* @__PURE__ */ s("div", { className: t.chatPanelHeader, children: [
983
+ /* @__PURE__ */ e(
984
+ _e,
985
+ {
986
+ size: "small",
987
+ value: n.model,
988
+ onChange: (r) => H(n.id, r),
989
+ options: ee,
990
+ style: { minWidth: 140, flex: 1 },
991
+ showSearch: !0,
992
+ optionFilterProp: "label"
993
+ }
994
+ ),
995
+ o.length > 1 && /* @__PURE__ */ e(
996
+ "span",
997
+ {
998
+ className: t.chatPanelClose,
999
+ onClick: () => R(n.id),
1000
+ children: /* @__PURE__ */ e(Te, {})
1001
+ }
1002
+ )
1003
+ ] }),
1004
+ /* @__PURE__ */ s(
1005
+ "div",
1006
+ {
1007
+ className: t.chatPanelBody,
1008
+ ref: (r) => {
1009
+ p.current.set(n.id, r);
1010
+ },
1011
+ children: [
1012
+ n.messages.map((r, N) => /* @__PURE__ */ s(
1013
+ "div",
1014
+ {
1015
+ className: r.role === "user" ? t.chatMsgUser : t.chatMsgAI,
1016
+ children: [
1017
+ r.role === "assistant" ? lt(r.content).map(
1018
+ (y, L) => y.type === "think" ? /* @__PURE__ */ s(
1019
+ "details",
1020
+ {
1021
+ className: t.chatThinkBlock,
1022
+ children: [
1023
+ /* @__PURE__ */ e("summary", { children: "思考过程" }),
1024
+ /* @__PURE__ */ e("pre", { children: y.text })
1025
+ ]
1026
+ },
1027
+ L
1028
+ ) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: y.text }, L)
1029
+ ) : /* @__PURE__ */ e("span", { style: { whiteSpace: "pre-wrap" }, children: r.content }),
1030
+ n.isStreaming && N === n.messages.length - 1 && r.role === "assistant" && /* @__PURE__ */ e("span", { className: t.chatStreamingCursor })
1031
+ ]
1032
+ },
1033
+ N
1034
+ )),
1035
+ n.error && /* @__PURE__ */ e("div", { className: t.chatMsgError, children: n.error }),
1036
+ n.usage && /* @__PURE__ */ s("div", { className: t.chatUsageBar, children: [
1037
+ /* @__PURE__ */ s("span", { children: [
1038
+ "输入: ",
1039
+ n.usage.promptTokens
1040
+ ] }),
1041
+ /* @__PURE__ */ s("span", { children: [
1042
+ "输出: ",
1043
+ n.usage.completionTokens
1044
+ ] })
1045
+ ] })
1046
+ ]
1047
+ }
1048
+ )
1049
+ ] }, n.id)),
1050
+ o.length < Z && /* @__PURE__ */ e(G, { title: "添加面板", children: /* @__PURE__ */ e("div", { className: t.addPanelBtn, onClick: K, children: /* @__PURE__ */ e(pe, {}) }) })
1051
+ ] }),
1052
+ /* @__PURE__ */ s("div", { className: t.chatInputBar, children: [
1053
+ /* @__PURE__ */ e(
1054
+ ue.TextArea,
1055
+ {
1056
+ className: t.chatInput,
1057
+ value: T,
1058
+ onChange: (n) => C(n.target.value),
1059
+ placeholder: "输入消息,所有面板将同时收到并流式输出...",
1060
+ autoSize: { minRows: 1, maxRows: 4 },
1061
+ onPressEnter: (n) => {
1062
+ n.shiftKey || (n.preventDefault(), u());
1063
+ },
1064
+ disabled: x
1065
+ }
1066
+ ),
1067
+ x ? /* @__PURE__ */ e(B, { danger: !0, onClick: A, children: "停止" }) : /* @__PURE__ */ s(B, { type: "primary", onClick: u, disabled: !T.trim(), children: [
1068
+ /* @__PURE__ */ e(Ce, {}),
1069
+ " 发送"
1070
+ ] })
1071
+ ] })
1072
+ ] });
1073
+ }
1074
+ function V(a) {
1075
+ return {
1076
+ id: ++rt,
1077
+ model: a,
1078
+ messages: [],
1079
+ streamingContent: "",
1080
+ isStreaming: !1,
1081
+ error: null,
1082
+ usage: null
1083
+ };
1084
+ }
1085
+ function dt({ onStartChat: a }) {
1086
+ const [o, c] = k([]), [d, g] = k(!0), [D, w] = k(/* @__PURE__ */ new Set());
1087
+ X(() => {
1088
+ let i = !1;
1089
+ return (async () => {
1090
+ try {
1091
+ const p = await fe();
1092
+ i || (c(p), g(!1));
1093
+ } catch {
1094
+ i || g(!1);
1095
+ }
1096
+ })(), () => {
1097
+ i = !0;
1098
+ };
1099
+ }, []);
1100
+ const T = (i) => {
1101
+ w((p) => {
1102
+ const h = new Set(p);
1103
+ return h.has(i) ? h.delete(i) : h.add(i), h;
1104
+ });
1105
+ }, C = Array.from(D), x = (i) => {
1106
+ a([i]);
1107
+ }, b = () => {
1108
+ C.length > 0 && a(C);
1109
+ }, P = (i) => {
1110
+ if (!i) return "default";
1111
+ const p = i.toLowerCase();
1112
+ 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";
1113
+ };
1114
+ return d ? /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: 60 }, children: /* @__PURE__ */ e(Q, { description: "加载模型列表..." }) }) : /* @__PURE__ */ s("div", { children: [
1115
+ /* @__PURE__ */ s("div", { className: t.modelMgmtHeader, children: [
1116
+ /* @__PURE__ */ e("h3", { className: t.modelMgmtTitle, children: "模型管理" }),
1117
+ /* @__PURE__ */ e("p", { className: t.modelMgmtSubtitle, children: "数据库管理的可用模型,可选择单个或多个模型发起对话对比" })
1118
+ ] }),
1119
+ /* @__PURE__ */ e("div", { className: t.modelGrid, children: o.map((i) => {
1120
+ const p = D.has(i.modelName);
1121
+ return /* @__PURE__ */ s(
1122
+ "div",
1123
+ {
1124
+ className: `${t.modelCard} ${p ? t.modelCardSelected : ""}`,
1125
+ onClick: () => T(i.modelName),
1126
+ children: [
1127
+ /* @__PURE__ */ e(
1128
+ ze,
1129
+ {
1130
+ className: t.modelCheckbox,
1131
+ checked: p,
1132
+ onChange: (h) => {
1133
+ h.stopPropagation(), T(i.modelName);
1134
+ }
1135
+ }
1136
+ ),
1137
+ /* @__PURE__ */ s("div", { className: t.modelCardHeader, children: [
1138
+ /* @__PURE__ */ e("div", { className: t.modelIconWrap, children: /* @__PURE__ */ e(he, {}) }),
1139
+ /* @__PURE__ */ s("div", { className: t.modelCardInfo, children: [
1140
+ /* @__PURE__ */ e("h4", { className: t.modelName, children: i.modelName }),
1141
+ /* @__PURE__ */ s("div", { className: t.modelTags, children: [
1142
+ i.modelProvider && /* @__PURE__ */ e(
1143
+ F,
1144
+ {
1145
+ color: P(i.modelProvider),
1146
+ style: { fontSize: 11, margin: 0 },
1147
+ children: i.modelProvider
1148
+ }
1149
+ ),
1150
+ /* @__PURE__ */ e(F, { style: { fontSize: 11, margin: 0 }, children: i.apiType })
1151
+ ] })
1152
+ ] })
1153
+ ] }),
1154
+ /* @__PURE__ */ e("p", { className: t.modelEndpoint, children: i.endpoint }),
1155
+ /* @__PURE__ */ e("div", { className: t.modelCardFooter, children: /* @__PURE__ */ e(
1156
+ B,
1157
+ {
1158
+ type: "link",
1159
+ size: "small",
1160
+ onClick: (h) => {
1161
+ h.stopPropagation(), x(i.modelName);
1162
+ },
1163
+ children: "发起对话"
1164
+ }
1165
+ ) })
1166
+ ]
1167
+ },
1168
+ i.modelName
1169
+ );
1170
+ }) }),
1171
+ C.length > 0 && /* @__PURE__ */ s("div", { className: t.modelActionBar, children: [
1172
+ /* @__PURE__ */ s("span", { className: t.modelSelectionCount, children: [
1173
+ "已选择 ",
1174
+ C.length,
1175
+ " 个模型"
1176
+ ] }),
1177
+ /* @__PURE__ */ e(
1178
+ B,
1179
+ {
1180
+ type: "primary",
1181
+ onClick: b,
1182
+ disabled: C.length === 0,
1183
+ children: "批量对比"
1184
+ }
1185
+ )
1186
+ ] })
1187
+ ] });
1188
+ }
1189
+ const mt = [
1190
+ // 模型与对话
1191
+ { key: "model-management", label: "模型管理", icon: /* @__PURE__ */ e(xe, {}) },
1192
+ { key: "model-chat", label: "模型对话", icon: /* @__PURE__ */ e(Pe, {}) },
1193
+ { key: "ak-management", label: "AK 管理", icon: /* @__PURE__ */ e(Se, {}) },
1194
+ // Agent 应用
1195
+ { key: "agent-app", label: "Agent 应用", icon: /* @__PURE__ */ e(he, {}) },
1196
+ { key: "agent-instance", label: "多 Agent 实例", icon: /* @__PURE__ */ e(be, {}) },
1197
+ { key: "template-market", label: "模板市场", icon: /* @__PURE__ */ e(Ie, {}) },
1198
+ // 协议与扩展
1199
+ { key: "mcp-service", label: "MCP 服务", icon: /* @__PURE__ */ e(Me, {}) },
1200
+ { key: "skill-market", label: "技能市场", icon: /* @__PURE__ */ e(Ke, {}) },
1201
+ // 监控与调试
1202
+ { key: "agent-dashboard", label: "Agent 监控", icon: /* @__PURE__ */ e(Oe, {}) },
1203
+ { key: "debug-console", label: "Debug 调试台", icon: /* @__PURE__ */ e(Ee, {}) }
1204
+ ];
1205
+ function wt() {
1206
+ const [a, o] = k("model-management"), [c, d] = k([]), g = (w) => {
1207
+ d(w), o("model-chat");
1208
+ }, D = Be(() => mt, []);
1209
+ return /* @__PURE__ */ s("div", { className: t.container, children: [
1210
+ /* @__PURE__ */ e("aside", { className: t.sidebar, children: /* @__PURE__ */ e("nav", { className: t.menuList, children: D.map((w) => /* @__PURE__ */ s(
1211
+ "div",
1212
+ {
1213
+ className: `${t.menuItem} ${a === w.key ? t.menuItemActive : ""}`,
1214
+ onClick: () => o(w.key),
1215
+ children: [
1216
+ /* @__PURE__ */ e("span", { className: t.menuIcon, children: w.icon }),
1217
+ /* @__PURE__ */ e("span", { children: w.label })
1218
+ ]
1219
+ },
1220
+ w.key
1221
+ )) }) }),
1222
+ /* @__PURE__ */ s("main", { className: t.panelArea, children: [
1223
+ /* @__PURE__ */ e(
1224
+ "div",
1225
+ {
1226
+ style: {
1227
+ display: a === "model-management" ? "block" : "none",
1228
+ height: "100%"
1229
+ },
1230
+ children: /* @__PURE__ */ e(dt, { onStartChat: g })
1231
+ }
1232
+ ),
1233
+ /* @__PURE__ */ e(
1234
+ "div",
1235
+ {
1236
+ style: {
1237
+ display: a === "model-chat" ? "flex" : "none",
1238
+ height: "100%",
1239
+ flexDirection: "column"
1240
+ },
1241
+ children: /* @__PURE__ */ e(ct, { initialModels: c })
1242
+ }
1243
+ ),
1244
+ /* @__PURE__ */ e(
1245
+ "div",
1246
+ {
1247
+ style: {
1248
+ display: a === "ak-management" ? "block" : "none",
1249
+ height: "100%"
1250
+ },
1251
+ children: /* @__PURE__ */ e(it, {})
1252
+ }
1253
+ ),
1254
+ /* @__PURE__ */ e(
1255
+ "div",
1256
+ {
1257
+ style: {
1258
+ display: a === "agent-app" ? "block" : "none",
1259
+ height: "100%"
1260
+ },
1261
+ children: /* @__PURE__ */ e(Re, {})
1262
+ }
1263
+ ),
1264
+ /* @__PURE__ */ e(
1265
+ "div",
1266
+ {
1267
+ style: {
1268
+ display: a === "agent-instance" ? "block" : "none",
1269
+ height: "100%"
1270
+ },
1271
+ children: /* @__PURE__ */ e(Ue, {})
1272
+ }
1273
+ ),
1274
+ /* @__PURE__ */ e(
1275
+ "div",
1276
+ {
1277
+ style: {
1278
+ display: a === "template-market" ? "block" : "none",
1279
+ height: "100%"
1280
+ },
1281
+ children: /* @__PURE__ */ e(je, {})
1282
+ }
1283
+ ),
1284
+ /* @__PURE__ */ e(
1285
+ "div",
1286
+ {
1287
+ style: {
1288
+ display: a === "mcp-service" ? "block" : "none",
1289
+ height: "100%"
1290
+ },
1291
+ children: /* @__PURE__ */ e(qe, {})
1292
+ }
1293
+ ),
1294
+ /* @__PURE__ */ e(
1295
+ "div",
1296
+ {
1297
+ style: {
1298
+ display: a === "skill-market" ? "block" : "none",
1299
+ height: "100%"
1300
+ },
1301
+ children: /* @__PURE__ */ e(Fe, {})
1302
+ }
1303
+ ),
1304
+ /* @__PURE__ */ e(
1305
+ "div",
1306
+ {
1307
+ style: {
1308
+ display: a === "agent-dashboard" ? "block" : "none",
1309
+ height: "100%"
1310
+ },
1311
+ children: /* @__PURE__ */ e(He, {})
1312
+ }
1313
+ ),
1314
+ /* @__PURE__ */ e(
1315
+ "div",
1316
+ {
1317
+ style: {
1318
+ display: a === "debug-console" ? "block" : "none",
1319
+ height: "100%"
1320
+ },
1321
+ children: /* @__PURE__ */ e(Ge, {})
1322
+ }
1323
+ )
1324
+ ] })
1325
+ ] });
1326
+ }
1327
+ export {
1328
+ wt as default
1329
+ };