Unable to Add Annotations for Conversations with More Than 4 Replies in Chatbot Chatflow BETA Mode #4787

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

Originally created by @QuintinShaw on GitHub (Jul 25, 2024).

Originally assigned to: @takatost, @laipz8200, @JzoNgKVO on GitHub.

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).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.15

Cloud or Self Hosted

Cloud

Steps to reproduce

Cloud or Self Hosted: Both (Cloud and Self Hosted Docker deployment)

Steps to reproduce:

Create a conversation with more than 4 replies in Chatbot Chatflow BETA mode.
Go to Logs & Ann. > Logs > Conversation for that specific chat.
Try to add an annotation.
Observe that the "Add annotation" functionality doesn't work.
Check the network requests in the browser's developer tools to confirm the missing Conversation ID in the URL.

Comment:
In the Chatbot Chatflow BETA mode, under Logs & Ann. > Logs > Conversation, it's impossible to add annotations once the conversation exceeds 4 replies (4 user messages and 4 system responses, 8 messages in total).

Upon investigating with the browser's developer tools (F12), I noticed that:

For conversations with 3 or fewer replies, the "Add annotation" button correctly sends a request to:
https://cloud.dify.ai/console/api/apps/d4d02a0f-a984-4913-9b99-923eb61258e6/annotations
Xnip Helper 2024-07-26 04 52 15

For conversations with more than 4 replies, the request URL changes to:
https://cloud.dify.ai/console/api/apps//annotations
image
The Conversation ID is missing from the URL in the latter case, which appears to be causing the issue.

✔️ Expected Behavior

The ability to add annotations should work for all conversations, regardless of the number of replies.

Actual Behavior

Unable to add annotations for conversations with more than 4 replies due to a missing Conversation ID in the request URL.

Originally created by @QuintinShaw on GitHub (Jul 25, 2024). Originally assigned to: @takatost, @laipz8200, @JzoNgKVO on GitHub. ### 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] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.15 ### Cloud or Self Hosted Cloud ### Steps to reproduce Cloud or Self Hosted: Both (Cloud and Self Hosted Docker deployment) Steps to reproduce: Create a conversation with more than 4 replies in Chatbot Chatflow BETA mode. Go to Logs & Ann. > Logs > Conversation for that specific chat. Try to add an annotation. Observe that the "Add annotation" functionality doesn't work. Check the network requests in the browser's developer tools to confirm the missing Conversation ID in the URL. Comment: In the Chatbot Chatflow BETA mode, under Logs & Ann. > Logs > Conversation, it's impossible to add annotations once the conversation exceeds 4 replies (4 user messages and 4 system responses, 8 messages in total). Upon investigating with the browser's developer tools (F12), I noticed that: For conversations with 3 or fewer replies, the "Add annotation" button correctly sends a request to: https://cloud.dify.ai/console/api/apps/d4d02a0f-a984-4913-9b99-923eb61258e6/annotations <img width="437" alt="Xnip Helper 2024-07-26 04 52 15" src="https://github.com/user-attachments/assets/6ca86fa5-5b58-42cd-8a94-3deafd330a30"> For conversations with more than 4 replies, the request URL changes to: https://cloud.dify.ai/console/api/apps//annotations <img width="433" alt="image" src="https://github.com/user-attachments/assets/ddcad527-0ef6-44ac-8d4d-57f5ca60726c"> The Conversation ID is missing from the URL in the latter case, which appears to be causing the issue. ### ✔️ Expected Behavior The ability to add annotations should work for all conversations, regardless of the number of replies. ### ❌ Actual Behavior Unable to add annotations for conversations with more than 4 replies due to a missing Conversation ID in the request URL.
yindo added the 🐞 bug label 2026-02-21 18:08:01 -05:00
yindo closed this issue 2026-02-21 18:08:01 -05:00
Author
Owner

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

Hello @QuintinShaw! I'm here to assist you with bug fixes, answer questions, and guide you on becoming a contributor. If you need any help, feel free to reach out!

