digitalsee-ai-flow-cli 0.7.24-beta.1 → 0.7.24-beta.2
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/dist/api/node.js +4 -0
- package/dist/commands/flow/node.js +21 -8
- package/package.json +1 -1
package/dist/api/node.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getActionDetail = getActionDetail;
|
|
3
4
|
exports.getActions = getActions;
|
|
4
5
|
exports.searchActions = searchActions;
|
|
5
6
|
exports.isNodePackageSupported = isNodePackageSupported;
|
|
@@ -13,6 +14,9 @@ exports.cancelDebugNode = cancelDebugNode;
|
|
|
13
14
|
const client_1 = require("@/api/client");
|
|
14
15
|
const knowledge_1 = require("@/api/knowledge");
|
|
15
16
|
const encoding_1 = require("@/utils/encoding");
|
|
17
|
+
async function getActionDetail(id, version) {
|
|
18
|
+
return await (0, client_1.apiGet)(`/acm/actions/${id}${version ? '/' + version : ''}`);
|
|
19
|
+
}
|
|
16
20
|
async function getActions(params) {
|
|
17
21
|
const data = await (0, client_1.apiGet)('/acm/actions/v2', params);
|
|
18
22
|
if (Array.isArray(data))
|
|
@@ -218,13 +218,26 @@ function registerFlowNode(flowCmd) {
|
|
|
218
218
|
let posX = options.positionX !== undefined ? Number(options.positionX) : defaultPos.x;
|
|
219
219
|
let posY = options.positionY !== undefined ? Number(options.positionY) : defaultPos.y;
|
|
220
220
|
const trigger = options.trigger || options.node_type === 'StartEventNode' || false;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
221
|
+
let action;
|
|
222
|
+
try {
|
|
223
|
+
action = await (0, node_1.getActionDetail)(connectorId);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
// 获取失败则回退到列表查找
|
|
227
|
+
}
|
|
228
|
+
if (action) {
|
|
229
|
+
// 兼容旧 API:非 node package 节点要求必传 action_id,此处设为 '0' 占位
|
|
230
|
+
action.id = '0';
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
(0, output_1.printInfo)(`获取连接器 ${connectorId} 的动作列表...`);
|
|
234
|
+
const actions = await (0, node_1.getActions)({
|
|
235
|
+
linkId: connectorId,
|
|
236
|
+
flowId,
|
|
237
|
+
trigger,
|
|
238
|
+
});
|
|
239
|
+
action = actions.find((a) => a.id === actionId);
|
|
240
|
+
}
|
|
228
241
|
if (!action) {
|
|
229
242
|
const msg = `未找到动作 ${actionId}`;
|
|
230
243
|
if (options.json) {
|
|
@@ -400,7 +413,7 @@ function registerFlowNode(flowCmd) {
|
|
|
400
413
|
const pairs = [
|
|
401
414
|
['节点 ID', String(resultObj.id || '-')],
|
|
402
415
|
['动作名称', action.name],
|
|
403
|
-
['连接器', action.connector_id],
|
|
416
|
+
action.connector_id ? ['连接器', action.connector_id] : ['package', action.action_key],
|
|
404
417
|
['节点类型', String(nPayload.node_type)],
|
|
405
418
|
['触发器', trigger ? '是' : '否'],
|
|
406
419
|
['位置', `(${nPos.x}, ${nPos.y})`],
|