@genfeedai/workflow-ui 0.1.0 → 0.1.1
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/canvas.js +12 -13
- package/dist/canvas.mjs +6 -7
- package/dist/{chunk-FT64PCUP.mjs → chunk-3PMLER6D.mjs} +6 -15
- package/dist/{chunk-CSUBLSKZ.mjs → chunk-73V6SUEO.mjs} +27 -36
- package/dist/{chunk-HPQT36RR.js → chunk-DICI5FSP.js} +18 -27
- package/dist/{chunk-EC2ZIWOK.js → chunk-DUZLPHRC.js} +36 -45
- package/dist/{chunk-ADWNF7V3.js → chunk-EMGXUNBL.js} +3 -3
- package/dist/{chunk-VOGL2WCE.mjs → chunk-EYL6J4MW.mjs} +9 -18
- package/dist/{chunk-H6LZKSLY.js → chunk-H3JOHAS5.js} +113 -148
- package/dist/{chunk-E544XUBL.js → chunk-HWY6IBWT.js} +8 -11
- package/dist/{chunk-22PDGHNQ.mjs → chunk-I3GNO2SR.mjs} +2 -2
- package/dist/{chunk-UQQUWGHW.mjs → chunk-IASLG6IA.mjs} +1 -1
- package/dist/chunk-IHF35QZD.js +1095 -0
- package/dist/{chunk-SW7QNEZU.js → chunk-OZNYKFMX.js} +30 -30
- package/dist/{chunk-XV5Z5XYR.mjs → chunk-PFHFGSM5.mjs} +18 -53
- package/dist/{chunk-CETJJ73S.js → chunk-PVWLMJGZ.js} +28 -37
- package/dist/chunk-RIGVIEYB.mjs +1093 -0
- package/dist/{chunk-LAJ34AH2.mjs → chunk-XOC5ETTX.mjs} +4 -7
- package/dist/hooks.js +14 -15
- package/dist/hooks.mjs +4 -5
- package/dist/index.js +41 -42
- package/dist/index.mjs +8 -9
- package/dist/lib.js +0 -1
- package/dist/lib.mjs +0 -1
- package/dist/nodes.js +37 -38
- package/dist/nodes.mjs +4 -5
- package/dist/panels.js +6 -7
- package/dist/panels.mjs +3 -4
- package/dist/provider.js +0 -1
- package/dist/provider.mjs +0 -1
- package/dist/stores.js +7 -8
- package/dist/stores.mjs +2 -3
- package/dist/toolbar.js +9 -10
- package/dist/toolbar.mjs +3 -4
- package/dist/ui.js +0 -1
- package/dist/ui.mjs +0 -1
- package/dist/workflowStore-32ZH5REM.js +11 -0
- package/dist/workflowStore-ZCSVIZQF.mjs +2 -0
- package/package.json +3 -3
- package/dist/chunk-AC6TWLRT.mjs +0 -27
- package/dist/chunk-BJ3R5R32.mjs +0 -2163
- package/dist/chunk-NSDLGLAQ.js +0 -2166
- package/dist/chunk-Z7PWFZG5.js +0 -30
- package/dist/workflowStore-4EGKJLYK.mjs +0 -3
- package/dist/workflowStore-KM32FDL7.js +0 -12
package/dist/canvas.js
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkPVWLMJGZ_js = require('./chunk-PVWLMJGZ.js');
|
|
4
|
+
require('./chunk-H3JOHAS5.js');
|
|
5
5
|
require('./chunk-3SPPKCWR.js');
|
|
6
6
|
require('./chunk-3YFFDHC5.js');
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-EMGXUNBL.js');
|
|
8
|
+
require('./chunk-DICI5FSP.js');
|
|
9
9
|
require('./chunk-5HJFQVUR.js');
|
|
10
10
|
require('./chunk-EMUMKW5C.js');
|
|
11
11
|
require('./chunk-6DOEUDD5.js');
|
|
12
12
|
require('./chunk-JLWKW3G5.js');
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-DUZLPHRC.js');
|
|
14
|
+
require('./chunk-IHF35QZD.js');
|
|
15
15
|
require('./chunk-5LQ4QBR5.js');
|
|
16
16
|
require('./chunk-RJ262NXS.js');
|
|
17
17
|
require('./chunk-RXNEDWK2.js');
|
|
18
|
-
require('./chunk-Z7PWFZG5.js');
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
Object.defineProperty(exports, "GroupOverlay", {
|
|
23
22
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkPVWLMJGZ_js.GroupOverlay; }
|
|
25
24
|
});
|
|
26
25
|
Object.defineProperty(exports, "HelperLines", {
|
|
27
26
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkPVWLMJGZ_js.HelperLines; }
|
|
29
28
|
});
|
|
30
29
|
Object.defineProperty(exports, "NodeSearch", {
|
|
31
30
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkPVWLMJGZ_js.NodeSearch; }
|
|
33
32
|
});
|
|
34
33
|
Object.defineProperty(exports, "PauseEdge", {
|
|
35
34
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkPVWLMJGZ_js.PauseEdge; }
|
|
37
36
|
});
|
|
38
37
|
Object.defineProperty(exports, "ShortcutHelpModal", {
|
|
39
38
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkPVWLMJGZ_js.ShortcutHelpModal; }
|
|
41
40
|
});
|
|
42
41
|
Object.defineProperty(exports, "WorkflowCanvas", {
|
|
43
42
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkPVWLMJGZ_js.WorkflowCanvas; }
|
|
45
44
|
});
|
package/dist/canvas.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
export { GroupOverlay, HelperLines, NodeSearch, PauseEdge, ShortcutHelpModal, WorkflowCanvas } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { GroupOverlay, HelperLines, NodeSearch, PauseEdge, ShortcutHelpModal, WorkflowCanvas } from './chunk-EYL6J4MW.mjs';
|
|
2
|
+
import './chunk-PFHFGSM5.mjs';
|
|
3
3
|
import './chunk-ZJD5WMR3.mjs';
|
|
4
4
|
import './chunk-E323WAZG.mjs';
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
5
|
+
import './chunk-IASLG6IA.mjs';
|
|
6
|
+
import './chunk-3PMLER6D.mjs';
|
|
7
7
|
import './chunk-7SKSRSS7.mjs';
|
|
8
8
|
import './chunk-EFXQT23N.mjs';
|
|
9
9
|
import './chunk-CV4M7CNU.mjs';
|
|
10
10
|
import './chunk-LDN7IX4Y.mjs';
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
11
|
+
import './chunk-73V6SUEO.mjs';
|
|
12
|
+
import './chunk-RIGVIEYB.mjs';
|
|
13
13
|
import './chunk-MLJJBBTB.mjs';
|
|
14
14
|
import './chunk-FT33LFII.mjs';
|
|
15
15
|
import './chunk-VRN3UWE5.mjs';
|
|
16
|
-
import './chunk-AC6TWLRT.mjs';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Button } from './chunk-7SKSRSS7.mjs';
|
|
2
2
|
import { extractEnumValues, supportsImageInput, validateRequiredSchemaFields, CONNECTION_FIELDS, getSchemaDefaults, getImageDimensions, getVideoMetadata } from './chunk-EFXQT23N.mjs';
|
|
3
|
-
import { useExecutionStore } from './chunk-
|
|
4
|
-
import {
|
|
3
|
+
import { useExecutionStore } from './chunk-73V6SUEO.mjs';
|
|
4
|
+
import { useWorkflowStore } from './chunk-RIGVIEYB.mjs';
|
|
5
5
|
import { useWorkflowUIConfig } from './chunk-FT33LFII.mjs';
|
|
6
|
-
import { __toESM } from './chunk-AC6TWLRT.mjs';
|
|
7
6
|
import { useMemo, useCallback, useRef, useEffect, useState } from 'react';
|
|
8
7
|
import { ChevronDown, Expand, Square, Play } from 'lucide-react';
|
|
9
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
import { NODE_DEFINITIONS, NodeStatusEnum } from '@genfeedai/types';
|
|
10
10
|
import { useShallow } from 'zustand/react/shallow';
|
|
11
11
|
|
|
12
12
|
function useAIGenNode({
|
|
@@ -134,13 +134,10 @@ function useAutoLoadModelSchema({
|
|
|
134
134
|
};
|
|
135
135
|
}, [currentModel, selectedModel, modelIdMap, onModelSelect, modelSchema]);
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
// src/hooks/useRequiredInputs.ts
|
|
139
|
-
var import_types = __toESM(require_dist());
|
|
140
137
|
function useRequiredInputs(nodeId, nodeType) {
|
|
141
138
|
const edges = useWorkflowStore((state) => state.edges);
|
|
142
139
|
return useMemo(() => {
|
|
143
|
-
const nodeDef =
|
|
140
|
+
const nodeDef = NODE_DEFINITIONS[nodeType];
|
|
144
141
|
if (!nodeDef) {
|
|
145
142
|
return { hasRequiredInputs: true, missingInputs: [], connectionStatus: /* @__PURE__ */ new Map() };
|
|
146
143
|
}
|
|
@@ -162,9 +159,6 @@ function useRequiredInputs(nodeId, nodeType) {
|
|
|
162
159
|
};
|
|
163
160
|
}, [nodeId, nodeType, edges]);
|
|
164
161
|
}
|
|
165
|
-
|
|
166
|
-
// src/hooks/useCanGenerate.ts
|
|
167
|
-
var import_types2 = __toESM(require_dist());
|
|
168
162
|
function extractOutputValue(node, handleType) {
|
|
169
163
|
const data = node.data;
|
|
170
164
|
if (handleType === "text") {
|
|
@@ -215,7 +209,7 @@ function useCanGenerate({
|
|
|
215
209
|
});
|
|
216
210
|
}
|
|
217
211
|
const connectedInputs = getConnectedInputs(nodeId);
|
|
218
|
-
const nodeDef =
|
|
212
|
+
const nodeDef = NODE_DEFINITIONS[nodeType];
|
|
219
213
|
const requiredHandleIds = new Set(
|
|
220
214
|
nodeDef?.inputs.filter((h) => h.required).map((h) => h.id) ?? []
|
|
221
215
|
);
|
|
@@ -288,15 +282,12 @@ function useModelSelection({ nodeId, modelMap, fallbackModel }) {
|
|
|
288
282
|
);
|
|
289
283
|
return { handleModelSelect };
|
|
290
284
|
}
|
|
291
|
-
|
|
292
|
-
// src/hooks/useNodeExecution.ts
|
|
293
|
-
var import_types3 = __toESM(require_dist());
|
|
294
285
|
function useNodeExecution(nodeId) {
|
|
295
286
|
const updateNodeData = useWorkflowStore((state) => state.updateNodeData);
|
|
296
287
|
const executeNode = useExecutionStore((state) => state.executeNode);
|
|
297
288
|
const stopNodeExecution = useExecutionStore((state) => state.stopNodeExecution);
|
|
298
289
|
const handleGenerate = useCallback(() => {
|
|
299
|
-
updateNodeData(nodeId, { status:
|
|
290
|
+
updateNodeData(nodeId, { status: NodeStatusEnum.PROCESSING });
|
|
300
291
|
executeNode(nodeId);
|
|
301
292
|
}, [nodeId, executeNode, updateNodeData]);
|
|
302
293
|
const handleStop = useCallback(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { __toESM } from './chunk-AC6TWLRT.mjs';
|
|
1
|
+
import { useWorkflowStore } from './chunk-RIGVIEYB.mjs';
|
|
3
2
|
import { create } from 'zustand';
|
|
3
|
+
import { ProviderTypeEnum, NodeStatusEnum } from '@genfeedai/types';
|
|
4
4
|
|
|
5
5
|
var notificationId = 0;
|
|
6
6
|
var useUIStore = create((set) => ({
|
|
@@ -84,9 +84,6 @@ var useUIStore = create((set) => ({
|
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
86
86
|
}));
|
|
87
|
-
|
|
88
|
-
// src/stores/settingsStore.ts
|
|
89
|
-
var import_types = __toESM(require_dist());
|
|
90
87
|
var STORAGE_KEY = "genfeed-settings";
|
|
91
88
|
var MAX_RECENT_MODELS = 8;
|
|
92
89
|
var DEFAULT_SETTINGS = {
|
|
@@ -214,7 +211,7 @@ var useSettingsStore = create((set, get) => {
|
|
|
214
211
|
},
|
|
215
212
|
setEdgeStyle: (style) => {
|
|
216
213
|
setAndPersist(() => ({ edgeStyle: style }));
|
|
217
|
-
import('./workflowStore-
|
|
214
|
+
import('./workflowStore-ZCSVIZQF.mjs').then(({ useWorkflowStore: useWorkflowStore2 }) => {
|
|
218
215
|
useWorkflowStore2.getState().setEdgeStyle(style);
|
|
219
216
|
});
|
|
220
217
|
},
|
|
@@ -269,10 +266,10 @@ var useSettingsStore = create((set, get) => {
|
|
|
269
266
|
const key = state.providers[provider].apiKey;
|
|
270
267
|
if (!key) return {};
|
|
271
268
|
const headerMap = {
|
|
272
|
-
[
|
|
273
|
-
[
|
|
274
|
-
[
|
|
275
|
-
[
|
|
269
|
+
[ProviderTypeEnum.REPLICATE]: "X-Replicate-Key",
|
|
270
|
+
[ProviderTypeEnum.FAL]: "X-Fal-Key",
|
|
271
|
+
[ProviderTypeEnum.HUGGINGFACE]: "X-HF-Key",
|
|
272
|
+
[ProviderTypeEnum.GENFEED_AI]: "X-Genfeed-Key"
|
|
276
273
|
};
|
|
277
274
|
return { [headerMap[provider]]: key };
|
|
278
275
|
},
|
|
@@ -285,34 +282,28 @@ var useSettingsStore = create((set, get) => {
|
|
|
285
282
|
};
|
|
286
283
|
});
|
|
287
284
|
var PROVIDER_INFO = {
|
|
288
|
-
[
|
|
285
|
+
[ProviderTypeEnum.REPLICATE]: {
|
|
289
286
|
name: "Replicate",
|
|
290
287
|
description: "Access thousands of open-source AI models",
|
|
291
288
|
docsUrl: "https://replicate.com/docs"
|
|
292
289
|
},
|
|
293
|
-
[
|
|
290
|
+
[ProviderTypeEnum.FAL]: {
|
|
294
291
|
name: "fal.ai",
|
|
295
292
|
description: "Fast inference for image and video generation",
|
|
296
293
|
docsUrl: "https://fal.ai/docs"
|
|
297
294
|
},
|
|
298
|
-
[
|
|
295
|
+
[ProviderTypeEnum.HUGGINGFACE]: {
|
|
299
296
|
name: "Hugging Face",
|
|
300
297
|
description: "The AI community platform with 500k+ models",
|
|
301
298
|
docsUrl: "https://huggingface.co/docs/api-inference"
|
|
302
299
|
},
|
|
303
|
-
[
|
|
300
|
+
[ProviderTypeEnum.GENFEED_AI]: {
|
|
304
301
|
name: "Genfeed AI",
|
|
305
302
|
description: "Built-in models powered by Genfeed",
|
|
306
303
|
docsUrl: "https://genfeed.ai/docs"
|
|
307
304
|
}
|
|
308
305
|
};
|
|
309
306
|
|
|
310
|
-
// src/stores/execution/slices/executionSlice.ts
|
|
311
|
-
var import_types3 = __toESM(require_dist());
|
|
312
|
-
|
|
313
|
-
// src/stores/execution/helpers/sseSubscription.ts
|
|
314
|
-
var import_types2 = __toESM(require_dist());
|
|
315
|
-
|
|
316
307
|
// src/stores/execution/helpers/outputHelpers.ts
|
|
317
308
|
function extractOutputValue(output) {
|
|
318
309
|
if (!output) return null;
|
|
@@ -394,11 +385,11 @@ function getOutputUpdate(nodeId, output, workflowStore) {
|
|
|
394
385
|
// src/stores/execution/helpers/sseSubscription.ts
|
|
395
386
|
var API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://local.genfeed.ai:3001/api";
|
|
396
387
|
var statusMap = {
|
|
397
|
-
pending:
|
|
398
|
-
processing:
|
|
399
|
-
complete:
|
|
400
|
-
succeeded:
|
|
401
|
-
error:
|
|
388
|
+
pending: NodeStatusEnum.IDLE,
|
|
389
|
+
processing: NodeStatusEnum.PROCESSING,
|
|
390
|
+
complete: NodeStatusEnum.COMPLETE,
|
|
391
|
+
succeeded: NodeStatusEnum.COMPLETE,
|
|
392
|
+
error: NodeStatusEnum.ERROR
|
|
402
393
|
};
|
|
403
394
|
function applyJobUpdates(jobs, workflowStore, debugMode, set, filterNodeId) {
|
|
404
395
|
if (!jobs || jobs.length === 0) return;
|
|
@@ -466,7 +457,7 @@ async function reconcileNodeStatuses(executionId) {
|
|
|
466
457
|
const execution = await response.json();
|
|
467
458
|
const workflowStore = useWorkflowStore.getState();
|
|
468
459
|
for (const nodeResult of execution.nodeResults || []) {
|
|
469
|
-
const nodeStatus = statusMap[nodeResult.status] ??
|
|
460
|
+
const nodeStatus = statusMap[nodeResult.status] ?? NodeStatusEnum.IDLE;
|
|
470
461
|
const isSuccess = nodeResult.status === "complete" || nodeResult.status === "succeeded";
|
|
471
462
|
workflowStore.updateNodeData(nodeResult.nodeId, {
|
|
472
463
|
status: nodeStatus,
|
|
@@ -491,7 +482,7 @@ function createExecutionSubscription(executionId, set) {
|
|
|
491
482
|
const workflowStore = useWorkflowStore.getState();
|
|
492
483
|
const nodeResults = data.nodeResults || [];
|
|
493
484
|
for (const nodeResult of nodeResults) {
|
|
494
|
-
const nodeStatus = statusMap[nodeResult.status] ??
|
|
485
|
+
const nodeStatus = statusMap[nodeResult.status] ?? NodeStatusEnum.IDLE;
|
|
495
486
|
const isSuccess = nodeResult.status === "complete" || nodeResult.status === "succeeded";
|
|
496
487
|
workflowStore.updateNodeData(nodeResult.nodeId, {
|
|
497
488
|
status: nodeStatus,
|
|
@@ -542,7 +533,7 @@ function createNodeExecutionSubscription(executionId, nodeId, set, _get) {
|
|
|
542
533
|
const workflowStore = useWorkflowStore.getState();
|
|
543
534
|
const nodeResults = data.nodeResults || [];
|
|
544
535
|
for (const nodeResult of nodeResults) {
|
|
545
|
-
const nodeStatus = statusMap[nodeResult.status] ??
|
|
536
|
+
const nodeStatus = statusMap[nodeResult.status] ?? NodeStatusEnum.IDLE;
|
|
546
537
|
const isSuccess = nodeResult.status === "complete" || nodeResult.status === "succeeded";
|
|
547
538
|
workflowStore.updateNodeData(nodeResult.nodeId, {
|
|
548
539
|
status: nodeStatus,
|
|
@@ -648,7 +639,7 @@ var createExecutionSlice = (set, get) => ({
|
|
|
648
639
|
set({ isRunning: true });
|
|
649
640
|
for (const node of workflowStore.nodes) {
|
|
650
641
|
workflowStore.updateNodeData(node.id, {
|
|
651
|
-
status:
|
|
642
|
+
status: NodeStatusEnum.IDLE,
|
|
652
643
|
error: void 0,
|
|
653
644
|
progress: void 0
|
|
654
645
|
});
|
|
@@ -685,7 +676,7 @@ var createExecutionSlice = (set, get) => ({
|
|
|
685
676
|
await workflowStore.saveWorkflow();
|
|
686
677
|
} catch {
|
|
687
678
|
workflowStore.updateNodeData(nodeId, {
|
|
688
|
-
status:
|
|
679
|
+
status: NodeStatusEnum.ERROR,
|
|
689
680
|
error: "Failed to save workflow"
|
|
690
681
|
});
|
|
691
682
|
return;
|
|
@@ -694,7 +685,7 @@ var createExecutionSlice = (set, get) => ({
|
|
|
694
685
|
const workflowId = workflowStore.workflowId;
|
|
695
686
|
if (!workflowId) {
|
|
696
687
|
workflowStore.updateNodeData(nodeId, {
|
|
697
|
-
status:
|
|
688
|
+
status: NodeStatusEnum.ERROR,
|
|
698
689
|
error: "Workflow must be saved first"
|
|
699
690
|
});
|
|
700
691
|
return;
|
|
@@ -721,7 +712,7 @@ var createExecutionSlice = (set, get) => ({
|
|
|
721
712
|
});
|
|
722
713
|
} catch (error) {
|
|
723
714
|
workflowStore.updateNodeData(nodeId, {
|
|
724
|
-
status:
|
|
715
|
+
status: NodeStatusEnum.ERROR,
|
|
725
716
|
error: error instanceof Error ? error.message : "Node execution failed"
|
|
726
717
|
});
|
|
727
718
|
}
|
|
@@ -775,7 +766,7 @@ var createExecutionSlice = (set, get) => ({
|
|
|
775
766
|
}
|
|
776
767
|
for (const nodeId of selectedNodeIds) {
|
|
777
768
|
workflowStore.updateNodeData(nodeId, {
|
|
778
|
-
status:
|
|
769
|
+
status: NodeStatusEnum.IDLE,
|
|
779
770
|
error: void 0,
|
|
780
771
|
progress: void 0
|
|
781
772
|
});
|
|
@@ -826,7 +817,7 @@ var createExecutionSlice = (set, get) => ({
|
|
|
826
817
|
useUIStore.getState().setShowDebugPanel(true);
|
|
827
818
|
}
|
|
828
819
|
workflowStore.updateNodeData(lastFailedNodeId, {
|
|
829
|
-
status:
|
|
820
|
+
status: NodeStatusEnum.IDLE,
|
|
830
821
|
error: void 0,
|
|
831
822
|
progress: void 0
|
|
832
823
|
});
|
|
@@ -883,7 +874,7 @@ var createExecutionSlice = (set, get) => ({
|
|
|
883
874
|
});
|
|
884
875
|
}
|
|
885
876
|
const workflowStore = useWorkflowStore.getState();
|
|
886
|
-
workflowStore.updateNodeData(nodeId, { status:
|
|
877
|
+
workflowStore.updateNodeData(nodeId, { status: NodeStatusEnum.IDLE, error: void 0 });
|
|
887
878
|
},
|
|
888
879
|
isNodeExecuting: (nodeId) => {
|
|
889
880
|
const { activeNodeExecutions } = get();
|
|
@@ -915,7 +906,7 @@ var createExecutionSlice = (set, get) => ({
|
|
|
915
906
|
const workflowStore = useWorkflowStore.getState();
|
|
916
907
|
for (const node of workflowStore.nodes) {
|
|
917
908
|
workflowStore.updateNodeData(node.id, {
|
|
918
|
-
status:
|
|
909
|
+
status: NodeStatusEnum.IDLE,
|
|
919
910
|
error: void 0,
|
|
920
911
|
progress: void 0
|
|
921
912
|
});
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var chunk5HJFQVUR_js = require('./chunk-5HJFQVUR.js');
|
|
4
4
|
var chunkEMUMKW5C_js = require('./chunk-EMUMKW5C.js');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkDUZLPHRC_js = require('./chunk-DUZLPHRC.js');
|
|
6
|
+
var chunkIHF35QZD_js = require('./chunk-IHF35QZD.js');
|
|
7
7
|
var chunkRJ262NXS_js = require('./chunk-RJ262NXS.js');
|
|
8
|
-
var chunkZ7PWFZG5_js = require('./chunk-Z7PWFZG5.js');
|
|
9
8
|
var react = require('react');
|
|
10
9
|
var lucideReact = require('lucide-react');
|
|
11
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
var types = require('@genfeedai/types');
|
|
12
12
|
var shallow = require('zustand/react/shallow');
|
|
13
13
|
|
|
14
14
|
function useAIGenNode({
|
|
@@ -16,7 +16,7 @@ function useAIGenNode({
|
|
|
16
16
|
selectedModel,
|
|
17
17
|
schemaParams
|
|
18
18
|
}) {
|
|
19
|
-
const updateNodeData =
|
|
19
|
+
const updateNodeData = chunkIHF35QZD_js.useWorkflowStore((state) => state.updateNodeData);
|
|
20
20
|
const schemaProperties = react.useMemo(() => {
|
|
21
21
|
const schema = selectedModel?.inputSchema;
|
|
22
22
|
return schema?.properties;
|
|
@@ -34,7 +34,7 @@ function useAIGenNode({
|
|
|
34
34
|
const componentSchemas = selectedModel?.componentSchemas;
|
|
35
35
|
const handleSchemaParamChange = react.useCallback(
|
|
36
36
|
(key, value) => {
|
|
37
|
-
const currentNode =
|
|
37
|
+
const currentNode = chunkIHF35QZD_js.useWorkflowStore.getState().getNodeById(nodeId);
|
|
38
38
|
const currentData = currentNode?.data;
|
|
39
39
|
updateNodeData(nodeId, {
|
|
40
40
|
schemaParams: {
|
|
@@ -136,13 +136,10 @@ function useAutoLoadModelSchema({
|
|
|
136
136
|
};
|
|
137
137
|
}, [currentModel, selectedModel, modelIdMap, onModelSelect, modelSchema]);
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
// src/hooks/useRequiredInputs.ts
|
|
141
|
-
var import_types = chunkZ7PWFZG5_js.__toESM(chunkNSDLGLAQ_js.require_dist());
|
|
142
139
|
function useRequiredInputs(nodeId, nodeType) {
|
|
143
|
-
const edges =
|
|
140
|
+
const edges = chunkIHF35QZD_js.useWorkflowStore((state) => state.edges);
|
|
144
141
|
return react.useMemo(() => {
|
|
145
|
-
const nodeDef =
|
|
142
|
+
const nodeDef = types.NODE_DEFINITIONS[nodeType];
|
|
146
143
|
if (!nodeDef) {
|
|
147
144
|
return { hasRequiredInputs: true, missingInputs: [], connectionStatus: /* @__PURE__ */ new Map() };
|
|
148
145
|
}
|
|
@@ -164,9 +161,6 @@ function useRequiredInputs(nodeId, nodeType) {
|
|
|
164
161
|
};
|
|
165
162
|
}, [nodeId, nodeType, edges]);
|
|
166
163
|
}
|
|
167
|
-
|
|
168
|
-
// src/hooks/useCanGenerate.ts
|
|
169
|
-
var import_types2 = chunkZ7PWFZG5_js.__toESM(chunkNSDLGLAQ_js.require_dist());
|
|
170
164
|
function extractOutputValue(node, handleType) {
|
|
171
165
|
const data = node.data;
|
|
172
166
|
if (handleType === "text") {
|
|
@@ -187,12 +181,12 @@ function useCanGenerate({
|
|
|
187
181
|
schemaParams
|
|
188
182
|
}) {
|
|
189
183
|
const { hasRequiredInputs, missingInputs } = useRequiredInputs(nodeId, nodeType);
|
|
190
|
-
const getConnectedInputs =
|
|
184
|
+
const getConnectedInputs = chunkIHF35QZD_js.useWorkflowStore((state) => state.getConnectedInputs);
|
|
191
185
|
const incomingEdgesSelector = react.useCallback(
|
|
192
186
|
(state) => state.edges.filter((e) => e.target === nodeId),
|
|
193
187
|
[nodeId]
|
|
194
188
|
);
|
|
195
|
-
const incomingEdges =
|
|
189
|
+
const incomingEdges = chunkIHF35QZD_js.useWorkflowStore(shallow.useShallow(incomingEdgesSelector));
|
|
196
190
|
const connectedOutputsSelector = react.useCallback(
|
|
197
191
|
(state) => {
|
|
198
192
|
const outputs = {};
|
|
@@ -206,7 +200,7 @@ function useCanGenerate({
|
|
|
206
200
|
},
|
|
207
201
|
[incomingEdges]
|
|
208
202
|
);
|
|
209
|
-
|
|
203
|
+
chunkIHF35QZD_js.useWorkflowStore(shallow.useShallow(connectedOutputsSelector));
|
|
210
204
|
return react.useMemo(() => {
|
|
211
205
|
const missingItems = [];
|
|
212
206
|
for (const inputId of missingInputs) {
|
|
@@ -217,7 +211,7 @@ function useCanGenerate({
|
|
|
217
211
|
});
|
|
218
212
|
}
|
|
219
213
|
const connectedInputs = getConnectedInputs(nodeId);
|
|
220
|
-
const nodeDef =
|
|
214
|
+
const nodeDef = types.NODE_DEFINITIONS[nodeType];
|
|
221
215
|
const requiredHandleIds = new Set(
|
|
222
216
|
nodeDef?.inputs.filter((h) => h.required).map((h) => h.id) ?? []
|
|
223
217
|
);
|
|
@@ -267,7 +261,7 @@ function useCanGenerate({
|
|
|
267
261
|
]);
|
|
268
262
|
}
|
|
269
263
|
function useModelSelection({ nodeId, modelMap, fallbackModel }) {
|
|
270
|
-
const updateNodeData =
|
|
264
|
+
const updateNodeData = chunkIHF35QZD_js.useWorkflowStore((state) => state.updateNodeData);
|
|
271
265
|
const handleModelSelect = react.useCallback(
|
|
272
266
|
(model) => {
|
|
273
267
|
const internalModel = modelMap[model.id] ?? fallbackModel;
|
|
@@ -290,15 +284,12 @@ function useModelSelection({ nodeId, modelMap, fallbackModel }) {
|
|
|
290
284
|
);
|
|
291
285
|
return { handleModelSelect };
|
|
292
286
|
}
|
|
293
|
-
|
|
294
|
-
// src/hooks/useNodeExecution.ts
|
|
295
|
-
var import_types3 = chunkZ7PWFZG5_js.__toESM(chunkNSDLGLAQ_js.require_dist());
|
|
296
287
|
function useNodeExecution(nodeId) {
|
|
297
|
-
const updateNodeData =
|
|
298
|
-
const executeNode =
|
|
299
|
-
const stopNodeExecution =
|
|
288
|
+
const updateNodeData = chunkIHF35QZD_js.useWorkflowStore((state) => state.updateNodeData);
|
|
289
|
+
const executeNode = chunkDUZLPHRC_js.useExecutionStore((state) => state.executeNode);
|
|
290
|
+
const stopNodeExecution = chunkDUZLPHRC_js.useExecutionStore((state) => state.stopNodeExecution);
|
|
300
291
|
const handleGenerate = react.useCallback(() => {
|
|
301
|
-
updateNodeData(nodeId, { status:
|
|
292
|
+
updateNodeData(nodeId, { status: types.NodeStatusEnum.PROCESSING });
|
|
302
293
|
executeNode(nodeId);
|
|
303
294
|
}, [nodeId, executeNode, updateNodeData]);
|
|
304
295
|
const handleStop = react.useCallback(() => {
|
|
@@ -324,8 +315,8 @@ function useMediaUpload({
|
|
|
324
315
|
buildUrlUpdate,
|
|
325
316
|
buildRemoveUpdate
|
|
326
317
|
}) {
|
|
327
|
-
const updateNodeData =
|
|
328
|
-
const workflowId =
|
|
318
|
+
const updateNodeData = chunkIHF35QZD_js.useWorkflowStore((state) => state.updateNodeData);
|
|
319
|
+
const workflowId = chunkIHF35QZD_js.useWorkflowStore((state) => state.workflowId);
|
|
329
320
|
const { fileUpload } = chunkRJ262NXS_js.useWorkflowUIConfig();
|
|
330
321
|
const fileInputRef = react.useRef(null);
|
|
331
322
|
const [showUrlInput, setShowUrlInput] = react.useState(false);
|