The issue you're experiencing with adding annotations for conversations with more than 4 replies in Chatbot Chatflow BETA mode on Dify version 0.6.15 is likely due to the annotation_reply feature being disabled in the configuration. This feature needs to be enabled to allow annotations for conversations with more than 4 replies.

Here's the relevant configuration setting:

"annotation_reply": {
    "enabled": false
}

To resolve this issue, you need to enable the annotation_reply feature in the configuration [1].

Additionally, the missing Conversation ID in the request URL for conversations with more than 4 replies could be due to how the Conversation ID is being managed. The Conversation ID should be retrieved and passed correctly in the URL for the annotation request. Ensure that the conversation_id is being correctly maintained and passed in the request for continuing an existing dialogue [2][3].

If the issue persists, it might be related to recent changes in the repository, such as the migration script e1901f623fd0_add_annotation_reply.py, which includes modifications to the message_annotations table. These changes could potentially affect the functionality related to annotations in conversations [4].

Check these configurations and recent changes to ensure that the annotation_reply feature is enabled and the Conversation ID is correctly managed.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 25, 2024): <!-- Greeting --> Hello @QuintinShaw! I'm here to assist you with bug fixes, answer questions, and guide you on becoming a contributor. If you need any help, feel free to reach out! <!-- Answer --> The issue you're experiencing with adding annotations for conversations with more than 4 replies in Chatbot Chatflow BETA mode on Dify version 0.6.15 is likely due to the `annotation_reply` feature being disabled in the configuration. This feature needs to be enabled to allow annotations for conversations with more than 4 replies. Here's the relevant configuration setting: ```json "annotation_reply": { "enabled": false } ``` To resolve this issue, you need to enable the `annotation_reply` feature in the configuration <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/constants/recommended_apps.json)</sup>. Additionally, the missing Conversation ID in the request URL for conversations with more than 4 replies could be due to how the Conversation ID is being managed. The Conversation ID should be retrieved and passed correctly in the URL for the annotation request. Ensure that the `conversation_id` is being correctly maintained and passed in the request for continuing an existing dialogue <sup>[[2]](https://github.com/langgenius/dify/blob/main/web/i18n/en-US/app-api.ts)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-publishing/developing-with-apis.md)</sup>. If the issue persists, it might be related to recent changes in the repository, such as the migration script `e1901f623fd0_add_annotation_reply.py`, which includes modifications to the `message_annotations` table. These changes could potentially affect the functionality related to annotations in conversations <sup>[[4]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/e1901f623fd0_add_annotation_reply.py)</sup>. Check these configurations and recent changes to ensure that the `annotation_reply` feature is enabled and the Conversation ID is correctly managed. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@QuintinShaw commented on GitHub (Jul 25, 2024):

Thank you for your response. However, I'd like to clarify that the annotation_reply feature is already enabled in my configuration. This issue occurs on both cloud and self-hosted versions, using Chrome version 126.0.6478.183 and Safari 17.1.2 (19616.2.9.11.12).

The core problem remains: the Conversation ID is missing from the URL when trying to add annotations to conversations with more than 4 replies.

Is there any other information I can provide to help diagnose this issue? I'm happy to assist with further testing or provide access to a test environment if needed.

@QuintinShaw commented on GitHub (Jul 25, 2024): Thank you for your response. However, I'd like to clarify that the annotation_reply feature is already enabled in my configuration. This issue occurs on both cloud and self-hosted versions, using Chrome version 126.0.6478.183 and Safari 17.1.2 (19616.2.9.11.12). The core problem remains: the Conversation ID is missing from the URL when trying to add annotations to conversations with more than 4 replies. Is there any other information I can provide to help diagnose this issue? I'm happy to assist with further testing or provide access to a test environment if needed.
Author
Owner

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

To resolve the issue of the missing conversation_id in the request URL for conversations with more than 4 replies, ensure that the conversation_id is correctly passed in your API request. Here is an example of how to include the conversation_id in your request:

Example API Call for Chat Messages

Using cURL

curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "inputs": {},
    "query": "eh",
    "response_mode": "streaming",
    "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276",
    "user": "abc-123"
}'

Using Python

import requests
import json

