From ed5ed0306e01da97088d1847088c152212480f1f Mon Sep 17 00:00:00 2001 From: NeatGuyCoding <15627489+NeatGuyCoding@users.noreply.github.com> Date: Tue, 2 Sep 2025 19:14:30 +0800 Subject: [PATCH] minor fix: fix the check of subscription capacity limit (#24991) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- api/tasks/duplicate_document_indexing_task.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/tasks/duplicate_document_indexing_task.py b/api/tasks/duplicate_document_indexing_task.py index 955e898ec..d93f30ba3 100644 --- a/api/tasks/duplicate_document_indexing_task.py +++ b/api/tasks/duplicate_document_indexing_task.py @@ -45,9 +45,11 @@ def duplicate_document_indexing_task(dataset_id: str, document_ids: list): batch_upload_limit = int(dify_config.BATCH_UPLOAD_LIMIT) if count > batch_upload_limit: raise ValueError(f"You have reached the batch upload limit of {batch_upload_limit}.") - if 0 < vector_space.limit <= vector_space.size: + current = int(getattr(vector_space, "size", 0) or 0) + limit = int(getattr(vector_space, "limit", 0) or 0) + if limit > 0 and (current + count) > limit: raise ValueError( - "Your total number of documents plus the number of uploads have over the limit of " + "Your total number of documents plus the number of uploads have exceeded the limit of " "your subscription." ) except Exception as e: