dsh-agent-toolkit 0.2.7 → 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 +210 -161
- package/lib/client.js.map +1 -1
- package/lib/index.js +18 -10
- 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
|
+
"root": "_8wQUq_root",
|
|
71
|
+
"prompt": "_8wQUq_prompt",
|
|
70
72
|
"summary": "_8wQUq_summary",
|
|
71
|
-
"
|
|
73
|
+
"childLink": "_8wQUq_childLink",
|
|
72
74
|
"row": "_8wQUq_row",
|
|
75
|
+
"body": "_8wQUq_body",
|
|
73
76
|
"chip": "_8wQUq_chip",
|
|
74
|
-
"prompt": "_8wQUq_prompt",
|
|
75
77
|
"result": "_8wQUq_result",
|
|
76
|
-
"visuallyHidden": "_8wQUq_visuallyHidden"
|
|
77
|
-
"root": "_8wQUq_root",
|
|
78
|
-
"childLink": "_8wQUq_childLink"
|
|
78
|
+
"visuallyHidden": "_8wQUq_visuallyHidden"
|
|
79
79
|
};
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/client/delegate/delegate-card.tsx
|
|
@@ -411,33 +411,33 @@ window.__ModuleLoader__.load({
|
|
|
411
411
|
document.head.appendChild(tag);
|
|
412
412
|
}
|
|
413
413
|
var agents_module_css_default = {
|
|
414
|
-
"readonlyId": "KsfSLW_readonlyId",
|
|
415
|
-
"split": "KsfSLW_split",
|
|
416
|
-
"toolGroupSet": "KsfSLW_toolGroupSet",
|
|
417
|
-
"editorPane": "KsfSLW_editorPane",
|
|
418
|
-
"toolGrid": "KsfSLW_toolGrid",
|
|
419
|
-
"hint": "KsfSLW_hint",
|
|
420
|
-
"dangerButton": "KsfSLW_dangerButton",
|
|
421
|
-
"actions": "KsfSLW_actions",
|
|
422
|
-
"select": "KsfSLW_select",
|
|
423
|
-
"agentRowActive": "KsfSLW_agentRowActive",
|
|
424
|
-
"toolCheck": "KsfSLW_toolCheck",
|
|
425
414
|
"block": "KsfSLW_block",
|
|
426
415
|
"editor": "KsfSLW_editor",
|
|
427
|
-
"
|
|
428
|
-
"
|
|
429
|
-
"agentRow": "KsfSLW_agentRow",
|
|
430
|
-
"blockTitle": "KsfSLW_blockTitle",
|
|
431
|
-
"input": "KsfSLW_input",
|
|
416
|
+
"agentDesc": "KsfSLW_agentDesc",
|
|
417
|
+
"select": "KsfSLW_select",
|
|
432
418
|
"textarea": "KsfSLW_textarea",
|
|
433
|
-
"
|
|
434
|
-
"
|
|
419
|
+
"toolMode": "KsfSLW_toolMode",
|
|
420
|
+
"toolGroupSet": "KsfSLW_toolGroupSet",
|
|
435
421
|
"toolGroupTitle": "KsfSLW_toolGroupTitle",
|
|
422
|
+
"dialog": "KsfSLW_dialog",
|
|
423
|
+
"toolCheck": "KsfSLW_toolCheck",
|
|
436
424
|
"error": "KsfSLW_error",
|
|
437
|
-
"
|
|
438
|
-
"
|
|
425
|
+
"dangerButton": "KsfSLW_dangerButton",
|
|
426
|
+
"hint": "KsfSLW_hint",
|
|
427
|
+
"readonlyId": "KsfSLW_readonlyId",
|
|
428
|
+
"builtinBadge": "KsfSLW_builtinBadge",
|
|
429
|
+
"agentName": "KsfSLW_agentName",
|
|
430
|
+
"actions": "KsfSLW_actions",
|
|
431
|
+
"agentRow": "KsfSLW_agentRow",
|
|
439
432
|
"field": "KsfSLW_field",
|
|
440
|
-
"
|
|
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
|
-
"dialog": "VZk1fa_dialog",
|
|
955
|
-
"editor": "VZk1fa_editor",
|
|
956
|
-
"editorPane": "VZk1fa_editorPane",
|
|
957
|
-
"listPane": "VZk1fa_listPane",
|
|
958
|
-
"layerOrder": "VZk1fa_layerOrder",
|
|
959
|
-
"tabs": "VZk1fa_tabs",
|
|
960
|
-
"textarea": "VZk1fa_textarea",
|
|
961
954
|
"layerName": "VZk1fa_layerName",
|
|
962
955
|
"field": "VZk1fa_field",
|
|
956
|
+
"editorPane": "VZk1fa_editorPane",
|
|
963
957
|
"split": "VZk1fa_split",
|
|
964
|
-
"
|
|
965
|
-
"layerRowActive": "VZk1fa_layerRowActive",
|
|
966
|
-
"actions": "VZk1fa_actions",
|
|
958
|
+
"textarea": "VZk1fa_textarea",
|
|
967
959
|
"hint": "VZk1fa_hint",
|
|
960
|
+
"tabs": "VZk1fa_tabs",
|
|
961
|
+
"listPane": "VZk1fa_listPane",
|
|
968
962
|
"tabActive": "VZk1fa_tabActive",
|
|
963
|
+
"layerRowActive": "VZk1fa_layerRowActive",
|
|
964
|
+
"actions": "VZk1fa_actions",
|
|
965
|
+
"editor": "VZk1fa_editor",
|
|
966
|
+
"layerOrder": "VZk1fa_layerOrder",
|
|
967
|
+
"dialog": "VZk1fa_dialog",
|
|
968
|
+
"readonlyTag": "VZk1fa_readonlyTag",
|
|
969
969
|
"error": "VZk1fa_error",
|
|
970
|
-
"
|
|
971
|
-
"
|
|
970
|
+
"layerRow": "VZk1fa_layerRow",
|
|
971
|
+
"tab": "VZk1fa_tab"
|
|
972
972
|
};
|
|
973
973
|
//#endregion
|
|
974
974
|
//#region src/client/prompt/PromptLayersModal.tsx
|
|
@@ -1452,13 +1452,13 @@ window.__ModuleLoader__.load({
|
|
|
1452
1452
|
document.head.appendChild(tag);
|
|
1453
1453
|
}
|
|
1454
1454
|
var chart_module_css_default = {
|
|
1455
|
-
"
|
|
1455
|
+
"chartTheme": "_8LXSJW_chartTheme",
|
|
1456
1456
|
"legend": "_8LXSJW_legend",
|
|
1457
|
-
"
|
|
1457
|
+
"tooltipTotal": "_8LXSJW_tooltipTotal",
|
|
1458
|
+
"swatchCached": "_8LXSJW_swatchCached",
|
|
1458
1459
|
"tooltipTitle": "_8LXSJW_tooltipTitle",
|
|
1459
|
-
"
|
|
1460
|
-
"
|
|
1461
|
-
"swatchCached": "_8LXSJW_swatchCached"
|
|
1460
|
+
"swatchFresh": "_8LXSJW_swatchFresh",
|
|
1461
|
+
"tooltip": "_8LXSJW_tooltip"
|
|
1462
1462
|
};
|
|
1463
1463
|
//#endregion
|
|
1464
1464
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\usage\ActivityHeatmap.module.css.mjs
|
|
@@ -1472,14 +1472,14 @@ window.__ModuleLoader__.load({
|
|
|
1472
1472
|
document.head.appendChild(tag);
|
|
1473
1473
|
}
|
|
1474
1474
|
var ActivityHeatmap_module_css_default = {
|
|
1475
|
-
"level2": "hjrYrq_level2",
|
|
1476
1475
|
"grid": "hjrYrq_grid",
|
|
1477
|
-
"level3": "hjrYrq_level3",
|
|
1478
|
-
"months": "hjrYrq_months",
|
|
1479
|
-
"level4": "hjrYrq_level4",
|
|
1480
|
-
"week": "hjrYrq_week",
|
|
1481
1476
|
"level0": "hjrYrq_level0",
|
|
1482
|
-
"
|
|
1477
|
+
"week": "hjrYrq_week",
|
|
1478
|
+
"level4": "hjrYrq_level4",
|
|
1479
|
+
"level1": "hjrYrq_level1",
|
|
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
|
-
"
|
|
52520
|
-
"tabActive": "MODeXa_tabActive",
|
|
52521
|
-
"rowName": "MODeXa_rowName",
|
|
52522
|
-
"tab": "MODeXa_tab",
|
|
52523
|
-
"pagerButton": "MODeXa_pagerButton",
|
|
52519
|
+
"dateLabel": "MODeXa_dateLabel",
|
|
52524
52520
|
"sectionTitle": "MODeXa_sectionTitle",
|
|
52525
|
-
"
|
|
52521
|
+
"pagerButton": "MODeXa_pagerButton",
|
|
52526
52522
|
"total": "MODeXa_total",
|
|
52523
|
+
"tabActive": "MODeXa_tabActive",
|
|
52524
|
+
"dialog": "MODeXa_dialog",
|
|
52525
|
+
"tabs": "MODeXa_tabs",
|
|
52526
|
+
"rowCalls": "MODeXa_rowCalls",
|
|
52527
52527
|
"compaction": "MODeXa_compaction",
|
|
52528
|
-
"
|
|
52528
|
+
"row": "MODeXa_row",
|
|
52529
52529
|
"pager": "MODeXa_pager",
|
|
52530
|
-
"
|
|
52531
|
-
"
|
|
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
|
-
"
|
|
55159
|
+
"stepSeparator": "vTbXga_stepSeparator",
|
|
55160
|
+
"stepActive": "vTbXga_stepActive",
|
|
55157
55161
|
"group": "vTbXga_group",
|
|
55158
|
-
"
|
|
55159
|
-
"
|
|
55162
|
+
"tabs": "vTbXga_tabs",
|
|
55163
|
+
"formActions": "vTbXga_formActions",
|
|
55164
|
+
"createButton": "vTbXga_createButton",
|
|
55160
55165
|
"groupTitle": "vTbXga_groupTitle",
|
|
55166
|
+
"steps": "vTbXga_steps",
|
|
55167
|
+
"scanSection": "vTbXga_scanSection",
|
|
55168
|
+
"botMain": "vTbXga_botMain",
|
|
55169
|
+
"botDelete": "vTbXga_botDelete",
|
|
55170
|
+
"input": "vTbXga_input",
|
|
55171
|
+
"status": "vTbXga_status",
|
|
55172
|
+
"textarea": "vTbXga_textarea",
|
|
55173
|
+
"botName": "vTbXga_botName",
|
|
55174
|
+
"tabActive": "vTbXga_tabActive",
|
|
55175
|
+
"channelBadge": "vTbXga_channelBadge",
|
|
55161
55176
|
"botRow": "vTbXga_botRow",
|
|
55162
|
-
"
|
|
55177
|
+
"select": "vTbXga_select",
|
|
55163
55178
|
"tab": "vTbXga_tab",
|
|
55164
55179
|
"dialog": "vTbXga_dialog",
|
|
55165
|
-
"
|
|
55180
|
+
"field": "vTbXga_field",
|
|
55166
55181
|
"step": "vTbXga_step",
|
|
55167
|
-
"scanSection": "vTbXga_scanSection",
|
|
55168
|
-
"botName": "vTbXga_botName",
|
|
55169
|
-
"select": "vTbXga_select",
|
|
55170
|
-
"input": "vTbXga_input",
|
|
55171
55182
|
"error": "vTbXga_error",
|
|
55172
|
-
"
|
|
55173
|
-
"formActions": "vTbXga_formActions",
|
|
55174
|
-
"status": "vTbXga_status",
|
|
55175
|
-
"steps": "vTbXga_steps",
|
|
55176
|
-
"stepSeparator": "vTbXga_stepSeparator",
|
|
55177
|
-
"channelBadge": "vTbXga_channelBadge",
|
|
55178
|
-
"tabActive": "vTbXga_tabActive"
|
|
55183
|
+
"hint": "vTbXga_hint"
|
|
55179
55184
|
};
|
|
55180
55185
|
//#endregion
|
|
55181
55186
|
//#region src/client/bots/BotForm.tsx
|
|
@@ -55326,28 +55331,31 @@ ${te.current.stack}
|
|
|
55326
55331
|
setError("请填写 App ID 与 App Secret,或先完成扫码创建");
|
|
55327
55332
|
return;
|
|
55328
55333
|
}
|
|
55329
|
-
|
|
55330
|
-
|
|
55331
|
-
|
|
55332
|
-
|
|
55333
|
-
|
|
55334
|
-
|
|
55335
|
-
|
|
55336
|
-
|
|
55337
|
-
|
|
55338
|
-
|
|
55339
|
-
|
|
55340
|
-
|
|
55341
|
-
|
|
55342
|
-
|
|
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;
|
|
55343
55351
|
setSaving(true);
|
|
55344
55352
|
try {
|
|
55345
55353
|
const payload = {
|
|
55346
55354
|
name: name.trim(),
|
|
55347
55355
|
project: project.trim(),
|
|
55348
55356
|
...editing ? { agentRef: agentRef === "main" ? null : agentRef } : agentRef !== "main" ? { agentRef } : {},
|
|
55349
|
-
|
|
55350
|
-
...
|
|
55357
|
+
...feishu !== void 0 ? { feishu } : {},
|
|
55358
|
+
...agentOptions !== void 0 ? { agentOptions } : {}
|
|
55351
55359
|
};
|
|
55352
55360
|
if (editing) await updateBot(bot.id, payload);
|
|
55353
55361
|
else await createBot({
|
|
@@ -55458,51 +55466,53 @@ ${te.current.stack}
|
|
|
55458
55466
|
}, a.id))]
|
|
55459
55467
|
})]
|
|
55460
55468
|
}),
|
|
55461
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
55462
|
-
|
|
55463
|
-
|
|
55464
|
-
|
|
55465
|
-
|
|
55466
|
-
|
|
55467
|
-
|
|
55468
|
-
|
|
55469
|
-
|
|
55470
|
-
|
|
55471
|
-
|
|
55472
|
-
|
|
55473
|
-
|
|
55474
|
-
|
|
55475
|
-
|
|
55476
|
-
|
|
55477
|
-
|
|
55478
|
-
|
|
55479
|
-
|
|
55480
|
-
|
|
55481
|
-
|
|
55482
|
-
|
|
55483
|
-
|
|
55484
|
-
|
|
55485
|
-
|
|
55486
|
-
|
|
55487
|
-
|
|
55488
|
-
|
|
55489
|
-
|
|
55490
|
-
|
|
55491
|
-
|
|
55492
|
-
|
|
55493
|
-
|
|
55494
|
-
|
|
55495
|
-
|
|
55496
|
-
|
|
55497
|
-
|
|
55498
|
-
|
|
55499
|
-
|
|
55500
|
-
|
|
55501
|
-
|
|
55502
|
-
|
|
55503
|
-
|
|
55504
|
-
|
|
55505
|
-
|
|
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
|
+
] }),
|
|
55506
55516
|
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
55507
55517
|
role: "alert",
|
|
55508
55518
|
className: bots_module_css_default.error,
|
|
@@ -55702,6 +55712,27 @@ ${te.current.stack}
|
|
|
55702
55712
|
const [view, setView] = (0, react.useState)("list");
|
|
55703
55713
|
/** 打开即拉取(body 随 open 全新挂载,天然复位);保存后 reload 重拉。 */
|
|
55704
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
|
+
}
|
|
55705
55736
|
const groups = /* @__PURE__ */ new Map();
|
|
55706
55737
|
if (state.kind === "ok") for (const bot of state.data) {
|
|
55707
55738
|
const list = groups.get(bot.project) ?? [];
|
|
@@ -55717,38 +55748,56 @@ ${te.current.stack}
|
|
|
55717
55748
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
55718
55749
|
className: bots_module_css_default.groupTitle,
|
|
55719
55750
|
children: project
|
|
55720
|
-
}), bots.map((bot) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
55721
|
-
type: "button",
|
|
55751
|
+
}), bots.map((bot) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
55722
55752
|
className: bots_module_css_default.botRow,
|
|
55723
|
-
|
|
55724
|
-
|
|
55725
|
-
|
|
55726
|
-
|
|
55727
|
-
|
|
55728
|
-
|
|
55729
|
-
|
|
55730
|
-
|
|
55731
|
-
|
|
55732
|
-
|
|
55733
|
-
|
|
55734
|
-
|
|
55735
|
-
|
|
55736
|
-
|
|
55737
|
-
|
|
55738
|
-
|
|
55739
|
-
|
|
55740
|
-
|
|
55741
|
-
|
|
55742
|
-
|
|
55743
|
-
|
|
55744
|
-
|
|
55745
|
-
|
|
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
|
+
})]
|
|
55746
55789
|
}, bot.id))]
|
|
55747
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
|
+
}),
|
|
55748
55796
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
55749
55797
|
variant: "primary",
|
|
55750
55798
|
className: bots_module_css_default.createButton,
|
|
55751
55799
|
onClick: () => {
|
|
55800
|
+
setConfirmDeleteId(null);
|
|
55752
55801
|
onCreate !== void 0 ? onCreate() : setView({ mode: "create" });
|
|
55753
55802
|
},
|
|
55754
55803
|
children: "新建机器人"
|