url = 'https://api.dify.ai/v1/chat-messages'
headers = {
    'Authorization': 'Bearer ENTER-YOUR-SECRET-KEY',
    'Content-Type': 'application/json',
}
data = {
    "inputs": {},
    "query": "eh",
    "response_mode": "streaming",
    "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276",
    "user": "abc-123"
}

response = requests.post(url, headers=headers, data=json.dumps(data))

print(response.json())

Ensure that the conversation_id is correctly included in the request payload. According to the Dify documentation, the conversation_id is an optional field but must be included if you want to continue a conversation based on previous chat history [1][2].

Additionally, recent changes in the Dify codebase might have affected the handling of conversation_id in the "Add annotation" functionality. Specifically, in the migration script e1901f623fd0_add_annotation_reply.py, the conversation_id column in the message_annotations table was altered to be nullable [3].

If the issue persists, you may want to check the specific part of the Dify codebase responsible for constructing the request URL for adding annotations. The ChatClient class within the create_chat_message method constructs the request URL and includes the conversation_id in the JSON payload if it is provided [4][5].

Here is the relevant code snippet:

class ChatClient(DifyClient):
    def create_chat_message(self, inputs, query, user, response_mode="blocking", conversation_id=None, files=None):
        data = {
            "inputs": inputs,
            "query": query,
            "user": user,
            "response_mode": response_mode,
            "files": files
        }
        if conversation_id:
            data["conversation_id"] = conversation_id

        return self._send_request("POST", "/chat-messages", data,
                                  stream=True if response_mode == "streaming" else False)

This method ensures that the conversation_id is included as a field in the JSON payload if it is not None. The request is then sent to the /chat-messages endpoint.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 25, 2024): <!-- Answer --> To resolve the issue of the missing `conversation_id` in the request URL for conversations with more than 4 replies, ensure that the `conversation_id` is correctly passed in your API request. Here is an example of how to include the `conversation_id` in your request: ### Example API Call for Chat Messages #### Using cURL ```sh curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "eh", "response_mode": "streaming", "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276", "user": "abc-123" }' ``` #### Using Python ```python import requests import json url = 'https://api.dify.ai/v1/chat-messages' headers = { 'Authorization': 'Bearer ENTER-YOUR-SECRET-KEY', 'Content-Type': 'application/json', } data = { "inputs": {}, "query": "eh", "response_mode": "streaming", "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276", "user": "abc-123" } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.json()) ``` Ensure that the `conversation_id` is correctly included in the request payload. According to the Dify documentation, the `conversation_id` is an optional field but must be included if you want to continue a conversation based on previous chat history <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-publishing/developing-with-apis.md)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/web/app/components/develop/template/template_advanced_chat.zh.mdx)</sup>. Additionally, recent changes in the Dify codebase might have affected the handling of `conversation_id` in the "Add annotation" functionality. Specifically, in the migration script `e1901f623fd0_add_annotation_reply.py`, the `conversation_id` column in the `message_annotations` table was altered to be nullable <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/e1901f623fd0_add_annotation_reply.py)</sup>. If the issue persists, you may want to check the specific part of the Dify codebase responsible for constructing the request URL for adding annotations. The `ChatClient` class within the `create_chat_message` method constructs the request URL and includes the `conversation_id` in the JSON payload if it is provided <sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/learn-more/use-cases/build-an-notion-ai-assistant.md)</sup><sup>[[5]](https://github.com/langgenius/dify/blob/main/sdks/python-client/dify_client/client.py)</sup>. Here is the relevant code snippet: ```python class ChatClient(DifyClient): def create_chat_message(self, inputs, query, user, response_mode="blocking", conversation_id=None, files=None): data = { "inputs": inputs, "query": query, "user": user, "response_mode": response_mode, "files": files } if conversation_id: data["conversation_id"] = conversation_id return self._send_request("POST", "/chat-messages", data, stream=True if response_mode == "streaming" else False) ``` This method ensures that the `conversation_id` is included as a field in the JSON payload if it is not `None`. The request is then sent to the `/chat-messages` endpoint. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4787