chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
31.46k stars 5.49k forks source link

[BUG] 知识库管理-上传txt格式文件报ModuleNotFoundError: No module named 'unstructured_inference.inference.ordering' #4449

Closed mk1990 closed 2 months ago

mk1990 commented 2 months ago

问题描述 / Problem Description 知识库管理功能添加txt格式知识库报错,chatchat后台报错ModuleNotFoundError: No module named 'unstructured_inference.inference.ordering'。

复现问题的步骤 / Steps to Reproduce

  1. 在知识库管理页面,点击“上传知识文件”,然后选择txt格式文件;
  2. 点击“添加文件到知识库”;
  3. 知识库中已有文件列表中“文档加载器”和“分词器”选项显示为空,"文档数量"显示为0,“向量库”选项显示为X;
  4. chatchat后台报错ModuleNotFoundError: No module named 'unstructured_inference.inference.ordering'。

预期的结果 / Expected Result

  1. 知识库已有文件列表正确显示文档加载器和分词器;
  2. chatchat后台不报错

实际结果 / Actual Result

  1. 知识库中已有文件列表中“文档加载器”和“分词器”选项显示为空,"文档数量"显示为0,“向量库”选项显示为X;
  2. chatchat后台报错ModuleNotFoundError: No module named 'unstructured_inference.inference.ordering'。

环境信息 / Environment Information

附加信息 / Additional Information

mk1990 commented 2 months ago

报错详情: 2024-07-09 14:36:44,946 root 63 INFO UnstructuredFileLoader used for /usr/local/lib/python3.11/site-packages/chatchat/data/knowledge_base/tt/content/三国.txt 2024-07-09 14:36:44,949 root 63 ERROR ModuleNotFoundError: 从文件 tt/三国.txt 加载文档时出错:No module named 'unstructured_inference.inference.ordering' Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/chatchat/server/knowledge_base/utils.py", line 424, in files2docs_in_thread_file2docs return True, (file.kb_name, file.filename, file.file2text(**kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/chatchat/server/knowledge_base/utils.py", line 399, in file2text docs = self.file2docs() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/chatchat/server/knowledge_base/utils.py", line 354, in file2docs self.docs = loader.load() ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 29, in load return list(self.lazy_load()) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/unstructured.py", line 88, in lazy_load elements = self._get_elements() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/unstructured.py", line 168, in _get_elements from unstructured.partition.auto import partition File "/usr/local/lib/python3.11/site-packages/unstructured/partition/auto.py", line 81, in from unstructured.partition.pdf import partition_pdf File "/usr/local/lib/python3.11/site-packages/unstructured/partition/pdf.py", line 81, in from unstructured.partition.pdf_image.pdfminer_processing import ( File "/usr/local/lib/python3.11/site-packages/unstructured/partition/pdf_image/pdfminer_processing.py", line 12, in from unstructured_inference.inference.ordering import order_layout ModuleNotFoundError: No module named 'unstructured_inference.inference.ordering'

hcxss commented 2 months ago

+1 No module named 'unstructured_inference.inference.ordering'

lelofraser commented 2 months ago

+1 没有名为“unstructured_inference.inference.ordering”的模块

hcxss commented 2 months ago

你们都是docker部署吗

hcxss commented 2 months ago

image

hcxss commented 2 months ago

有没有可能是版本太新了!

hcxss commented 2 months ago

ordering这个文件没有,去历史版本找个ordering文件

QJBX-DJN commented 2 months ago

pip install unstructured==0.11.0

liunux4odoo commented 2 months ago

0.3.1 版已经发布,优化了配置方式,修改配置项无需重启服务器,可以更新尝试。