[Feature Request] Add a ChatFLow Block that support handling historical messages. #4683

Closed
opened 2026-02-21 18:07:33 -05:00 by yindo · 1 comment
Owner

Originally created by @jiacheo on GitHub (Jul 19, 2024).

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).
  • 请务必使用英文提交 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.

I want to calculate the total number of tokens in the historical messages in advance. If the number exceeds a certain value, I will use memory compression flow; if it doesn’t, I will not. The prerequisite is that I need a non-inference block to fetch the historical messages and calculate their token count (need your function support like token_count()), but currently, there is no such block available. I hope one can be added.

Additionally, the LLM block should not be forced to reference the {sys.query} parameter. For instance, this block may only use a constant summary prompt and not need any user input at all.

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @jiacheo on GitHub (Jul 19, 2024). ### 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] 请务必使用英文提交 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. I want to calculate the total number of tokens in the historical messages in advance. If the number exceeds a certain value, I will use memory compression flow; if it doesn’t, I will not. The prerequisite is that I need a non-inference block to fetch the historical messages and calculate their token count (need your function support like `token_count()`), but currently, there is no such block available. I hope one can be added. Additionally, the LLM block should not be forced to reference the {sys.query} parameter. For instance, this block may only use a constant summary prompt and not need any user input at all. ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 18:07:33 -05:00
yindo closed this issue 2026-02-21 18:07:33 -05:00
Author
Owner

@alterxyz commented on GitHub (Aug 16, 2024):

  1. Token counting:

    • Currently, there's no built-in block for in-process token counting as factor for other node. You can make it by your own , and we will add this feature in future.
  2. LLM block flexibility:

    • The {sys.query} parameter is typically modifiable.
    • For constant prompts without user input, you can set a fixed value.
  3. Managing historical messages:

  4. Contributing:

For further assistance, refer to our documentation: https://docs.dify.ai/

@alterxyz commented on GitHub (Aug 16, 2024): 1. Token counting: - Currently, there's no built-in block for in-process token counting as factor for other node. You can make it by your own , and we will add this feature in future. 2. LLM block flexibility: - The {sys.query} parameter is typically modifiable. - For constant prompts without user input, you can set a fixed value. 3. Managing historical messages: - Version 0.7.0 introduced Conversation Variables: https://docs.dify.ai/guides/workflow/key_concepts#conversation-variables - This feature can help manage historical message status. 4. Contributing: - We welcome contributions! Please check our contribution guidelines: https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md For further assistance, refer to our documentation: https://docs.dify.ai/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4683