Follow-up Questions Appear in Chinese Instead of the Query Language #5753

Closed
opened 2026-02-21 18:12:26 -05:00 by yindo · 2 comments
Owner

Originally created by @NourKhdour on GitHub (Sep 23, 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.7.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Enable the follow-up feature.
Submit a query in a language other than Chinese (e.g., English or Arabic).
Observe that the follow-up question is displayed in Chinese, not in the query language.

✔️ Expected Behavior

The follow-up question should be displayed in the same language as the original query.

Actual Behavior

The follow-up question is displayed in Chinese, regardless of the original query language.

Originally created by @NourKhdour on GitHub (Sep 23, 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.7.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Enable the follow-up feature. Submit a query in a language other than Chinese (e.g., English or Arabic). Observe that the follow-up question is displayed in Chinese, not in the query language. ### ✔️ Expected Behavior The follow-up question should be displayed in the same language as the original query. ### ❌ Actual Behavior The follow-up question is displayed in Chinese, regardless of the original query language.
yindo added the 🐞 bug label 2026-02-21 18:12:26 -05:00
yindo closed this issue 2026-02-21 18:12:27 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 23, 2024):

@NourKhdour Hello there! I'm here to assist you with bug solving, answering questions, and becoming a contributor. Let's tackle this issue together while we wait for a human maintainer.

I found a similar open issue: Suggestions in Chinese, although the message is in English, which was last updated on September 21, 2024, and has no comments or solution yet [1].

Additionally, there was a closed issue: next suggest question need support chinese, which was resolved by a pull request: fix: next suggest question logic problem on July 19, 2024 [2].

The follow-up question generation logic is implemented in the get_suggested_questions_after_answer method of the MessageService class. This method uses the LLMGenerator.generate_suggested_questions_after_answer function to generate the follow-up questions [3][4].

The system ensures that the language of the follow-up questions matches the language of the assistant's latest response through the SUGGESTED_QUESTIONS_AFTER_ANSWER_INSTRUCTION_PROMPT:

SUGGESTED_QUESTIONS_AFTER_ANSWER_INSTRUCTION_PROMPT = (
    "Please help me predict the three most likely questions that human would ask, "
    "and keeping each question under 20 characters.\n"
    "MAKE SURE your output is the SAME language as the Assistant's latest response"
    "(if the main response is written in Chinese, then the language of your output must be using Chinese.)!\n"
    "The output must be an array in JSON format following the specified schema:\n"
    '["question1","question2","question3"]\n'
)

This prompt ensures that the follow-up questions are generated in the same language as the original query [5].

It seems like there might be an issue with the language detection mechanism or the prompt instructions not being followed correctly. You might want to check the implementation of the LLMGenerator.generate_suggested_questions_after_answer function and ensure that the language detection and prompt formatting are working as expected.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 23, 2024): <!-- Greeting --> @NourKhdour Hello there! I'm here to assist you with bug solving, answering questions, and becoming a contributor. Let's tackle this issue together while we wait for a human maintainer. <!-- Answer --> I found a similar open issue: [Suggestions in Chinese, although the message is in English](https://github.com/langgenius/dify/issues/8609), which was last updated on September 21, 2024, and has no comments or solution yet <sup>[[1]](https://github.com/langgenius/dify/issues/8609)</sup>. Additionally, there was a closed issue: [next suggest question need support chinese](https://github.com/langgenius/dify/issues/6231), which was resolved by a pull request: [fix: next suggest question logic problem](https://github.com/langgenius/dify/pull/6451) on July 19, 2024 <sup>[[2]](https://github.com/langgenius/dify/issues/6231)</sup>. The follow-up question generation logic is implemented in the `get_suggested_questions_after_answer` method of the `MessageService` class. This method uses the `LLMGenerator.generate_suggested_questions_after_answer` function to generate the follow-up questions <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/services/message_service.py)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/core/llm_generator/llm_generator.py)</sup>. The system ensures that the language of the follow-up questions matches the language of the assistant's latest response through the `SUGGESTED_QUESTIONS_AFTER_ANSWER_INSTRUCTION_PROMPT`: ```python SUGGESTED_QUESTIONS_AFTER_ANSWER_INSTRUCTION_PROMPT = ( "Please help me predict the three most likely questions that human would ask, " "and keeping each question under 20 characters.\n" "MAKE SURE your output is the SAME language as the Assistant's latest response" "(if the main response is written in Chinese, then the language of your output must be using Chinese.)!\n" "The output must be an array in JSON format following the specified schema:\n" '["question1","question2","question3"]\n' ) ``` This prompt ensures that the follow-up questions are generated in the same language as the original query <sup>[[5]](https://github.com/langgenius/dify/blob/main/api/core/llm_generator/prompts.py)</sup>. It seems like there might be an issue with the language detection mechanism or the prompt instructions not being followed correctly. You might want to check the implementation of the `LLMGenerator.generate_suggested_questions_after_answer` function and ensure that the language detection and prompt formatting are working as expected. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Sep 23, 2024):

Duplicated https://github.com/langgenius/dify/issues/8609

@crazywoola commented on GitHub (Sep 23, 2024): Duplicated https://github.com/langgenius/dify/issues/8609
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5753