When disabling the "Annotation Reply" button, the backend reports an error. #1440

Closed
opened 2026-02-21 17:33:42 -05:00 by yindo · 0 comments
Owner

Originally created by @colvin777 on GitHub (Mar 19, 2024).

Self Checks

  • 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).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.5.9

Cloud or Self Hosted

Cloud, Self Hosted (Source)

Steps to reproduce

If there are no annotations, activating the "Annotation Reply" button does not create a collection in the vector database.
image

If the "Annotation Reply" button is then turned off (without ever having created any annotations), the backend reports an error due to the absence of the corresponding collection name in the vector database.
image

✔️ Expected Behavior

disable_annotation_reply_task.py
to add a check for whether the annotations are empty:
annotations_count = db.session.query(MessageAnnotation).filter(MessageAnnotation.app_id == app_id).count()

if annotations_count > 0:
vector = Vector(dataset, attributes=['doc_id', 'annotation_id', 'app_id'])
vector.delete_by_metadata_field('app_id', app_id)

Actual Behavior

No response

Originally created by @colvin777 on GitHub (Mar 19, 2024). ### Self Checks - [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] Pleas do not modify this template :) and fill in all the required fields. ### Dify version 0.5.9 ### Cloud or Self Hosted Cloud, Self Hosted (Source) ### Steps to reproduce If there are no annotations, activating the "Annotation Reply" button does not create a collection in the vector database. ![image](https://github.com/langgenius/dify/assets/6747311/c91c173c-a268-4258-b146-0b38e25fb6c5) If the "Annotation Reply" button is then turned off (without ever having created any annotations), the backend reports an error due to the absence of the corresponding collection name in the vector database. ![image](https://github.com/langgenius/dify/assets/6747311/717f1949-185c-4941-9ff9-293494fb904b) ### ✔️ Expected Behavior disable_annotation_reply_task.py to add a check for whether the annotations are empty: annotations_count = db.session.query(MessageAnnotation).filter(MessageAnnotation.app_id == app_id).count() if annotations_count > 0: vector = Vector(dataset, attributes=['doc_id', 'annotation_id', 'app_id']) vector.delete_by_metadata_field('app_id', app_id) ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 17:33:42 -05:00
yindo closed this issue 2026-02-21 17:33:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1440