Skip to content

Self-improving AI Employees for everyone

fix(panel): show a source node's stored output as live input data

trohitg875b247e5240
diff --git a/client/src/components/parameterPanel/InputSection.tsx b/client/src/components/parameterPanel/InputSection.tsx
index e932baab..b704ef0a 100644
--- a/client/src/components/parameterPanel/InputSection.tsx
+++ b/client/src/components/parameterPanel/InputSection.tsx
@@ -324,8 +324,11 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
outputKey = `output_${handleName}`;
}
+ // `get_node_output` returns the source node's stored result as it
+ // is (NodeExecutor stores `result`): a dict, list, string or
+ // number, and null when the node has not run.
let executionData = await getNodeOutput(edge.source, outputKey);
- if (!executionData && outputKey !== 'output_0') {
+ if (executionData == null && outputKey !== 'output_0') {
executionData = await getNodeOutput(edge.source, 'output_0');
}
let inputData: any = null;
@@ -334,17 +337,15 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
// here only hid that from the reader. Matches `outputSchema` above.
let hasExecutionData: boolean;
- if (executionData && executionData[0] && executionData[0][0]) {
- const rawData = executionData[0][0].json || executionData[0][0];
- if (typeof rawData === 'object' && rawData !== null) {
- inputData = rawData;
- outputSchema = rawData;
- hasExecutionData = true;
+ if (executionData != null) {
+ if (typeof executionData === 'object') {
+ inputData = executionData;
+ outputSchema = executionData;
} else {
- inputData = { value: rawData };
- outputSchema = { value: typeof rawData };
- hasExecutionData = true;
+ inputData = { value: executionData };
+ outputSchema = { value: typeof executionData };
}
+ hasExecutionData = true;
} else {
hasExecutionData = false;
const sourceSpec = nodeType ? getCachedNodeSpec(nodeType) : null;
diff --git a/client/src/components/parameterPanel/__tests__/InputSection.test.tsx b/client/src/components/parameterPanel/__tests__/InputSection.test.tsx
index 38e44056..e96c52fa 100644
--- a/client/src/components/parameterPanel/__tests__/InputSection.test.tsx
+++ b/client/src/components/parameterPanel/__tests__/InputSection.test.tsx
@@ -163,13 +163,13 @@ describe('InputSection -- direct main edges', () => {
await waitFor(() => expect(wsMock.getNodeOutput).toHaveBeenCalledWith('src-b', 'output_main'));
await act(async () => {
- resolveB([[{ json: { value: 'from-b' } }]]);
+ resolveB({ value: 'from-b' });
await pendingB;
});
expect(await screen.findByText(/Source B/)).toBeInTheDocument();
await act(async () => {
- resolveA([[{ json: { value: 'from-a' } }]]);
+ resolveA({ value: 'from-a' });
await pendingA;
});
await waitFor(() => {
@@ -180,6 +180,49 @@ describe('InputSection -- direct main edges', () => {
});
+describe('InputSection -- live output data', () => {
+ // get_node_output returns the stored result as it is (NodeExecutor stores
+ // `result`). The panel used to expect an n8n-style `[[{ json }]]` list, so
+ // a real dict never matched and the column always fell back to the schema.
+ function wireHttpIntoAgent() {
+ setWorkflow(
+ [
+ { id: 'src', type: 'httpRequest', data: { label: 'HTTP' }, position: { x: 0, y: 0 } },
+ { id: 'agent', type: 'aiAgent', data: { label: 'Agent' }, position: { x: 100, y: 0 } },
+ ],
+ [{ id: 'e1', source: 'src', target: 'agent', sourceHandle: 'output-main', targetHandle: 'input-main' }],
+ );
+ }
+
+ it('shows a stored dict result as live data', async () => {
+ wireHttpIntoAgent();
+ wsMock.getNodeOutput.mockResolvedValue({ status: 200, body: 'pong' });
+
+ render(<InputSection nodeId="agent" />);
+ expect(await screen.findByText('LIVE')).toBeInTheDocument();
+ expect(screen.queryByText('SCHEMA')).not.toBeInTheDocument();
+ });
+
+ it('shows a stored string result whole, not its first character', async () => {
+ wireHttpIntoAgent();
+ wsMock.getNodeOutput.mockResolvedValue('hello world');
+
+ const { container } = render(<InputSection nodeId="agent" />);
+ // Rows open on load, so Received Data is visible without a click.
+ expect(await screen.findByText('LIVE')).toBeInTheDocument();
+ await waitFor(() => expect(container.textContent).toContain('"value": "hello world"'));
+ });
+
+ it('falls back to the schema view when the node has not run', async () => {
+ wireHttpIntoAgent();
+ wsMock.getNodeOutput.mockResolvedValue(null);
+
+ render(<InputSection nodeId="agent" />);
+ expect(await screen.findByText('SCHEMA')).toBeInTheDocument();
+ });
+});
+
+
describe('InputSection -- config handle filtering for agent nodes', () => {
it('SKIPS input-memory edges on agent nodes (they belong in MiddleSection)', async () => {
setWorkflow(