Annotation reply is null #4954

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

Originally created by @aerok on GitHub (Aug 8, 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.6.16

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

step 1. Enable the annotated reply
step 2. Reply is empty in frondend if the answer hits the annotated content, and an error occurs in backend

✔️ Expected Behavior

Reply the annotated content

Actual Behavior

[2024-08-07 01:56:33 +0000] [46] [ERROR] Error handling request /api/chat-messages
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.10/site-packages/gunicorn/workers/base_async.py", line 55, in handle
    self.handle_request(listener_name, req, client, addr)
  File "/app/api/.venv/lib/python3.10/site-packages/gunicorn/workers/ggevent.py", line 128, in handle_request
    super().handle_request(listener_name, req, sock, addr)
  File "/app/api/.venv/lib/python3.10/site-packages/gunicorn/workers/base_async.py", line 115, in handle_request
    for item in respiter:
  File "/app/api/.venv/lib/python3.10/site-packages/werkzeug/wsgi.py", line 256, in __next__
    return self._next()
  File "/app/api/.venv/lib/python3.10/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded
    for item in iterable:
  File "/app/api/.venv/lib/python3.10/site-packages/flask/helpers.py", line 113, in generator
    yield from gen
  File "/app/api/libs/helper.py", line 168, in generate
    yield from response
  File "/app/api/core/app/features/rate_limiting/rate_limit.py", line 110, in __next__
    return next(self.generator)
  File "/app/api/core/app/apps/base_app_generate_response_converter.py", line 37, in _generate_simple_response
    for chunk in cls.convert_stream_simple_response(response):
  File "/app/api/core/app/apps/advanced_chat/generate_response_converter.py", line 94, in convert_stream_simple_response
    for chunk in stream_response:
  File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 179, in _to_stream_response
    for stream_response in generator:
  File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 206, in _wrapper_process_stream_response
    for response in self._process_stream_response(publisher=publisher, trace_manager=trace_manager):
  File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 247, in _process_stream_response
    if hasattr(message.event, 'metadata') and message.event.metadata.get('is_answer_previous_node', False) and publisher:
AttributeError: 'NoneType' object has no attribute 'get'
Originally created by @aerok on GitHub (Aug 8, 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.6.16 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce step 1. Enable the annotated reply step 2. Reply is empty in frondend if the answer hits the annotated content, and an error occurs in backend ### ✔️ Expected Behavior Reply the annotated content ### ❌ Actual Behavior ```python [2024-08-07 01:56:33 +0000] [46] [ERROR] Error handling request /api/chat-messages Traceback (most recent call last): File "/app/api/.venv/lib/python3.10/site-packages/gunicorn/workers/base_async.py", line 55, in handle self.handle_request(listener_name, req, client, addr) File "/app/api/.venv/lib/python3.10/site-packages/gunicorn/workers/ggevent.py", line 128, in handle_request super().handle_request(listener_name, req, sock, addr) File "/app/api/.venv/lib/python3.10/site-packages/gunicorn/workers/base_async.py", line 115, in handle_request for item in respiter: File "/app/api/.venv/lib/python3.10/site-packages/werkzeug/wsgi.py", line 256, in __next__ return self._next() File "/app/api/.venv/lib/python3.10/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded for item in iterable: File "/app/api/.venv/lib/python3.10/site-packages/flask/helpers.py", line 113, in generator yield from gen File "/app/api/libs/helper.py", line 168, in generate yield from response File "/app/api/core/app/features/rate_limiting/rate_limit.py", line 110, in __next__ return next(self.generator) File "/app/api/core/app/apps/base_app_generate_response_converter.py", line 37, in _generate_simple_response for chunk in cls.convert_stream_simple_response(response): File "/app/api/core/app/apps/advanced_chat/generate_response_converter.py", line 94, in convert_stream_simple_response for chunk in stream_response: File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 179, in _to_stream_response for stream_response in generator: File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 206, in _wrapper_process_stream_response for response in self._process_stream_response(publisher=publisher, trace_manager=trace_manager): File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 247, in _process_stream_response if hasattr(message.event, 'metadata') and message.event.metadata.get('is_answer_previous_node', False) and publisher: AttributeError: 'NoneType' object has no attribute 'get' ```
yindo added the 🐞 bug label 2026-02-21 18:08:45 -05:00
yindo closed this issue 2026-02-21 18:08:45 -05:00
Author
Owner

@aerok commented on GitHub (Aug 8, 2024):

I check the fix #7051 but not fixed yet

@aerok commented on GitHub (Aug 8, 2024): I check the fix #7051 but not fixed yet
Author
Owner

@dosubot[bot] commented on GitHub (Aug 8, 2024):

Hey @aerok, I'm here to help you out with any bugs or questions while we wait for a human maintainer to address the issue. Let's tackle this together! 🤖

The issue with the annotation reply being null and causing an error in the backend when the annotated content is hit in Dify version 0.6.16 could be due to several reasons:

  1. Score Threshold Not Met: The similarity score of the query might not meet the minimum score threshold set for an annotation to be considered a match.
  2. Embedding Model Issues: There might be an issue with the embedding model used for converting annotated text into vectors.
  3. Annotation Deactivation: The Annotation Reply feature might be deactivated.
  4. Missing or Incorrect Annotations: Annotations might not be properly added or saved, or there might be no annotations matching the query.
  5. Exception Handling: An exception might occur during the query process, such as issues with the database or vector search.
  6. Database Schema Changes: Recent changes in the database schema might not have been applied correctly.

To resolve this, ensure that:

  • The score threshold is appropriately set.
  • The embedding model is correctly configured and functioning.
  • The Annotation Reply feature is activated.
  • Annotations are correctly added and saved.
  • Check the logs for any exceptions that might have occurred during the query process.
  • Verify that the database schema changes have been applied correctly by checking the migration status and ensuring that all new columns and tables are present and correctly configured.

For more details, refer to the following sections in the documentation:

  • Activation: How to enable the Annotation Reply feature.
  • Adding Annotations in Debug Mode: How to add or modify annotations.
  • Adjusting Backend Parameters for Annotations: How to set the score threshold and embedding model.
  • Exception Handling: How to handle and debug exceptions during the query process.
  • Database Migrations: Ensure that the migration script e1901f623fd0_add_annotation_reply.py has been successfully applied [1][2][3][4].

Additionally, the pull request #7051 aimed to fix the annotation reply issue, but it seems the problem persists. You might want to check if the changes introduced in the pull request were correctly applied and if there are any additional steps required to fully resolve the issue.

This is a tough nut to crack, could really use your help on this, @takatost.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 8, 2024): <!-- Greeting --> Hey @aerok, I'm here to help you out with any bugs or questions while we wait for a human maintainer to address the issue. Let's tackle this together! 🤖 <!-- Answer --> The issue with the annotation reply being null and causing an error in the backend when the annotated content is hit in Dify version 0.6.16 could be due to several reasons: 1. **Score Threshold Not Met:** The similarity score of the query might not meet the minimum score threshold set for an annotation to be considered a match. 2. **Embedding Model Issues:** There might be an issue with the embedding model used for converting annotated text into vectors. 3. **Annotation Deactivation:** The Annotation Reply feature might be deactivated. 4. **Missing or Incorrect Annotations:** Annotations might not be properly added or saved, or there might be no annotations matching the query. 5. **Exception Handling:** An exception might occur during the query process, such as issues with the database or vector search. 6. **Database Schema Changes:** Recent changes in the database schema might not have been applied correctly. To resolve this, ensure that: - The score threshold is appropriately set. - The embedding model is correctly configured and functioning. - The Annotation Reply feature is activated. - Annotations are correctly added and saved. - Check the logs for any exceptions that might have occurred during the query process. - Verify that the database schema changes have been applied correctly by checking the migration status and ensuring that all new columns and tables are present and correctly configured. For more details, refer to the following sections in the documentation: - **Activation**: How to enable the Annotation Reply feature. - **Adding Annotations in Debug Mode**: How to add or modify annotations. - **Adjusting Backend Parameters for Annotations**: How to set the score threshold and embedding model. - **Exception Handling**: How to handle and debug exceptions during the query process. - **Database Migrations**: Ensure that the migration script `e1901f623fd0_add_annotation_reply.py` has been successfully applied <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/biao-zhu/annotation-reply.md)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/app/features/annotation_reply/annotation_reply.py)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/guides/biao-zhu/annotation-reply.md)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/e1901f623fd0_add_annotation_reply.py)</sup>. Additionally, the pull request #7051 aimed to fix the annotation reply issue, but it seems the problem persists. You might want to check if the changes introduced in the pull request were correctly applied and if there are any additional steps required to fully resolve the issue. This is a tough nut to crack, could really use your help on this, @takatost. <!-- 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#4954