发生了什么?
在一个新的虚拟机上安装了Quivr示例。登录并将附件中的文档上传到一个脑海中。
woocommerce-api-v3.md
通知:
Processing File woocommerceapiv3.md
An error occurred while processing the file: 'File' object has no attribute 'file'
相关的日志输出
worker | [2024-06-29 07:34:21,772: INFO/MainProcess] Task process_file_and_notify[e7a3c704-c721-4c1f-9509-a36c2c71f9ad] received
backend-core | INFO: 192.168.1.15:65181 - "POST /upload?brain_id=07121c8f-4d1c-42b6-b0c1-c78d0a6a0eec&chat_id=e742ea72-83ef-424a-b1d4-6ee49ffdedcf HTTP/1.1" 200 OK
worker | [2024-06-29 07:34:21,795: INFO/ForkPoolWorker-22] HTTP Request: GET http://host.docker.internal:54321/storage/v1/object/quivr/07121c8f-4d1c-42b6-b0c1-c78d0a6a0eec/woocommerceapiv3.md "HTTP/1.1 200 OK"
backend-core | INFO: 192.168.1.15:65181 - "DELETE /chat/e742ea72-83ef-424a-b1d4-6ee49ffdedcf HTTP/1.1" 200 OK
worker | [2024-06-29 07:34:21,812: INFO/ForkPoolWorker-22] HTTP Request: GET http://host.docker.internal:54321/rest/v1/vectors?select=id&file_sha1=eq.None "HTTP/1.1 200 OK"
worker | [2024-06-29 07:34:21,822: INFO/ForkPoolWorker-22] HTTP Request: GET http://host.docker.internal:54321/rest/v1/vectors?select=id&file_sha1=eq.None "HTTP/1.1 200 OK"
worker | [2024-06-29 07:34:21,827: INFO/ForkPoolWorker-22] HTTP Request: GET http://host.docker.internal:54321/rest/v1/brains_vectors?select=brain_id%2C%20vector_id&brain_id=eq.07121c8f-4d1c-42b6-b0c1-c78d0a6a0eec&file_sha1=eq.None "HTTP/1.1 200 OK"
worker | [2024-06-29 07:34:21,832: WARNING/ForkPoolWorker-22] Error processing file: 'File' object has no attribute 'file'
worker | [ERROR] quivr_api.celery_worker [celery_worker.py:91]: 'File' object has no attribute 'file'
worker | Traceback (most recent call last):
worker | File "/code/api/quivr_api/celery_worker.py", line 69, in process_file_and_notify
worker | filter_file(
worker | File "/code/api/quivr_api/packages/files/processors.py", line 103, in filter_file
worker | raise e
worker | File "/code/api/quivr_api/packages/files/processors.py", line 86, in filter_file
worker | result = file_processors[file.file_extension](
worker | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker | File "/code/api/quivr_api/packages/files/parsers/markdown.py", line 10, in process_markdown
worker | return process_file(
worker | ^^^^^^^^^^^^^
worker | File "/code/api/quivr_api/packages/files/parsers/common.py", line 36, in process_file
worker | doc = file.file
worker | ^^^^^^^^^
worker | File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 811, in __getattr__
worker | raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
worker | AttributeError: 'File' object has no attribute 'file'
worker | [2024-06-29 07:34:21,841: INFO/ForkPoolWorker-22] HTTP Request: PATCH http://host.docker.internal:54321/rest/v1/notifications?id=eq.1d11cf53-d076-4ad7-ac3e-d410e1525954 "HTTP/1.1 200 OK"
worker | [2024-06-29 07:34:21,843: INFO/ForkPoolWorker-22] Task process_file_and_notify[e7a3c704-c721-4c1f-9509-a36c2c71f9ad] succeeded in 0.06813362699995196s: None
backend-core | INFO: 192.168.1.15:65181 - "GET /knowledge?brain_id=07121c8f-4d1c-42b6-b0c1-c78d0a6a0eec HTTP/1.1" 200 OK
Twitter / LinkedIn详细信息
- 无响应*
4条答案
按热度按时间fgw7neuy1#
TECH-63 [Bug]: An error occurred while processing the file: 'File' object has no attribute 'file'
0aydgbwb2#
要解决在处理quivr中上传的文件时出现的错误 "'File' object has no attribute 'file'",需要确保您没有错误地尝试访问不存在的属性
file
。File
对象应该具有正确定义的属性和方法。以下是处理
File
对象的已更正部分代码:File
类正确定义:process_file_and_notify
函数:filter_file
函数正确实现:通过确保
File
类及其方法正确定义和使用,您应该能够解决错误1(https://github.com/QuivrHQ/quivr/blob/main/backend/api/quivr_api/modules/sync/utils/upload.py)2(https://github.com/QuivrHQ/quivr/blob/main/backend/api/quivr_api/modules/upload/controller/upload_routes.py)3(https://github.com/QuivrHQ/quivr/blob/main/backend/api/quivr_api/modules/upload/service/upload_file.py)4(https://github.com/QuivrHQ/quivr/blob/main/backend/api/quivr_api/modules/assistant/ito/summary.py)。vmjh9lq93#
更新:我用来上传到Quivr的任何文件类型都会产生相同的错误。例如,PDF:
在最新的Ubuntu 22.04上运行,docker-compose.yml。无法弄清楚我在这里遗漏了什么...
jtw3ybtb4#
我明白了:
临时移除 LLAMA_CLOUD_API_KEY 解决了问题
quivr/backend/api/quivr_api/packages/files/parsers/common.py
第35行到第37行 in 2e4b801
| ifos.getenv("LLAMA_CLOUD_API_KEY"): |
| doc=file.file |
| document_ext=os.path.splitext(doc.filename)[1] |