digitalsee-ai-flow-cli 0.7.24-beta.1 → 0.7.24-beta.3
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 +23 -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,28 @@ 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
|
+
if (!action.id && action.node_schema) {
|
|
230
|
+
// 兼容旧 API:非 node package 节点要求必传 action_id,此处设为 '0' 占位
|
|
231
|
+
action.id = '0';
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
(0, output_1.printInfo)(`获取连接器 ${connectorId} 的动作列表...`);
|
|
236
|
+
const actions = await (0, node_1.getActions)({
|
|
237
|
+
linkId: connectorId,
|
|
238
|
+
flowId,
|
|
239
|
+
trigger,
|
|
240
|
+
});
|
|
241
|
+
action = actions.find((a) => a.id === actionId);
|
|
242
|
+
}
|
|
228
243
|
if (!action) {
|
|
229
244
|
const msg = `未找到动作 ${actionId}`;
|
|
230
245
|
if (options.json) {
|
|
@@ -400,7 +415,7 @@ function registerFlowNode(flowCmd) {
|
|
|
400
415
|
const pairs = [
|
|
401
416
|
['节点 ID', String(resultObj.id || '-')],
|
|
402
417
|
['动作名称', action.name],
|
|
403
|
-
['连接器', action.connector_id],
|
|
418
|
+
action.connector_id ? ['连接器', action.connector_id] : ['package', action.action_key],
|
|
404
419
|
['节点类型', String(nPayload.node_type)],
|
|
405
420
|
['触发器', trigger ? '是' : '否'],
|
|
406
421
|
['位置', `(${nPos.x}, ${nPos.y})`],
|