machinaos 0.0.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/.env.template +71 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/bin/cli.js +159 -0
- package/client/.dockerignore +45 -0
- package/client/Dockerfile +68 -0
- package/client/eslint.config.js +29 -0
- package/client/index.html +13 -0
- package/client/nginx.conf +66 -0
- package/client/package.json +48 -0
- package/client/src/App.tsx +27 -0
- package/client/src/Dashboard.tsx +1173 -0
- package/client/src/ParameterPanel.tsx +301 -0
- package/client/src/components/AIAgentNode.tsx +321 -0
- package/client/src/components/APIKeyValidator.tsx +118 -0
- package/client/src/components/ClaudeChatModelNode.tsx +18 -0
- package/client/src/components/ConditionalEdge.tsx +189 -0
- package/client/src/components/CredentialsModal.tsx +306 -0
- package/client/src/components/EdgeConditionEditor.tsx +443 -0
- package/client/src/components/GeminiChatModelNode.tsx +18 -0
- package/client/src/components/GenericNode.tsx +357 -0
- package/client/src/components/LocationParameterPanel.tsx +154 -0
- package/client/src/components/ModelNode.tsx +286 -0
- package/client/src/components/OpenAIChatModelNode.tsx +18 -0
- package/client/src/components/OutputPanel.tsx +471 -0
- package/client/src/components/ParameterRenderer.tsx +1874 -0
- package/client/src/components/SkillEditorModal.tsx +417 -0
- package/client/src/components/SquareNode.tsx +797 -0
- package/client/src/components/StartNode.tsx +250 -0
- package/client/src/components/ToolkitNode.tsx +365 -0
- package/client/src/components/TriggerNode.tsx +463 -0
- package/client/src/components/auth/LoginPage.tsx +247 -0
- package/client/src/components/auth/ProtectedRoute.tsx +59 -0
- package/client/src/components/base/BaseChatModelNode.tsx +271 -0
- package/client/src/components/icons/AIProviderIcons.tsx +50 -0
- package/client/src/components/maps/GoogleMapsPicker.tsx +137 -0
- package/client/src/components/maps/MapsPreviewPanel.tsx +110 -0
- package/client/src/components/maps/index.ts +26 -0
- package/client/src/components/parameterPanel/InputSection.tsx +1094 -0
- package/client/src/components/parameterPanel/LocationPanelLayout.tsx +65 -0
- package/client/src/components/parameterPanel/MapsSection.tsx +92 -0
- package/client/src/components/parameterPanel/MiddleSection.tsx +571 -0
- package/client/src/components/parameterPanel/OutputSection.tsx +81 -0
- package/client/src/components/parameterPanel/ParameterPanelLayout.tsx +82 -0
- package/client/src/components/parameterPanel/ToolSchemaEditor.tsx +436 -0
- package/client/src/components/parameterPanel/index.ts +42 -0
- package/client/src/components/shared/DataPanel.tsx +142 -0
- package/client/src/components/shared/JSONTreeRenderer.tsx +106 -0
- package/client/src/components/ui/AIResultModal.tsx +204 -0
- package/client/src/components/ui/AndroidSettingsPanel.tsx +401 -0
- package/client/src/components/ui/CodeEditor.tsx +81 -0
- package/client/src/components/ui/CollapsibleSection.tsx +88 -0
- package/client/src/components/ui/ComponentItem.tsx +154 -0
- package/client/src/components/ui/ComponentPalette.tsx +321 -0
- package/client/src/components/ui/ConsolePanel.tsx +1074 -0
- package/client/src/components/ui/ErrorBoundary.tsx +196 -0
- package/client/src/components/ui/InputNodesPanel.tsx +204 -0
- package/client/src/components/ui/MapSelector.tsx +314 -0
- package/client/src/components/ui/Modal.tsx +149 -0
- package/client/src/components/ui/NodeContextMenu.tsx +192 -0
- package/client/src/components/ui/NodeOutputPanel.tsx +1150 -0
- package/client/src/components/ui/OutputDisplayPanel.tsx +381 -0
- package/client/src/components/ui/SettingsPanel.tsx +243 -0
- package/client/src/components/ui/TopToolbar.tsx +736 -0
- package/client/src/components/ui/WhatsAppSettingsPanel.tsx +345 -0
- package/client/src/components/ui/WorkflowSidebar.tsx +294 -0
- package/client/src/config/antdTheme.ts +186 -0
- package/client/src/config/api.ts +54 -0
- package/client/src/contexts/AuthContext.tsx +221 -0
- package/client/src/contexts/ThemeContext.tsx +42 -0
- package/client/src/contexts/WebSocketContext.tsx +1971 -0
- package/client/src/factories/baseChatModelFactory.ts +256 -0
- package/client/src/hooks/useAndroidOperations.ts +164 -0
- package/client/src/hooks/useApiKeyValidation.ts +107 -0
- package/client/src/hooks/useApiKeys.ts +238 -0
- package/client/src/hooks/useAppTheme.ts +17 -0
- package/client/src/hooks/useComponentPalette.ts +51 -0
- package/client/src/hooks/useCopyPaste.ts +155 -0
- package/client/src/hooks/useDragAndDrop.ts +124 -0
- package/client/src/hooks/useDragVariable.ts +88 -0
- package/client/src/hooks/useExecution.ts +313 -0
- package/client/src/hooks/useParameterPanel.ts +176 -0
- package/client/src/hooks/useReactFlowNodes.ts +189 -0
- package/client/src/hooks/useToolSchema.ts +209 -0
- package/client/src/hooks/useWhatsApp.ts +196 -0
- package/client/src/hooks/useWorkflowManagement.ts +46 -0
- package/client/src/index.css +315 -0
- package/client/src/main.tsx +19 -0
- package/client/src/nodeDefinitions/aiAgentNodes.ts +336 -0
- package/client/src/nodeDefinitions/aiModelNodes.ts +340 -0
- package/client/src/nodeDefinitions/androidDeviceNodes.ts +140 -0
- package/client/src/nodeDefinitions/androidServiceNodes.ts +383 -0
- package/client/src/nodeDefinitions/chatNodes.ts +135 -0
- package/client/src/nodeDefinitions/codeNodes.ts +54 -0
- package/client/src/nodeDefinitions/documentNodes.ts +379 -0
- package/client/src/nodeDefinitions/index.ts +15 -0
- package/client/src/nodeDefinitions/locationNodes.ts +463 -0
- package/client/src/nodeDefinitions/schedulerNodes.ts +220 -0
- package/client/src/nodeDefinitions/skillNodes.ts +211 -0
- package/client/src/nodeDefinitions/toolNodes.ts +198 -0
- package/client/src/nodeDefinitions/utilityNodes.ts +284 -0
- package/client/src/nodeDefinitions/whatsappNodes.ts +865 -0
- package/client/src/nodeDefinitions/workflowNodes.ts +41 -0
- package/client/src/nodeDefinitions.ts +104 -0
- package/client/src/schemas/workflowSchema.ts +264 -0
- package/client/src/services/dynamicParameterService.ts +96 -0
- package/client/src/services/execution/aiAgentExecutionService.ts +35 -0
- package/client/src/services/executionService.ts +232 -0
- package/client/src/services/workflowApi.ts +91 -0
- package/client/src/store/useAppStore.ts +582 -0
- package/client/src/styles/theme.ts +508 -0
- package/client/src/styles/zIndex.ts +17 -0
- package/client/src/types/ComponentTypes.ts +39 -0
- package/client/src/types/EdgeCondition.ts +231 -0
- package/client/src/types/INodeProperties.ts +288 -0
- package/client/src/types/NodeTypes.ts +28 -0
- package/client/src/utils/formatters.ts +33 -0
- package/client/src/utils/googleMapsLoader.ts +140 -0
- package/client/src/utils/locationUtils.ts +85 -0
- package/client/src/utils/nodeUtils.ts +31 -0
- package/client/src/utils/workflow.ts +30 -0
- package/client/src/utils/workflowExport.ts +120 -0
- package/client/src/vite-env.d.ts +12 -0
- package/client/tailwind.config.js +60 -0
- package/client/tsconfig.json +25 -0
- package/client/tsconfig.node.json +11 -0
- package/client/vite.config.js +35 -0
- package/docker-compose.prod.yml +107 -0
- package/docker-compose.yml +104 -0
- package/docs-MachinaOs/README.md +85 -0
- package/docs-MachinaOs/deployment/docker.mdx +228 -0
- package/docs-MachinaOs/deployment/production.mdx +345 -0
- package/docs-MachinaOs/docs.json +75 -0
- package/docs-MachinaOs/faq.mdx +309 -0
- package/docs-MachinaOs/favicon.svg +5 -0
- package/docs-MachinaOs/installation.mdx +160 -0
- package/docs-MachinaOs/introduction.mdx +114 -0
- package/docs-MachinaOs/logo/dark.svg +6 -0
- package/docs-MachinaOs/logo/light.svg +6 -0
- package/docs-MachinaOs/nodes/ai-agent.mdx +216 -0
- package/docs-MachinaOs/nodes/ai-models.mdx +240 -0
- package/docs-MachinaOs/nodes/android.mdx +411 -0
- package/docs-MachinaOs/nodes/overview.mdx +181 -0
- package/docs-MachinaOs/nodes/schedulers.mdx +316 -0
- package/docs-MachinaOs/nodes/webhooks.mdx +330 -0
- package/docs-MachinaOs/nodes/whatsapp.mdx +305 -0
- package/docs-MachinaOs/quickstart.mdx +119 -0
- package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +177 -0
- package/docs-MachinaOs/tutorials/android-automation.mdx +242 -0
- package/docs-MachinaOs/tutorials/first-workflow.mdx +134 -0
- package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +185 -0
- package/nul +0 -0
- package/package.json +70 -0
- package/scripts/build.js +158 -0
- package/scripts/check-ports.ps1 +33 -0
- package/scripts/clean.js +40 -0
- package/scripts/docker.js +93 -0
- package/scripts/kill-port.ps1 +154 -0
- package/scripts/start.js +210 -0
- package/scripts/stop.js +325 -0
- package/server/.dockerignore +44 -0
- package/server/Dockerfile +45 -0
- package/server/constants.py +249 -0
- package/server/core/__init__.py +1 -0
- package/server/core/cache.py +461 -0
- package/server/core/config.py +128 -0
- package/server/core/container.py +99 -0
- package/server/core/database.py +1211 -0
- package/server/core/logging.py +314 -0
- package/server/main.py +289 -0
- package/server/middleware/__init__.py +5 -0
- package/server/middleware/auth.py +89 -0
- package/server/models/__init__.py +1 -0
- package/server/models/auth.py +52 -0
- package/server/models/cache.py +24 -0
- package/server/models/database.py +211 -0
- package/server/models/nodes.py +455 -0
- package/server/package.json +9 -0
- package/server/pyproject.toml +72 -0
- package/server/requirements.txt +83 -0
- package/server/routers/__init__.py +1 -0
- package/server/routers/android.py +294 -0
- package/server/routers/auth.py +203 -0
- package/server/routers/database.py +151 -0
- package/server/routers/maps.py +142 -0
- package/server/routers/nodejs_compat.py +289 -0
- package/server/routers/webhook.py +90 -0
- package/server/routers/websocket.py +2127 -0
- package/server/routers/whatsapp.py +761 -0
- package/server/routers/workflow.py +200 -0
- package/server/services/__init__.py +1 -0
- package/server/services/ai.py +2415 -0
- package/server/services/android/__init__.py +27 -0
- package/server/services/android/broadcaster.py +114 -0
- package/server/services/android/client.py +608 -0
- package/server/services/android/manager.py +78 -0
- package/server/services/android/protocol.py +165 -0
- package/server/services/android_service.py +588 -0
- package/server/services/auth.py +131 -0
- package/server/services/chat_client.py +160 -0
- package/server/services/deployment/__init__.py +12 -0
- package/server/services/deployment/manager.py +706 -0
- package/server/services/deployment/state.py +47 -0
- package/server/services/deployment/triggers.py +275 -0
- package/server/services/event_waiter.py +785 -0
- package/server/services/execution/__init__.py +77 -0
- package/server/services/execution/cache.py +769 -0
- package/server/services/execution/conditions.py +373 -0
- package/server/services/execution/dlq.py +132 -0
- package/server/services/execution/executor.py +1351 -0
- package/server/services/execution/models.py +531 -0
- package/server/services/execution/recovery.py +235 -0
- package/server/services/handlers/__init__.py +126 -0
- package/server/services/handlers/ai.py +355 -0
- package/server/services/handlers/android.py +260 -0
- package/server/services/handlers/code.py +278 -0
- package/server/services/handlers/document.py +598 -0
- package/server/services/handlers/http.py +193 -0
- package/server/services/handlers/polyglot.py +105 -0
- package/server/services/handlers/tools.py +845 -0
- package/server/services/handlers/triggers.py +107 -0
- package/server/services/handlers/utility.py +822 -0
- package/server/services/handlers/whatsapp.py +476 -0
- package/server/services/maps.py +289 -0
- package/server/services/memory_store.py +103 -0
- package/server/services/node_executor.py +375 -0
- package/server/services/parameter_resolver.py +218 -0
- package/server/services/polyglot_client.py +169 -0
- package/server/services/scheduler.py +155 -0
- package/server/services/skill_loader.py +417 -0
- package/server/services/status_broadcaster.py +826 -0
- package/server/services/temporal/__init__.py +23 -0
- package/server/services/temporal/activities.py +344 -0
- package/server/services/temporal/client.py +76 -0
- package/server/services/temporal/executor.py +147 -0
- package/server/services/temporal/worker.py +251 -0
- package/server/services/temporal/workflow.py +355 -0
- package/server/services/temporal/ws_client.py +236 -0
- package/server/services/text.py +111 -0
- package/server/services/user_auth.py +172 -0
- package/server/services/websocket_client.py +29 -0
- package/server/services/workflow.py +597 -0
- package/server/skills/android-skill/SKILL.md +82 -0
- package/server/skills/assistant-personality/SKILL.md +45 -0
- package/server/skills/code-skill/SKILL.md +140 -0
- package/server/skills/http-skill/SKILL.md +161 -0
- package/server/skills/maps-skill/SKILL.md +170 -0
- package/server/skills/memory-skill/SKILL.md +154 -0
- package/server/skills/scheduler-skill/SKILL.md +84 -0
- package/server/skills/whatsapp-skill/SKILL.md +283 -0
- package/server/uv.lock +2916 -0
- package/server/whatsapp-rpc/.dockerignore +30 -0
- package/server/whatsapp-rpc/Dockerfile +44 -0
- package/server/whatsapp-rpc/Dockerfile.web +17 -0
- package/server/whatsapp-rpc/README.md +139 -0
- package/server/whatsapp-rpc/cli.js +95 -0
- package/server/whatsapp-rpc/configs/config.yaml +7 -0
- package/server/whatsapp-rpc/docker-compose.yml +35 -0
- package/server/whatsapp-rpc/docs/API.md +410 -0
- package/server/whatsapp-rpc/go.mod +67 -0
- package/server/whatsapp-rpc/go.sum +203 -0
- package/server/whatsapp-rpc/package.json +30 -0
- package/server/whatsapp-rpc/schema.json +1294 -0
- package/server/whatsapp-rpc/scripts/clean.cjs +66 -0
- package/server/whatsapp-rpc/scripts/cli.js +162 -0
- package/server/whatsapp-rpc/src/go/cmd/server/main.go +91 -0
- package/server/whatsapp-rpc/src/go/config/config.go +49 -0
- package/server/whatsapp-rpc/src/go/rpc/rpc.go +446 -0
- package/server/whatsapp-rpc/src/go/rpc/server.go +112 -0
- package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -0
- package/server/whatsapp-rpc/src/go/whatsapp/messages.go +390 -0
- package/server/whatsapp-rpc/src/go/whatsapp/service.go +2130 -0
- package/server/whatsapp-rpc/src/go/whatsapp/types.go +261 -0
- package/server/whatsapp-rpc/src/python/pyproject.toml +15 -0
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -0
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -0
- package/server/whatsapp-rpc/web/app.py +609 -0
- package/server/whatsapp-rpc/web/requirements.txt +6 -0
- package/server/whatsapp-rpc/web/rpc_client.py +427 -0
- package/server/whatsapp-rpc/web/static/openapi.yaml +59 -0
- package/server/whatsapp-rpc/web/templates/base.html +150 -0
- package/server/whatsapp-rpc/web/templates/contacts.html +240 -0
- package/server/whatsapp-rpc/web/templates/dashboard.html +320 -0
- package/server/whatsapp-rpc/web/templates/groups.html +328 -0
- package/server/whatsapp-rpc/web/templates/messages.html +465 -0
- package/server/whatsapp-rpc/web/templates/messaging.html +681 -0
- package/server/whatsapp-rpc/web/templates/send.html +259 -0
- package/server/whatsapp-rpc/web/templates/settings.html +459 -0
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import ParameterRenderer from '../ParameterRenderer';
|
|
3
|
+
import ToolSchemaEditor from './ToolSchemaEditor';
|
|
4
|
+
import { useAppTheme } from '../../hooks/useAppTheme';
|
|
5
|
+
import { useAppStore } from '../../store/useAppStore';
|
|
6
|
+
import { nodeDefinitions } from '../../nodeDefinitions';
|
|
7
|
+
import { INodeTypeDescription, INodeProperties } from '../../types/INodeProperties';
|
|
8
|
+
import { ExecutionResult } from '../../services/executionService';
|
|
9
|
+
import { Edge } from 'reactflow';
|
|
10
|
+
import { SKILL_NODE_TYPES } from '../../nodeDefinitions/skillNodes';
|
|
11
|
+
|
|
12
|
+
// Tool node types that support schema editing
|
|
13
|
+
const TOOL_NODE_TYPES = ['androidTool', 'calculatorTool', 'currentTimeTool', 'webSearchTool'];
|
|
14
|
+
|
|
15
|
+
interface ConnectedSkill {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
description: string;
|
|
21
|
+
color: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface MiddleSectionProps {
|
|
25
|
+
nodeId: string;
|
|
26
|
+
nodeDefinition: INodeTypeDescription;
|
|
27
|
+
parameters: Record<string, any>;
|
|
28
|
+
onParameterChange: (paramName: string, value: any) => void;
|
|
29
|
+
isLoadingParameters?: boolean;
|
|
30
|
+
executionResults?: ExecutionResult[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const shouldShowParameter = (param: INodeProperties, allParameters: Record<string, any>): boolean => {
|
|
34
|
+
if (!param.displayOptions?.show) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const showConditions = param.displayOptions.show;
|
|
39
|
+
|
|
40
|
+
for (const [paramName, allowedValues] of Object.entries(showConditions)) {
|
|
41
|
+
const currentValue = allParameters[paramName];
|
|
42
|
+
|
|
43
|
+
if (Array.isArray(allowedValues)) {
|
|
44
|
+
if (!allowedValues.includes(currentValue)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
if (currentValue !== allowedValues) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return true;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const MiddleSection: React.FC<MiddleSectionProps> = ({
|
|
58
|
+
nodeId,
|
|
59
|
+
nodeDefinition,
|
|
60
|
+
parameters,
|
|
61
|
+
onParameterChange,
|
|
62
|
+
isLoadingParameters = false,
|
|
63
|
+
executionResults = []
|
|
64
|
+
}) => {
|
|
65
|
+
const theme = useAppTheme();
|
|
66
|
+
const { currentWorkflow } = useAppStore();
|
|
67
|
+
const [isConsoleExpanded, setIsConsoleExpanded] = useState(true);
|
|
68
|
+
const [connectedSkills, setConnectedSkills] = useState<ConnectedSkill[]>([]);
|
|
69
|
+
const [isSkillsExpanded, setIsSkillsExpanded] = useState(true);
|
|
70
|
+
|
|
71
|
+
const visibleParams = (nodeDefinition.properties || [])
|
|
72
|
+
.filter((param: INodeProperties) => shouldShowParameter(param, parameters));
|
|
73
|
+
|
|
74
|
+
// Check if this is a code executor node (Python or JavaScript)
|
|
75
|
+
const isCodeExecutorNode = nodeDefinition.name === 'pythonExecutor' || nodeDefinition.name === 'javascriptExecutor';
|
|
76
|
+
|
|
77
|
+
// Check if this is a skill node with code editor (needs similar flex layout)
|
|
78
|
+
const isSkillNode = SKILL_NODE_TYPES.includes(nodeDefinition.name) && nodeDefinition.name !== 'customSkill';
|
|
79
|
+
|
|
80
|
+
// Check if this is a memory node with markdown editor
|
|
81
|
+
const isMemoryNode = nodeDefinition.name === 'simpleMemory';
|
|
82
|
+
|
|
83
|
+
// Nodes that need flexible code editor layout
|
|
84
|
+
const needsCodeEditorLayout = isCodeExecutorNode || isSkillNode || isMemoryNode;
|
|
85
|
+
|
|
86
|
+
// Check if this is a tool node that supports schema editing
|
|
87
|
+
const isToolNode = TOOL_NODE_TYPES.includes(nodeDefinition.name);
|
|
88
|
+
|
|
89
|
+
// Check if this is a Chat Agent node
|
|
90
|
+
const isChatAgentNode = nodeDefinition.name === 'chatAgent';
|
|
91
|
+
|
|
92
|
+
// Get connected skills for Chat Agent nodes
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!isChatAgentNode || !currentWorkflow) {
|
|
95
|
+
setConnectedSkills([]);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const nodes = currentWorkflow.nodes || [];
|
|
100
|
+
const edges = currentWorkflow.edges || [];
|
|
101
|
+
|
|
102
|
+
// Find edges connecting to this node's input-skill handle
|
|
103
|
+
const skillEdges = edges.filter((edge: Edge) =>
|
|
104
|
+
edge.target === nodeId && edge.targetHandle === 'input-skill'
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
// Get skill node data
|
|
108
|
+
const skills: ConnectedSkill[] = skillEdges.map((edge: Edge) => {
|
|
109
|
+
const sourceNode = nodes.find((n: any) => n.id === edge.source);
|
|
110
|
+
const nodeType = sourceNode?.type || '';
|
|
111
|
+
const nodeDef = nodeDefinitions[nodeType];
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
id: edge.source,
|
|
115
|
+
name: sourceNode?.data?.label || nodeDef?.displayName || nodeType,
|
|
116
|
+
type: nodeType,
|
|
117
|
+
icon: nodeDef?.icon || '',
|
|
118
|
+
description: nodeDef?.description || '',
|
|
119
|
+
color: nodeDef?.defaults?.color as string || '#6366F1',
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
setConnectedSkills(skills);
|
|
124
|
+
}, [nodeId, isChatAgentNode, currentWorkflow]);
|
|
125
|
+
|
|
126
|
+
// Extract console output from execution results
|
|
127
|
+
const getConsoleOutput = (): string => {
|
|
128
|
+
if (executionResults.length === 0) return '';
|
|
129
|
+
|
|
130
|
+
const latestResult = executionResults[0];
|
|
131
|
+
const outputs = latestResult.outputs || latestResult.data || latestResult.nodeData?.[0]?.[0]?.json;
|
|
132
|
+
|
|
133
|
+
if (!outputs) return '';
|
|
134
|
+
|
|
135
|
+
// Check for console_output or stdout in the result
|
|
136
|
+
if (outputs.console_output) return outputs.console_output;
|
|
137
|
+
if (outputs.stdout) return outputs.stdout;
|
|
138
|
+
if (outputs.result?.console_output) return outputs.result.console_output;
|
|
139
|
+
if (outputs.result?.stdout) return outputs.result.stdout;
|
|
140
|
+
|
|
141
|
+
// Check for error output
|
|
142
|
+
if (latestResult.error) return `Error: ${latestResult.error}`;
|
|
143
|
+
if (outputs.error) return `Error: ${outputs.error}`;
|
|
144
|
+
if (outputs.stderr) return `Error: ${outputs.stderr}`;
|
|
145
|
+
|
|
146
|
+
return '';
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const consoleOutput = isCodeExecutorNode ? getConsoleOutput() : '';
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<div style={{
|
|
153
|
+
flex: 1,
|
|
154
|
+
display: 'flex',
|
|
155
|
+
flexDirection: 'column',
|
|
156
|
+
height: '100%',
|
|
157
|
+
overflow: 'hidden',
|
|
158
|
+
position: 'relative'
|
|
159
|
+
}}>
|
|
160
|
+
{/* Description - hide for code editor nodes (Python, Skill) */}
|
|
161
|
+
{!needsCodeEditorLayout && (
|
|
162
|
+
<div style={{
|
|
163
|
+
padding: `${theme.spacing.lg} ${theme.spacing.xl} ${theme.spacing.sm}`,
|
|
164
|
+
borderBottom: `1px solid ${theme.colors.border}`,
|
|
165
|
+
backgroundColor: theme.colors.backgroundAlt,
|
|
166
|
+
flexShrink: 0
|
|
167
|
+
}}>
|
|
168
|
+
<p style={{
|
|
169
|
+
margin: 0,
|
|
170
|
+
fontSize: theme.fontSize.base,
|
|
171
|
+
color: theme.colors.textSecondary,
|
|
172
|
+
lineHeight: '1.5',
|
|
173
|
+
}}>
|
|
174
|
+
{nodeDefinition.description}
|
|
175
|
+
</p>
|
|
176
|
+
</div>
|
|
177
|
+
)}
|
|
178
|
+
|
|
179
|
+
{/* Main Content Area - Flexible */}
|
|
180
|
+
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, overflow: 'hidden' }}>
|
|
181
|
+
{/* Parameters */}
|
|
182
|
+
<div style={{
|
|
183
|
+
padding: theme.spacing.xl,
|
|
184
|
+
flex: needsCodeEditorLayout ? '3' : 1,
|
|
185
|
+
overflowY: needsCodeEditorLayout ? 'hidden' : 'auto',
|
|
186
|
+
overflowX: 'hidden',
|
|
187
|
+
width: '100%',
|
|
188
|
+
boxSizing: 'border-box',
|
|
189
|
+
minHeight: 0,
|
|
190
|
+
display: needsCodeEditorLayout ? 'flex' : 'block',
|
|
191
|
+
flexDirection: 'column'
|
|
192
|
+
}}>
|
|
193
|
+
{/* Parameters Container */}
|
|
194
|
+
<div style={{
|
|
195
|
+
backgroundColor: theme.colors.background,
|
|
196
|
+
border: `1px solid ${theme.colors.border}`,
|
|
197
|
+
borderRadius: theme.borderRadius.md,
|
|
198
|
+
padding: theme.spacing.lg,
|
|
199
|
+
boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
|
|
200
|
+
height: needsCodeEditorLayout ? '100%' : 'auto',
|
|
201
|
+
display: needsCodeEditorLayout ? 'flex' : 'block',
|
|
202
|
+
flexDirection: 'column',
|
|
203
|
+
boxSizing: 'border-box'
|
|
204
|
+
}}>
|
|
205
|
+
{/* All Parameters - standard n8n style */}
|
|
206
|
+
{visibleParams.map((param: INodeProperties, index: number) => {
|
|
207
|
+
// Check if this parameter is a code editor - give it more flex space
|
|
208
|
+
const isCodeParam = (param as any).typeOptions?.editor === 'code';
|
|
209
|
+
return (
|
|
210
|
+
<div
|
|
211
|
+
key={param.name}
|
|
212
|
+
style={{
|
|
213
|
+
paddingBottom: index < visibleParams.length - 1 ? theme.spacing.md : 0,
|
|
214
|
+
marginBottom: index < visibleParams.length - 1 ? theme.spacing.md : 0,
|
|
215
|
+
borderBottom: index < visibleParams.length - 1 ? `1px solid ${theme.colors.border}` : 'none',
|
|
216
|
+
flex: needsCodeEditorLayout && isCodeParam ? 1 : 'none',
|
|
217
|
+
display: needsCodeEditorLayout ? 'flex' : 'block',
|
|
218
|
+
flexDirection: 'column',
|
|
219
|
+
minHeight: needsCodeEditorLayout && isCodeParam ? '300px' : 0
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
<ParameterRenderer
|
|
223
|
+
parameter={param}
|
|
224
|
+
value={parameters[param.name]}
|
|
225
|
+
onChange={(value) => onParameterChange(param.name, value)}
|
|
226
|
+
allParameters={parameters}
|
|
227
|
+
onParameterChange={onParameterChange}
|
|
228
|
+
onClosePanel={() => {}}
|
|
229
|
+
isLoadingParameters={isLoadingParameters}
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
})}
|
|
234
|
+
|
|
235
|
+
{/* Tool Schema Editor - Only for tool nodes */}
|
|
236
|
+
{isToolNode && (
|
|
237
|
+
<ToolSchemaEditor
|
|
238
|
+
nodeId={nodeId}
|
|
239
|
+
toolName={parameters.toolName || nodeDefinition.name}
|
|
240
|
+
toolDescription={parameters.toolDescription || nodeDefinition.description || ''}
|
|
241
|
+
/>
|
|
242
|
+
)}
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
{/* Connected Skills Section - Only for Chat Agent nodes */}
|
|
246
|
+
{isChatAgentNode && (
|
|
247
|
+
<div style={{
|
|
248
|
+
marginTop: theme.spacing.lg,
|
|
249
|
+
backgroundColor: theme.colors.background,
|
|
250
|
+
border: `1px solid ${theme.colors.border}`,
|
|
251
|
+
borderRadius: theme.borderRadius.md,
|
|
252
|
+
boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
|
|
253
|
+
overflow: 'hidden'
|
|
254
|
+
}}>
|
|
255
|
+
{/* Skills Header */}
|
|
256
|
+
<div
|
|
257
|
+
onClick={() => setIsSkillsExpanded(!isSkillsExpanded)}
|
|
258
|
+
style={{
|
|
259
|
+
display: 'flex',
|
|
260
|
+
alignItems: 'center',
|
|
261
|
+
justifyContent: 'space-between',
|
|
262
|
+
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
263
|
+
backgroundColor: theme.colors.backgroundAlt,
|
|
264
|
+
borderBottom: isSkillsExpanded ? `1px solid ${theme.colors.border}` : 'none',
|
|
265
|
+
cursor: 'pointer',
|
|
266
|
+
userSelect: 'none'
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
|
|
270
|
+
<svg
|
|
271
|
+
width="14"
|
|
272
|
+
height="14"
|
|
273
|
+
viewBox="0 0 24 24"
|
|
274
|
+
fill="none"
|
|
275
|
+
stroke={theme.colors.textSecondary}
|
|
276
|
+
strokeWidth="2"
|
|
277
|
+
strokeLinecap="round"
|
|
278
|
+
strokeLinejoin="round"
|
|
279
|
+
style={{
|
|
280
|
+
transform: isSkillsExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
|
|
281
|
+
transition: 'transform 0.2s ease'
|
|
282
|
+
}}
|
|
283
|
+
>
|
|
284
|
+
<polyline points="9 18 15 12 9 6" />
|
|
285
|
+
</svg>
|
|
286
|
+
<svg
|
|
287
|
+
width="14"
|
|
288
|
+
height="14"
|
|
289
|
+
viewBox="0 0 24 24"
|
|
290
|
+
fill="none"
|
|
291
|
+
stroke={theme.dracula.purple}
|
|
292
|
+
strokeWidth="2"
|
|
293
|
+
strokeLinecap="round"
|
|
294
|
+
strokeLinejoin="round"
|
|
295
|
+
>
|
|
296
|
+
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
|
|
297
|
+
</svg>
|
|
298
|
+
<span style={{
|
|
299
|
+
fontSize: theme.fontSize.sm,
|
|
300
|
+
fontWeight: theme.fontWeight.medium,
|
|
301
|
+
color: theme.colors.text
|
|
302
|
+
}}>
|
|
303
|
+
Connected Skills
|
|
304
|
+
</span>
|
|
305
|
+
</div>
|
|
306
|
+
<span style={{
|
|
307
|
+
fontSize: theme.fontSize.xs,
|
|
308
|
+
color: connectedSkills.length > 0 ? theme.dracula.purple : theme.colors.textMuted,
|
|
309
|
+
padding: `2px ${theme.spacing.sm}`,
|
|
310
|
+
backgroundColor: connectedSkills.length > 0 ? theme.dracula.purple + '20' : theme.colors.backgroundAlt,
|
|
311
|
+
borderRadius: theme.borderRadius.sm,
|
|
312
|
+
fontWeight: theme.fontWeight.medium
|
|
313
|
+
}}>
|
|
314
|
+
{connectedSkills.length}
|
|
315
|
+
</span>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
{/* Skills Content */}
|
|
319
|
+
{isSkillsExpanded && (
|
|
320
|
+
<div style={{ padding: theme.spacing.md }}>
|
|
321
|
+
{connectedSkills.length === 0 ? (
|
|
322
|
+
<div style={{
|
|
323
|
+
display: 'flex',
|
|
324
|
+
flexDirection: 'column',
|
|
325
|
+
alignItems: 'center',
|
|
326
|
+
justifyContent: 'center',
|
|
327
|
+
padding: theme.spacing.lg,
|
|
328
|
+
color: theme.colors.textMuted,
|
|
329
|
+
textAlign: 'center'
|
|
330
|
+
}}>
|
|
331
|
+
<svg
|
|
332
|
+
width="32"
|
|
333
|
+
height="32"
|
|
334
|
+
viewBox="0 0 24 24"
|
|
335
|
+
fill="none"
|
|
336
|
+
stroke={theme.colors.textMuted}
|
|
337
|
+
strokeWidth="1.5"
|
|
338
|
+
strokeLinecap="round"
|
|
339
|
+
strokeLinejoin="round"
|
|
340
|
+
style={{ marginBottom: theme.spacing.sm, opacity: 0.5 }}
|
|
341
|
+
>
|
|
342
|
+
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
|
|
343
|
+
</svg>
|
|
344
|
+
<span style={{ fontSize: theme.fontSize.sm, marginBottom: theme.spacing.xs }}>
|
|
345
|
+
No skills connected
|
|
346
|
+
</span>
|
|
347
|
+
<span style={{ fontSize: theme.fontSize.xs }}>
|
|
348
|
+
Connect skill nodes to the Skill handle to add capabilities
|
|
349
|
+
</span>
|
|
350
|
+
</div>
|
|
351
|
+
) : (
|
|
352
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: theme.spacing.sm }}>
|
|
353
|
+
{connectedSkills.map((skill) => (
|
|
354
|
+
<div
|
|
355
|
+
key={skill.id}
|
|
356
|
+
style={{
|
|
357
|
+
display: 'flex',
|
|
358
|
+
alignItems: 'flex-start',
|
|
359
|
+
gap: theme.spacing.md,
|
|
360
|
+
padding: theme.spacing.md,
|
|
361
|
+
backgroundColor: theme.colors.backgroundAlt,
|
|
362
|
+
borderRadius: theme.borderRadius.md,
|
|
363
|
+
border: `1px solid ${theme.colors.border}`,
|
|
364
|
+
borderLeft: `3px solid ${skill.color}`
|
|
365
|
+
}}
|
|
366
|
+
>
|
|
367
|
+
{/* Skill Icon */}
|
|
368
|
+
<div style={{
|
|
369
|
+
width: 36,
|
|
370
|
+
height: 36,
|
|
371
|
+
borderRadius: theme.borderRadius.md,
|
|
372
|
+
backgroundColor: skill.color + '20',
|
|
373
|
+
display: 'flex',
|
|
374
|
+
alignItems: 'center',
|
|
375
|
+
justifyContent: 'center',
|
|
376
|
+
flexShrink: 0
|
|
377
|
+
}}>
|
|
378
|
+
<span style={{ fontSize: 18 }}>{skill.icon}</span>
|
|
379
|
+
</div>
|
|
380
|
+
|
|
381
|
+
{/* Skill Info */}
|
|
382
|
+
<div style={{ flex: 1, minWidth: 0 }}>
|
|
383
|
+
<div style={{
|
|
384
|
+
fontSize: theme.fontSize.sm,
|
|
385
|
+
fontWeight: theme.fontWeight.semibold,
|
|
386
|
+
color: theme.colors.text,
|
|
387
|
+
marginBottom: 2
|
|
388
|
+
}}>
|
|
389
|
+
{skill.name}
|
|
390
|
+
</div>
|
|
391
|
+
<div style={{
|
|
392
|
+
fontSize: theme.fontSize.xs,
|
|
393
|
+
color: theme.colors.textMuted,
|
|
394
|
+
overflow: 'hidden',
|
|
395
|
+
textOverflow: 'ellipsis',
|
|
396
|
+
display: '-webkit-box',
|
|
397
|
+
WebkitLineClamp: 2,
|
|
398
|
+
WebkitBoxOrient: 'vertical'
|
|
399
|
+
}}>
|
|
400
|
+
{skill.description}
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
{/* Active Badge */}
|
|
405
|
+
<div style={{
|
|
406
|
+
fontSize: '10px',
|
|
407
|
+
fontWeight: theme.fontWeight.medium,
|
|
408
|
+
color: theme.dracula.green,
|
|
409
|
+
padding: `2px ${theme.spacing.xs}`,
|
|
410
|
+
backgroundColor: theme.dracula.green + '20',
|
|
411
|
+
borderRadius: theme.borderRadius.sm,
|
|
412
|
+
flexShrink: 0
|
|
413
|
+
}}>
|
|
414
|
+
Active
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
))}
|
|
418
|
+
</div>
|
|
419
|
+
)}
|
|
420
|
+
</div>
|
|
421
|
+
)}
|
|
422
|
+
</div>
|
|
423
|
+
)}
|
|
424
|
+
</div>
|
|
425
|
+
|
|
426
|
+
{/* Console Output Section - Only for Python nodes */}
|
|
427
|
+
{isCodeExecutorNode && (
|
|
428
|
+
<div style={{
|
|
429
|
+
padding: `0 ${theme.spacing.xl} ${theme.spacing.xl}`,
|
|
430
|
+
flex: '1',
|
|
431
|
+
minHeight: 0,
|
|
432
|
+
display: 'flex',
|
|
433
|
+
flexDirection: 'column'
|
|
434
|
+
}}>
|
|
435
|
+
<div style={{
|
|
436
|
+
backgroundColor: theme.colors.background,
|
|
437
|
+
border: `1px solid ${theme.colors.border}`,
|
|
438
|
+
borderRadius: theme.borderRadius.md,
|
|
439
|
+
boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
|
|
440
|
+
overflow: 'hidden',
|
|
441
|
+
flex: 1,
|
|
442
|
+
display: 'flex',
|
|
443
|
+
flexDirection: 'column',
|
|
444
|
+
minHeight: 0
|
|
445
|
+
}}>
|
|
446
|
+
{/* Console Header */}
|
|
447
|
+
<div
|
|
448
|
+
onClick={() => setIsConsoleExpanded(!isConsoleExpanded)}
|
|
449
|
+
style={{
|
|
450
|
+
display: 'flex',
|
|
451
|
+
alignItems: 'center',
|
|
452
|
+
justifyContent: 'space-between',
|
|
453
|
+
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
454
|
+
backgroundColor: theme.colors.backgroundAlt,
|
|
455
|
+
borderBottom: isConsoleExpanded ? `1px solid ${theme.colors.border}` : 'none',
|
|
456
|
+
cursor: 'pointer',
|
|
457
|
+
userSelect: 'none'
|
|
458
|
+
}}
|
|
459
|
+
>
|
|
460
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
|
|
461
|
+
<svg
|
|
462
|
+
width="14"
|
|
463
|
+
height="14"
|
|
464
|
+
viewBox="0 0 24 24"
|
|
465
|
+
fill="none"
|
|
466
|
+
stroke={theme.colors.textSecondary}
|
|
467
|
+
strokeWidth="2"
|
|
468
|
+
strokeLinecap="round"
|
|
469
|
+
strokeLinejoin="round"
|
|
470
|
+
style={{
|
|
471
|
+
transform: isConsoleExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
|
|
472
|
+
transition: 'transform 0.2s ease'
|
|
473
|
+
}}
|
|
474
|
+
>
|
|
475
|
+
<polyline points="9 18 15 12 9 6" />
|
|
476
|
+
</svg>
|
|
477
|
+
<svg
|
|
478
|
+
width="14"
|
|
479
|
+
height="14"
|
|
480
|
+
viewBox="0 0 24 24"
|
|
481
|
+
fill="none"
|
|
482
|
+
stroke={theme.dracula.cyan}
|
|
483
|
+
strokeWidth="2"
|
|
484
|
+
strokeLinecap="round"
|
|
485
|
+
strokeLinejoin="round"
|
|
486
|
+
>
|
|
487
|
+
<polyline points="4 17 10 11 4 5" />
|
|
488
|
+
<line x1="12" y1="19" x2="20" y2="19" />
|
|
489
|
+
</svg>
|
|
490
|
+
<span style={{
|
|
491
|
+
fontSize: theme.fontSize.sm,
|
|
492
|
+
fontWeight: theme.fontWeight.medium,
|
|
493
|
+
color: theme.colors.text
|
|
494
|
+
}}>
|
|
495
|
+
Console
|
|
496
|
+
</span>
|
|
497
|
+
</div>
|
|
498
|
+
{consoleOutput && (
|
|
499
|
+
<span style={{
|
|
500
|
+
fontSize: theme.fontSize.xs,
|
|
501
|
+
color: theme.dracula.green,
|
|
502
|
+
padding: `2px ${theme.spacing.sm}`,
|
|
503
|
+
backgroundColor: theme.dracula.green + '20',
|
|
504
|
+
borderRadius: theme.borderRadius.sm
|
|
505
|
+
}}>
|
|
506
|
+
Output
|
|
507
|
+
</span>
|
|
508
|
+
)}
|
|
509
|
+
</div>
|
|
510
|
+
|
|
511
|
+
{/* Console Content */}
|
|
512
|
+
{isConsoleExpanded && (
|
|
513
|
+
<div style={{
|
|
514
|
+
padding: theme.spacing.sm,
|
|
515
|
+
backgroundColor: '#1a1a2e',
|
|
516
|
+
flex: 1,
|
|
517
|
+
minHeight: 0,
|
|
518
|
+
overflowY: 'auto',
|
|
519
|
+
fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
|
|
520
|
+
fontSize: theme.fontSize.sm,
|
|
521
|
+
lineHeight: '1.4'
|
|
522
|
+
}}>
|
|
523
|
+
{consoleOutput ? (
|
|
524
|
+
<pre style={{
|
|
525
|
+
margin: 0,
|
|
526
|
+
whiteSpace: 'pre-wrap',
|
|
527
|
+
wordBreak: 'break-word',
|
|
528
|
+
color: consoleOutput.startsWith('Error') ? theme.dracula.red : theme.dracula.green
|
|
529
|
+
}}>
|
|
530
|
+
{consoleOutput}
|
|
531
|
+
</pre>
|
|
532
|
+
) : (
|
|
533
|
+
<div style={{
|
|
534
|
+
display: 'flex',
|
|
535
|
+
flexDirection: 'column',
|
|
536
|
+
alignItems: 'center',
|
|
537
|
+
justifyContent: 'center',
|
|
538
|
+
height: '100%',
|
|
539
|
+
minHeight: '40px',
|
|
540
|
+
color: theme.colors.textMuted
|
|
541
|
+
}}>
|
|
542
|
+
<svg
|
|
543
|
+
width="24"
|
|
544
|
+
height="24"
|
|
545
|
+
viewBox="0 0 24 24"
|
|
546
|
+
fill="none"
|
|
547
|
+
stroke={theme.colors.textMuted}
|
|
548
|
+
strokeWidth="1.5"
|
|
549
|
+
strokeLinecap="round"
|
|
550
|
+
strokeLinejoin="round"
|
|
551
|
+
style={{ marginBottom: theme.spacing.sm, opacity: 0.5 }}
|
|
552
|
+
>
|
|
553
|
+
<polyline points="4 17 10 11 4 5" />
|
|
554
|
+
<line x1="12" y1="19" x2="20" y2="19" />
|
|
555
|
+
</svg>
|
|
556
|
+
<span style={{ fontSize: theme.fontSize.xs }}>
|
|
557
|
+
Run the code to see console output
|
|
558
|
+
</span>
|
|
559
|
+
</div>
|
|
560
|
+
)}
|
|
561
|
+
</div>
|
|
562
|
+
)}
|
|
563
|
+
</div>
|
|
564
|
+
</div>
|
|
565
|
+
)}
|
|
566
|
+
</div>
|
|
567
|
+
</div>
|
|
568
|
+
);
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
export default MiddleSection;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import NodeOutputPanel from '../ui/NodeOutputPanel';
|
|
3
|
+
import { useAppTheme } from '../../hooks/useAppTheme';
|
|
4
|
+
import { ExecutionResult } from '../../services/executionService';
|
|
5
|
+
import { Node } from 'reactflow';
|
|
6
|
+
import { useWebSocket } from '../../contexts/WebSocketContext';
|
|
7
|
+
|
|
8
|
+
interface OutputSectionProps {
|
|
9
|
+
selectedNode: Node;
|
|
10
|
+
executionResults: ExecutionResult[];
|
|
11
|
+
onClearResults: () => void;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const OutputSection: React.FC<OutputSectionProps> = ({
|
|
16
|
+
selectedNode,
|
|
17
|
+
executionResults,
|
|
18
|
+
onClearResults,
|
|
19
|
+
visible = true
|
|
20
|
+
}) => {
|
|
21
|
+
const theme = useAppTheme();
|
|
22
|
+
const { nodeStatuses } = useWebSocket();
|
|
23
|
+
|
|
24
|
+
if (!visible) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Combine local execution results with WebSocket nodeStatuses from workflow execution
|
|
29
|
+
const combinedResults = React.useMemo(() => {
|
|
30
|
+
const results = [...executionResults];
|
|
31
|
+
|
|
32
|
+
// Check if there's output from workflow execution in nodeStatuses
|
|
33
|
+
const nodeStatus = nodeStatuses[selectedNode.id];
|
|
34
|
+
if (nodeStatus && nodeStatus.data && (nodeStatus.status === 'success' || nodeStatus.status === 'error')) {
|
|
35
|
+
// Check if this output is already in executionResults
|
|
36
|
+
const alreadyExists = results.some(r =>
|
|
37
|
+
r.nodeId === selectedNode.id &&
|
|
38
|
+
JSON.stringify(r.outputs) === JSON.stringify(nodeStatus.data)
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
if (!alreadyExists) {
|
|
42
|
+
// Create ExecutionResult from nodeStatus (from workflow execution)
|
|
43
|
+
const wsResult: ExecutionResult = {
|
|
44
|
+
success: nodeStatus.status === 'success',
|
|
45
|
+
nodeId: selectedNode.id,
|
|
46
|
+
nodeType: selectedNode.type || 'unknown',
|
|
47
|
+
nodeName: selectedNode.type || 'Node',
|
|
48
|
+
timestamp: new Date().toISOString(),
|
|
49
|
+
executionTime: 0,
|
|
50
|
+
outputs: nodeStatus.data,
|
|
51
|
+
nodeData: [[{ json: nodeStatus.data }]],
|
|
52
|
+
error: nodeStatus.status === 'error' ? nodeStatus.data?.error : undefined
|
|
53
|
+
};
|
|
54
|
+
// Add WebSocket result to the beginning (most recent)
|
|
55
|
+
results.unshift(wsResult);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return results;
|
|
60
|
+
}, [executionResults, nodeStatuses, selectedNode.id, selectedNode.type]);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div style={{
|
|
64
|
+
backgroundColor: theme.colors.backgroundPanel,
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexDirection: 'column',
|
|
67
|
+
width: '100%',
|
|
68
|
+
height: '100%',
|
|
69
|
+
overflow: 'hidden',
|
|
70
|
+
position: 'relative'
|
|
71
|
+
}}>
|
|
72
|
+
<NodeOutputPanel
|
|
73
|
+
results={combinedResults}
|
|
74
|
+
onClear={onClearResults}
|
|
75
|
+
selectedNode={selectedNode}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default OutputSection;
|