Follow-up (suggested questions) does not refer to the most recent message #5937

Closed
opened 2026-02-21 18:13:19 -05:00 by yindo · 10 comments
Owner

Originally created by @fujita-h on GitHub (Oct 7, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • 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.

Dify version

0.9.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a simple LLM chatbot with Chatflow
  2. Enable follow-ups
  3. Publish the app
  4. Chat and see the suggested questions

✔️ Expected Behavior

Suggested questions should be reference including the content of the last message.

Actual Behavior

Suggested questions do not reference the content of the most recent message, but are based only on previous information.

Originally created by @fujita-h on GitHub (Oct 7, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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. ### Dify version 0.9.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Create a simple LLM chatbot with Chatflow 2. Enable follow-ups 3. Publish the app 4. Chat and see the suggested questions ### ✔️ Expected Behavior Suggested questions should be reference including the content of the last message. ### ❌ Actual Behavior Suggested questions do not reference the content of the most recent message, but are based only on previous information.
yindo added the 🐞 bug label 2026-02-21 18:13:19 -05:00
yindo closed this issue 2026-02-21 18:13:19 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 7, 2024):

@fujita-h Hello there! I'm here to assist you with any bugs, questions, or contribution opportunities you may have. Let's work together to resolve your issue.

I found a similar unsolved discussion and a closed issue related to your problem:

  1. Why the suggested-questions always return empty? - This discussion is still open and was last updated on June 18, 2024.
  2. Suggestions next step is empty - This issue is closed and was last updated on May 11, 2024. The solution involved checking the configuration settings.

To address the issue where follow-up suggestions do not reference the most recent message, you might want to ensure that:

  • The "Next Question Suggestion" feature is enabled.
  • The AI model supports this feature.
  • The AI has access to a comprehensive knowledge base.
  • All dependencies and external services are correctly configured and operational.

Additionally, the TokenBufferMemory class is responsible for retrieving conversation history, which is used to generate follow-up suggestions. It ensures that the conversation's memory is correctly processed to include recent messages [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 7, 2024): <!-- Greeting --> @fujita-h Hello there! I'm here to assist you with any bugs, questions, or contribution opportunities you may have. Let's work together to resolve your issue. <!-- Answer --> I found a similar unsolved discussion and a closed issue related to your problem: 1. [Why the suggested-questions always return empty?](https://github.com/langgenius/dify/discussions/4215) - This discussion is still open and was last updated on June 18, 2024. 2. [Suggestions next step is empty](https://github.com/langgenius/dify/issues/4229) - This issue is closed and was last updated on May 11, 2024. The solution involved checking the configuration settings. To address the issue where follow-up suggestions do not reference the most recent message, you might want to ensure that: - The "Next Question Suggestion" feature is enabled. - The AI model supports this feature. - The AI has access to a comprehensive knowledge base. - All dependencies and external services are correctly configured and operational. Additionally, the `TokenBufferMemory` class is responsible for retrieving conversation history, which is used to generate follow-up suggestions. It ensures that the conversation's memory is correctly processed to include recent messages <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/memory/token_buffer_memory.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/services/message_service.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@fujita-h commented on GitHub (Oct 7, 2024):

Suggested questions are generated by the following methods:
https://github.com/langgenius/dify/blob/2571b0c4e36b7ce7a3ada94aac751ad20f319e1f/api/services/message_service.py#L205

When we look at the processing of this function, we see that in the process of referencing messages, it skips the most recent message.
https://github.com/langgenius/dify/blob/2571b0c4e36b7ce7a3ada94aac751ad20f319e1f/api/core/memory/token_buffer_memory.py#L61

This was added in #7661

@fujita-h commented on GitHub (Oct 7, 2024): Suggested questions are generated by the following methods: https://github.com/langgenius/dify/blob/2571b0c4e36b7ce7a3ada94aac751ad20f319e1f/api/services/message_service.py#L205 When we look at the processing of this function, we see that in the process of referencing messages, it skips the most recent message. https://github.com/langgenius/dify/blob/2571b0c4e36b7ce7a3ada94aac751ad20f319e1f/api/core/memory/token_buffer_memory.py#L61 This was added in #7661
Author
Owner

@Kevin9703 commented on GitHub (Oct 9, 2024):

I encountered the same issue, and it also seems to affect the conversation's historical context. @xuzuodong

@Kevin9703 commented on GitHub (Oct 9, 2024): I encountered the same issue, and it also seems to affect the conversation's historical context. @xuzuodong
Author
Owner

@xuzuodong commented on GitHub (Oct 9, 2024):

Sorry for causing this bug, I will try to fix it.

@xuzuodong commented on GitHub (Oct 9, 2024): Sorry for causing this bug, I will try to fix it.
Author
Owner

@xuzuodong commented on GitHub (Oct 9, 2024):

I encountered the same issue, and it also seems to affect the conversation's historical context.

Are you using API in self-hosted environment?

@xuzuodong commented on GitHub (Oct 9, 2024): > I encountered the same issue, and it also seems to affect the conversation's historical context. Are you using API in self-hosted environment?
Author
Owner

@Kevin9703 commented on GitHub (Oct 9, 2024):

I encountered the same issue, and it also seems to affect the conversation's historical context.

Are you using API in self-hosted environment?

Yeah, using API to call the app

@Kevin9703 commented on GitHub (Oct 9, 2024): > > I encountered the same issue, and it also seems to affect the conversation's historical context. > > Are you using API in self-hosted environment? Yeah, using API to call the app
Author
Owner

@xuzuodong commented on GitHub (Oct 9, 2024):

I encountered the same issue, and it also seems to affect the conversation's historical context.

Are you using API in self-hosted environment?

Yeah, using API to call the app

The conversation's historical context bug has been fixed by https://github.com/langgenius/dify/pull/8965, but they haven't released a new version yet

@xuzuodong commented on GitHub (Oct 9, 2024): > > > I encountered the same issue, and it also seems to affect the conversation's historical context. > > > > > > Are you using API in self-hosted environment? > > Yeah, using API to call the app The conversation's historical context bug has been fixed by https://github.com/langgenius/dify/pull/8965, but they haven't released a new version yet
Author
Owner

@Kevin9703 commented on GitHub (Oct 9, 2024):

I encountered the same issue, and it also seems to affect the conversation's historical context.

Are you using API in self-hosted environment?

Yeah, using API to call the app

The conversation's historical context bug has been fixed by #8965, but they haven't released a new version yet

Thank you for the update.

@Kevin9703 commented on GitHub (Oct 9, 2024): > > > > I encountered the same issue, and it also seems to affect the conversation's historical context. > > > > > > > > > Are you using API in self-hosted environment? > > > > > > Yeah, using API to call the app > > The conversation's historical context bug has been fixed by #8965, but they haven't released a new version yet Thank you for the update.
Author
Owner

@xuzuodong commented on GitHub (Oct 9, 2024):

If it's convenient for you , can you pull #9122 and test to see if it's fixed? @Kevin9703

@xuzuodong commented on GitHub (Oct 9, 2024): If it's convenient for you , can you pull #9122 and test to see if it's fixed? @Kevin9703
Author
Owner

@Kevin9703 commented on GitHub (Oct 9, 2024):

If it's convenient for you , can you pull #9122 and test to see if it's fixed? @Kevin9703

Looks like it's working now. Thanks for the fix

@Kevin9703 commented on GitHub (Oct 9, 2024): > If it's convenient for you , can you pull #9122 and test to see if it's fixed? @Kevin9703 Looks like it's working now. Thanks for the fix
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5937