How can I change it so that only the content returned by LLM is returned in the form of streaming? #7770

Closed
opened 2026-02-21 18:22:18 -05:00 by yindo · 14 comments
Owner

Originally created by @Wjc0323 on GitHub (Jan 17, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

If the current response mode is streaming, each node will be output. How can I change it so that only the content returned by LLM is returned in the form of streaming?Like I don't want to have the element such as "workflow_started"... Can I change some code to make it happen?

Image

2. Additional context or comments

which part of code I need to change

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @Wjc0323 on GitHub (Jan 17, 2025). ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. If the current response mode is streaming, each node will be output. How can I change it so that only the content returned by LLM is returned in the form of streaming?Like I don't want to have the element such as "workflow_started"... Can I change some code to make it happen? <img width="2240" alt="Image" src="https://github.com/user-attachments/assets/5d3956f3-ccf7-4302-8f08-f2d5e72a62c6" /> ### 2. Additional context or comments which part of code I need to change ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 18:22:18 -05:00
yindo closed this issue 2026-02-21 18:22:18 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 17, 2025):

I found a similar discussion and issue related to your question:

  1. Discussion: If the current response mode is streaming, each node will be output. How can I change it so that only the content returned by LLM is returned in the form of streaming? - This discussion is still open and might provide some insights or ongoing solutions.

  2. Issue: about streaming response mode - This issue is closed but might contain relevant information or solutions that were considered.

To modify the code so that only the content returned by the LLM is streamed, excluding elements like "workflow_started", you can filter the events and only process those with the event: message. Here's a conceptual example:

def process_streamed_data(data_stream):
    for data in data_stream:
        event = data.get("event")
        if event == "message":
            # Process the LLM returned text block
            answer = data.get("answer")
            if answer:
                print(answer)  # or handle the answer as needed

This code snippet assumes data_stream is an iterable of event data. It filters out any events that are not message, ensuring only the LLM content is processed [1][2].

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 17, 2025): <!-- Answer --> I found a similar discussion and issue related to your question: 1. [Discussion: If the current response mode is streaming, each node will be output. How can I change it so that only the content returned by LLM is returned in the form of streaming?](https://github.com/langgenius/dify/discussions/12815) - This discussion is still open and might provide some insights or ongoing solutions. 2. [Issue: about streaming response mode](https://github.com/langgenius/dify/issues/12816) - This issue is closed but might contain relevant information or solutions that were considered. To modify the code so that only the content returned by the LLM is streamed, excluding elements like "workflow_started", you can filter the events and only process those with the `event: message`. Here's a conceptual example: ```python def process_streamed_data(data_stream): for data in data_stream: event = data.get("event") if event == "message": # Process the LLM returned text block answer = data.get("answer") if answer: print(answer) # or handle the answer as needed ``` This code snippet assumes `data_stream` is an iterable of event data. It filters out any events that are not `message`, ensuring only the LLM content is processed <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/develop/template/template_advanced_chat.zh.mdx)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/web/app/components/develop/template/template_advanced_chat.en.mdx)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/5c65af06-bb6a-41b7-96d5-e6d0ff727b93?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/5c65af06-bb6a-41b7-96d5-e6d0ff727b93?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/5c65af06-bb6a-41b7-96d5-e6d0ff727b93?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/5c65af06-bb6a-41b7-96d5-e6d0ff727b93?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/5c65af06-bb6a-41b7-96d5-e6d0ff727b93?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/5c65af06-bb6a-41b7-96d5-e6d0ff727b93?feedback_type=other)</sup>
Author
Owner

@Wjc0323 commented on GitHub (Jan 19, 2025):

@dosu
Could you pls tell me which file should I add this function? Thx

@Wjc0323 commented on GitHub (Jan 19, 2025): @dosu Could you pls tell me which file should I add this function? Thx
Author
Owner

@dosubot[bot] commented on GitHub (Jan 19, 2025):

To process streamed data so that only the content returned by the LLM is streamed, you should add the function in the llm.py file within the llm module. Specifically, you should implement the _handle_stream_response method in the XinferenceAILargeLanguageModel class, which should be created in this file [1][2].

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 19, 2025): <!-- Answer --> To process streamed data so that only the content returned by the LLM is streamed, you should add the function in the `llm.py` file within the `llm` module. Specifically, you should implement the `_handle_stream_response` method in the `XinferenceAILargeLanguageModel` class, which should be created in this file <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/jp/guides/model-configuration/predefined-model.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/en/guides/model-configuration/customizable-model.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/0e464a8e-5785-475d-aa56-8c1366d23901?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/0e464a8e-5785-475d-aa56-8c1366d23901?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/0e464a8e-5785-475d-aa56-8c1366d23901?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/0e464a8e-5785-475d-aa56-8c1366d23901?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0e464a8e-5785-475d-aa56-8c1366d23901?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/0e464a8e-5785-475d-aa56-8c1366d23901?feedback_type=other)</sup>
Author
Owner

