langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
45.3k stars 6.36k forks source link

Missing line break for multiple workflow end results #6264

Closed harrywang closed 2 months ago

harrywang commented 2 months ago

Self Checks

Dify version

0.6.13

Cloud or Self Hosted

Cloud

Steps to reproduce

I have three results in the End node, each is a text output. When running the test AND the published workflow, there is a missing line break between the three text outputs, making it hard to tell one output from another:

Screenshot 2024-07-14 at 7 34 21 AM Screenshot 2024-07-14 at 7 35 40 AM Screenshot 2024-07-14 at 7 30 14 AM Screenshot 2024-07-14 at 7 30 22 AM

✔️ Expected Behavior

there should be a line break between different outputs.

❌ Actual Behavior

missing line break.

dosubot[bot] commented 2 months ago

To ensure that there is a line break between multiple workflow end results in Dify version 0.6.13 on the cloud platform, you can configure the output_format to include line breaks. Here is an example configuration:

{
  "dify_api_base": "https://api.dify.ai/v1",
  "dify_api_key": "app-xxx",
  "dify_app_type": "workflow",
  "channel_type": "wx",
  "model": "dify",
  "single_chat_prefix": [""],
  "single_chat_reply_prefix": "",
  "group_chat_prefix": ["@bot"],
  "group_name_white_list": ["ALL_GROUP"],
  "output_format": "text\n\n"  // Ensure line breaks between results
}

In this configuration, the output_format key is set to include \n\n, which ensures that there is a line break between multiple workflow end results [1].

To continue talking to Dosu, mention @dosu.

crazywoola commented 2 months ago

Thanks for this suggestion, however you can use jinja template to fulfill this need. In this case , you could achieve more complex layout design.

harrywang commented 2 months ago

Thanks for this suggestion, however you can use jinja template to fulfill this need. In this case , you could achieve more complex layout design.

Thanks - any example on how to do this using jinja?

harrywang commented 2 months ago
Screenshot 2024-07-15 at 7 24 04 AM

@crazywoola I used the jinjia template to format the results - it works but the result only shows once the workflow completes. The LLM nodes won't stream results while running. A line break is still needed for streaming results I guess.