@yzdys/dsh-connect-madao 0.0.0-stage → 0.12.0
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.
- package/CHANGELOG.md +181 -0
- package/FAQ.md +327 -0
- package/INSTALL.md +284 -0
- package/LICENSE +21 -0
- package/README.md +326 -2
- package/cordis.patch.yml +5 -0
- package/icons/dsh-connect-madao-128.png +0 -0
- package/lib/bin.js +3062 -0
- package/lib/client.js +1581 -0
- package/lib/index.d.ts +83 -0
- package/lib/index.js +4212 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +85 -4
package/lib/client.js
ADDED
|
@@ -0,0 +1,1581 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "dsh-connect-madao",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
// src/client/Panel.tsx
|
|
8
|
+
const { useCallback, useEffect, useMemo, useRef, useState } = require("react");
|
|
9
|
+
// src/client/bridge.ts
|
|
10
|
+
var BRIDGE_PORT = 8765;
|
|
11
|
+
var BRIDGE_BASE = `http://127.0.0.1:${BRIDGE_PORT}`;
|
|
12
|
+
async function bridgeJson(path, timeoutMs = 8e3) {
|
|
13
|
+
return request("GET", path, void 0, timeoutMs);
|
|
14
|
+
}
|
|
15
|
+
async function bridgePost(path, body, timeoutMs = 15e3) {
|
|
16
|
+
return request("POST", path, body, timeoutMs);
|
|
17
|
+
}
|
|
18
|
+
async function request(method, path, body, timeoutMs) {
|
|
19
|
+
const ctrl = new AbortController();
|
|
20
|
+
const timer = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetch(`${BRIDGE_BASE}${path}`, {
|
|
23
|
+
method,
|
|
24
|
+
signal: ctrl.signal,
|
|
25
|
+
headers: {
|
|
26
|
+
Accept: "application/json",
|
|
27
|
+
...body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
28
|
+
},
|
|
29
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
30
|
+
});
|
|
31
|
+
if (!res.ok) {
|
|
32
|
+
const text = await res.text().catch(() => "");
|
|
33
|
+
throw new Error(`HTTP ${res.status} ${text.slice(0, 160)}`);
|
|
34
|
+
}
|
|
35
|
+
return await res.json();
|
|
36
|
+
} finally {
|
|
37
|
+
clearTimeout(timer);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/client/settings.ts
|
|
42
|
+
var CHIP_CACHE_KEY = "dsh-connect-madao:composerChip";
|
|
43
|
+
var AUTO_CACHE_KEY = "dsh-connect-madao:autoCheckin";
|
|
44
|
+
function readCachedBool(key) {
|
|
45
|
+
try {
|
|
46
|
+
const raw = window.localStorage.getItem(key);
|
|
47
|
+
if (raw === "0") return false;
|
|
48
|
+
if (raw === "1") return true;
|
|
49
|
+
} catch {
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function writeCachedBool(key, value) {
|
|
54
|
+
try {
|
|
55
|
+
window.localStorage.setItem(key, value ? "1" : "0");
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
var current = {
|
|
60
|
+
composerChip: readCachedBool(CHIP_CACHE_KEY) ?? true,
|
|
61
|
+
autoCheckin: readCachedBool(AUTO_CACHE_KEY) ?? false,
|
|
62
|
+
hiddenModels: [],
|
|
63
|
+
contextCaps: {}
|
|
64
|
+
};
|
|
65
|
+
var autoState = null;
|
|
66
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
67
|
+
function getSettings() {
|
|
68
|
+
return current;
|
|
69
|
+
}
|
|
70
|
+
function getAutoCheckinState() {
|
|
71
|
+
return autoState;
|
|
72
|
+
}
|
|
73
|
+
function subscribeSettings(listener) {
|
|
74
|
+
listeners.add(listener);
|
|
75
|
+
return () => {
|
|
76
|
+
listeners.delete(listener);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function emit(next) {
|
|
80
|
+
current = next;
|
|
81
|
+
writeCachedBool(CHIP_CACHE_KEY, next.composerChip);
|
|
82
|
+
writeCachedBool(AUTO_CACHE_KEY, next.autoCheckin);
|
|
83
|
+
for (const listener of [...listeners]) {
|
|
84
|
+
try {
|
|
85
|
+
listener(next);
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function applyPayload(payload) {
|
|
91
|
+
if (!payload) return;
|
|
92
|
+
const next = { ...current };
|
|
93
|
+
const settings = payload.settings;
|
|
94
|
+
if (settings) {
|
|
95
|
+
if (typeof settings.composerChip === "boolean") next.composerChip = settings.composerChip;
|
|
96
|
+
if (typeof settings.autoCheckin === "boolean") next.autoCheckin = settings.autoCheckin;
|
|
97
|
+
if (Array.isArray(settings.hiddenModels)) {
|
|
98
|
+
next.hiddenModels = settings.hiddenModels.filter(
|
|
99
|
+
(value) => typeof value === "string" && value.length > 0
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
if (typeof settings.contextCaps === "object" && settings.contextCaps !== null) {
|
|
103
|
+
const caps = {};
|
|
104
|
+
for (const [key, value] of Object.entries(settings.contextCaps)) {
|
|
105
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) caps[key] = value;
|
|
106
|
+
}
|
|
107
|
+
next.contextCaps = caps;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (payload.autoCheckin && typeof payload.autoCheckin === "object") {
|
|
111
|
+
autoState = payload.autoCheckin;
|
|
112
|
+
}
|
|
113
|
+
emit(next);
|
|
114
|
+
}
|
|
115
|
+
async function loadSettings() {
|
|
116
|
+
try {
|
|
117
|
+
applyPayload(await bridgeJson("/settings", 8e3));
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
return current;
|
|
121
|
+
}
|
|
122
|
+
async function saveSettings(patch) {
|
|
123
|
+
const response = await bridgePost("/settings", patch, 3e4);
|
|
124
|
+
applyPayload(response);
|
|
125
|
+
return {
|
|
126
|
+
settings: current,
|
|
127
|
+
modelApply: response.modelApply ?? null,
|
|
128
|
+
modelApplyError: response.modelApplyError
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// src/client/Panel.tsx
|
|
133
|
+
const { Fragment, jsx, jsxs } = require("react/jsx-runtime");
|
|
134
|
+
var FALLBACK_MODELS = [
|
|
135
|
+
{ id: "deepseek-v4.1-flash", name: "DeepSeek-V4.1-Flash", context: 1048576, maxOutput: 65536, ratio: "0.18x" },
|
|
136
|
+
{ id: "deepseek-v4.1-flash-1017", name: "DeepSeek-V4.1-Flash-1017", context: 1048576, maxOutput: 65536, ratio: "0.18x" },
|
|
137
|
+
{ id: "glm-5.3", name: "GLM-5.3", context: 1048576, maxOutput: 65536, ratio: "0.79x" },
|
|
138
|
+
{ id: "glm-5.3-flash", name: "GLM-5.3-Flash", context: 1048576, maxOutput: 65536, ratio: "0.08x" },
|
|
139
|
+
{ id: "GLM-5.2", name: "GLM-5.2", context: 202752, maxOutput: 65536, ratio: "0.7x" },
|
|
140
|
+
{ id: "glm-5.2-sft-harmony", name: "GLM-5.2-ArkTS-SPARK", context: 202752, maxOutput: 65535, ratio: "0.7x" },
|
|
141
|
+
{ id: "kimi-k3", name: "Kimi-K3", context: 1048576, maxOutput: 65536, ratio: "2.38x" },
|
|
142
|
+
{ id: "kimi-k3.1-pro", name: "Kimi-K3.1-Pro", context: 1048576, maxOutput: 65536, ratio: "1.63x" },
|
|
143
|
+
{ id: "openpangu-2.0-pro", name: "OpenPangu-2.0-Pro", context: 524288, maxOutput: 65535, ratio: "0.7x" },
|
|
144
|
+
{ id: "openpangu-2.0-flash", name: "OpenPangu-2.0-Flash", context: 524288, maxOutput: 65535, ratio: "0.32x" },
|
|
145
|
+
{ id: "speed", name: "\u667A\u901F\u6A21\u5F0F", context: 1048576, maxOutput: 65536, ratio: "0.18x" }
|
|
146
|
+
];
|
|
147
|
+
function formatTokens(value) {
|
|
148
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return "\u2014";
|
|
149
|
+
if (value >= 1048576) {
|
|
150
|
+
const m = value / 1048576;
|
|
151
|
+
return `${Number.isInteger(m) ? m : m.toFixed(1)}M`;
|
|
152
|
+
}
|
|
153
|
+
if (value >= 1024) return `${Math.round(value / 1024)}K`;
|
|
154
|
+
return String(value);
|
|
155
|
+
}
|
|
156
|
+
var CONTEXT_PRESETS = [1048576, 524288, 262144, 131072, 65536];
|
|
157
|
+
function contextChoices(real) {
|
|
158
|
+
return [real, ...CONTEXT_PRESETS.filter((preset) => preset < real)];
|
|
159
|
+
}
|
|
160
|
+
var S = {
|
|
161
|
+
root: {
|
|
162
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
163
|
+
borderRadius: 10,
|
|
164
|
+
padding: 16,
|
|
165
|
+
fontFamily: "inherit",
|
|
166
|
+
fontSize: 13,
|
|
167
|
+
color: "var(--dsw-alias-label-primary, #0f1115)"
|
|
168
|
+
},
|
|
169
|
+
// 账号详情区块
|
|
170
|
+
section: {
|
|
171
|
+
marginTop: 16,
|
|
172
|
+
paddingTop: 14,
|
|
173
|
+
borderTop: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))"
|
|
174
|
+
},
|
|
175
|
+
sectionTitle: {
|
|
176
|
+
display: "flex",
|
|
177
|
+
alignItems: "center",
|
|
178
|
+
justifyContent: "space-between",
|
|
179
|
+
fontWeight: 600,
|
|
180
|
+
fontSize: 12,
|
|
181
|
+
marginBottom: 8
|
|
182
|
+
},
|
|
183
|
+
detailGrid: {
|
|
184
|
+
display: "grid",
|
|
185
|
+
gridTemplateColumns: "auto 1fr",
|
|
186
|
+
gap: "5px 14px",
|
|
187
|
+
alignItems: "center"
|
|
188
|
+
},
|
|
189
|
+
detailKey: { fontSize: 11, color: "var(--dsw-alias-label-secondary, #61666b)" },
|
|
190
|
+
detailVal: { fontFamily: "monospace", fontSize: 11, wordBreak: "break-all" },
|
|
191
|
+
miniBtn: {
|
|
192
|
+
background: "none",
|
|
193
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
194
|
+
borderRadius: 5,
|
|
195
|
+
color: "var(--dsw-alias-label-primary, #0f1115)",
|
|
196
|
+
fontSize: 11,
|
|
197
|
+
padding: "1px 8px",
|
|
198
|
+
cursor: "pointer"
|
|
199
|
+
},
|
|
200
|
+
header: { display: "flex", alignItems: "flex-start", gap: 12, marginBottom: 14 },
|
|
201
|
+
logo: {
|
|
202
|
+
width: 32,
|
|
203
|
+
height: 32,
|
|
204
|
+
borderRadius: 8,
|
|
205
|
+
background: "linear-gradient(135deg,#c7000b,#ff6a00)",
|
|
206
|
+
flex: "0 0 auto",
|
|
207
|
+
display: "flex",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
justifyContent: "center",
|
|
210
|
+
color: "#fff",
|
|
211
|
+
fontWeight: 700,
|
|
212
|
+
fontSize: 15
|
|
213
|
+
},
|
|
214
|
+
title: { fontSize: 15, fontWeight: 600, margin: 0, color: "var(--dsw-alias-label-primary, #0f1115)" },
|
|
215
|
+
sub: { fontSize: 12, color: "var(--dsw-alias-label-secondary, #61666b)", margin: "3px 0 0" },
|
|
216
|
+
tabs: { display: "flex", gap: 4, borderBottom: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))", marginBottom: 14 },
|
|
217
|
+
tab: (active) => ({
|
|
218
|
+
padding: "7px 12px",
|
|
219
|
+
cursor: "pointer",
|
|
220
|
+
background: "transparent",
|
|
221
|
+
border: "none",
|
|
222
|
+
borderBottom: active ? "2px solid #c7000b" : "2px solid transparent",
|
|
223
|
+
color: active ? "var(--dsw-alias-label-primary, #0f1115)" : "var(--dsw-alias-label-secondary, #61666b)",
|
|
224
|
+
fontWeight: active ? 600 : 400,
|
|
225
|
+
fontSize: 13,
|
|
226
|
+
fontFamily: "inherit"
|
|
227
|
+
}),
|
|
228
|
+
field: { marginBottom: 12 },
|
|
229
|
+
label: { display: "block", marginBottom: 5, fontSize: 12, color: "var(--dsw-alias-label-secondary, #61666b)" },
|
|
230
|
+
input: {
|
|
231
|
+
width: "100%",
|
|
232
|
+
padding: "7px 9px",
|
|
233
|
+
borderRadius: 6,
|
|
234
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
235
|
+
background: "var(--dsw-alias-bg-layer-2, #f4f5f7)",
|
|
236
|
+
color: "var(--dsw-alias-label-primary, #0f1115)",
|
|
237
|
+
fontFamily: "monospace",
|
|
238
|
+
fontSize: 12,
|
|
239
|
+
boxSizing: "border-box"
|
|
240
|
+
},
|
|
241
|
+
row: { display: "flex", gap: 8, alignItems: "center", marginTop: 12 },
|
|
242
|
+
btn: (primary) => ({
|
|
243
|
+
padding: "7px 14px",
|
|
244
|
+
borderRadius: 6,
|
|
245
|
+
cursor: "pointer",
|
|
246
|
+
border: primary ? "none" : "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
247
|
+
background: primary ? "#c7000b" : "transparent",
|
|
248
|
+
color: primary ? "#fff" : "var(--dsw-alias-label-primary, #0f1115)",
|
|
249
|
+
fontSize: 12,
|
|
250
|
+
fontFamily: "inherit"
|
|
251
|
+
}),
|
|
252
|
+
hint: { fontSize: 12, color: "var(--dsw-alias-label-secondary, #61666b)", lineHeight: 1.6, margin: "0 0 14px" },
|
|
253
|
+
table: { width: "100%", borderCollapse: "collapse", fontSize: 12 },
|
|
254
|
+
th: { textAlign: "left", padding: "7px 8px", borderBottom: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))", color: "var(--dsw-alias-label-secondary, #61666b)", fontWeight: 500 },
|
|
255
|
+
td: { padding: "7px 8px", borderBottom: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))" },
|
|
256
|
+
step: (state) => ({
|
|
257
|
+
display: "flex",
|
|
258
|
+
alignItems: "center",
|
|
259
|
+
gap: 8,
|
|
260
|
+
padding: "6px 0",
|
|
261
|
+
fontSize: 12
|
|
262
|
+
}),
|
|
263
|
+
dot: (state) => ({
|
|
264
|
+
width: 7,
|
|
265
|
+
height: 7,
|
|
266
|
+
borderRadius: "50%",
|
|
267
|
+
flex: "0 0 auto",
|
|
268
|
+
background: state === "ok" ? "var(--dsw-alias-state-success-primary, #2ea043)" : state === "fail" ? "var(--dsw-alias-state-error-primary, #d1242f)" : state === "run" ? "var(--dsw-alias-state-warn-primary, #d29922)" : "var(--dsw-alias-label-tertiary, #81858c)"
|
|
269
|
+
}),
|
|
270
|
+
kv: { display: "grid", gridTemplateColumns: "110px 1fr", gap: "6px 12px", fontSize: 12, lineHeight: 1.7 },
|
|
271
|
+
kvk: { color: "var(--dsw-alias-label-secondary, #61666b)" },
|
|
272
|
+
// 开关行:文字在左、开关在右
|
|
273
|
+
uiRow: { display: "flex", alignItems: "center", gap: 12 },
|
|
274
|
+
switch: (on, busy) => ({
|
|
275
|
+
flex: "0 0 auto",
|
|
276
|
+
position: "relative",
|
|
277
|
+
width: 38,
|
|
278
|
+
height: 22,
|
|
279
|
+
padding: 0,
|
|
280
|
+
borderRadius: 11,
|
|
281
|
+
border: "none",
|
|
282
|
+
cursor: busy ? "default" : "pointer",
|
|
283
|
+
opacity: busy ? 0.6 : 1,
|
|
284
|
+
background: on ? "var(--dsw-alias-state-success-primary, #2ea043)" : "var(--dsw-alias-label-tertiary, #81858c)",
|
|
285
|
+
transition: "background .15s ease"
|
|
286
|
+
}),
|
|
287
|
+
knob: (on) => ({
|
|
288
|
+
position: "absolute",
|
|
289
|
+
top: 3,
|
|
290
|
+
left: on ? 19 : 3,
|
|
291
|
+
width: 16,
|
|
292
|
+
height: 16,
|
|
293
|
+
borderRadius: "50%",
|
|
294
|
+
background: "#fff",
|
|
295
|
+
boxShadow: "0 1px 3px rgba(0,0,0,.35)",
|
|
296
|
+
transition: "left .15s ease"
|
|
297
|
+
}),
|
|
298
|
+
// 模型勾选列表
|
|
299
|
+
modelToolbar: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8, marginBottom: 10 },
|
|
300
|
+
modelTitle: { fontSize: 12, fontWeight: 600 },
|
|
301
|
+
modelCount: { fontSize: 11, color: "var(--dsw-alias-label-secondary, #61666b)", marginTop: 2 },
|
|
302
|
+
modelList: {
|
|
303
|
+
maxHeight: 360,
|
|
304
|
+
overflowY: "auto",
|
|
305
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
306
|
+
borderRadius: 8
|
|
307
|
+
},
|
|
308
|
+
modelRow: (on) => ({
|
|
309
|
+
display: "flex",
|
|
310
|
+
alignItems: "center",
|
|
311
|
+
gap: 10,
|
|
312
|
+
padding: "9px 10px",
|
|
313
|
+
borderBottom: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
314
|
+
cursor: "pointer",
|
|
315
|
+
opacity: on ? 1 : 0.55
|
|
316
|
+
}),
|
|
317
|
+
modelRowMain: { display: "flex", alignItems: "center", gap: 10, flex: 1, minWidth: 0, cursor: "pointer" },
|
|
318
|
+
checkbox: { margin: 0, accentColor: "#c7000b", flex: "0 0 auto" },
|
|
319
|
+
modelTitleRow: { display: "flex", alignItems: "baseline", gap: 8, flexWrap: "wrap" },
|
|
320
|
+
modelName: { fontSize: 12, fontWeight: 500 },
|
|
321
|
+
modelId: { fontFamily: "monospace", fontSize: 11, color: "var(--dsw-alias-label-secondary, #61666b)" },
|
|
322
|
+
modelMeta: { fontSize: 11, color: "var(--dsw-alias-label-secondary, #61666b)" },
|
|
323
|
+
modelSub: { fontSize: 11, color: "var(--dsw-alias-label-secondary, #61666b)", marginTop: 2 },
|
|
324
|
+
capSelect: {
|
|
325
|
+
flex: "0 0 auto",
|
|
326
|
+
fontSize: 11,
|
|
327
|
+
padding: "2px 4px",
|
|
328
|
+
borderRadius: 4,
|
|
329
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
330
|
+
background: "transparent",
|
|
331
|
+
color: "var(--dsw-alias-label-primary, #0f1115)",
|
|
332
|
+
fontFamily: "inherit"
|
|
333
|
+
},
|
|
334
|
+
modelFooter: { display: "flex", alignItems: "center", gap: 10, marginTop: 12, flexWrap: "wrap" },
|
|
335
|
+
modelMsg: (error) => ({
|
|
336
|
+
fontSize: 11,
|
|
337
|
+
color: error ? "var(--dsw-alias-state-error-primary, #d1242f)" : "var(--dsw-alias-state-success-primary, #2ea043)"
|
|
338
|
+
})
|
|
339
|
+
};
|
|
340
|
+
function CodeArtsPanel({ t }) {
|
|
341
|
+
const [tab, setTab] = useState("account");
|
|
342
|
+
const [ak, setAk] = useState("");
|
|
343
|
+
const [sk, setSk] = useState("");
|
|
344
|
+
const [saved, setSaved] = useState(false);
|
|
345
|
+
const [saving, setSaving] = useState(false);
|
|
346
|
+
const [testing, setTesting] = useState(false);
|
|
347
|
+
const [testResult, setTestResult] = useState(null);
|
|
348
|
+
const [models, setModels] = useState(FALLBACK_MODELS);
|
|
349
|
+
const [diag, setDiag] = useState({});
|
|
350
|
+
const [diagRunning, setDiagRunning] = useState(false);
|
|
351
|
+
const [acct, setAcct] = useState(null);
|
|
352
|
+
const [checkin, setCheckin] = useState(null);
|
|
353
|
+
const [checkinBusy, setCheckinBusy] = useState(false);
|
|
354
|
+
const [uiSettings, setUiSettings] = useState(getSettings());
|
|
355
|
+
const [uiSaving, setUiSaving] = useState(false);
|
|
356
|
+
const [uiError, setUiError] = useState(null);
|
|
357
|
+
const [autoState2, setAutoState] = useState(getAutoCheckinState());
|
|
358
|
+
const [autoBusy, setAutoBusy] = useState(false);
|
|
359
|
+
const [hiddenModels, setHiddenModels] = useState(() => [...getSettings().hiddenModels]);
|
|
360
|
+
const [contextCaps, setContextCaps] = useState(() => ({
|
|
361
|
+
...getSettings().contextCaps
|
|
362
|
+
}));
|
|
363
|
+
const [modelQuery, setModelQuery] = useState("");
|
|
364
|
+
const [modelSaving, setModelSaving] = useState(false);
|
|
365
|
+
const [modelNotice, setModelNotice] = useState(null);
|
|
366
|
+
const [modelError, setModelError] = useState(null);
|
|
367
|
+
const modelDirtyRef = useRef(false);
|
|
368
|
+
useEffect(() => {
|
|
369
|
+
if (modelDirtyRef.current) return;
|
|
370
|
+
setHiddenModels([...uiSettings.hiddenModels]);
|
|
371
|
+
setContextCaps({ ...uiSettings.contextCaps });
|
|
372
|
+
}, [uiSettings.hiddenModels, uiSettings.contextCaps]);
|
|
373
|
+
const hiddenKey = useMemo(() => [...hiddenModels].sort().join(","), [hiddenModels]);
|
|
374
|
+
const savedHiddenKey = useMemo(
|
|
375
|
+
() => [...uiSettings.hiddenModels].sort().join(","),
|
|
376
|
+
[uiSettings.hiddenModels]
|
|
377
|
+
);
|
|
378
|
+
const capsKey = useMemo(
|
|
379
|
+
() => JSON.stringify(Object.keys(contextCaps).sort().map((key) => [key, contextCaps[key]])),
|
|
380
|
+
[contextCaps]
|
|
381
|
+
);
|
|
382
|
+
const savedCapsKey = useMemo(
|
|
383
|
+
() => JSON.stringify(Object.keys(uiSettings.contextCaps).sort().map((key) => [key, uiSettings.contextCaps[key]])),
|
|
384
|
+
[uiSettings.contextCaps]
|
|
385
|
+
);
|
|
386
|
+
const modelDirty = hiddenKey !== savedHiddenKey || capsKey !== savedCapsKey;
|
|
387
|
+
useEffect(() => {
|
|
388
|
+
modelDirtyRef.current = modelDirty;
|
|
389
|
+
}, [modelDirty]);
|
|
390
|
+
const visibleModelCount = useMemo(
|
|
391
|
+
() => models.filter((model) => !hiddenModels.includes(model.id)).length,
|
|
392
|
+
[models, hiddenModels]
|
|
393
|
+
);
|
|
394
|
+
const filteredModels = useMemo(() => {
|
|
395
|
+
const query = modelQuery.trim().toLowerCase();
|
|
396
|
+
const list = models;
|
|
397
|
+
if (!query) return list;
|
|
398
|
+
return list.filter(
|
|
399
|
+
(model) => String(model.name ?? "").toLowerCase().includes(query) || String(model.id ?? "").toLowerCase().includes(query)
|
|
400
|
+
);
|
|
401
|
+
}, [models, modelQuery]);
|
|
402
|
+
const toggleModel = useCallback((id) => {
|
|
403
|
+
setModelNotice(null);
|
|
404
|
+
setModelError(null);
|
|
405
|
+
setHiddenModels((prev) => prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id]);
|
|
406
|
+
}, []);
|
|
407
|
+
const setAllModelsVisible = useCallback(
|
|
408
|
+
(visible) => {
|
|
409
|
+
setModelNotice(null);
|
|
410
|
+
setModelError(null);
|
|
411
|
+
setHiddenModels(visible ? [] : models.map((model) => model.id));
|
|
412
|
+
},
|
|
413
|
+
[models]
|
|
414
|
+
);
|
|
415
|
+
const setModelCap = useCallback((id, cap, real) => {
|
|
416
|
+
setModelNotice(null);
|
|
417
|
+
setModelError(null);
|
|
418
|
+
setContextCaps((prev) => {
|
|
419
|
+
const next = { ...prev };
|
|
420
|
+
if (!Number.isFinite(cap) || cap <= 0 || cap >= real) delete next[id];
|
|
421
|
+
else next[id] = Math.round(cap);
|
|
422
|
+
return next;
|
|
423
|
+
});
|
|
424
|
+
}, []);
|
|
425
|
+
const saveModelSelection = useCallback(async () => {
|
|
426
|
+
if (modelSaving || !modelDirty) return;
|
|
427
|
+
setModelSaving(true);
|
|
428
|
+
setModelError(null);
|
|
429
|
+
setModelNotice(null);
|
|
430
|
+
try {
|
|
431
|
+
const out = await saveSettings({ hiddenModels, contextCaps });
|
|
432
|
+
setHiddenModels([...out.settings.hiddenModels]);
|
|
433
|
+
setContextCaps({ ...out.settings.contextCaps });
|
|
434
|
+
modelDirtyRef.current = false;
|
|
435
|
+
if (out.modelApply === "live") setModelNotice(t("models.savedLive"));
|
|
436
|
+
else if (out.modelApply === "unavailable") setModelError(t("models.applyUnavailable"));
|
|
437
|
+
else if (out.modelApply === "failed") {
|
|
438
|
+
setModelError(`${t("models.applyFailed")} \xB7 ${out.modelApplyError ?? ""}`);
|
|
439
|
+
} else setModelNotice(t("models.saved"));
|
|
440
|
+
} catch (e) {
|
|
441
|
+
setModelError(String(e?.message ?? e));
|
|
442
|
+
} finally {
|
|
443
|
+
setModelSaving(false);
|
|
444
|
+
}
|
|
445
|
+
}, [modelSaving, modelDirty, hiddenModels, contextCaps, t]);
|
|
446
|
+
useEffect(() => {
|
|
447
|
+
const stop = subscribeSettings((next) => {
|
|
448
|
+
setUiSettings(next);
|
|
449
|
+
setAutoState(getAutoCheckinState());
|
|
450
|
+
});
|
|
451
|
+
void loadSettings();
|
|
452
|
+
return stop;
|
|
453
|
+
}, []);
|
|
454
|
+
useEffect(() => {
|
|
455
|
+
if (!uiSettings.autoCheckin) return;
|
|
456
|
+
const timer = setInterval(() => {
|
|
457
|
+
void loadSettings();
|
|
458
|
+
}, 3e4);
|
|
459
|
+
return () => clearInterval(timer);
|
|
460
|
+
}, [uiSettings.autoCheckin]);
|
|
461
|
+
const toggleComposerChip = useCallback(async (next) => {
|
|
462
|
+
setUiSaving(true);
|
|
463
|
+
setUiError(null);
|
|
464
|
+
setUiSettings({ ...getSettings(), composerChip: next });
|
|
465
|
+
try {
|
|
466
|
+
await saveSettings({ composerChip: next });
|
|
467
|
+
} catch (e) {
|
|
468
|
+
setUiSettings({ ...getSettings(), composerChip: !next });
|
|
469
|
+
setUiError(String(e?.message ?? e));
|
|
470
|
+
} finally {
|
|
471
|
+
setUiSaving(false);
|
|
472
|
+
}
|
|
473
|
+
}, []);
|
|
474
|
+
const toggleAutoCheckin = useCallback(async (next) => {
|
|
475
|
+
setAutoBusy(true);
|
|
476
|
+
setUiError(null);
|
|
477
|
+
setUiSettings({ ...getSettings(), autoCheckin: next });
|
|
478
|
+
try {
|
|
479
|
+
await saveSettings({ autoCheckin: next });
|
|
480
|
+
setAutoState(getAutoCheckinState());
|
|
481
|
+
if (next) {
|
|
482
|
+
setTimeout(() => {
|
|
483
|
+
void loadSettings();
|
|
484
|
+
}, 1500);
|
|
485
|
+
}
|
|
486
|
+
} catch (e) {
|
|
487
|
+
setUiSettings({ ...getSettings(), autoCheckin: !next });
|
|
488
|
+
setUiError(String(e?.message ?? e));
|
|
489
|
+
} finally {
|
|
490
|
+
setAutoBusy(false);
|
|
491
|
+
}
|
|
492
|
+
}, []);
|
|
493
|
+
const loadCheckin = useCallback(async () => {
|
|
494
|
+
try {
|
|
495
|
+
setCheckin(await bridgeJson("/diag/checkin", 3e4));
|
|
496
|
+
} catch {
|
|
497
|
+
setCheckin(null);
|
|
498
|
+
}
|
|
499
|
+
}, []);
|
|
500
|
+
const loadAccount = useCallback(async () => {
|
|
501
|
+
try {
|
|
502
|
+
setAcct(await bridgeJson("/diag/account", 2e4));
|
|
503
|
+
} catch {
|
|
504
|
+
setAcct(null);
|
|
505
|
+
}
|
|
506
|
+
}, []);
|
|
507
|
+
const doCheckin = useCallback(async () => {
|
|
508
|
+
if (checkinBusy) return;
|
|
509
|
+
setCheckinBusy(true);
|
|
510
|
+
try {
|
|
511
|
+
const r = await bridgePost("/diag/checkin", {}, 6e4);
|
|
512
|
+
setCheckin(r);
|
|
513
|
+
void loadAccount();
|
|
514
|
+
} catch (e) {
|
|
515
|
+
setCheckin({ ok: false, reason: String(e?.message ?? e) });
|
|
516
|
+
} finally {
|
|
517
|
+
setCheckinBusy(false);
|
|
518
|
+
}
|
|
519
|
+
}, [checkinBusy, loadAccount]);
|
|
520
|
+
const doClaimAll = useCallback(async () => {
|
|
521
|
+
if (checkinBusy) return;
|
|
522
|
+
setCheckinBusy(true);
|
|
523
|
+
try {
|
|
524
|
+
const r = await bridgePost("/diag/checkin/all", {}, 9e4);
|
|
525
|
+
const got = Array.isArray(r?.claimed) ? r.claimed.length : 0;
|
|
526
|
+
setCheckin({
|
|
527
|
+
ok: true,
|
|
528
|
+
available: true,
|
|
529
|
+
claimAll: r,
|
|
530
|
+
reason: got > 0 ? t("checkin.allGot", { n: got }) : t("checkin.allNone")
|
|
531
|
+
});
|
|
532
|
+
void loadAccount();
|
|
533
|
+
void loadCheckin();
|
|
534
|
+
} catch (e) {
|
|
535
|
+
setCheckin({ ok: false, reason: String(e?.message ?? e) });
|
|
536
|
+
} finally {
|
|
537
|
+
setCheckinBusy(false);
|
|
538
|
+
}
|
|
539
|
+
}, [checkinBusy, loadAccount, loadCheckin, t]);
|
|
540
|
+
useEffect(() => {
|
|
541
|
+
void loadAccount();
|
|
542
|
+
void loadCheckin();
|
|
543
|
+
}, [loadAccount, loadCheckin]);
|
|
544
|
+
const saveCredentials = useCallback(async () => {
|
|
545
|
+
if (saving) return;
|
|
546
|
+
if (!ak.trim() || !sk.trim()) {
|
|
547
|
+
setTestResult({ ok: false, message: t("account.needBoth") });
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
setSaving(true);
|
|
551
|
+
try {
|
|
552
|
+
const r = await bridgePost(
|
|
553
|
+
"/diag/credentials",
|
|
554
|
+
{ ak: ak.trim(), sk: sk.trim() },
|
|
555
|
+
3e4
|
|
556
|
+
);
|
|
557
|
+
setSaved(true);
|
|
558
|
+
setAk("");
|
|
559
|
+
setSk("");
|
|
560
|
+
setTestResult(
|
|
561
|
+
r.warning ? { ok: false, message: r.warning } : { ok: true, message: t("account.saveOk", { source: r.source ?? "file" }) }
|
|
562
|
+
);
|
|
563
|
+
void loadAccount();
|
|
564
|
+
} catch (e) {
|
|
565
|
+
setTestResult({ ok: false, message: `${t("account.saveFail")} \xB7 ${String(e?.message ?? e)}` });
|
|
566
|
+
} finally {
|
|
567
|
+
setSaving(false);
|
|
568
|
+
}
|
|
569
|
+
}, [ak, sk, saving, loadAccount, t]);
|
|
570
|
+
useEffect(() => {
|
|
571
|
+
let cancelled = false;
|
|
572
|
+
bridgeJson("/v1/models").then((j) => {
|
|
573
|
+
if (cancelled || !j?.data) return;
|
|
574
|
+
setModels(
|
|
575
|
+
j.data.map((m) => ({
|
|
576
|
+
id: m.id,
|
|
577
|
+
name: m.name ?? m.id,
|
|
578
|
+
context: m.context_window ?? 0,
|
|
579
|
+
maxOutput: m.max_output_tokens ?? 0,
|
|
580
|
+
ratio: m.ratio,
|
|
581
|
+
supportsImages: m.supports_images === true,
|
|
582
|
+
strengths: m.strengths ?? [],
|
|
583
|
+
description: void 0
|
|
584
|
+
}))
|
|
585
|
+
);
|
|
586
|
+
}).catch(() => {
|
|
587
|
+
});
|
|
588
|
+
return () => {
|
|
589
|
+
cancelled = true;
|
|
590
|
+
};
|
|
591
|
+
}, []);
|
|
592
|
+
const runDiag = useCallback(async () => {
|
|
593
|
+
setDiagRunning(true);
|
|
594
|
+
setDiag({ credentials: "run", sts: "run", handshake: "run", models: "run", chat: "run" });
|
|
595
|
+
try {
|
|
596
|
+
const j = await bridgeJson(
|
|
597
|
+
"/diag/test",
|
|
598
|
+
9e4
|
|
599
|
+
);
|
|
600
|
+
const byName = (kw) => j.steps?.find((s) => s.name.includes(kw));
|
|
601
|
+
const map = (kw) => {
|
|
602
|
+
const s = byName(kw);
|
|
603
|
+
return s ? s.ok ? "ok" : "fail" : "fail";
|
|
604
|
+
};
|
|
605
|
+
setDiag({
|
|
606
|
+
credentials: map("\u51ED\u8BC1"),
|
|
607
|
+
sts: map("\u51ED\u8BC1"),
|
|
608
|
+
// 凭证一步已包含 STS 换取
|
|
609
|
+
handshake: map("\u534F\u5546"),
|
|
610
|
+
models: map("\u6A21\u578B"),
|
|
611
|
+
chat: j.ok ? "ok" : "fail"
|
|
612
|
+
});
|
|
613
|
+
if (!j.ok) {
|
|
614
|
+
console.warn("[dsh-connect-madao] diag steps", j.steps);
|
|
615
|
+
}
|
|
616
|
+
} catch (e) {
|
|
617
|
+
setDiag({ credentials: "fail", sts: "fail", handshake: "fail", models: "fail", chat: "fail" });
|
|
618
|
+
console.warn("[dsh-connect-madao] diag failed", e);
|
|
619
|
+
} finally {
|
|
620
|
+
setDiagRunning(false);
|
|
621
|
+
}
|
|
622
|
+
}, []);
|
|
623
|
+
const testConnection = useCallback(async () => {
|
|
624
|
+
setTesting(true);
|
|
625
|
+
setTestResult(null);
|
|
626
|
+
try {
|
|
627
|
+
const j = await bridgeJson(
|
|
628
|
+
"/diag/test",
|
|
629
|
+
9e4
|
|
630
|
+
);
|
|
631
|
+
const steps = j.steps ?? [];
|
|
632
|
+
if (j.ok) {
|
|
633
|
+
setTestResult({ ok: true, message: `${t("account.ok")} \xB7 ${steps.length} \u6B65\u5168\u901A` });
|
|
634
|
+
} else {
|
|
635
|
+
const bad = steps.find((s) => !s.ok);
|
|
636
|
+
setTestResult({
|
|
637
|
+
ok: false,
|
|
638
|
+
message: `${t("account.fail")} \xB7 ${bad ? `${bad.name}\uFF1A${bad.detail ?? ""}` : "\u672A\u77E5\u6B65\u9AA4"}`
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
} catch (err) {
|
|
642
|
+
setTestResult({ ok: false, message: `${t("account.fail")} \xB7 ${String(err)}` });
|
|
643
|
+
} finally {
|
|
644
|
+
setTesting(false);
|
|
645
|
+
}
|
|
646
|
+
}, [t]);
|
|
647
|
+
const tabBtn = (id, label) => /* @__PURE__ */ jsx("button", { style: S.tab(tab === id), onClick: () => setTab(id), children: label }, id);
|
|
648
|
+
return /* @__PURE__ */ jsxs("div", { style: S.root, children: [
|
|
649
|
+
/* @__PURE__ */ jsxs("div", { style: S.header, children: [
|
|
650
|
+
/* @__PURE__ */ jsx("div", { style: S.logo, children: "\u7801" }),
|
|
651
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
|
|
652
|
+
/* @__PURE__ */ jsx("h3", { style: S.title, children: t("meta.title") }),
|
|
653
|
+
/* @__PURE__ */ jsx("p", { style: S.sub, children: t("meta.desc") })
|
|
654
|
+
] })
|
|
655
|
+
] }),
|
|
656
|
+
/* @__PURE__ */ jsxs("div", { style: S.tabs, children: [
|
|
657
|
+
tabBtn("account", t("tab.account")),
|
|
658
|
+
tabBtn("interface", t("tab.interface")),
|
|
659
|
+
tabBtn("models", t("tab.models")),
|
|
660
|
+
tabBtn("diagnostics", t("tab.diagnostics")),
|
|
661
|
+
tabBtn("about", t("tab.about"))
|
|
662
|
+
] }),
|
|
663
|
+
tab === "account" && /* @__PURE__ */ jsxs("div", { children: [
|
|
664
|
+
/* @__PURE__ */ jsxs("div", { style: S.section, children: [
|
|
665
|
+
/* @__PURE__ */ jsx("div", { style: S.sectionTitle, children: t("account.sourceTitle") }),
|
|
666
|
+
/* @__PURE__ */ jsx("p", { style: { ...S.hint, marginTop: 0 }, children: t("account.sourceDesc") }),
|
|
667
|
+
(() => {
|
|
668
|
+
const src = acct?.source;
|
|
669
|
+
const temp = acct?.temporary === true;
|
|
670
|
+
const exp = typeof acct?.expiresAtMs === "number" ? acct.expiresAtMs : null;
|
|
671
|
+
const leftMs = exp ? exp - Date.now() : null;
|
|
672
|
+
const leftMin = leftMs !== null ? Math.round(leftMs / 6e4) : null;
|
|
673
|
+
const expired = temp && leftMs !== null && leftMs <= 0;
|
|
674
|
+
const urgent = temp && !expired && leftMs !== null && leftMs <= 10 * 6e4;
|
|
675
|
+
const rows = [
|
|
676
|
+
{ key: "env", label: t("account.sourceEnv"), active: src === "env" },
|
|
677
|
+
{ key: "file", label: t("account.sourceFile"), active: src === "file" },
|
|
678
|
+
{
|
|
679
|
+
key: "codearts",
|
|
680
|
+
label: t("account.sourceCodearts"),
|
|
681
|
+
extra: temp ? expired ? t("account.sourceExpired") : leftMs !== null ? leftMs < 6e4 ? t("account.sourceTempSec", { n: Math.max(0, Math.round(leftMs / 1e3)) }) : urgent ? t("account.sourceTempSoon", { n: leftMin ?? 0 }) : t("account.sourceTemp", { n: leftMin ?? 0 }) : void 0 : void 0,
|
|
682
|
+
active: src === "codearts"
|
|
683
|
+
}
|
|
684
|
+
];
|
|
685
|
+
return /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: rows.map((r, i) => /* @__PURE__ */ jsxs(
|
|
686
|
+
"div",
|
|
687
|
+
{
|
|
688
|
+
style: {
|
|
689
|
+
display: "flex",
|
|
690
|
+
alignItems: "center",
|
|
691
|
+
gap: 8,
|
|
692
|
+
fontSize: 12,
|
|
693
|
+
padding: "6px 8px",
|
|
694
|
+
borderRadius: 6,
|
|
695
|
+
background: r.active ? "rgba(46,160,67,0.10)" : "transparent",
|
|
696
|
+
border: r.active ? "1px solid rgba(46,160,67,0.35)" : "1px solid transparent",
|
|
697
|
+
color: r.active ? "var(--dsw-alias-label-primary, #0f1115)" : "var(--dsw-alias-label-secondary, #61666b)"
|
|
698
|
+
},
|
|
699
|
+
children: [
|
|
700
|
+
/* @__PURE__ */ jsxs("span", { style: { color: "var(--dsw-alias-label-secondary, #61666b)", minWidth: 14 }, children: [
|
|
701
|
+
i + 1,
|
|
702
|
+
"."
|
|
703
|
+
] }),
|
|
704
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: r.label }),
|
|
705
|
+
r.extra && /* @__PURE__ */ jsx(
|
|
706
|
+
"span",
|
|
707
|
+
{
|
|
708
|
+
style: {
|
|
709
|
+
fontSize: 11,
|
|
710
|
+
fontWeight: expired || urgent ? 600 : 400,
|
|
711
|
+
color: expired || urgent ? "var(--dsw-alias-state-error-primary, #d1242f)" : "var(--dsw-alias-state-warn-primary, #d29922)"
|
|
712
|
+
},
|
|
713
|
+
children: r.extra
|
|
714
|
+
}
|
|
715
|
+
),
|
|
716
|
+
r.active && /* @__PURE__ */ jsx("span", { style: { fontSize: 11, color: "var(--dsw-alias-state-success-primary, #2ea043)", fontWeight: 600 }, children: t("account.sourceActive") })
|
|
717
|
+
]
|
|
718
|
+
},
|
|
719
|
+
r.key
|
|
720
|
+
)) });
|
|
721
|
+
})(),
|
|
722
|
+
/* @__PURE__ */ jsx("p", { style: { ...S.hint, marginBottom: 0 }, children: acct?.temporary === true ? t("account.sourceTempNote") : t("account.sourcePermNote") }),
|
|
723
|
+
/* @__PURE__ */ jsxs("details", { style: { marginTop: 10 }, children: [
|
|
724
|
+
/* @__PURE__ */ jsx("summary", { style: { fontSize: 12, cursor: "pointer", color: "var(--dsw-alias-label-secondary, #61666b)" }, children: t("account.howToGetAk") }),
|
|
725
|
+
/* @__PURE__ */ jsx("p", { style: { ...S.hint, marginTop: 6, marginBottom: 0 }, children: t("account.howToGetAkSteps") })
|
|
726
|
+
] }),
|
|
727
|
+
/* @__PURE__ */ jsxs("details", { style: { marginTop: 6 }, children: [
|
|
728
|
+
/* @__PURE__ */ jsx("summary", { style: { fontSize: 12, cursor: "pointer", color: "var(--dsw-alias-label-secondary, #61666b)" }, children: t("account.howCodeartsWorks") }),
|
|
729
|
+
/* @__PURE__ */ jsx("p", { style: { ...S.hint, marginTop: 6, marginBottom: 0 }, children: t("account.howCodeartsWorksDesc") })
|
|
730
|
+
] })
|
|
731
|
+
] }),
|
|
732
|
+
/* @__PURE__ */ jsx("p", { style: S.hint, children: t("account.hint") }),
|
|
733
|
+
/* @__PURE__ */ jsxs("div", { style: S.field, children: [
|
|
734
|
+
/* @__PURE__ */ jsx("label", { style: S.label, children: t("account.ak") }),
|
|
735
|
+
/* @__PURE__ */ jsx(
|
|
736
|
+
"input",
|
|
737
|
+
{
|
|
738
|
+
style: S.input,
|
|
739
|
+
value: ak,
|
|
740
|
+
placeholder: saved ? t("account.masked") : "HPUA\u2026",
|
|
741
|
+
onChange: (e) => setAk(e.target.value),
|
|
742
|
+
spellCheck: false
|
|
743
|
+
}
|
|
744
|
+
)
|
|
745
|
+
] }),
|
|
746
|
+
/* @__PURE__ */ jsxs("div", { style: S.field, children: [
|
|
747
|
+
/* @__PURE__ */ jsx("label", { style: S.label, children: t("account.sk") }),
|
|
748
|
+
/* @__PURE__ */ jsx(
|
|
749
|
+
"input",
|
|
750
|
+
{
|
|
751
|
+
style: S.input,
|
|
752
|
+
type: "password",
|
|
753
|
+
value: sk,
|
|
754
|
+
placeholder: saved ? t("account.masked") : "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
755
|
+
onChange: (e) => setSk(e.target.value),
|
|
756
|
+
spellCheck: false
|
|
757
|
+
}
|
|
758
|
+
)
|
|
759
|
+
] }),
|
|
760
|
+
/* @__PURE__ */ jsxs("div", { style: S.row, children: [
|
|
761
|
+
/* @__PURE__ */ jsx("button", { style: S.btn(true), onClick: saveCredentials, disabled: saving, children: saving ? t("account.saving") : saved ? t("account.saved") : t("account.save") }),
|
|
762
|
+
/* @__PURE__ */ jsx("button", { style: S.btn(false), onClick: testConnection, disabled: testing, children: testing ? t("account.testing") : t("account.test") }),
|
|
763
|
+
testResult && /* @__PURE__ */ jsx(
|
|
764
|
+
"span",
|
|
765
|
+
{
|
|
766
|
+
style: {
|
|
767
|
+
fontSize: 12,
|
|
768
|
+
color: testResult.ok ? "var(--dsw-alias-state-success-primary, #2ea043)" : "var(--dsw-alias-state-error-primary, #d1242f)"
|
|
769
|
+
},
|
|
770
|
+
children: testResult.message
|
|
771
|
+
}
|
|
772
|
+
)
|
|
773
|
+
] }),
|
|
774
|
+
/* @__PURE__ */ jsxs("div", { style: S.section, children: [
|
|
775
|
+
/* @__PURE__ */ jsxs("div", { style: S.sectionTitle, children: [
|
|
776
|
+
t("account.current"),
|
|
777
|
+
/* @__PURE__ */ jsx("button", { style: S.miniBtn, onClick: () => void loadAccount(), children: t("account.refresh") })
|
|
778
|
+
] }),
|
|
779
|
+
acct ? /* @__PURE__ */ jsxs("div", { style: S.detailGrid, children: [
|
|
780
|
+
/* @__PURE__ */ jsx("span", { style: S.detailKey, children: t("account.user") }),
|
|
781
|
+
/* @__PURE__ */ jsx("span", { style: S.detailVal, children: acct.account ?? "\u2014" }),
|
|
782
|
+
/* @__PURE__ */ jsx("span", { style: S.detailKey, children: "AK" }),
|
|
783
|
+
/* @__PURE__ */ jsx("span", { style: S.detailVal, children: acct.ak ?? "\u2014" }),
|
|
784
|
+
/* @__PURE__ */ jsx("span", { style: S.detailKey, children: "SK" }),
|
|
785
|
+
/* @__PURE__ */ jsx("span", { style: S.detailVal, children: acct.sk ?? "\u2014" }),
|
|
786
|
+
/* @__PURE__ */ jsx("span", { style: S.detailKey, children: "STS" }),
|
|
787
|
+
/* @__PURE__ */ jsx("span", { style: S.detailVal, children: acct.sts && typeof acct.sts === "object" ? `${new Date(acct.sts.expiresAt).toLocaleString()} \xB7 \u5269 ${acct.sts.ttlSec}s` : acct.sts ?? "\u2014" }),
|
|
788
|
+
/* @__PURE__ */ jsx("span", { style: S.detailKey, children: "keyId" }),
|
|
789
|
+
/* @__PURE__ */ jsx("span", { style: S.detailVal, children: acct.sessionKey?.keyId ?? "\u2014" }),
|
|
790
|
+
acct.credit ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
791
|
+
/* @__PURE__ */ jsx("span", { style: S.detailKey, children: t("account.credit") }),
|
|
792
|
+
/* @__PURE__ */ jsxs("span", { style: S.detailVal, children: [
|
|
793
|
+
acct.credit.remain,
|
|
794
|
+
" / ",
|
|
795
|
+
acct.credit.total,
|
|
796
|
+
"\uFF08",
|
|
797
|
+
t("account.used"),
|
|
798
|
+
" ",
|
|
799
|
+
acct.credit.used,
|
|
800
|
+
"\uFF09"
|
|
801
|
+
] })
|
|
802
|
+
] }) : null,
|
|
803
|
+
acct.creditExpiry ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
804
|
+
/* @__PURE__ */ jsx("span", { style: S.detailKey, children: t("checkin.expiring") }),
|
|
805
|
+
/* @__PURE__ */ jsx(
|
|
806
|
+
"span",
|
|
807
|
+
{
|
|
808
|
+
style: {
|
|
809
|
+
...S.detailVal,
|
|
810
|
+
color: acct.creditExpiry.level === "urgent" || acct.creditExpiry.level === "warn" ? "var(--dsw-alias-state-error-primary, #d1242f)" : "var(--dsw-alias-state-warn-primary, #d29922)"
|
|
811
|
+
},
|
|
812
|
+
children: acct.creditExpiry.message
|
|
813
|
+
}
|
|
814
|
+
)
|
|
815
|
+
] }) : null
|
|
816
|
+
] }) : /* @__PURE__ */ jsx("div", { style: S.hint, children: t("account.noState") })
|
|
817
|
+
] }),
|
|
818
|
+
/* @__PURE__ */ jsxs("div", { style: S.section, children: [
|
|
819
|
+
/* @__PURE__ */ jsx("div", { style: S.sectionTitle, children: t("account.checkin") }),
|
|
820
|
+
checkin && checkin.available !== false ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
821
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1, fontSize: 12 }, children: checkin.status === "CLAIMED" || checkin.status === "CONFIRMED" || checkin.status === "CONSUMED" ? t("checkin.done", { n: checkin.amount ?? 100 }) : checkin.claimable ? t("checkin.available", { n: checkin.pendingAmount ?? 100 }) : t("checkin.idle") }),
|
|
822
|
+
checkin.claimable ? /* @__PURE__ */ jsx("button", { style: S.btn(true), onClick: () => void doCheckin(), disabled: checkinBusy, children: checkinBusy ? t("checkin.doing") : t("checkin.claim") }) : null,
|
|
823
|
+
/* @__PURE__ */ jsx("button", { style: S.btn(false), onClick: () => void doClaimAll(), disabled: checkinBusy, children: checkinBusy ? t("checkin.allDoing") : t("checkin.all") })
|
|
824
|
+
] }) : /* @__PURE__ */ jsx("div", { style: S.hint, children: checkin?.reason ?? t("checkin.unavailable") }),
|
|
825
|
+
/* @__PURE__ */ jsxs(
|
|
826
|
+
"div",
|
|
827
|
+
{
|
|
828
|
+
style: {
|
|
829
|
+
...S.uiRow,
|
|
830
|
+
marginTop: 12,
|
|
831
|
+
paddingTop: 12,
|
|
832
|
+
borderTop: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))"
|
|
833
|
+
},
|
|
834
|
+
children: [
|
|
835
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
836
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 12 }, children: t("checkin.auto") }),
|
|
837
|
+
/* @__PURE__ */ jsx("div", { style: { ...S.hint, margin: "2px 0 0", fontSize: 11 }, children: t("checkin.autoHint") })
|
|
838
|
+
] }),
|
|
839
|
+
/* @__PURE__ */ jsx(
|
|
840
|
+
"button",
|
|
841
|
+
{
|
|
842
|
+
type: "button",
|
|
843
|
+
role: "switch",
|
|
844
|
+
"aria-checked": uiSettings.autoCheckin ? "true" : "false",
|
|
845
|
+
"aria-label": t("checkin.auto"),
|
|
846
|
+
style: S.switch(uiSettings.autoCheckin, autoBusy),
|
|
847
|
+
disabled: autoBusy,
|
|
848
|
+
onClick: () => void toggleAutoCheckin(!uiSettings.autoCheckin),
|
|
849
|
+
children: /* @__PURE__ */ jsx("span", { style: S.knob(uiSettings.autoCheckin) })
|
|
850
|
+
}
|
|
851
|
+
)
|
|
852
|
+
]
|
|
853
|
+
}
|
|
854
|
+
),
|
|
855
|
+
uiSettings.autoCheckin && /* @__PURE__ */ jsx("div", { style: { ...S.hint, margin: "8px 0 0", fontSize: 11 }, children: autoState2?.lastMessage ? `${t("checkin.autoLast")}${autoState2.lastMessage}` : t("checkin.autoIdle") })
|
|
856
|
+
] })
|
|
857
|
+
] }),
|
|
858
|
+
tab === "interface" && /* @__PURE__ */ jsxs("div", { children: [
|
|
859
|
+
/* @__PURE__ */ jsx("p", { style: { ...S.hint, marginTop: 0 }, children: t("ui.hint") }),
|
|
860
|
+
/* @__PURE__ */ jsxs("div", { style: S.section, children: [
|
|
861
|
+
/* @__PURE__ */ jsx("div", { style: S.sectionTitle, children: t("ui.chipSection") }),
|
|
862
|
+
/* @__PURE__ */ jsxs("div", { style: S.uiRow, children: [
|
|
863
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
864
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 12 }, children: t("ui.composerChip") }),
|
|
865
|
+
/* @__PURE__ */ jsx("div", { style: { ...S.hint, margin: "2px 0 0", fontSize: 11 }, children: t("ui.composerChipHint") })
|
|
866
|
+
] }),
|
|
867
|
+
/* @__PURE__ */ jsx(
|
|
868
|
+
"button",
|
|
869
|
+
{
|
|
870
|
+
type: "button",
|
|
871
|
+
role: "switch",
|
|
872
|
+
"aria-checked": uiSettings.composerChip ? "true" : "false",
|
|
873
|
+
"aria-label": t("ui.composerChip"),
|
|
874
|
+
style: S.switch(uiSettings.composerChip, uiSaving),
|
|
875
|
+
disabled: uiSaving,
|
|
876
|
+
onClick: () => void toggleComposerChip(!uiSettings.composerChip),
|
|
877
|
+
children: /* @__PURE__ */ jsx("span", { style: S.knob(uiSettings.composerChip) })
|
|
878
|
+
}
|
|
879
|
+
)
|
|
880
|
+
] }),
|
|
881
|
+
uiError && /* @__PURE__ */ jsxs("div", { style: { marginTop: 8, fontSize: 11, color: "var(--dsw-alias-state-error-primary, #d1242f)" }, children: [
|
|
882
|
+
t("ui.saveFail"),
|
|
883
|
+
" \xB7 ",
|
|
884
|
+
uiError
|
|
885
|
+
] })
|
|
886
|
+
] })
|
|
887
|
+
] }),
|
|
888
|
+
tab === "models" && /* @__PURE__ */ jsxs("div", { children: [
|
|
889
|
+
/* @__PURE__ */ jsxs("div", { style: S.modelToolbar, children: [
|
|
890
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
891
|
+
/* @__PURE__ */ jsx("div", { style: S.modelTitle, children: t("models.title") }),
|
|
892
|
+
/* @__PURE__ */ jsx("div", { style: S.modelCount, children: t("models.enabledCount", { on: visibleModelCount, all: models.length }) })
|
|
893
|
+
] }),
|
|
894
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 6, flex: "0 0 auto" }, children: [
|
|
895
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: S.miniBtn, onClick: () => setAllModelsVisible(true), children: t("models.selectAll") }),
|
|
896
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: S.miniBtn, onClick: () => setAllModelsVisible(false), children: t("models.selectNone") })
|
|
897
|
+
] })
|
|
898
|
+
] }),
|
|
899
|
+
/* @__PURE__ */ jsx("p", { style: { ...S.hint, marginBottom: 10 }, children: t("models.hint", { n: models.length }) }),
|
|
900
|
+
/* @__PURE__ */ jsx(
|
|
901
|
+
"input",
|
|
902
|
+
{
|
|
903
|
+
style: { ...S.input, fontFamily: "inherit", marginBottom: 10 },
|
|
904
|
+
placeholder: t("models.search"),
|
|
905
|
+
value: modelQuery,
|
|
906
|
+
onChange: (event) => setModelQuery(event.target.value)
|
|
907
|
+
}
|
|
908
|
+
),
|
|
909
|
+
/* @__PURE__ */ jsxs("div", { style: S.modelList, children: [
|
|
910
|
+
filteredModels.length === 0 && /* @__PURE__ */ jsx("div", { style: { ...S.modelCount, padding: "18px 12px" }, children: t("models.empty") }),
|
|
911
|
+
filteredModels.map((model) => {
|
|
912
|
+
const on = !hiddenModels.includes(model.id);
|
|
913
|
+
const real = Number(model.context ?? model.context_window ?? 0);
|
|
914
|
+
const cap = contextCaps[model.id];
|
|
915
|
+
const capValue = typeof cap === "number" && cap > 0 && cap < real ? cap : real;
|
|
916
|
+
const supportsImages = Boolean(model.supportsImages ?? model.supports_images);
|
|
917
|
+
const think = model.strengths?.length ? model.strengths.join(" / ") : t("models.thinkNone");
|
|
918
|
+
return /* @__PURE__ */ jsxs("div", { style: S.modelRow(on), children: [
|
|
919
|
+
/* @__PURE__ */ jsxs("label", { style: S.modelRowMain, children: [
|
|
920
|
+
/* @__PURE__ */ jsx(
|
|
921
|
+
"input",
|
|
922
|
+
{
|
|
923
|
+
type: "checkbox",
|
|
924
|
+
style: S.checkbox,
|
|
925
|
+
checked: on,
|
|
926
|
+
onChange: () => toggleModel(model.id)
|
|
927
|
+
}
|
|
928
|
+
),
|
|
929
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
930
|
+
/* @__PURE__ */ jsxs("div", { style: S.modelTitleRow, children: [
|
|
931
|
+
/* @__PURE__ */ jsx("span", { style: S.modelName, title: model.description ?? void 0, children: model.name }),
|
|
932
|
+
/* @__PURE__ */ jsx("span", { style: S.modelId, children: model.id }),
|
|
933
|
+
model.ratio && /* @__PURE__ */ jsx("span", { style: S.modelMeta, children: model.ratio }),
|
|
934
|
+
supportsImages && /* @__PURE__ */ jsx("span", { style: S.modelMeta, title: t("models.visionHint"), children: "\u{1F441}" })
|
|
935
|
+
] }),
|
|
936
|
+
/* @__PURE__ */ jsx("div", { style: S.modelSub, children: t("models.rowMeta", {
|
|
937
|
+
context: formatTokens(real),
|
|
938
|
+
output: formatTokens(model.maxOutput ?? model.max_output_tokens),
|
|
939
|
+
think
|
|
940
|
+
}) })
|
|
941
|
+
] })
|
|
942
|
+
] }),
|
|
943
|
+
/* @__PURE__ */ jsx(
|
|
944
|
+
"select",
|
|
945
|
+
{
|
|
946
|
+
"aria-label": t("models.contextCap"),
|
|
947
|
+
title: t("models.contextCapHint"),
|
|
948
|
+
style: S.capSelect,
|
|
949
|
+
value: capValue,
|
|
950
|
+
disabled: !on || real <= 0,
|
|
951
|
+
onChange: (event) => setModelCap(model.id, Number(event.target.value), real),
|
|
952
|
+
children: contextChoices(real).map((value) => /* @__PURE__ */ jsx("option", { value, children: value === real ? t("models.contextGateway", { v: formatTokens(value) }) : formatTokens(value) }, value))
|
|
953
|
+
}
|
|
954
|
+
)
|
|
955
|
+
] }, model.id);
|
|
956
|
+
})
|
|
957
|
+
] }),
|
|
958
|
+
/* @__PURE__ */ jsxs("div", { style: S.modelFooter, children: [
|
|
959
|
+
/* @__PURE__ */ jsx(
|
|
960
|
+
"button",
|
|
961
|
+
{
|
|
962
|
+
type: "button",
|
|
963
|
+
style: S.btn(true),
|
|
964
|
+
disabled: !modelDirty || modelSaving || visibleModelCount === 0,
|
|
965
|
+
onClick: () => void saveModelSelection(),
|
|
966
|
+
children: modelSaving ? t("models.saving") : t("models.save")
|
|
967
|
+
}
|
|
968
|
+
),
|
|
969
|
+
modelDirty && /* @__PURE__ */ jsx("span", { style: { ...S.modelMeta }, children: t("models.dirty") }),
|
|
970
|
+
modelNotice && /* @__PURE__ */ jsx("span", { style: S.modelMsg(false), children: modelNotice }),
|
|
971
|
+
modelError && /* @__PURE__ */ jsxs("span", { style: S.modelMsg(true), children: [
|
|
972
|
+
t("models.saveFail"),
|
|
973
|
+
" \xB7 ",
|
|
974
|
+
modelError
|
|
975
|
+
] })
|
|
976
|
+
] })
|
|
977
|
+
] }),
|
|
978
|
+
tab === "diagnostics" && /* @__PURE__ */ jsxs("div", { children: [
|
|
979
|
+
/* @__PURE__ */ jsx("div", { style: S.row, children: /* @__PURE__ */ jsx("button", { style: S.btn(true), onClick: runDiag, disabled: diagRunning, children: diagRunning ? t("diag.running") : t("diag.run") }) }),
|
|
980
|
+
/* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: [
|
|
981
|
+
["credentials", t("diag.credentials")],
|
|
982
|
+
["sts", t("diag.sts")],
|
|
983
|
+
["handshake", t("diag.handshake")],
|
|
984
|
+
["models", t("diag.models")],
|
|
985
|
+
["chat", t("diag.chat")]
|
|
986
|
+
].map(([key, label]) => /* @__PURE__ */ jsxs("div", { style: S.step(diag[key] ?? "idle"), children: [
|
|
987
|
+
/* @__PURE__ */ jsx("span", { style: S.dot(diag[key] ?? "idle") }),
|
|
988
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: label }),
|
|
989
|
+
/* @__PURE__ */ jsx("span", { style: { color: "var(--dsw-alias-label-secondary, #61666b)", fontSize: 11 }, children: diag[key] === "ok" ? "\u2713" : diag[key] === "fail" ? "\u2717" : diag[key] === "run" ? "\u2026" : "\u2014" })
|
|
990
|
+
] }, key)) })
|
|
991
|
+
] }),
|
|
992
|
+
tab === "about" && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { style: S.kv, children: [
|
|
993
|
+
/* @__PURE__ */ jsx("span", { style: S.kvk, children: t("about.protocol") }),
|
|
994
|
+
/* @__PURE__ */ jsx("span", { children: "OpenAI Chat Completions \u517C\u5BB9 \xB7 /api/v2/chat/completions" }),
|
|
995
|
+
/* @__PURE__ */ jsx("span", { style: S.kvk, children: t("about.auth") }),
|
|
996
|
+
/* @__PURE__ */ jsx("span", { children: "SDK-HMAC-SHA256\uFF08AK + SK + STS\uFF09" }),
|
|
997
|
+
/* @__PURE__ */ jsx("span", { style: S.kvk, children: t("about.encrypt") }),
|
|
998
|
+
/* @__PURE__ */ jsx("span", { children: "P-256 ECDH \u534F\u5546 + SM4-GCM \u8F7D\u8377\u52A0\u5BC6" }),
|
|
999
|
+
/* @__PURE__ */ jsx("span", { style: S.kvk, children: "Gateway" }),
|
|
1000
|
+
/* @__PURE__ */ jsx("span", { style: { fontFamily: "monospace", fontSize: 11 }, children: "snap-access.cn-north-4.myhuaweicloud.com" })
|
|
1001
|
+
] }) })
|
|
1002
|
+
] });
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// src/client/ComposerChip.tsx
|
|
1006
|
+
const { useCallback: useCallback2, useEffect: useEffect2, useRef: useRef2, useState: useState2 } = require("react");
|
|
1007
|
+
const { Fragment: Fragment2, jsx: jsx2, jsxs: jsxs2 } = require("react/jsx-runtime");
|
|
1008
|
+
function fmt(n) {
|
|
1009
|
+
if (typeof n !== "number" || !Number.isFinite(n)) return "\u2014";
|
|
1010
|
+
return n.toLocaleString("zh-CN", { maximumFractionDigits: 2 });
|
|
1011
|
+
}
|
|
1012
|
+
function ComposerChip({ t }) {
|
|
1013
|
+
const [visible, setVisible] = useState2(getSettings().composerChip);
|
|
1014
|
+
useEffect2(() => {
|
|
1015
|
+
const stop = subscribeSettings((next) => setVisible(next.composerChip));
|
|
1016
|
+
void loadSettings();
|
|
1017
|
+
return stop;
|
|
1018
|
+
}, []);
|
|
1019
|
+
const [health, setHealth] = useState2(null);
|
|
1020
|
+
const [account, setAccount] = useState2(null);
|
|
1021
|
+
const [open, setOpen] = useState2(false);
|
|
1022
|
+
const [busy, setBusy] = useState2(false);
|
|
1023
|
+
const [steps, setSteps] = useState2(null);
|
|
1024
|
+
const boxRef = useRef2(null);
|
|
1025
|
+
const refreshHealth = useCallback2(async () => {
|
|
1026
|
+
try {
|
|
1027
|
+
setHealth(await bridgeJson("/healthz"));
|
|
1028
|
+
} catch {
|
|
1029
|
+
setHealth({ ok: false, stage: "offline" });
|
|
1030
|
+
}
|
|
1031
|
+
}, []);
|
|
1032
|
+
const refreshAccount = useCallback2(async () => {
|
|
1033
|
+
try {
|
|
1034
|
+
setAccount(await bridgeJson("/diag/account", 2e4));
|
|
1035
|
+
} catch (e) {
|
|
1036
|
+
setAccount({ ok: false, stage: "offline", error: String(e) });
|
|
1037
|
+
}
|
|
1038
|
+
}, []);
|
|
1039
|
+
useEffect2(() => {
|
|
1040
|
+
let alive = true;
|
|
1041
|
+
refreshHealth();
|
|
1042
|
+
const timer = setInterval(() => {
|
|
1043
|
+
if (alive) refreshHealth();
|
|
1044
|
+
}, 6e4);
|
|
1045
|
+
return () => {
|
|
1046
|
+
alive = false;
|
|
1047
|
+
clearInterval(timer);
|
|
1048
|
+
};
|
|
1049
|
+
}, [refreshHealth]);
|
|
1050
|
+
useEffect2(() => {
|
|
1051
|
+
if (open) void refreshAccount();
|
|
1052
|
+
}, [open, refreshAccount]);
|
|
1053
|
+
useEffect2(() => {
|
|
1054
|
+
if (!open) return;
|
|
1055
|
+
const onDown = (e) => {
|
|
1056
|
+
if (boxRef.current && !boxRef.current.contains(e.target)) setOpen(false);
|
|
1057
|
+
};
|
|
1058
|
+
document.addEventListener("mousedown", onDown);
|
|
1059
|
+
return () => document.removeEventListener("mousedown", onDown);
|
|
1060
|
+
}, [open]);
|
|
1061
|
+
const testAndRefresh = useCallback2(async () => {
|
|
1062
|
+
setBusy(true);
|
|
1063
|
+
setSteps(null);
|
|
1064
|
+
try {
|
|
1065
|
+
const r = await bridgeJson("/diag/test", 9e4);
|
|
1066
|
+
setSteps(r.steps ?? []);
|
|
1067
|
+
void refreshHealth();
|
|
1068
|
+
void refreshAccount();
|
|
1069
|
+
} catch (e) {
|
|
1070
|
+
setSteps([{ name: t("chip.test"), ok: false, detail: String(e) }]);
|
|
1071
|
+
} finally {
|
|
1072
|
+
setBusy(false);
|
|
1073
|
+
}
|
|
1074
|
+
}, [refreshAccount, refreshHealth, t]);
|
|
1075
|
+
const state = health?.ok ? "ready" : health ? "fail" : "idle";
|
|
1076
|
+
const label = state === "ready" ? t("chip.ready") : t("chip.idle");
|
|
1077
|
+
const credit = account?.credit;
|
|
1078
|
+
if (!visible) return null;
|
|
1079
|
+
return /* @__PURE__ */ jsxs2("div", { ref: boxRef, style: { position: "relative", display: "inline-flex" }, children: [
|
|
1080
|
+
/* @__PURE__ */ jsxs2("button", { style: S2.chip(state), onClick: () => setOpen((v) => !v), title: t("meta.title"), children: [
|
|
1081
|
+
/* @__PURE__ */ jsx2("span", { style: S2.dot(state) }),
|
|
1082
|
+
label,
|
|
1083
|
+
credit ? /* @__PURE__ */ jsx2("span", { style: S2.mini, children: fmt(credit.remain) }) : null
|
|
1084
|
+
] }),
|
|
1085
|
+
open && /* @__PURE__ */ jsxs2("div", { style: S2.pop, children: [
|
|
1086
|
+
/* @__PURE__ */ jsxs2("div", { style: S2.head, children: [
|
|
1087
|
+
/* @__PURE__ */ jsx2("span", { style: { fontWeight: 600 }, children: t("chip.account") }),
|
|
1088
|
+
/* @__PURE__ */ jsx2("span", { style: S2.badge(!!health?.ok), children: health?.ok ? t("chip.online") : t("chip.offline") })
|
|
1089
|
+
] }),
|
|
1090
|
+
/* @__PURE__ */ jsxs2("div", { style: S2.account, children: [
|
|
1091
|
+
/* @__PURE__ */ jsx2("span", { style: S2.avatar, children: (account?.account ?? "?").slice(0, 1).toUpperCase() }),
|
|
1092
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: 1, minWidth: 0 }, children: [
|
|
1093
|
+
/* @__PURE__ */ jsx2("span", { style: { fontFamily: "monospace", fontSize: 12 }, children: account?.account ?? "\u2014" }),
|
|
1094
|
+
account?.roles?.length ? /* @__PURE__ */ jsx2("span", { style: S2.sub, children: account.roles.join(", ") }) : null
|
|
1095
|
+
] })
|
|
1096
|
+
] }),
|
|
1097
|
+
/* @__PURE__ */ jsx2("div", { style: S2.sep }),
|
|
1098
|
+
/* @__PURE__ */ jsx2("div", { style: S2.head, children: /* @__PURE__ */ jsx2("span", { style: { fontWeight: 600 }, children: t("chip.credit") }) }),
|
|
1099
|
+
credit ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1100
|
+
/* @__PURE__ */ jsxs2("div", { style: S2.big, children: [
|
|
1101
|
+
fmt(credit.remain),
|
|
1102
|
+
/* @__PURE__ */ jsxs2("span", { style: S2.bigUnit, children: [
|
|
1103
|
+
" / ",
|
|
1104
|
+
fmt(credit.total)
|
|
1105
|
+
] })
|
|
1106
|
+
] }),
|
|
1107
|
+
/* @__PURE__ */ jsxs2("div", { style: S2.kv, children: [
|
|
1108
|
+
/* @__PURE__ */ jsx2("span", { style: S2.k, children: t("chip.used") }),
|
|
1109
|
+
/* @__PURE__ */ jsx2("span", { style: S2.mono, children: fmt(credit.used) }),
|
|
1110
|
+
credit.bonus ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1111
|
+
/* @__PURE__ */ jsx2("span", { style: S2.k, children: t("chip.bonus") }),
|
|
1112
|
+
/* @__PURE__ */ jsx2("span", { style: S2.mono, children: fmt(credit.bonus.remain) })
|
|
1113
|
+
] }) : null,
|
|
1114
|
+
credit.basic ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1115
|
+
/* @__PURE__ */ jsx2("span", { style: S2.k, children: t("chip.basic") }),
|
|
1116
|
+
/* @__PURE__ */ jsx2("span", { style: S2.mono, children: fmt(credit.basic.remain) })
|
|
1117
|
+
] }) : null
|
|
1118
|
+
] })
|
|
1119
|
+
] }) : /* @__PURE__ */ jsx2("div", { style: S2.hint, children: account?.error ?? t("chip.noCredit") }),
|
|
1120
|
+
/* @__PURE__ */ jsx2("div", { style: S2.sep }),
|
|
1121
|
+
/* @__PURE__ */ jsx2("button", { style: S2.testBtn(busy), disabled: busy, onClick: () => void testAndRefresh(), children: busy ? t("chip.testing") : t("chip.testRefresh") }),
|
|
1122
|
+
steps && /* @__PURE__ */ jsx2("div", { style: S2.steps, children: steps.map((s) => /* @__PURE__ */ jsxs2("div", { style: S2.stepRow, children: [
|
|
1123
|
+
/* @__PURE__ */ jsx2("span", { style: { color: s.ok ? "var(--dsw-alias-state-success-primary, #2ea043)" : "var(--dsw-alias-state-error-primary, #d1242f)" }, children: s.ok ? "\u2713" : "\u2717" }),
|
|
1124
|
+
/* @__PURE__ */ jsx2("span", { style: { flex: 1 }, children: s.name }),
|
|
1125
|
+
/* @__PURE__ */ jsx2("span", { style: S2.stepDetail, title: s.detail, children: s.detail ?? (s.ms ? `${s.ms}ms` : "") })
|
|
1126
|
+
] }, s.name)) })
|
|
1127
|
+
] })
|
|
1128
|
+
] });
|
|
1129
|
+
}
|
|
1130
|
+
var S2 = {
|
|
1131
|
+
chip: (state) => ({
|
|
1132
|
+
display: "inline-flex",
|
|
1133
|
+
alignItems: "center",
|
|
1134
|
+
gap: 5,
|
|
1135
|
+
height: 26,
|
|
1136
|
+
padding: "0 9px",
|
|
1137
|
+
borderRadius: 13,
|
|
1138
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
1139
|
+
background: "transparent",
|
|
1140
|
+
color: "var(--dsw-alias-label-primary, #0f1115)",
|
|
1141
|
+
fontSize: 12,
|
|
1142
|
+
cursor: "pointer",
|
|
1143
|
+
opacity: state === "idle" ? 0.6 : 1
|
|
1144
|
+
}),
|
|
1145
|
+
dot: (state) => ({
|
|
1146
|
+
width: 6,
|
|
1147
|
+
height: 6,
|
|
1148
|
+
borderRadius: "50%",
|
|
1149
|
+
background: state === "ready" ? "var(--dsw-alias-state-success-primary, #2ea043)" : state === "fail" ? "var(--dsw-alias-state-error-primary, #d1242f)" : "var(--dsw-alias-label-tertiary, #81858c)"
|
|
1150
|
+
}),
|
|
1151
|
+
mini: {
|
|
1152
|
+
marginLeft: 2,
|
|
1153
|
+
paddingLeft: 6,
|
|
1154
|
+
borderLeft: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
1155
|
+
fontFamily: "monospace",
|
|
1156
|
+
fontSize: 11,
|
|
1157
|
+
color: "var(--dsw-alias-label-secondary, #61666b)"
|
|
1158
|
+
},
|
|
1159
|
+
pop: {
|
|
1160
|
+
position: "absolute",
|
|
1161
|
+
bottom: "calc(100% + 8px)",
|
|
1162
|
+
right: 0,
|
|
1163
|
+
width: 288,
|
|
1164
|
+
padding: 12,
|
|
1165
|
+
borderRadius: 10,
|
|
1166
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
1167
|
+
background: "var(--dsw-alias-bg-layer-3, #ffffff)",
|
|
1168
|
+
boxShadow: "0 8px 28px rgba(0,0,0,.45)",
|
|
1169
|
+
color: "var(--dsw-alias-label-primary, #0f1115)",
|
|
1170
|
+
fontSize: 12,
|
|
1171
|
+
zIndex: 50
|
|
1172
|
+
},
|
|
1173
|
+
head: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 8 },
|
|
1174
|
+
badge: (ok) => ({
|
|
1175
|
+
fontSize: 10,
|
|
1176
|
+
padding: "1px 6px",
|
|
1177
|
+
borderRadius: 8,
|
|
1178
|
+
background: ok ? "color-mix(in srgb, var(--dsw-alias-state-success-primary, #2ea043) 16%, transparent)" : "color-mix(in srgb, var(--dsw-alias-state-error-primary, #d1242f) 16%, transparent)",
|
|
1179
|
+
color: ok ? "var(--dsw-alias-state-success-primary, #2ea043)" : "var(--dsw-alias-state-error-primary, #d1242f)"
|
|
1180
|
+
}),
|
|
1181
|
+
account: { display: "flex", alignItems: "center", gap: 8 },
|
|
1182
|
+
avatar: {
|
|
1183
|
+
width: 26,
|
|
1184
|
+
height: 26,
|
|
1185
|
+
borderRadius: "50%",
|
|
1186
|
+
display: "inline-flex",
|
|
1187
|
+
alignItems: "center",
|
|
1188
|
+
justifyContent: "center",
|
|
1189
|
+
background: "var(--dsw-alias-bg-layer-2, #f4f5f7)",
|
|
1190
|
+
fontSize: 12,
|
|
1191
|
+
fontWeight: 600,
|
|
1192
|
+
flexShrink: 0
|
|
1193
|
+
},
|
|
1194
|
+
sub: { fontSize: 10, opacity: 0.5 },
|
|
1195
|
+
kv: { display: "grid", gridTemplateColumns: "auto 1fr", gap: "3px 10px", alignItems: "center" },
|
|
1196
|
+
k: { opacity: 0.6, fontSize: 11 },
|
|
1197
|
+
mono: { fontFamily: "monospace", fontSize: 11 },
|
|
1198
|
+
big: { fontSize: 22, fontWeight: 600, fontVariantNumeric: "tabular-nums", marginBottom: 5 },
|
|
1199
|
+
bigUnit: { fontSize: 12, fontWeight: 400, opacity: 0.55 },
|
|
1200
|
+
sep: { height: 1, background: "var(--dsw-alias-border-l2, rgba(0,0,0,.1))", margin: "10px 0" },
|
|
1201
|
+
hint: { fontSize: 11, opacity: 0.6, lineHeight: 1.5 },
|
|
1202
|
+
testBtn: (busy) => ({
|
|
1203
|
+
width: "100%",
|
|
1204
|
+
height: 30,
|
|
1205
|
+
borderRadius: 7,
|
|
1206
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.1))",
|
|
1207
|
+
background: "var(--dsw-alias-bg-layer-2, #f4f5f7)",
|
|
1208
|
+
color: "var(--dsw-alias-label-primary, #0f1115)",
|
|
1209
|
+
fontSize: 12,
|
|
1210
|
+
cursor: busy ? "default" : "pointer",
|
|
1211
|
+
opacity: busy ? 0.6 : 1
|
|
1212
|
+
}),
|
|
1213
|
+
steps: { marginTop: 8, display: "flex", flexDirection: "column", gap: 3 },
|
|
1214
|
+
stepRow: { display: "flex", alignItems: "center", gap: 6, fontSize: 11 },
|
|
1215
|
+
stepDetail: { opacity: 0.55, fontFamily: "monospace", fontSize: 10, maxWidth: 140, textAlign: "right", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
// src/client/SectionIcon.tsx
|
|
1219
|
+
const { jsx: jsx3 } = require("react/jsx-runtime");
|
|
1220
|
+
function SettingsSectionIcon(props) {
|
|
1221
|
+
const size = typeof props?.size === "number" ? props.size : 16;
|
|
1222
|
+
return jsx3("span", {
|
|
1223
|
+
style: {
|
|
1224
|
+
display: "inline-flex",
|
|
1225
|
+
alignItems: "center",
|
|
1226
|
+
justifyContent: "center",
|
|
1227
|
+
width: size,
|
|
1228
|
+
height: size,
|
|
1229
|
+
borderRadius: Math.max(3, Math.round(size * 0.25)),
|
|
1230
|
+
background: "linear-gradient(135deg,#c7000b,#ff6a00)",
|
|
1231
|
+
color: "#fff",
|
|
1232
|
+
fontSize: Math.max(9, Math.round(size * 0.68)),
|
|
1233
|
+
fontWeight: 700,
|
|
1234
|
+
lineHeight: 1,
|
|
1235
|
+
opacity: props?.active === false ? 0.55 : 1,
|
|
1236
|
+
flex: "0 0 auto"
|
|
1237
|
+
},
|
|
1238
|
+
children: "\u7801"
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
// src/client/index.ts
|
|
1243
|
+
var name = "dsh-connect-madao-client";
|
|
1244
|
+
var inject = ["slots", "locale"];
|
|
1245
|
+
var zh = {
|
|
1246
|
+
"meta.title": "\u7801\u9053\u8FDE\u63A5\u5668",
|
|
1247
|
+
"meta.desc": "\u628A\u534E\u4E3A\u4E91\u7801\u9053\uFF08CodeArts Agent\uFF09\u6A21\u578B\u63A5\u5165 DSH",
|
|
1248
|
+
"tab.account": "\u8D26\u53F7",
|
|
1249
|
+
"tab.interface": "\u754C\u9762",
|
|
1250
|
+
"tab.models": "\u6A21\u578B",
|
|
1251
|
+
"tab.diagnostics": "\u8BCA\u65AD",
|
|
1252
|
+
"tab.about": "\u5173\u4E8E",
|
|
1253
|
+
"account.title": "\u534E\u4E3A\u4E91\u51ED\u8BC1",
|
|
1254
|
+
"account.hint": "\u4E0D\u586B\u4E5F\u80FD\u7528\uFF1A\u88C5\u8FC7\u5E76\u767B\u5F55\u8FC7\u7801\u9053\u5BA2\u6237\u7AEF\u7684\u8BDD\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u501F\u7528\u5B83\u7684\u767B\u5F55\u6001\u3002\u586B\u4E0A\u6C38\u4E45 AK/SK \u5219\u4E00\u52B3\u6C38\u9038\uFF0C\u4E4B\u540E\u4E0D\u7528\u518D\u7BA1\u3002",
|
|
1255
|
+
"account.sourceTitle": "\u51ED\u8BC1\u4ECE\u54EA\u6765",
|
|
1256
|
+
"account.sourceDesc": "\u63D2\u4EF6\u6309\u4E0B\u9762\u7684\u987A\u5E8F\u627E\u51ED\u8BC1\uFF0C\u627E\u5230\u7B2C\u4E00\u4E2A\u80FD\u7528\u7684\u5C31\u7528\uFF0C\u4E0D\u9700\u8981\u4E09\u79CD\u90FD\u914D\u3002",
|
|
1257
|
+
"account.sourceEnv": "\u73AF\u5883\u53D8\u91CF MADAO_AK / MADAO_SK",
|
|
1258
|
+
"account.sourceFile": "\u4E0A\u9762\u586B\u5199\u7684\u6C38\u4E45 AK/SK",
|
|
1259
|
+
"account.sourceCodearts": "\u7801\u9053\u5BA2\u6237\u7AEF\u767B\u5F55\u6001\uFF08\u96F6\u914D\u7F6E\uFF09",
|
|
1260
|
+
"account.sourceActive": "\u5F53\u524D\u751F\u6548",
|
|
1261
|
+
"account.sourceTemp": "\u4E34\u65F6\u51ED\u8BC1\uFF0C\u5269 {n} \u5206\u949F",
|
|
1262
|
+
"account.sourceExpired": "\u5DF2\u8FC7\u671F \xB7 \u6253\u5F00\u4E00\u6B21\u7801\u9053\u8BA9\u5B83\u5237\u65B0\uFF0C\u518D\u70B9\u4E0A\u65B9\u300C\u6D4B\u8BD5\u8FDE\u63A5\u300D",
|
|
1263
|
+
"account.sourceTempSoon": "\u5373\u5C06\u8FC7\u671F\uFF0C\u5269 {n} \u5206\u949F \xB7 \u5EFA\u8BAE\u73B0\u5728\u6253\u5F00\u7801\u9053\u5237\u65B0\uFF0C\u6216\u6539\u586B\u6C38\u4E45 AK/SK",
|
|
1264
|
+
"account.sourceTempSec": "\u5269 {n} \u79D2\uFF0C\u5373\u5C06\u5931\u6548",
|
|
1265
|
+
"account.sourceTempNote": "\u4F60\u7528\u7684\u662F\u4ECE\u7801\u9053\u767B\u5F55\u6001\u501F\u6765\u7684\u4E34\u65F6\u51ED\u8BC1\uFF0C\u51E0\u5C0F\u65F6\u540E\u4F1A\u5931\u6548\u3002\u5931\u6548\u540E\uFF1A\u6253\u5F00\u4E00\u6B21\u7801\u9053\u5BA2\u6237\u7AEF\u8BA9\u5B83\u5237\u65B0\uFF0C\u518D\u70B9\u4E0A\u9762\u7684\u300C\u6D4B\u8BD5\u8FDE\u63A5\u300D\u5373\u53EF\u6062\u590D\u3002\u60F3\u514D\u53BB\u8FD9\u4E00\u6B65\uFF0C\u5C31\u586B\u4E0A\u9762\u7684\u6C38\u4E45 AK/SK \u2014\u2014 \u53EA\u914D\u4E00\u6B21\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u6362 STS \u5E76\u7EED\u671F\uFF0C\u4E4B\u540E\u4E0D\u7528\u518D\u7BA1\u3002",
|
|
1266
|
+
"account.sourcePermNote": "\u5F53\u524D\u7528\u7684\u662F\u6C38\u4E45\u51ED\u8BC1\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u6362\u53D6 STS \u5E76\u5728\u8FC7\u671F\u524D\u7EED\u671F\uFF0C\u65E0\u9700\u518D\u64CD\u4F5C\u3002",
|
|
1267
|
+
"account.howToGetAk": "\u600E\u4E48\u62FF\u5230 AK/SK",
|
|
1268
|
+
"account.howToGetAkSteps": "\u534E\u4E3A\u4E91\u63A7\u5236\u53F0 \u2192 \u53F3\u4E0A\u89D2\u8D26\u53F7\u540D \u2192 \u6211\u7684\u51ED\u8BC1 \u2192 \u8BBF\u95EE\u5BC6\u94A5 \u2192 \u65B0\u589E\u8BBF\u95EE\u5BC6\u94A5\u3002\u4E0B\u8F7D\u7684 credentials.csv \u91CC Access Key Id \u548C Secret Access Key \u5C31\u5BF9\u5E94\u4E0A\u9762\u4E24\u680F\uFF08Secret \u53EA\u5728\u521B\u5EFA\u65F6\u663E\u793A\u4E00\u6B21\uFF0C\u52A1\u5FC5\u4FDD\u5B58\uFF09\u3002\u4E0D\u9700\u8981\u586B STS\u3002",
|
|
1269
|
+
"account.howCodeartsWorks": "\u7B2C 3 \u9879\u662F\u600E\u4E48\u5DE5\u4F5C\u7684",
|
|
1270
|
+
"account.howCodeartsWorksDesc": '\u672C\u673A\u88C5\u8FC7\u7801\u9053\u5BA2\u6237\u7AEF\uFF08CodeArts Agent\uFF09\u5E76\u767B\u5F55\u8FC7\u7684\u8BDD\uFF0C\u63D2\u4EF6\u4F1A\u76F4\u63A5\u8BFB\u5B83\u5B58\u5728\u672C\u5730\u7684\u767B\u5F55\u6001\uFF0C\u4F60\u4EC0\u4E48\u90FD\u4E0D\u7528\u586B\u3002\u6CE8\u610F\uFF1A\u63D2\u4EF6\u81EA\u8EAB\u6CA1\u6709\u767B\u5F55\u5165\u53E3\uFF0C\u767B\u5F55\u8FD9\u4E2A\u52A8\u4F5C\u59CB\u7EC8\u5728\u7801\u9053\u5BA2\u6237\u7AEF\u91CC\u5B8C\u6210 \u2014\u2014 \u6240\u4EE5"\u4E0D\u586B\u4E5F\u80FD\u7528"\u7684\u524D\u63D0\u662F\u90A3\u53F0\u673A\u5668\u4E0A\u7801\u9053\u5DF2\u7ECF\u767B\u5F55\u8FC7\u3002',
|
|
1271
|
+
"account.needBoth": "Access Key ID \u548C Secret Access Key \u90FD\u8981\u586B\u3002",
|
|
1272
|
+
"account.saving": "\u4FDD\u5B58\u4E2D\u2026",
|
|
1273
|
+
"account.saveOk": "\u5DF2\u5199\u5165\u78C1\u76D8\u5E76\u7ACB\u5373\u751F\u6548\uFF08\u6765\u6E90\uFF1A{source}\uFF09",
|
|
1274
|
+
"account.saveFail": "\u4FDD\u5B58\u5931\u8D25",
|
|
1275
|
+
"account.ak": "Access Key ID",
|
|
1276
|
+
"account.sk": "Secret Access Key",
|
|
1277
|
+
"account.save": "\u4FDD\u5B58",
|
|
1278
|
+
"account.saved": "\u5DF2\u4FDD\u5B58",
|
|
1279
|
+
"account.test": "\u6D4B\u8BD5\u8FDE\u63A5",
|
|
1280
|
+
"account.testing": "\u6D4B\u8BD5\u4E2D\u2026",
|
|
1281
|
+
"account.ok": "\u8FDE\u63A5\u6B63\u5E38",
|
|
1282
|
+
"account.fail": "\u8FDE\u63A5\u5931\u8D25",
|
|
1283
|
+
"account.masked": "\u5DF2\u751F\u6548 \xB7 \u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8\uFF0C\u8F93\u5165\u5373\u8986\u76D6\u65E7\u503C",
|
|
1284
|
+
"account.current": "\u5F53\u524D\u8FDE\u63A5",
|
|
1285
|
+
"account.refresh": "\u5237\u65B0",
|
|
1286
|
+
"account.user": "\u534E\u4E3A\u4E91\u8D26\u53F7",
|
|
1287
|
+
"account.credit": "\u79EF\u5206\u989D\u5EA6",
|
|
1288
|
+
"account.used": "\u5DF2\u7528",
|
|
1289
|
+
"account.noState": "\u6865\u63A5\u670D\u52A1\u672A\u5C31\u7EEA\uFF0C\u7A0D\u540E\u5237\u65B0\u91CD\u8BD5",
|
|
1290
|
+
"account.checkin": "\u6BCF\u65E5\u7B7E\u5230",
|
|
1291
|
+
"checkin.done": "\u4ECA\u65E5\u5DF2\u7B7E\u5230\uFF0C+{n} \u79EF\u5206\u5DF2\u5230\u8D26",
|
|
1292
|
+
"checkin.available": "\u53EF\u9886\u53D6 {n} \u79EF\u5206",
|
|
1293
|
+
"checkin.idle": "\u6682\u65E0\u53EF\u9886\u53D6\u7684\u7B7E\u5230\u5956\u52B1",
|
|
1294
|
+
"checkin.claim": "\u9886\u53D6",
|
|
1295
|
+
"checkin.doing": "\u9886\u53D6\u4E2D\u2026",
|
|
1296
|
+
"checkin.unavailable": "\u7B7E\u5230\u72B6\u6001\u6682\u65F6\u67E5\u8BE2\u4E0D\u5230",
|
|
1297
|
+
"checkin.all": "\u9886\u5168\u90E8",
|
|
1298
|
+
"checkin.allDoing": "\u9886\u53D6\u4E2D\u2026",
|
|
1299
|
+
"checkin.allGot": "\u5DF2\u9886\u53D6 {n} \u9879\u6D3B\u52A8",
|
|
1300
|
+
"checkin.allNone": "\u6CA1\u6709\u53EF\u9886\u7684\u6D3B\u52A8",
|
|
1301
|
+
"checkin.expiring": "\u79EF\u5206\u5373\u5C06\u5230\u671F",
|
|
1302
|
+
"checkin.auto": "\u81EA\u52A8\u7B7E\u5230",
|
|
1303
|
+
"checkin.autoHint": "\u5F00\u542F\u540E\uFF0C\u63D2\u4EF6\u6BCF\u5206\u949F\u68C0\u67E5\u4E00\u6B21\uFF0C\u53D1\u73B0\u5F53\u5929\u53EF\u9886\u5C31\u81EA\u52A8\u9886\u53D6\uFF08\u6BCF 15 \u5206\u949F\u6700\u591A\u5C1D\u8BD5\u4E00\u6B21\uFF09\u3002\u9ED8\u8BA4\u5173\u95ED\u3002",
|
|
1304
|
+
"checkin.autoLast": "\u4E0A\u6B21\uFF1A",
|
|
1305
|
+
"checkin.autoIdle": "\u8FD8\u6CA1\u6709\u8FD0\u884C\u8FC7\uFF0C\u7A0D\u540E\u81EA\u52A8\u68C0\u67E5\u3002",
|
|
1306
|
+
"ui.hint": "\u8FD9\u91CC\u7684\u5F00\u5173\u70B9\u4E00\u4E0B\u5C31\u751F\u6548\uFF0C\u4E0D\u9700\u8981\u91CD\u542F DSH\u3002",
|
|
1307
|
+
"ui.chipSection": "\u8F93\u5165\u6846\u72B6\u6001\u80F6\u56CA",
|
|
1308
|
+
"ui.composerChip": "\u663E\u793A\u8F93\u5165\u6846\u300C\u7801\u9053\u300D\u72B6\u6001\u80F6\u56CA",
|
|
1309
|
+
"ui.composerChipHint": "\u5173\u6389\u540E\uFF0C\u8F93\u5165\u6846\u53F3\u4FA7\u90A3\u4E2A\u300C\u25CF \u7801\u9053\u300D\u5C0F\u80F6\u56CA\u4E0D\u518D\u51FA\u73B0\uFF1B\u8D26\u53F7\u4E0E\u79EF\u5206\u4ECD\u53EF\u5728\u672C\u9875\u67E5\u770B\u3002",
|
|
1310
|
+
"ui.saveFail": "\u4FDD\u5B58\u5931\u8D25",
|
|
1311
|
+
"models.title": "\u53EF\u7528\u6A21\u578B",
|
|
1312
|
+
"models.hint": "\u4EE5\u4E0B\u6A21\u578B\u53D6\u81EA\u7801\u9053\u7F51\u5173\uFF0C\u5171 {n} \u4E2A\u3002",
|
|
1313
|
+
"models.name": "\u540D\u79F0",
|
|
1314
|
+
"models.context": "\u4E0A\u4E0B\u6587",
|
|
1315
|
+
"models.output": "\u6700\u5927\u8F93\u51FA",
|
|
1316
|
+
"models.ratio": "\u8BA1\u8D39\u500D\u7387",
|
|
1317
|
+
"models.ratioHint": "\u76F8\u5BF9\u57FA\u51C6\u4EF7\u683C\u7684\u6D88\u8017\u500D\u7387\uFF0C\u8D8A\u4F4E\u8D8A\u7701",
|
|
1318
|
+
"models.think": "\u601D\u8003",
|
|
1319
|
+
"models.thinkHint": "\u8BE5\u6A21\u578B\u5728\u7801\u9053\u4FA7\u53EF\u9009\u7684\u601D\u8003\u5F3A\u5EA6\u3002\u6CE8\u610F\uFF1A\u7F51\u5173\u7684 chat \u63A5\u53E3\u4E0D\u900F\u4F20\u5F3A\u5EA6\u53C2\u6570\uFF08\u5B9E\u6D4B\u5404\u79CD\u5B57\u6BB5\u540D\u4E0E model \u53D8\u4F53\u5747\u88AB\u5FFD\u7565\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u7684\u6863\u4F4D\u76EE\u524D\u53EA\u5F71\u54CD DSH \u4FA7\u5C55\u793A\uFF0C\u4E0D\u4F1A\u6539\u53D8\u4E0A\u6E38\u884C\u4E3A\u3002",
|
|
1320
|
+
"models.enabledCount": "\u5DF2\u542F\u7528 {on} \u4E2A \xB7 \u5171 {all} \u4E2A",
|
|
1321
|
+
"models.selectAll": "\u5168\u9009",
|
|
1322
|
+
"models.selectNone": "\u5168\u4E0D\u9009",
|
|
1323
|
+
"models.search": "\u6309\u540D\u79F0\u6216 model_id \u641C\u7D22",
|
|
1324
|
+
"models.rowMeta": "\u4E0A\u4E0B\u6587 {context} \xB7 \u8F93\u51FA {output} \xB7 \u601D\u8003 {think}",
|
|
1325
|
+
"models.thinkNone": "\u4E0D\u652F\u6301",
|
|
1326
|
+
"models.contextCap": "\u663E\u793A\u4E0A\u4E0B\u6587",
|
|
1327
|
+
"models.contextCapHint": "\u53EA\u5F71\u54CD DSH \u91CC\u663E\u793A\u7684\u4E0A\u4E0B\u6587\u4E0A\u9650\uFF0C\u5F80\u5C0F\u8C03\u4F1A\u8BA9 DSH \u66F4\u65E9\u538B\u7F29\uFF1B\u7F51\u5173\u771F\u5B9E\u4E0A\u9650\u4E0D\u53D8\u3002",
|
|
1328
|
+
"models.contextGateway": "\u7F51\u5173\u503C {v}",
|
|
1329
|
+
"models.save": "\u4FDD\u5B58",
|
|
1330
|
+
"models.saving": "\u4FDD\u5B58\u4E2D\u2026",
|
|
1331
|
+
"models.saved": "\u5DF2\u4FDD\u5B58",
|
|
1332
|
+
"models.savedLive": "\u5DF2\u4FDD\u5B58\uFF0C\u6A21\u578B\u9009\u62E9\u5668\u5DF2\u66F4\u65B0",
|
|
1333
|
+
"models.dirty": "\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8",
|
|
1334
|
+
"models.applyUnavailable": "\u9009\u62E9\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u5F53\u524D\u5BBF\u4E3B\u4E0D\u652F\u6301\u5373\u65F6\u5E94\u7528\uFF1B\u91CD\u542F DSH \u540E\u751F\u6548\u3002",
|
|
1335
|
+
"models.applyFailed": "\u9009\u62E9\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u5E94\u7528\u5931\u8D25",
|
|
1336
|
+
"models.saveFail": "\u4FDD\u5B58\u5931\u8D25",
|
|
1337
|
+
"models.empty": "\u6CA1\u6709\u5339\u914D\u7684\u6A21\u578B",
|
|
1338
|
+
"models.visionHint": "\u7801\u9053\u7F51\u5173\u662F\u5426\u4E3A\u8BE5\u6A21\u578B\u5F00\u653E\u56FE\u7247\u8F93\u5165\u3002\u6CE8\u610F\uFF1A\u6865\u63A5\u76EE\u524D\u53EA\u8F6C\u53D1\u6587\u672C\uFF0C\u56FE\u7247\u4F1A\u5728\u8BF7\u6C42\u6784\u9020\u9636\u6BB5\u88AB\u4E22\u5F03\uFF0C\u56E0\u6B64\u73B0\u5728\u4E0D\u80FD\u771F\u7684\u53D1\u56FE\u3002",
|
|
1339
|
+
"models.visionYes": "\u7F51\u5173\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF08\u6865\u63A5\u6682\u53EA\u8F6C\u53D1\u6587\u672C\uFF09",
|
|
1340
|
+
"models.visionNo": "\u7F51\u5173\u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165",
|
|
1341
|
+
"diag.title": "\u8BCA\u65AD",
|
|
1342
|
+
"diag.run": "\u8FD0\u884C\u81EA\u68C0",
|
|
1343
|
+
"diag.running": "\u81EA\u68C0\u4E2D\u2026",
|
|
1344
|
+
"diag.credentials": "\u51ED\u8BC1",
|
|
1345
|
+
"diag.sts": "STS \u6362\u53D6",
|
|
1346
|
+
"diag.handshake": "\u5BC6\u94A5\u534F\u5546",
|
|
1347
|
+
"diag.models": "\u6A21\u578B\u6E05\u5355",
|
|
1348
|
+
"diag.chat": "\u5BF9\u8BDD\u8FDE\u901A",
|
|
1349
|
+
"about.title": "\u5173\u4E8E",
|
|
1350
|
+
"about.protocol": "\u534F\u8BAE",
|
|
1351
|
+
"about.auth": "\u9274\u6743",
|
|
1352
|
+
"about.encrypt": "\u8F7D\u8377\u52A0\u5BC6",
|
|
1353
|
+
"chip.ready": "\u7801\u9053",
|
|
1354
|
+
"chip.idle": "\u7801\u9053\xB7\u672A\u914D\u7F6E",
|
|
1355
|
+
"chip.busy": "\u7801\u9053\xB7\u8BF7\u6C42\u4E2D",
|
|
1356
|
+
"chip.account": "\u8D26\u53F7",
|
|
1357
|
+
"chip.online": "\u5DF2\u8FDE\u63A5",
|
|
1358
|
+
"chip.offline": "\u672A\u8FDE\u63A5",
|
|
1359
|
+
"chip.keyId": "keyId",
|
|
1360
|
+
"chip.role": "\u89D2\u8272",
|
|
1361
|
+
"chip.credit": "\u79EF\u5206\u989D\u5EA6",
|
|
1362
|
+
"chip.refresh": "\u5237\u65B0",
|
|
1363
|
+
"chip.used": "\u5DF2\u7528",
|
|
1364
|
+
"chip.bonus": "\u8D60\u9001\u4F59\u989D",
|
|
1365
|
+
"chip.basic": "\u57FA\u7840\u4F59\u989D",
|
|
1366
|
+
"chip.tokens": "\u7D2F\u8BA1 token",
|
|
1367
|
+
"chip.noCredit": "\u989D\u5EA6\u63A5\u53E3\u672A\u8FD4\u56DE\uFF0C\u7A0D\u540E\u70B9\u5237\u65B0\u91CD\u8BD5",
|
|
1368
|
+
"chip.testRefresh": "\u6D4B\u8BD5\u5E76\u5237\u65B0\u989D\u5EA6",
|
|
1369
|
+
"chip.testing": "\u68C0\u6D4B\u4E2D\u2026"
|
|
1370
|
+
};
|
|
1371
|
+
var en = {
|
|
1372
|
+
"meta.title": "CodeArts Connector",
|
|
1373
|
+
"meta.desc": "Bring Huawei Cloud CodeArts Agent models into DSH",
|
|
1374
|
+
"tab.account": "Account",
|
|
1375
|
+
"tab.interface": "Interface",
|
|
1376
|
+
"tab.models": "Models",
|
|
1377
|
+
"tab.diagnostics": "Diagnostics",
|
|
1378
|
+
"tab.about": "About",
|
|
1379
|
+
"account.title": "Huawei Cloud credentials",
|
|
1380
|
+
"account.hint": "Nothing to fill in is fine: if the CodeArts client is installed and signed in, the plugin borrows its login state automatically. Entering permanent AK/SK makes it fully hands-off afterwards.",
|
|
1381
|
+
"account.sourceTitle": "Where the credential comes from",
|
|
1382
|
+
"account.sourceDesc": "The plugin tries these in order and uses the first usable one \u2014 you do not need all three.",
|
|
1383
|
+
"account.sourceEnv": "Environment variables MADAO_AK / MADAO_SK",
|
|
1384
|
+
"account.sourceFile": "Permanent AK/SK entered above",
|
|
1385
|
+
"account.sourceCodearts": "CodeArts client login state (zero config)",
|
|
1386
|
+
"account.sourceActive": "in use",
|
|
1387
|
+
"account.sourceTemp": "temporary, {n} min left",
|
|
1388
|
+
"account.sourceExpired": "expired \xB7 open CodeArts once so it refreshes, then retry the connection test",
|
|
1389
|
+
"account.sourceTempSoon": "expiring in {n} min \xB7 refresh CodeArts now, or use permanent AK/SK",
|
|
1390
|
+
"account.sourceTempSec": "{n}s left, about to expire",
|
|
1391
|
+
"account.sourceTempNote": 'You are using a temporary credential borrowed from the CodeArts login state; it stops working after a few hours. To recover: open the CodeArts client once so it refreshes, then click "Test connection" above. To skip this entirely, enter permanent AK/SK above \u2014 one-time setup, and the plugin keeps exchanging and renewing STS by itself.',
|
|
1392
|
+
"account.sourcePermNote": "Using a permanent credential. The plugin exchanges STS automatically and renews it before expiry \u2014 nothing left to do.",
|
|
1393
|
+
"account.howToGetAk": "How to get AK/SK",
|
|
1394
|
+
"account.howToGetAkSteps": 'Huawei Cloud console \u2192 account menu (top right) \u2192 My Credentials \u2192 Access Keys \u2192 Create Access Key. In the downloaded credentials.csv, "Access Key Id" and "Secret Access Key" are the two fields above (the secret is shown only once \u2014 save it). Do not fill in STS.',
|
|
1395
|
+
"account.howCodeartsWorks": "How option 3 works",
|
|
1396
|
+
"account.howCodeartsWorksDesc": 'If the CodeArts client is installed and signed in on this machine, the plugin reads its local login state directly \u2014 nothing to fill in. Note: the plugin has no login screen of its own; signing in always happens in the CodeArts client. So "works with no setup" assumes CodeArts is already signed in on that machine.',
|
|
1397
|
+
"account.needBoth": "Both Access Key ID and Secret Access Key are required.",
|
|
1398
|
+
"account.saving": "Saving\u2026",
|
|
1399
|
+
"account.saveOk": "Written to disk and applied immediately (source: {source})",
|
|
1400
|
+
"account.saveFail": "Save failed",
|
|
1401
|
+
"account.ak": "Access Key ID",
|
|
1402
|
+
"account.sk": "Secret Access Key",
|
|
1403
|
+
"account.save": "Save",
|
|
1404
|
+
"account.saved": "Saved",
|
|
1405
|
+
"account.test": "Test connection",
|
|
1406
|
+
"account.testing": "Testing\u2026",
|
|
1407
|
+
"account.ok": "Connected",
|
|
1408
|
+
"account.fail": "Connection failed",
|
|
1409
|
+
"account.masked": "Active \xB7 leave blank to keep, type to replace",
|
|
1410
|
+
"account.current": "Current connection",
|
|
1411
|
+
"account.refresh": "Refresh",
|
|
1412
|
+
"account.user": "Huawei Cloud account",
|
|
1413
|
+
"account.credit": "Credits",
|
|
1414
|
+
"account.used": "used",
|
|
1415
|
+
"account.noState": "Bridge not ready, try Refresh again",
|
|
1416
|
+
"account.checkin": "Daily check-in",
|
|
1417
|
+
"checkin.done": "Checked in today, +{n} credits added",
|
|
1418
|
+
"checkin.available": "{n} credits available",
|
|
1419
|
+
"checkin.idle": "Nothing to claim right now",
|
|
1420
|
+
"checkin.claim": "Claim",
|
|
1421
|
+
"checkin.doing": "Claiming\u2026",
|
|
1422
|
+
"checkin.unavailable": "Check-in status unavailable",
|
|
1423
|
+
"checkin.all": "Claim all",
|
|
1424
|
+
"checkin.allDoing": "Claiming\u2026",
|
|
1425
|
+
"checkin.allGot": "Claimed {n} campaign(s)",
|
|
1426
|
+
"checkin.allNone": "Nothing to claim",
|
|
1427
|
+
"checkin.expiring": "Credits expiring soon",
|
|
1428
|
+
"checkin.auto": "Auto check-in",
|
|
1429
|
+
"checkin.autoHint": "When on, the plugin checks once a minute and claims the daily reward as soon as it is available (at most one attempt every 15 minutes). Off by default.",
|
|
1430
|
+
"checkin.autoLast": "Last: ",
|
|
1431
|
+
"checkin.autoIdle": "Has not run yet; it will check shortly.",
|
|
1432
|
+
"ui.hint": "These switches take effect immediately \u2014 no DSH restart needed.",
|
|
1433
|
+
"ui.chipSection": "Composer status chip",
|
|
1434
|
+
"ui.composerChip": "Show the CodeArts status chip in the composer",
|
|
1435
|
+
"ui.composerChipHint": "When off, the small \u201C\u25CF CodeArts\u201D chip beside the composer is hidden. Account and credits stay available on this page.",
|
|
1436
|
+
"ui.saveFail": "Save failed",
|
|
1437
|
+
"models.title": "Available models",
|
|
1438
|
+
"models.hint": "{n} models from the CodeArts gateway.",
|
|
1439
|
+
"models.name": "Name",
|
|
1440
|
+
"models.context": "Context",
|
|
1441
|
+
"models.output": "Max output",
|
|
1442
|
+
"models.ratio": "Rate",
|
|
1443
|
+
"models.ratioHint": "Credit multiplier vs. baseline price; lower is cheaper",
|
|
1444
|
+
"models.think": "Thinking",
|
|
1445
|
+
"models.thinkHint": "Thinking strengths offered by CodeArts. Note: the gateway chat endpoint does not forward a strength parameter (every field name and model-id variant probed was ignored), so these levels currently affect display only, not upstream behaviour.",
|
|
1446
|
+
"models.enabledCount": "{on} of {all} enabled",
|
|
1447
|
+
"models.selectAll": "Select all",
|
|
1448
|
+
"models.selectNone": "Select none",
|
|
1449
|
+
"models.search": "Search by name or model_id",
|
|
1450
|
+
"models.rowMeta": "Context {context} \xB7 Output {output} \xB7 Thinking {think}",
|
|
1451
|
+
"models.thinkNone": "none",
|
|
1452
|
+
"models.contextCap": "Shown context",
|
|
1453
|
+
"models.contextCapHint": "Caps the context DSH displays; a lower value makes DSH compact earlier. The gateway limit is unchanged.",
|
|
1454
|
+
"models.contextGateway": "Gateway {v}",
|
|
1455
|
+
"models.save": "Save",
|
|
1456
|
+
"models.saving": "Saving\u2026",
|
|
1457
|
+
"models.saved": "Saved",
|
|
1458
|
+
"models.savedLive": "Saved \u2014 the model picker is updated",
|
|
1459
|
+
"models.dirty": "Unsaved changes",
|
|
1460
|
+
"models.applyUnavailable": "Saved, but this host cannot apply it live; restart DSH to apply.",
|
|
1461
|
+
"models.applyFailed": "Saved, but applying failed",
|
|
1462
|
+
"models.saveFail": "Save failed",
|
|
1463
|
+
"models.empty": "No matching models",
|
|
1464
|
+
"models.visionHint": "Whether the CodeArts gateway opens image input for this model. Note: the bridge forwards text only, so images are dropped when building the request.",
|
|
1465
|
+
"models.visionYes": "Gateway supports images (bridge forwards text only)",
|
|
1466
|
+
"models.visionNo": "Gateway: text only",
|
|
1467
|
+
"diag.title": "Diagnostics",
|
|
1468
|
+
"diag.run": "Run check",
|
|
1469
|
+
"diag.running": "Running\u2026",
|
|
1470
|
+
"diag.credentials": "Credentials",
|
|
1471
|
+
"diag.sts": "STS exchange",
|
|
1472
|
+
"diag.handshake": "Key exchange",
|
|
1473
|
+
"diag.models": "Model list",
|
|
1474
|
+
"diag.chat": "Chat",
|
|
1475
|
+
"about.title": "About",
|
|
1476
|
+
"about.protocol": "Protocol",
|
|
1477
|
+
"about.auth": "Auth",
|
|
1478
|
+
"about.encrypt": "Payload encryption",
|
|
1479
|
+
"chip.ready": "CodeArts",
|
|
1480
|
+
"chip.idle": "CodeArts \xB7 unset",
|
|
1481
|
+
"chip.busy": "CodeArts \xB7 busy",
|
|
1482
|
+
"chip.account": "Account",
|
|
1483
|
+
"chip.online": "Connected",
|
|
1484
|
+
"chip.offline": "Not connected",
|
|
1485
|
+
"chip.keyId": "keyId",
|
|
1486
|
+
"chip.role": "Role",
|
|
1487
|
+
"chip.credit": "Credits",
|
|
1488
|
+
"chip.refresh": "Refresh",
|
|
1489
|
+
"chip.used": "Used",
|
|
1490
|
+
"chip.bonus": "Bonus",
|
|
1491
|
+
"chip.basic": "Basic",
|
|
1492
|
+
"chip.tokens": "Total tokens",
|
|
1493
|
+
"chip.noCredit": "Credit endpoint unavailable, try Refresh later",
|
|
1494
|
+
"chip.testRefresh": "Test & refresh",
|
|
1495
|
+
"chip.testing": "Testing\u2026"
|
|
1496
|
+
};
|
|
1497
|
+
function apply(ctx) {
|
|
1498
|
+
const namespace = "settings.madao";
|
|
1499
|
+
try {
|
|
1500
|
+
ctx.effect(
|
|
1501
|
+
() => ctx.locale.register(namespace, { zh, en }),
|
|
1502
|
+
"dsh-connect-madao: settings copy"
|
|
1503
|
+
);
|
|
1504
|
+
} catch (err) {
|
|
1505
|
+
console.warn("[dsh-connect-madao] locale register failed:", err);
|
|
1506
|
+
}
|
|
1507
|
+
const t = ctx.locale.bind(namespace);
|
|
1508
|
+
const registerCard = (slotName) => {
|
|
1509
|
+
try {
|
|
1510
|
+
return ctx.slots.inject(
|
|
1511
|
+
slotName,
|
|
1512
|
+
() => ctx.slots.register(
|
|
1513
|
+
{
|
|
1514
|
+
name: slotName,
|
|
1515
|
+
key: "dsh-connect-madao",
|
|
1516
|
+
priority: 40,
|
|
1517
|
+
inject: () => ({ t })
|
|
1518
|
+
},
|
|
1519
|
+
CodeArtsPanel
|
|
1520
|
+
)
|
|
1521
|
+
);
|
|
1522
|
+
} catch (err) {
|
|
1523
|
+
console.error(`[dsh-connect-madao] slot "${slotName}" register failed:`, err);
|
|
1524
|
+
return void 0;
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
registerCard("plugins.bundle.config");
|
|
1528
|
+
const SETTINGS_SECTION_ID = "dsh-connect-madao";
|
|
1529
|
+
try {
|
|
1530
|
+
ctx.slots.inject(
|
|
1531
|
+
"settings.section",
|
|
1532
|
+
() => ctx.slots.register(
|
|
1533
|
+
{
|
|
1534
|
+
name: "settings.section",
|
|
1535
|
+
id: SETTINGS_SECTION_ID,
|
|
1536
|
+
order: 55,
|
|
1537
|
+
label: () => t("meta.title"),
|
|
1538
|
+
locale: namespace,
|
|
1539
|
+
inject: () => ({ t, surface: "settings" })
|
|
1540
|
+
},
|
|
1541
|
+
CodeArtsPanel
|
|
1542
|
+
)
|
|
1543
|
+
);
|
|
1544
|
+
} catch (err) {
|
|
1545
|
+
console.error("[dsh-connect-madao] settings.section register failed:", err);
|
|
1546
|
+
}
|
|
1547
|
+
try {
|
|
1548
|
+
ctx.slots.inject(
|
|
1549
|
+
"settings.section.icon",
|
|
1550
|
+
() => ctx.slots.register(
|
|
1551
|
+
{ name: "settings.section.icon", id: SETTINGS_SECTION_ID, locale: namespace },
|
|
1552
|
+
SettingsSectionIcon
|
|
1553
|
+
)
|
|
1554
|
+
);
|
|
1555
|
+
} catch (err) {
|
|
1556
|
+
console.warn("[dsh-connect-madao] settings nav icon register failed (page unaffected):", err);
|
|
1557
|
+
}
|
|
1558
|
+
try {
|
|
1559
|
+
ctx.slots.inject(
|
|
1560
|
+
"conversation.input.right",
|
|
1561
|
+
() => ctx.slots.register(
|
|
1562
|
+
{
|
|
1563
|
+
name: "conversation.input.right",
|
|
1564
|
+
id: "dsh-connect-madao-chip",
|
|
1565
|
+
order: 6,
|
|
1566
|
+
locale: namespace,
|
|
1567
|
+
inject: () => ({ t })
|
|
1568
|
+
},
|
|
1569
|
+
ComposerChip
|
|
1570
|
+
)
|
|
1571
|
+
);
|
|
1572
|
+
} catch (err) {
|
|
1573
|
+
console.warn("[dsh-connect-madao] composer chip register failed:", err);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
exports.apply = apply;
|
|
1577
|
+
exports.inject = inject;
|
|
1578
|
+
exports.name = name;
|
|
1579
|
+
return module.exports;
|
|
1580
|
+
}
|
|
1581
|
+
});
|