@Wjc0323 commented on GitHub (Jan 19, 2025):

@dosu
I think you may have misunderstood me. I want to know, when I choose streaming as the response mode, I don't want anything except the LLM result. I just want to keep the LLM data. So, in which file can I control what the output includes?

@Wjc0323 commented on GitHub (Jan 19, 2025): @dosu I think you may have misunderstood me. I want to know, when I choose streaming as the response mode, I don't want anything except the LLM result. I just want to keep the LLM data. So, in which file can I control what the output includes?
Author
Owner

@dosubot[bot] commented on GitHub (Jan 19, 2025):

To control the output to include only the LLM data when streaming is chosen as the response mode, you should look into the llm.py file located in the api/core/model_runtime/model_providers/nvidia/llm/ directory. Specifically, you can modify the _generate method to handle the streaming response. This method sets the Accept header to "text/event-stream" when streaming is enabled and processes the response accordingly [1].

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 19, 2025): <!-- Answer --> To control the output to include only the LLM data when streaming is chosen as the response mode, you should look into the `llm.py` file located in the `api/core/model_runtime/model_providers/nvidia/llm/` directory. Specifically, you can modify the `_generate` method to handle the streaming response. This method sets the `Accept` header to `"text/event-stream"` when streaming is enabled and processes the response accordingly <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/nvidia/llm/llm.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/c054c0ff-ceb2-4ef4-9060-6651b1eb9204?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/c054c0ff-ceb2-4ef4-9060-6651b1eb9204?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/c054c0ff-ceb2-4ef4-9060-6651b1eb9204?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/c054c0ff-ceb2-4ef4-9060-6651b1eb9204?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c054c0ff-ceb2-4ef4-9060-6651b1eb9204?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/c054c0ff-ceb2-4ef4-9060-6651b1eb9204?feedback_type=other)</sup>
Author
Owner

@Wjc0323 commented on GitHub (Jan 19, 2025):

@dosu
For example:
I only want to keep these info. How can I remove all other info?

Image
@Wjc0323 commented on GitHub (Jan 19, 2025): @dosu For example: I only want to keep these info. How can I remove all other info? <img width="2240" alt="Image" src="https://github.com/user-attachments/assets/b71b921e-c61c-4441-841e-f1e062e2a61e" />
Author
Owner

@dosubot[bot] commented on GitHub (Jan 19, 2025):

To keep only the LLM data in the streaming output and remove other information, you should focus on modifying the code that handles the streaming response. Specifically, you can adjust the _handle_generate_stream_response method in the llm.py file. This method processes each chunk of the response and can be modified to filter out non-LLM data.

Here's a conceptual example of how you might modify this method to include only the LLM data:

def _handle_generate_stream_response(
    self, model: str, credentials: dict, response: dict, prompt_messages: list[PromptMessage]
) -> Generator:
    stream = response.get("body")
    if not stream:
        raise InvokeError("No response body")

    for event in stream:
        chunk = event.get("chunk")

        if not chunk:
            continue

        payload = json.loads(chunk.get("bytes").decode())

        # Filter to include only LLM data
        if "contentBlockDelta" in payload:
            delta = payload["contentBlockDelta"]["delta"]
            if "text" in delta:
                chunk_text = delta["text"] or ""
                yield chunk_text  # Yield only the text content

