dsh-agent-toolkit 0.2.6 → 0.2.8
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/lib/client.js +264 -176
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +108 -46
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -67,15 +67,15 @@ window.__ModuleLoader__.load({
|
|
|
67
67
|
document.head.appendChild(tag);
|
|
68
68
|
}
|
|
69
69
|
var delegate_card_module_css_default = {
|
|
70
|
-
"
|
|
70
|
+
"root": "_8wQUq_root",
|
|
71
71
|
"prompt": "_8wQUq_prompt",
|
|
72
|
-
"
|
|
72
|
+
"summary": "_8wQUq_summary",
|
|
73
73
|
"childLink": "_8wQUq_childLink",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
74
|
+
"row": "_8wQUq_row",
|
|
75
|
+
"body": "_8wQUq_body",
|
|
76
76
|
"chip": "_8wQUq_chip",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
77
|
+
"result": "_8wQUq_result",
|
|
78
|
+
"visuallyHidden": "_8wQUq_visuallyHidden"
|
|
79
79
|
};
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/client/delegate/delegate-card.tsx
|
|
@@ -311,8 +311,8 @@ window.__ModuleLoader__.load({
|
|
|
311
311
|
document.head.appendChild(tag);
|
|
312
312
|
}
|
|
313
313
|
var entry_module_css_default$1 = {
|
|
314
|
-
"
|
|
315
|
-
"
|
|
314
|
+
"rail": "VJWWsa_rail",
|
|
315
|
+
"trigger": "VJWWsa_trigger"
|
|
316
316
|
};
|
|
317
317
|
//#endregion
|
|
318
318
|
//#region src/client/shared/entry.tsx
|
|
@@ -411,33 +411,33 @@ window.__ModuleLoader__.load({
|
|
|
411
411
|
document.head.appendChild(tag);
|
|
412
412
|
}
|
|
413
413
|
var agents_module_css_default = {
|
|
414
|
-
"
|
|
415
|
-
"listPane": "KsfSLW_listPane",
|
|
416
|
-
"agentRow": "KsfSLW_agentRow",
|
|
417
|
-
"agentRowActive": "KsfSLW_agentRowActive",
|
|
418
|
-
"createButton": "KsfSLW_createButton",
|
|
419
|
-
"editorPane": "KsfSLW_editorPane",
|
|
414
|
+
"block": "KsfSLW_block",
|
|
420
415
|
"editor": "KsfSLW_editor",
|
|
421
|
-
"
|
|
422
|
-
"toolGrid": "KsfSLW_toolGrid",
|
|
423
|
-
"split": "KsfSLW_split",
|
|
424
|
-
"actions": "KsfSLW_actions",
|
|
425
|
-
"dangerButton": "KsfSLW_dangerButton",
|
|
426
|
-
"toolGroupTitle": "KsfSLW_toolGroupTitle",
|
|
427
|
-
"toolCheck": "KsfSLW_toolCheck",
|
|
428
|
-
"readonlyId": "KsfSLW_readonlyId",
|
|
416
|
+
"agentDesc": "KsfSLW_agentDesc",
|
|
429
417
|
"select": "KsfSLW_select",
|
|
418
|
+
"textarea": "KsfSLW_textarea",
|
|
430
419
|
"toolMode": "KsfSLW_toolMode",
|
|
431
|
-
"field": "KsfSLW_field",
|
|
432
420
|
"toolGroupSet": "KsfSLW_toolGroupSet",
|
|
421
|
+
"toolGroupTitle": "KsfSLW_toolGroupTitle",
|
|
422
|
+
"dialog": "KsfSLW_dialog",
|
|
423
|
+
"toolCheck": "KsfSLW_toolCheck",
|
|
433
424
|
"error": "KsfSLW_error",
|
|
434
|
-
"
|
|
435
|
-
"
|
|
425
|
+
"dangerButton": "KsfSLW_dangerButton",
|
|
426
|
+
"hint": "KsfSLW_hint",
|
|
427
|
+
"readonlyId": "KsfSLW_readonlyId",
|
|
436
428
|
"builtinBadge": "KsfSLW_builtinBadge",
|
|
437
|
-
"
|
|
438
|
-
"
|
|
439
|
-
"
|
|
440
|
-
"
|
|
429
|
+
"agentName": "KsfSLW_agentName",
|
|
430
|
+
"actions": "KsfSLW_actions",
|
|
431
|
+
"agentRow": "KsfSLW_agentRow",
|
|
432
|
+
"field": "KsfSLW_field",
|
|
433
|
+
"toolGrid": "KsfSLW_toolGrid",
|
|
434
|
+
"agentRowActive": "KsfSLW_agentRowActive",
|
|
435
|
+
"listPane": "KsfSLW_listPane",
|
|
436
|
+
"input": "KsfSLW_input",
|
|
437
|
+
"split": "KsfSLW_split",
|
|
438
|
+
"blockTitle": "KsfSLW_blockTitle",
|
|
439
|
+
"createButton": "KsfSLW_createButton",
|
|
440
|
+
"editorPane": "KsfSLW_editorPane"
|
|
441
441
|
};
|
|
442
442
|
//#endregion
|
|
443
443
|
//#region src/client/agents/AgentEditor.tsx
|
|
@@ -951,24 +951,24 @@ window.__ModuleLoader__.load({
|
|
|
951
951
|
document.head.appendChild(tag);
|
|
952
952
|
}
|
|
953
953
|
var prompt_module_css_default = {
|
|
954
|
-
"
|
|
954
|
+
"layerName": "VZk1fa_layerName",
|
|
955
955
|
"field": "VZk1fa_field",
|
|
956
|
+
"editorPane": "VZk1fa_editorPane",
|
|
957
|
+
"split": "VZk1fa_split",
|
|
956
958
|
"textarea": "VZk1fa_textarea",
|
|
957
|
-
"
|
|
959
|
+
"hint": "VZk1fa_hint",
|
|
960
|
+
"tabs": "VZk1fa_tabs",
|
|
961
|
+
"listPane": "VZk1fa_listPane",
|
|
962
|
+
"tabActive": "VZk1fa_tabActive",
|
|
958
963
|
"layerRowActive": "VZk1fa_layerRowActive",
|
|
964
|
+
"actions": "VZk1fa_actions",
|
|
965
|
+
"editor": "VZk1fa_editor",
|
|
959
966
|
"layerOrder": "VZk1fa_layerOrder",
|
|
960
|
-
"listPane": "VZk1fa_listPane",
|
|
961
967
|
"dialog": "VZk1fa_dialog",
|
|
962
|
-
"editorPane": "VZk1fa_editorPane",
|
|
963
|
-
"editor": "VZk1fa_editor",
|
|
964
|
-
"split": "VZk1fa_split",
|
|
965
|
-
"actions": "VZk1fa_actions",
|
|
966
|
-
"layerRow": "VZk1fa_layerRow",
|
|
967
968
|
"readonlyTag": "VZk1fa_readonlyTag",
|
|
968
|
-
"
|
|
969
|
-
"
|
|
970
|
-
"
|
|
971
|
-
"hint": "VZk1fa_hint"
|
|
969
|
+
"error": "VZk1fa_error",
|
|
970
|
+
"layerRow": "VZk1fa_layerRow",
|
|
971
|
+
"tab": "VZk1fa_tab"
|
|
972
972
|
};
|
|
973
973
|
//#endregion
|
|
974
974
|
//#region src/client/prompt/PromptLayersModal.tsx
|
|
@@ -1453,11 +1453,11 @@ window.__ModuleLoader__.load({
|
|
|
1453
1453
|
}
|
|
1454
1454
|
var chart_module_css_default = {
|
|
1455
1455
|
"chartTheme": "_8LXSJW_chartTheme",
|
|
1456
|
-
"tooltipTotal": "_8LXSJW_tooltipTotal",
|
|
1457
1456
|
"legend": "_8LXSJW_legend",
|
|
1457
|
+
"tooltipTotal": "_8LXSJW_tooltipTotal",
|
|
1458
|
+
"swatchCached": "_8LXSJW_swatchCached",
|
|
1458
1459
|
"tooltipTitle": "_8LXSJW_tooltipTitle",
|
|
1459
1460
|
"swatchFresh": "_8LXSJW_swatchFresh",
|
|
1460
|
-
"swatchCached": "_8LXSJW_swatchCached",
|
|
1461
1461
|
"tooltip": "_8LXSJW_tooltip"
|
|
1462
1462
|
};
|
|
1463
1463
|
//#endregion
|
|
@@ -1472,14 +1472,14 @@ window.__ModuleLoader__.load({
|
|
|
1472
1472
|
document.head.appendChild(tag);
|
|
1473
1473
|
}
|
|
1474
1474
|
var ActivityHeatmap_module_css_default = {
|
|
1475
|
-
"level3": "hjrYrq_level3",
|
|
1476
|
-
"level2": "hjrYrq_level2",
|
|
1477
|
-
"level0": "hjrYrq_level0",
|
|
1478
1475
|
"grid": "hjrYrq_grid",
|
|
1476
|
+
"level0": "hjrYrq_level0",
|
|
1477
|
+
"week": "hjrYrq_week",
|
|
1479
1478
|
"level4": "hjrYrq_level4",
|
|
1480
1479
|
"level1": "hjrYrq_level1",
|
|
1481
|
-
"
|
|
1482
|
-
"
|
|
1480
|
+
"months": "hjrYrq_months",
|
|
1481
|
+
"level2": "hjrYrq_level2",
|
|
1482
|
+
"level3": "hjrYrq_level3"
|
|
1483
1483
|
};
|
|
1484
1484
|
//#endregion
|
|
1485
1485
|
//#region ../usage/src/client/usage/ActivityHeatmap.tsx
|
|
@@ -52516,19 +52516,19 @@ ${te.current.stack}
|
|
|
52516
52516
|
document.head.appendChild(tag);
|
|
52517
52517
|
}
|
|
52518
52518
|
var UsageModal_module_css_default = {
|
|
52519
|
-
"compaction": "MODeXa_compaction",
|
|
52520
52519
|
"dateLabel": "MODeXa_dateLabel",
|
|
52521
|
-
"
|
|
52520
|
+
"sectionTitle": "MODeXa_sectionTitle",
|
|
52521
|
+
"pagerButton": "MODeXa_pagerButton",
|
|
52522
52522
|
"total": "MODeXa_total",
|
|
52523
52523
|
"tabActive": "MODeXa_tabActive",
|
|
52524
|
-
"pagerButton": "MODeXa_pagerButton",
|
|
52525
|
-
"pager": "MODeXa_pager",
|
|
52526
|
-
"rowName": "MODeXa_rowName",
|
|
52527
52524
|
"dialog": "MODeXa_dialog",
|
|
52528
|
-
"sectionTitle": "MODeXa_sectionTitle",
|
|
52529
52525
|
"tabs": "MODeXa_tabs",
|
|
52526
|
+
"rowCalls": "MODeXa_rowCalls",
|
|
52527
|
+
"compaction": "MODeXa_compaction",
|
|
52530
52528
|
"row": "MODeXa_row",
|
|
52531
|
-
"
|
|
52529
|
+
"pager": "MODeXa_pager",
|
|
52530
|
+
"tab": "MODeXa_tab",
|
|
52531
|
+
"rowName": "MODeXa_rowName"
|
|
52532
52532
|
};
|
|
52533
52533
|
//#endregion
|
|
52534
52534
|
//#region ../usage/src/client/usage/UsageModal.tsx
|
|
@@ -52737,6 +52737,9 @@ ${te.current.stack}
|
|
|
52737
52737
|
body: JSON.stringify(input)
|
|
52738
52738
|
});
|
|
52739
52739
|
}
|
|
52740
|
+
function deleteBot(id) {
|
|
52741
|
+
return request(`/dsh-agent-toolkit/api/bots/bots?id=${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
52742
|
+
}
|
|
52740
52743
|
const startRegisterApp = () => request("/dsh-agent-toolkit/api/bots/register-app", { method: "POST" });
|
|
52741
52744
|
const pollRegisterApp = (id) => request(`/dsh-agent-toolkit/api/bots/register-app/status?id=${encodeURIComponent(id)}`).then((r) => r.state);
|
|
52742
52745
|
//#endregion
|
|
@@ -55143,7 +55146,7 @@ ${te.current.stack}
|
|
|
55143
55146
|
return SvgRenderer.render(data, opts);
|
|
55144
55147
|
});
|
|
55145
55148
|
})))();
|
|
55146
|
-
const css = ".vTbXga_dialog{width:560px}.vTbXga_group{margin-bottom:12px}.vTbXga_groupTitle{opacity:.6;word-break:break-all;margin:0 0 4px;font-size:12px}.vTbXga_botRow{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;width:
|
|
55149
|
+
const css = ".vTbXga_dialog{width:560px}.vTbXga_group{margin-bottom:12px}.vTbXga_groupTitle{opacity:.6;word-break:break-all;margin:0 0 4px;font-size:12px}.vTbXga_botRow{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;align-items:center;gap:8px;width:100%;margin-bottom:4px;padding:8px 10px;display:flex}.vTbXga_botRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.vTbXga_botMain{cursor:pointer;min-width:0;font:inherit;color:inherit;text-align:left;background:0 0;border:none;flex:1;align-items:center;gap:8px;padding:0;display:flex}.vTbXga_botDelete{cursor:pointer;font:inherit;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;padding:2px 8px;font-size:12px;line-height:18px}.vTbXga_botDelete:hover{color:var(--dsw-alias-state-error-primary)}.vTbXga_botName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.vTbXga_channelBadge{flex:none}.vTbXga_status{color:var(--dsw-alias-label-tertiary);flex:none;align-items:center;gap:6px;font-size:12px;line-height:18px;display:inline-flex}.vTbXga_createButton{margin-top:8px}.vTbXga_field{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;margin:0 0 12px;font-size:13px;line-height:20px;display:flex}.vTbXga_input{box-sizing:border-box;width:100%}.vTbXga_select,.vTbXga_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:12px;font-size:14px;line-height:22px}.vTbXga_select{height:32px;padding:0 8px}.vTbXga_textarea{resize:vertical;padding:4px 8px}.vTbXga_select:focus,.vTbXga_textarea:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.vTbXga_steps{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;margin:0 0 16px;font-size:13px;line-height:20px;display:flex}.vTbXga_step{color:var(--dsw-alias-label-tertiary)}.vTbXga_stepActive{color:var(--dsw-alias-label-primary);font-weight:600}.vTbXga_stepSeparator{color:var(--dsw-alias-label-tertiary)}.vTbXga_tabs{background:var(--dsw-alias-bg-layer-2);border-radius:12px;gap:2px;margin-bottom:12px;padding:3px;display:inline-flex}.vTbXga_tab{height:28px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:9px;padding:0 12px;font-size:13px;line-height:28px}.vTbXga_tabActive{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.vTbXga_scanSection{margin:0 0 12px}.vTbXga_error{color:var(--dsw-alias-state-error-primary);margin:0 0 12px;font-size:12px;line-height:18px}.vTbXga_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 12px;font-size:12px;line-height:18px}.vTbXga_formActions{justify-content:flex-end;gap:8px;margin-top:4px;display:flex}";
|
|
55147
55150
|
const tagId = "dsh-agent-toolkit/bots.module.css-2ed59f26";
|
|
55148
55151
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
55149
55152
|
const tag = document.createElement("style");
|
|
@@ -55153,29 +55156,31 @@ ${te.current.stack}
|
|
|
55153
55156
|
document.head.appendChild(tag);
|
|
55154
55157
|
}
|
|
55155
55158
|
var bots_module_css_default = {
|
|
55156
|
-
"
|
|
55157
|
-
"
|
|
55158
|
-
"
|
|
55159
|
-
"error": "vTbXga_error",
|
|
55159
|
+
"stepSeparator": "vTbXga_stepSeparator",
|
|
55160
|
+
"stepActive": "vTbXga_stepActive",
|
|
55161
|
+
"group": "vTbXga_group",
|
|
55160
55162
|
"tabs": "vTbXga_tabs",
|
|
55161
|
-
"
|
|
55162
|
-
"step": "vTbXga_step",
|
|
55163
|
-
"scanSection": "vTbXga_scanSection",
|
|
55164
|
-
"textarea": "vTbXga_textarea",
|
|
55163
|
+
"formActions": "vTbXga_formActions",
|
|
55165
55164
|
"createButton": "vTbXga_createButton",
|
|
55166
55165
|
"groupTitle": "vTbXga_groupTitle",
|
|
55167
|
-
"
|
|
55166
|
+
"steps": "vTbXga_steps",
|
|
55167
|
+
"scanSection": "vTbXga_scanSection",
|
|
55168
|
+
"botMain": "vTbXga_botMain",
|
|
55169
|
+
"botDelete": "vTbXga_botDelete",
|
|
55170
|
+
"input": "vTbXga_input",
|
|
55168
55171
|
"status": "vTbXga_status",
|
|
55169
|
-
"
|
|
55170
|
-
"botRow": "vTbXga_botRow",
|
|
55171
|
-
"channelBadge": "vTbXga_channelBadge",
|
|
55172
|
-
"group": "vTbXga_group",
|
|
55173
|
-
"tabActive": "vTbXga_tabActive",
|
|
55174
|
-
"stepActive": "vTbXga_stepActive",
|
|
55172
|
+
"textarea": "vTbXga_textarea",
|
|
55175
55173
|
"botName": "vTbXga_botName",
|
|
55174
|
+
"tabActive": "vTbXga_tabActive",
|
|
55175
|
+
"channelBadge": "vTbXga_channelBadge",
|
|
55176
|
+
"botRow": "vTbXga_botRow",
|
|
55176
55177
|
"select": "vTbXga_select",
|
|
55177
|
-
"
|
|
55178
|
-
"
|
|
55178
|
+
"tab": "vTbXga_tab",
|
|
55179
|
+
"dialog": "vTbXga_dialog",
|
|
55180
|
+
"field": "vTbXga_field",
|
|
55181
|
+
"step": "vTbXga_step",
|
|
55182
|
+
"error": "vTbXga_error",
|
|
55183
|
+
"hint": "vTbXga_hint"
|
|
55179
55184
|
};
|
|
55180
55185
|
//#endregion
|
|
55181
55186
|
//#region src/client/bots/BotForm.tsx
|
|
@@ -55195,11 +55200,12 @@ ${te.current.stack}
|
|
|
55195
55200
|
const [providersLoaded, setProvidersLoaded] = (0, react.useState)(false);
|
|
55196
55201
|
const [models, setModels] = (0, react.useState)([]);
|
|
55197
55202
|
const [tab, setTab] = (0, react.useState)("scan");
|
|
55198
|
-
const [appId, setAppId] = (0, react.useState)(bot?.feishu
|
|
55203
|
+
const [appId, setAppId] = (0, react.useState)(bot?.feishu?.appId ?? "");
|
|
55199
55204
|
const [appSecret, setAppSecret] = (0, react.useState)("");
|
|
55200
55205
|
const [scan, setScan] = (0, react.useState)({ status: "idle" });
|
|
55201
55206
|
const [error, setError] = (0, react.useState)(null);
|
|
55202
55207
|
const [saving, setSaving] = (0, react.useState)(false);
|
|
55208
|
+
const [confirmUnbind, setConfirmUnbind] = (0, react.useState)(false);
|
|
55203
55209
|
const canvasRef = (0, react.useRef)(null);
|
|
55204
55210
|
const pollTimer = (0, react.useRef)(void 0);
|
|
55205
55211
|
(0, react.useEffect)(() => {
|
|
@@ -55304,47 +55310,52 @@ ${te.current.stack}
|
|
|
55304
55310
|
});
|
|
55305
55311
|
}
|
|
55306
55312
|
}
|
|
55313
|
+
const bindable = bot === void 0 || bot.feishu === void 0;
|
|
55307
55314
|
(0, react.useEffect)(() => {
|
|
55308
|
-
if (step === 2 &&
|
|
55315
|
+
if (step === 2 && bindable && scan.status === "idle") beginScan();
|
|
55309
55316
|
}, [
|
|
55310
55317
|
step,
|
|
55311
55318
|
scan.status,
|
|
55312
|
-
|
|
55319
|
+
bindable
|
|
55313
55320
|
]);
|
|
55314
55321
|
async function save() {
|
|
55315
55322
|
setError(null);
|
|
55316
|
-
const feishu =
|
|
55323
|
+
const feishu = bindable ? tab === "scan" ? scan.status === "done" ? {
|
|
55317
55324
|
appId: scan.appId,
|
|
55318
55325
|
appSecretRef: scan.credentialRef
|
|
55319
55326
|
} : void 0 : appId.trim().length > 0 && appSecret.trim().length > 0 ? {
|
|
55320
55327
|
appId: appId.trim(),
|
|
55321
55328
|
appSecret: appSecret.trim()
|
|
55322
|
-
} : void 0;
|
|
55329
|
+
} : void 0 : void 0;
|
|
55323
55330
|
if (!editing && feishu === void 0) {
|
|
55324
55331
|
setError("请填写 App ID 与 App Secret,或先完成扫码创建");
|
|
55325
55332
|
return;
|
|
55326
55333
|
}
|
|
55327
|
-
|
|
55328
|
-
|
|
55329
|
-
|
|
55330
|
-
|
|
55331
|
-
|
|
55332
|
-
|
|
55333
|
-
|
|
55334
|
-
|
|
55335
|
-
|
|
55336
|
-
|
|
55337
|
-
|
|
55338
|
-
|
|
55339
|
-
|
|
55340
|
-
|
|
55334
|
+
let agentOptions;
|
|
55335
|
+
if (agentRef === "main") {
|
|
55336
|
+
const providerValue = provider.trim();
|
|
55337
|
+
const modelValue = model.trim();
|
|
55338
|
+
if (providerValue.length === 0) {
|
|
55339
|
+
setError("请选择 Provider");
|
|
55340
|
+
return;
|
|
55341
|
+
}
|
|
55342
|
+
if (modelValue.length === 0) {
|
|
55343
|
+
setError("请选择或填写模型");
|
|
55344
|
+
return;
|
|
55345
|
+
}
|
|
55346
|
+
agentOptions = {
|
|
55347
|
+
provider: providerValue,
|
|
55348
|
+
model: modelValue
|
|
55349
|
+
};
|
|
55350
|
+
} else if (editing) agentOptions = null;
|
|
55341
55351
|
setSaving(true);
|
|
55342
55352
|
try {
|
|
55343
55353
|
const payload = {
|
|
55344
55354
|
name: name.trim(),
|
|
55345
55355
|
project: project.trim(),
|
|
55346
55356
|
...editing ? { agentRef: agentRef === "main" ? null : agentRef } : agentRef !== "main" ? { agentRef } : {},
|
|
55347
|
-
|
|
55357
|
+
...feishu !== void 0 ? { feishu } : {},
|
|
55358
|
+
...agentOptions !== void 0 ? { agentOptions } : {}
|
|
55348
55359
|
};
|
|
55349
55360
|
if (editing) await updateBot(bot.id, payload);
|
|
55350
55361
|
else await createBot({
|
|
@@ -55358,6 +55369,33 @@ ${te.current.stack}
|
|
|
55358
55369
|
setSaving(false);
|
|
55359
55370
|
}
|
|
55360
55371
|
}
|
|
55372
|
+
/** 解绑渠道:两段确认后立即 PUT feishu:null(不经保存),成功回列表刷新。 */
|
|
55373
|
+
async function unbind() {
|
|
55374
|
+
if (!confirmUnbind) {
|
|
55375
|
+
setConfirmUnbind(true);
|
|
55376
|
+
return;
|
|
55377
|
+
}
|
|
55378
|
+
setError(null);
|
|
55379
|
+
setSaving(true);
|
|
55380
|
+
try {
|
|
55381
|
+
await updateBot(bot.id, { feishu: null });
|
|
55382
|
+
onSaved();
|
|
55383
|
+
} catch (e) {
|
|
55384
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
55385
|
+
} finally {
|
|
55386
|
+
setSaving(false);
|
|
55387
|
+
}
|
|
55388
|
+
}
|
|
55389
|
+
/** 离开第二步:解除解绑确认态,避免回到第二步后单次误触直接销毁凭据。 */
|
|
55390
|
+
function back() {
|
|
55391
|
+
setConfirmUnbind(false);
|
|
55392
|
+
setError(null);
|
|
55393
|
+
setStep(1);
|
|
55394
|
+
}
|
|
55395
|
+
function cancel() {
|
|
55396
|
+
setConfirmUnbind(false);
|
|
55397
|
+
onCancel();
|
|
55398
|
+
}
|
|
55361
55399
|
const showModelSelect = provider.trim().length > 0 && models.length > 0;
|
|
55362
55400
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
55363
55401
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -55428,51 +55466,53 @@ ${te.current.stack}
|
|
|
55428
55466
|
}, a.id))]
|
|
55429
55467
|
})]
|
|
55430
55468
|
}),
|
|
55431
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
55432
|
-
|
|
55433
|
-
|
|
55434
|
-
|
|
55435
|
-
|
|
55436
|
-
|
|
55437
|
-
|
|
55438
|
-
|
|
55439
|
-
|
|
55440
|
-
|
|
55441
|
-
|
|
55442
|
-
|
|
55443
|
-
|
|
55444
|
-
|
|
55445
|
-
|
|
55446
|
-
|
|
55447
|
-
|
|
55448
|
-
|
|
55449
|
-
|
|
55450
|
-
|
|
55451
|
-
|
|
55452
|
-
|
|
55453
|
-
|
|
55454
|
-
|
|
55455
|
-
|
|
55456
|
-
|
|
55457
|
-
|
|
55458
|
-
|
|
55459
|
-
|
|
55460
|
-
|
|
55461
|
-
|
|
55462
|
-
|
|
55463
|
-
|
|
55464
|
-
|
|
55465
|
-
|
|
55466
|
-
|
|
55467
|
-
|
|
55468
|
-
|
|
55469
|
-
|
|
55470
|
-
|
|
55471
|
-
|
|
55472
|
-
|
|
55473
|
-
|
|
55474
|
-
|
|
55475
|
-
|
|
55469
|
+
agentRef === "main" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
55470
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
55471
|
+
className: bots_module_css_default.field,
|
|
55472
|
+
children: ["Provider", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
55473
|
+
className: bots_module_css_default.select,
|
|
55474
|
+
value: provider,
|
|
55475
|
+
"aria-label": "Provider",
|
|
55476
|
+
disabled: providers.length === 0,
|
|
55477
|
+
onChange: (e) => {
|
|
55478
|
+
setProvider(e.target.value);
|
|
55479
|
+
setModel("");
|
|
55480
|
+
setModels([]);
|
|
55481
|
+
},
|
|
55482
|
+
children: providers.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
55483
|
+
value: p.id,
|
|
55484
|
+
children: p.name
|
|
55485
|
+
}, p.id))
|
|
55486
|
+
})]
|
|
55487
|
+
}),
|
|
55488
|
+
providersLoaded && providers.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
55489
|
+
role: "alert",
|
|
55490
|
+
className: bots_module_css_default.error,
|
|
55491
|
+
children: "未发现可用 Provider"
|
|
55492
|
+
}),
|
|
55493
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
55494
|
+
className: bots_module_css_default.field,
|
|
55495
|
+
children: ["模型", showModelSelect ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
55496
|
+
className: bots_module_css_default.select,
|
|
55497
|
+
value: model,
|
|
55498
|
+
"aria-label": "模型",
|
|
55499
|
+
onChange: (e) => {
|
|
55500
|
+
setModel(e.target.value);
|
|
55501
|
+
},
|
|
55502
|
+
children: models.map((m) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
55503
|
+
value: m.id,
|
|
55504
|
+
children: m.name
|
|
55505
|
+
}, m.id))
|
|
55506
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
55507
|
+
value: model,
|
|
55508
|
+
onChange: (e) => {
|
|
55509
|
+
setModel(e.target.value);
|
|
55510
|
+
},
|
|
55511
|
+
"aria-label": "模型",
|
|
55512
|
+
className: bots_module_css_default.input
|
|
55513
|
+
})]
|
|
55514
|
+
})
|
|
55515
|
+
] }),
|
|
55476
55516
|
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
55477
55517
|
role: "alert",
|
|
55478
55518
|
className: bots_module_css_default.error,
|
|
@@ -55482,7 +55522,7 @@ ${te.current.stack}
|
|
|
55482
55522
|
className: bots_module_css_default.formActions,
|
|
55483
55523
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
55484
55524
|
variant: "outline",
|
|
55485
|
-
onClick:
|
|
55525
|
+
onClick: cancel,
|
|
55486
55526
|
children: "取消"
|
|
55487
55527
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
55488
55528
|
variant: "primary",
|
|
@@ -55492,7 +55532,7 @@ ${te.current.stack}
|
|
|
55492
55532
|
})
|
|
55493
55533
|
] }),
|
|
55494
55534
|
step === 2 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
55495
|
-
|
|
55535
|
+
bindable && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
55496
55536
|
className: bots_module_css_default.scanSection,
|
|
55497
55537
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
55498
55538
|
role: "tablist",
|
|
@@ -55586,10 +55626,20 @@ ${te.current.stack}
|
|
|
55586
55626
|
})
|
|
55587
55627
|
] })]
|
|
55588
55628
|
}),
|
|
55589
|
-
editing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
55590
|
-
"当前应用:",
|
|
55591
|
-
|
|
55592
|
-
|
|
55629
|
+
editing && bot.feishu !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
55630
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: ["当前应用:", bot.feishu.appId] }),
|
|
55631
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
55632
|
+
variant: "outline",
|
|
55633
|
+
disabled: saving,
|
|
55634
|
+
onClick: () => {
|
|
55635
|
+
unbind();
|
|
55636
|
+
},
|
|
55637
|
+
children: confirmUnbind ? "确认解绑?" : "解绑"
|
|
55638
|
+
}),
|
|
55639
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
55640
|
+
className: bots_module_css_default.hint,
|
|
55641
|
+
children: "解绑后密钥立即删除,历史会话保留;重新绑定同一应用可继续原会话。"
|
|
55642
|
+
})
|
|
55593
55643
|
] }),
|
|
55594
55644
|
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
55595
55645
|
role: "alert",
|
|
@@ -55601,15 +55651,12 @@ ${te.current.stack}
|
|
|
55601
55651
|
children: [
|
|
55602
55652
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
55603
55653
|
variant: "outline",
|
|
55604
|
-
onClick:
|
|
55605
|
-
setError(null);
|
|
55606
|
-
setStep(1);
|
|
55607
|
-
},
|
|
55654
|
+
onClick: back,
|
|
55608
55655
|
children: "上一步"
|
|
55609
55656
|
}),
|
|
55610
55657
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
55611
55658
|
variant: "outline",
|
|
55612
|
-
onClick:
|
|
55659
|
+
onClick: cancel,
|
|
55613
55660
|
children: "取消"
|
|
55614
55661
|
}),
|
|
55615
55662
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
@@ -55634,7 +55681,8 @@ ${te.current.stack}
|
|
|
55634
55681
|
reconnecting: "重连中",
|
|
55635
55682
|
idle: "空闲",
|
|
55636
55683
|
failed: "连接失败",
|
|
55637
|
-
"not-running": "未运行"
|
|
55684
|
+
"not-running": "未运行",
|
|
55685
|
+
unbound: "未绑定"
|
|
55638
55686
|
};
|
|
55639
55687
|
/** 连接状态 → StateDot 四色语义:正常绿 / 过渡蓝跑马 / 非故障停止琥珀 / 故障红。 */
|
|
55640
55688
|
const STATUS_DOT = {
|
|
@@ -55643,7 +55691,8 @@ ${te.current.stack}
|
|
|
55643
55691
|
reconnecting: "ongoing",
|
|
55644
55692
|
idle: "warning",
|
|
55645
55693
|
failed: "error",
|
|
55646
|
-
"not-running": "warning"
|
|
55694
|
+
"not-running": "warning",
|
|
55695
|
+
unbound: "warning"
|
|
55647
55696
|
};
|
|
55648
55697
|
function BotsModal({ open, onClose, useWorkspaces, onEdit, onCreate }) {
|
|
55649
55698
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
@@ -55663,6 +55712,27 @@ ${te.current.stack}
|
|
|
55663
55712
|
const [view, setView] = (0, react.useState)("list");
|
|
55664
55713
|
/** 打开即拉取(body 随 open 全新挂载,天然复位);保存后 reload 重拉。 */
|
|
55665
55714
|
const { state, reload } = useLoadState$1(() => fetchBots(), []);
|
|
55715
|
+
/** 两段确认:记录待删行 id;点其它行转移,执行后清空。 */
|
|
55716
|
+
const [confirmDeleteId, setConfirmDeleteId] = (0, react.useState)(null);
|
|
55717
|
+
const [deletingId, setDeletingId] = (0, react.useState)(null);
|
|
55718
|
+
const [deleteError, setDeleteError] = (0, react.useState)(null);
|
|
55719
|
+
async function remove(bot) {
|
|
55720
|
+
if (confirmDeleteId !== bot.id) {
|
|
55721
|
+
setConfirmDeleteId(bot.id);
|
|
55722
|
+
setDeleteError(null);
|
|
55723
|
+
return;
|
|
55724
|
+
}
|
|
55725
|
+
setDeletingId(bot.id);
|
|
55726
|
+
try {
|
|
55727
|
+
await deleteBot(bot.id);
|
|
55728
|
+
setConfirmDeleteId(null);
|
|
55729
|
+
reload();
|
|
55730
|
+
} catch (e) {
|
|
55731
|
+
setDeleteError(`删除失败:${e instanceof Error ? e.message : String(e)}`);
|
|
55732
|
+
} finally {
|
|
55733
|
+
setDeletingId(null);
|
|
55734
|
+
}
|
|
55735
|
+
}
|
|
55666
55736
|
const groups = /* @__PURE__ */ new Map();
|
|
55667
55737
|
if (state.kind === "ok") for (const bot of state.data) {
|
|
55668
55738
|
const list = groups.get(bot.project) ?? [];
|
|
@@ -55678,38 +55748,56 @@ ${te.current.stack}
|
|
|
55678
55748
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
55679
55749
|
className: bots_module_css_default.groupTitle,
|
|
55680
55750
|
children: project
|
|
55681
|
-
}), bots.map((bot) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
55682
|
-
type: "button",
|
|
55751
|
+
}), bots.map((bot) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
55683
55752
|
className: bots_module_css_default.botRow,
|
|
55684
|
-
|
|
55685
|
-
|
|
55686
|
-
|
|
55687
|
-
|
|
55688
|
-
|
|
55689
|
-
|
|
55690
|
-
|
|
55691
|
-
|
|
55692
|
-
|
|
55693
|
-
|
|
55694
|
-
|
|
55695
|
-
|
|
55696
|
-
|
|
55697
|
-
|
|
55698
|
-
|
|
55699
|
-
|
|
55700
|
-
|
|
55701
|
-
|
|
55702
|
-
|
|
55703
|
-
|
|
55704
|
-
|
|
55705
|
-
|
|
55706
|
-
|
|
55753
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
55754
|
+
type: "button",
|
|
55755
|
+
className: bots_module_css_default.botMain,
|
|
55756
|
+
onClick: () => {
|
|
55757
|
+
setConfirmDeleteId(null);
|
|
55758
|
+
onEdit !== void 0 ? onEdit(bot) : setView({
|
|
55759
|
+
mode: "edit",
|
|
55760
|
+
bot
|
|
55761
|
+
});
|
|
55762
|
+
},
|
|
55763
|
+
children: [
|
|
55764
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
55765
|
+
className: bots_module_css_default.botName,
|
|
55766
|
+
children: bot.name
|
|
55767
|
+
}),
|
|
55768
|
+
bot.feishu !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
55769
|
+
className: bots_module_css_default.channelBadge,
|
|
55770
|
+
children: "飞书"
|
|
55771
|
+
}),
|
|
55772
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
55773
|
+
className: bots_module_css_default.status,
|
|
55774
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
|
|
55775
|
+
state: STATUS_DOT[bot.status] ?? "warning",
|
|
55776
|
+
size: 8
|
|
55777
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: STATUS_LABEL[bot.status] ?? bot.status })]
|
|
55778
|
+
})
|
|
55779
|
+
]
|
|
55780
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
55781
|
+
type: "button",
|
|
55782
|
+
className: bots_module_css_default.botDelete,
|
|
55783
|
+
disabled: deletingId !== null,
|
|
55784
|
+
onClick: () => {
|
|
55785
|
+
remove(bot);
|
|
55786
|
+
},
|
|
55787
|
+
children: confirmDeleteId === bot.id ? "确认删除?" : "删除"
|
|
55788
|
+
})]
|
|
55707
55789
|
}, bot.id))]
|
|
55708
55790
|
}, project)),
|
|
55791
|
+
deleteError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
55792
|
+
role: "alert",
|
|
55793
|
+
className: bots_module_css_default.error,
|
|
55794
|
+
children: deleteError
|
|
55795
|
+
}),
|
|
55709
55796
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
55710
55797
|
variant: "primary",
|
|
55711
55798
|
className: bots_module_css_default.createButton,
|
|
55712
55799
|
onClick: () => {
|
|
55800
|
+
setConfirmDeleteId(null);
|
|
55713
55801
|
onCreate !== void 0 ? onCreate() : setView({ mode: "create" });
|
|
55714
55802
|
},
|
|
55715
55803
|
children: "新建机器人"
|