glm-4-chat 添加后有问题 #4255

Closed
opened 2026-02-21 18:05:25 -05:00 by yindo · 3 comments
Owner

Originally created by @zps-509 on GitHub (Jun 25, 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).
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.11

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

✔️ Expected Behavior

img_v3_02bi_ca3a774d-e0e1-4f8a-bd02-94192893c68g

Actual Behavior

image

Originally created by @zps-509 on GitHub (Jun 25, 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] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.11 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![image](https://github.com/langgenius/dify/assets/109783453/55b22151-05d9-45b9-95ca-16477d9dd78e) ### ✔️ Expected Behavior ![img_v3_02bi_ca3a774d-e0e1-4f8a-bd02-94192893c68g](https://github.com/langgenius/dify/assets/109783453/a9dac1ec-b5ea-4cbe-bd4b-2bb4f4874ab8) ### ❌ Actual Behavior ![image](https://github.com/langgenius/dify/assets/109783453/38602895-4a85-4460-9038-1af1d60ba8ea)
yindo closed this issue 2026-02-21 18:05:25 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 25, 2024):

You are receiving an empty response from the glm-4-chat model because the model does not support system messages, and user messages must be in sequence. Ensure that your prompt messages are correctly formatted and that the content is properly handled.

Here are some key points to check:

  1. System Message Handling: If there is a system message, it should have content. If not, it should be removed.
  2. User Messages: There must be at least one user message after any system message. Ensure that user messages are properly sequenced and concatenated if necessary.

Here is a relevant part of the code that handles this:

if len(prompt_messages) == 0:
    raise BadRequestError('At least one message is required')

if prompt_messages[0].role == MinimaxMessage.Role.SYSTEM.value:
    if prompt_messages[0].content:
        bot_setting['content'] = prompt_messages[0].content
    prompt_messages = prompt_messages[1:]

if len(prompt_messages) == 0:
    raise BadRequestError('At least one user message is required')

messages = [message.to_dict() for message in prompt_messages]

Additionally, ensure that you are using the latest version of both the frontend and backend of your Dify instance. If you are using Azure OpenAI, verify that the model is successfully deployed and that the model version is 0613 or later, as earlier versions do not support the function call capability required by the chat model [1][2][3][4][5].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jun 25, 2024): <!-- Answer --> You are receiving an empty response from the `glm-4-chat` model because the model does not support system messages, and user messages must be in sequence. Ensure that your prompt messages are correctly formatted and that the content is properly handled. Here are some key points to check: 1. **System Message Handling**: If there is a system message, it should have content. If not, it should be removed. 2. **User Messages**: There must be at least one user message after any system message. Ensure that user messages are properly sequenced and concatenated if necessary. Here is a relevant part of the code that handles this: ```python if len(prompt_messages) == 0: raise BadRequestError('At least one message is required') if prompt_messages[0].role == MinimaxMessage.Role.SYSTEM.value: if prompt_messages[0].content: bot_setting['content'] = prompt_messages[0].content prompt_messages = prompt_messages[1:] if len(prompt_messages) == 0: raise BadRequestError('At least one user message is required') messages = [message.to_dict() for message in prompt_messages] ``` Additionally, ensure that you are using the latest version of both the frontend and backend of your Dify instance. If you are using Azure OpenAI, verify that the model is successfully deployed and that the model version is 0613 or later, as earlier versions do not support the function call capability required by the chat model <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/zhipuai/llm/llm.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/minimax/llm/chat_completion.py)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/learn-more/faq/llms-use-faq.md)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/minimax/llm/chat_completion_pro.py)</sup><sup>[[5]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/chatglm/llm/llm.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Jun 25, 2024):

Close due to #1542

@crazywoola commented on GitHub (Jun 25, 2024): Close due to #1542
Author
Owner

@zps-509 commented on GitHub (Jun 25, 2024):

image
hai还是不行呀,我直接掉 glm-4是可以的,到DIFY里面就是使用不了

@zps-509 commented on GitHub (Jun 25, 2024): ![image](https://github.com/langgenius/dify/assets/109783453/10aaa1ec-f04c-428f-a4a2-da8035b433fd) hai还是不行呀,我直接掉 glm-4是可以的,到DIFY里面就是使用不了
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4255