This example assumes that the LLM data is contained within the contentBlockDelta field and specifically within the text attribute. You should adjust the filtering logic based on the actual structure of your data to ensure only the desired LLM content is included in the output [1][2].

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 19, 2025): <!-- Answer --> To keep only the LLM data in the streaming output and remove other information, you should focus on modifying the code that handles the streaming response. Specifically, you can adjust the `_handle_generate_stream_response` method in the `llm.py` file. This method processes each chunk of the response and can be modified to filter out non-LLM data. Here's a conceptual example of how you might modify this method to include only the LLM data: ```python def _handle_generate_stream_response( self, model: str, credentials: dict, response: dict, prompt_messages: list[PromptMessage] ) -> Generator: stream = response.get("body") if not stream: raise InvokeError("No response body") for event in stream: chunk = event.get("chunk") if not chunk: continue payload = json.loads(chunk.get("bytes").decode()) # Filter to include only LLM data if "contentBlockDelta" in payload: delta = payload["contentBlockDelta"]["delta"] if "text" in delta: chunk_text = delta["text"] or "" yield chunk_text # Yield only the text content ``` This example assumes that the LLM data is contained within the `contentBlockDelta` field and specifically within the `text` attribute. You should adjust the filtering logic based on the actual structure of your data to ensure only the desired LLM content is included in the output <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/baichuan/llm/llm.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/bedrock/llm/llm.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/5de4e023-f0ef-427f-9f8d-b3da53f38894?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/5de4e023-f0ef-427f-9f8d-b3da53f38894?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/5de4e023-f0ef-427f-9f8d-b3da53f38894?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/5de4e023-f0ef-427f-9f8d-b3da53f38894?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/5de4e023-f0ef-427f-9f8d-b3da53f38894?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/5de4e023-f0ef-427f-9f8d-b3da53f38894?feedback_type=other)</sup>
Author
Owner

@Wjc0323 commented on GitHub (Jan 19, 2025):

@dosu

How can I remove this part of the output?

Image
@Wjc0323 commented on GitHub (Jan 19, 2025): @dosu How can I remove this part of the output? <img width="2240" alt="Image" src="https://github.com/user-attachments/assets/17e26260-53bc-4a97-bebd-591e8602cdd5" />
Author
Owner

@dosubot[bot] commented on GitHub (Jan 19, 2025):

To remove specific parts of the output, such as "workflow_started" and "node_started" events, you can modify the code that processes the streaming response. This can be done by filtering out these events in the read function where the events are being processed.

Here's how you can adjust the code to exclude these events:

function read() {
  let hasError = false;
  reader?.read().then((result: any) => {
    if (result.done) {
      onCompleted && onCompleted();
      return;
    }
    buffer += decoder.decode(result.value, { stream: true });
    const lines = buffer.split('\n');
    try {
      lines.forEach((message) => {
        if (message.startsWith('data: ')) {
          try {
            bufferObj = JSON.parse(message.substring(6)) as Record<string, any>;
          } catch (e) {
            onData('', isFirstMessage, {
              conversationId: bufferObj?.conversation_id,
              messageId: bufferObj?.message_id,
            });
            return;
          }
          if (bufferObj.status === 400 || !bufferObj.event) {
            onData('', false, {
              conversationId: undefined,
              messageId: '',
              errorMessage: bufferObj?.message,
              errorCode: bufferObj?.code,
            });
            hasError = true;
            onCompleted?.(true, bufferObj?.message);
            return;
          }
          // Exclude specific event types
          if (bufferObj.event === 'workflow_started' || bufferObj.event === 'node_started') {
            return; // Skip processing these events
          }
          if (bufferObj.event === 'message' || bufferObj.event === 'agent_message') {
            onData(unicodeToChar(bufferObj.answer), isFirstMessage, {
              conversationId: bufferObj.conversation_id,
              taskId: bufferObj.task_id,
              messageId: bufferObj.id,
            });
            isFirstMessage = false;
          }
          else if (bufferObj.event === 'agent_thought') {
            onThought?.(bufferObj as ThoughtItem);
          }
          // ... other event handlers ...
        }
      });
    } catch (e) {
      console.error(e);
    }
  });
}

