langflow icon indicating copy to clipboard operation
langflow copied to clipboard

If-Else component,stream=true on the URL will not response

Open CHparis opened this issue 8 months ago • 5 comments

Bug Description

When I add If-Else component to my flow and request the flow through API, stream=true on the URL will not response。

Reproduction

If-Else component

Expected behavior

When I add If-Else component to my flow and request the flow through API, stream=true on the URL has reponse

Who can help?

No response

Operating System

ubuntu22.04

Langflow Version

1.4.1

Python Version

3.12

Screenshot

No response

Flow File

No response

CHparis avatar May 18 '25 08:05 CHparis

The issue you're experiencing with the If-Else component not responding when using stream=true in the URL might be related to how the Langflow API handles streaming with this component. The If-Else component, known as the ConditionalRouterComponent, is designed to route messages based on conditional logic, but there might be limitations or specific configurations required for it to support streaming.

The Langflow API processes the stream parameter in the build_vertex_stream function, which is responsible for streaming vertex data. However, the If-Else component's interaction with streaming requests isn't explicitly documented, which could be a reason for the lack of response [1][2].

Additionally, the API handles errors during streaming by raising an HTTPException and sending error messages as part of the stream data. If an exception occurs, it is logged, and the error message is sent with the event type "error" [1][3].

To troubleshoot, you might want to check if there are any specific conditions or configurations required for the If-Else component to support streaming, or if there are any known issues with this component in version 1.4.1 [4].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar May 18 '25 08:05 dosubot[bot]

@dosu, if use agent component, use api {base_url}/api/v1/run/{flow_id}?stream=true,no response!!

CHparis avatar May 21 '25 09:05 CHparis

The API call to {base_url}/api/v1/run/{flow_id}?stream=true does not receive a response when using the agent component because the Agent Component does not support streaming responses directly. The Agent Component class lacks a 'stream' parameter in its definition, meaning streaming functionality cannot be enabled through this component. Instead, you should use the /build endpoint for streaming responses, which is currently used in the Langflow playground. Alternatively, the experimental_run_flow endpoint in the Langflow API does support a stream parameter, allowing for streaming capability when executing flows [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar May 21 '25 09:05 dosubot[bot]

@dosu, use /api/v1/build/{flow_id}/flow and /v1/build/${jobId}/events, no response!!

CHparis avatar May 21 '25 09:05 CHparis

The lack of response when using the endpoints /api/v1/build/{flow_id}/flow and /v1/build/${jobId}/events could be due to several reasons:

  1. Job Not Found: If the job ID or flow ID does not exist, a JobQueueNotFoundError will be raised, resulting in a 404 HTTP error. Ensure the job or flow ID is correct and exists.

  2. No Event Task Found: If there is no event task associated with the job ID, a 404 HTTP error will be raised. Verify that the event task is properly set up for the job.

  3. Unexpected Errors: Any unexpected errors during processing will result in a 500 HTTP error. Check server logs for more details on any exceptions.

  4. Timeouts: If there is a timeout while waiting for events, an empty response will be returned instead of an error. This might appear as no response.

To resolve the issue, ensure the job and flow IDs are correct and the job has been properly initiated. Additionally, check the server logs for any errors or exceptions that might provide more context on the issue [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar May 21 '25 09:05 dosubot[bot]