Bug Description
Hi,
using api , it is not possible to launch and stream output of flow , when we chain llms
There is no streaming reply, it replies with done.
Reproduction
const response = await axios.post(
`${this.baseUrl}/v1/run/${flow}?stream=true`,
requestBody,
{
headers: {
// "Authorization": "Bearer <TOKEN>",
"Content-Type": "application/json",
// "x-api-key": "sk-wcChzPLjRj2LKIPriY7hB4l-PpB4fEky_bvEfAPLw8Q",
},
responseType: "stream",
adapter: "fetch",
},
);
// Get the response body as a ReadableStream
const stream = response.data;
// Create a reader from the stream
const reader = stream.getReader();
// Process the stream chunks
try {
while (true) {
const { done, value } = await reader.read();
// Exit the loop when the stream is complete
if (done) {
console.log("Stream complete");
break;
}
// Convert the chunk (Uint8Array) to a string
const chunk = new TextDecoder().decode(value);
try {
// Each chunk might be one or more JSON objects separated by newlines
const lines = chunk.split('\n').filter(line => line.trim() !== '');
for (const line of lines) {
// Parse the JSON data from each line
const data = JSON.parse(line);
// Process the streaming data based on your needs
if (data.type === 'message') {
console.log('Received message:', data.content);
// Update UI or process message content
} else if (data.type === 'error') {
console.error('Error:', data.error);
// Handle error
} else if (data.type === 'end') {
console.log('Stream ended with status:', data.status);
// Handle completion
}
}
} catch (parseError) {
console.error('Error parsing chunk:', parseError);
console.log('Problematic chunk:', chunk);
}
}
} catch (streamError) {
console.error('Stream reading error:', streamError);
} finally {
// Always release the reader when done
reader.releaseLock();
}
Expected behavior
should wait end of my flow and stream output
Who can help?
@italojohnny @anovazzi1 @nicoloboschi
Operating System
win10
Langflow Version
1.2.0
Python Version
3.12
Screenshot
No response
Flow File
test.json
Bug Description
Hi,
using api , it is not possible to launch and stream output of flow , when we chain llms
There is no streaming reply, it replies with done.
Reproduction
Expected behavior
should wait end of my flow and stream output
Who can help?
@italojohnny @anovazzi1 @nicoloboschi
Operating System
win10
Langflow Version
1.2.0
Python Version
3.12
Screenshot
No response
Flow File
test.json