This modification will prevent the log output from being generated for 'workflow_started' and 'node_started' events by simply returning early in those cases [1]. Adjust the filtering logic based on the actual structure of your data to ensure only the desired content is included in the output.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 19, 2025): <!-- Answer --> To remove specific parts of the output, such as "workflow_started" and "node_started" events, you can modify the code that processes the streaming response. This can be done by filtering out these events in the `read` function where the events are being processed. Here's how you can adjust the code to exclude these events: ```ts function read() { let hasError = false; reader?.read().then((result: any) => { if (result.done) { onCompleted && onCompleted(); return; } buffer += decoder.decode(result.value, { stream: true }); const lines = buffer.split('\n'); try { lines.forEach((message) => { if (message.startsWith('data: ')) { try { bufferObj = JSON.parse(message.substring(6)) as Record<string, any>; } catch (e) { onData('', isFirstMessage, { conversationId: bufferObj?.conversation_id, messageId: bufferObj?.message_id, }); return; } if (bufferObj.status === 400 || !bufferObj.event) { onData('', false, { conversationId: undefined, messageId: '', errorMessage: bufferObj?.message, errorCode: bufferObj?.code, }); hasError = true; onCompleted?.(true, bufferObj?.message); return; } // Exclude specific event types if (bufferObj.event === 'workflow_started' || bufferObj.event === 'node_started') { return; // Skip processing these events } if (bufferObj.event === 'message' || bufferObj.event === 'agent_message') { onData(unicodeToChar(bufferObj.answer), isFirstMessage, { conversationId: bufferObj.conversation_id, taskId: bufferObj.task_id, messageId: bufferObj.id, }); isFirstMessage = false; } else if (bufferObj.event === 'agent_thought') { onThought?.(bufferObj as ThoughtItem); } // ... other event handlers ... } }); } catch (e) { console.error(e); } }); } ``` This modification will prevent the log output from being generated for 'workflow_started' and 'node_started' events by simply returning early in those cases <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/service/base.ts)</sup>. Adjust the filtering logic based on the actual structure of your data to ensure only the desired content is included in the output. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/799bee62-a90d-482a-a731-7602b852cea2?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/799bee62-a90d-482a-a731-7602b852cea2?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/799bee62-a90d-482a-a731-7602b852cea2?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/799bee62-a90d-482a-a731-7602b852cea2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/799bee62-a90d-482a-a731-7602b852cea2?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/799bee62-a90d-482a-a731-7602b852cea2?feedback_type=other)</sup>
Author
Owner

@Wjc0323 commented on GitHub (Jan 20, 2025):

@dosu

I modified it according to your method, but the content was not removed.

This is the command I post the request.
curl -X POST 'http://localhost/v1/workflows/run' \
--header 'Authorization: Bearer xxxx'
--header 'Content-Type: application/json'
--data-raw '{
"inputs": {"question":"帮我写一份50字的道歉信?"},
"response_mode": "streaming",
"user": "abc-123"
}'

These parts still exist.

Image
@Wjc0323 commented on GitHub (Jan 20, 2025): @dosu I modified it according to your method, but the content was not removed. This is the command I post the request. curl -X POST 'http://localhost/v1/workflows/run' \ --header 'Authorization: Bearer xxxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {"question":"帮我写一份50字的道歉信?"}, "response_mode": "streaming", "user": "abc-123" }' These parts still exist. <img width="2240" alt="Image" src="https://github.com/user-attachments/assets/ef62ea1c-fe18-4010-abfc-a2c5bd91c372" />
Author
Owner

@dosubot[bot] commented on GitHub (Jan 20, 2025):

To ensure that only the LLM data is included in the streaming output, you need to filter the events in the generator to yield only RunStreamChunkEvent instances. Here's how you can adjust the code:

for event in generator:
    if isinstance(event, RunStreamChunkEvent):
        yield event

