dify icon indicating copy to clipboard operation
dify copied to clipboard

知识库添加文档一直在排队

Open superbread93a opened this issue 2 years ago • 3 comments

Self Checks

  • [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.9

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Image_20240614101627 image 知识库添加文档一直在排队和等待 image 平台一直在发送这个请求,且智能体无法进行对话

✔️ Expected Behavior

如何解决问题,重启服务还是无法解决

❌ Actual Behavior

No response

superbread93a avatar Jun 14 '24 02:06 superbread93a

@superbread93a 你好,我是Dosu。我是一个能够帮助你解决bug并回答问题的机器人,也可以帮助你成为贡献者。在等待人类维护者的过程中,我会尽力帮助你。

To resolve the issue where documents remain in a queued state and are not being processed in the knowledge base of your self-hosted Dify version 0.6.9, you should check the following:

  1. Document Limit and Subscription Constraints: Ensure that the document limit and subscription constraints are not being violated. The code checks for batch upload limits and vector space limits. If these limits are exceeded, the documents will not be processed and will be marked with an error status.

  2. Error Handling: The code has a section that catches exceptions and sets the document's indexing_status to 'error'. Check the logs for any error messages that might indicate why the documents are not being processed.

  3. Indexing Status: Ensure that the documents' indexing_status is being updated correctly. The status should change from 'queued' to 'parsing' and then to 'processed' as the indexing progresses.

Here is the relevant part of the code that handles these checks and updates:

# check document limit
features = FeatureService.get_features(dataset.tenant_id)
try:
    if features.billing.enabled:
        vector_space = features.vector_space
        count = len(document_ids)
        batch_upload_limit = int(current_app.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:
            raise ValueError("Your total number of documents plus the number of uploads have over the limit of "
                             "your subscription.")
except Exception as e:
    for document_id in document_ids:
        document = db.session.query(Document).filter(
            Document.id == document_id,
            Document.dataset_id == dataset_id
        ).first()
        if document:
            document.indexing_status = 'error'
            document.error = str(e)
            document.stopped_at = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
            db.session.add(document)
    db.session.commit()
    return

Ensure that the BATCH_UPLOAD_LIMIT and vector space limits are configured correctly in your current_app.config. Additionally, check the logs for any exceptions that might be causing the documents to remain in a queued state [1].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Jun 14 '24 03:06 dosubot[bot]

@superbread93a Have you started the worker service as referenced in api/README.md?

  1. If you need to debug local async processing, please start the worker service by running celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail. The started celery app handles the async tasks, e.g. dataset importing and documents indexing.

doufa avatar Jun 14 '24 05:06 doufa

Ensure that the BATCH_UPLOAD_LIMIT and vector space limits are configured correctly in your current_app.config. Additionally, check the logs for any exceptions that might be causing the documents to remain in a queued state [1].

怎么修改这个 vector_space.limit ?在 dify/docker/.env.example 里没有相关设置

piwawa avatar Dec 20 '24 13:12 piwawa