This code snippet ensures that only RunStreamChunkEvent events, which contain the LLM data, are yielded in the streaming output. Other events, such as ModelInvokeCompletedEvent or RunCompletedEvent, are not included in the output [1].

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 20, 2025): <!-- Answer --> To ensure that only the LLM data is included in the streaming output, you need to filter the events in the generator to yield only `RunStreamChunkEvent` instances. Here's how you can adjust the code: ```python for event in generator: if isinstance(event, RunStreamChunkEvent): yield event ``` This code snippet ensures that only `RunStreamChunkEvent` events, which contain the LLM data, are yielded in the streaming output. Other events, such as `ModelInvokeCompletedEvent` or `RunCompletedEvent`, are not included in the output <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/llm/node.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/9b98051c-80bb-49bc-8a03-0716dff3c259?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/9b98051c-80bb-49bc-8a03-0716dff3c259?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/9b98051c-80bb-49bc-8a03-0716dff3c259?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/9b98051c-80bb-49bc-8a03-0716dff3c259?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9b98051c-80bb-49bc-8a03-0716dff3c259?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/9b98051c-80bb-49bc-8a03-0716dff3c259?feedback_type=other)</sup>
Author
Owner

@Wjc0323 commented on GitHub (Jan 20, 2025):

@dosu

The changes you just mentioned in base.ts don't seem to work. Why is that?

@Wjc0323 commented on GitHub (Jan 20, 2025): @dosu The changes you just mentioned in base.ts don't seem to work. Why is that?
Author
Owner

@dosubot[bot] commented on GitHub (Jan 20, 2025):

If the changes in base.ts are not working as expected, there could be several reasons for this. Here are a few possibilities to consider:

  1. Incorrect File or Function: Ensure that you are modifying the correct file and function. The read function in base.ts is responsible for processing the streaming response, so make sure your changes are applied there.

  2. Event Filtering Logic: Double-check the filtering logic to ensure it correctly identifies and skips the events you want to exclude. Make sure the conditions for skipping events like workflow_started and node_started are correctly implemented.

  3. Caching or Deployment Issues: If the application is running in a development or production environment, there might be caching issues or the changes might not have been deployed correctly. Ensure that the latest version of the code is running.

  4. Unexpected Data Structure: The structure of the incoming data might not match your expectations. Add logging or debugging statements to verify the structure of the data being processed.

  5. Middleware or Additional Processing: There might be other parts of the codebase that process the streaming response after the read function. Check if there are any middleware or additional processing layers that could override your changes.

By addressing these areas, you should be able to diagnose why the changes are not taking effect and adjust the code accordingly.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 20, 2025): <!-- Answer --> If the changes in `base.ts` are not working as expected, there could be several reasons for this. Here are a few possibilities to consider: 1. **Incorrect File or Function**: Ensure that you are modifying the correct file and function. The `read` function in `base.ts` is responsible for processing the streaming response, so make sure your changes are applied there. 2. **Event Filtering Logic**: Double-check the filtering logic to ensure it correctly identifies and skips the events you want to exclude. Make sure the conditions for skipping events like `workflow_started` and `node_started` are correctly implemented. 3. **Caching or Deployment Issues**: If the application is running in a development or production environment, there might be caching issues or the changes might not have been deployed correctly. Ensure that the latest version of the code is running. 4. **Unexpected Data Structure**: The structure of the incoming data might not match your expectations. Add logging or debugging statements to verify the structure of the data being processed. 5. **Middleware or Additional Processing**: There might be other parts of the codebase that process the streaming response after the `read` function. Check if there are any middleware or additional processing layers that could override your changes. By addressing these areas, you should be able to diagnose why the changes are not taking effect and adjust the code accordingly. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/08273b20-8f58-46f2-8d7b-c57db93f6bc8?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/08273b20-8f58-46f2-8d7b-c57db93f6bc8?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/08273b20-8f58-46f2-8d7b-c57db93f6bc8?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/08273b20-8f58-46f2-8d7b-c57db93f6bc8?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/08273b20-8f58-46f2-8d7b-c57db93f6bc8?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/08273b20-8f58-46f2-8d7b-c57db93f6bc8?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Jan 20, 2025):

For questions please use discussion instead.

@crazywoola commented on GitHub (Jan 20, 2025): For questions please use discussion instead.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7770