labring / FastGPT

FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, and visual AI workflow orchestration, letting you easily develop and deploy complex question-answering systems without the need for extensive setup or configuration.
https://tryfastgpt.ai
Other
16.96k stars 4.54k forks source link

上传的文件通过“文档解析“工具无法解析结果 #2372

Open zkstudio opened 1 month ago

zkstudio commented 1 month ago

例行检查

你的版本

问题描述, 日志截图 上传文件启用后,上传txt或者pdf文件通过文档解析后,不能解析具体文本,解析结果为“Only support .txt, .md, .html, .pdf, .docx, pptx, .csv, .xlsx”。

复现步骤

  1. 开启文档上传文件,通过调试发现上传后地址为: [ "http://x.x.x.x:3000/api/common/file/read?filename=1.txt&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJidWNrZXROYW1lIjoiY2hhdCIsInRlYW1JZCI6IjY2NjdmYmQwNTViYWEzZWVkZGQ5ZjQzYyIsInRtYklkIjoiNjY2N2ZiZDA1NWJhYTNlZWRkZDlmNDNlIiwiZmlsZUlkIjoiNjZiYWZhOTM4ODkwOTMwYTQyNjFlNTNmIiwiZXhwIjoxNzI0MTM0Njc1LCJpYXQiOjE3MjM1Mjk4NzV9.1Dxgbjc5I8xOn4W02rzn3V9XPsIeCeTToQ7c691A8OU" ]

  2. 通过文档解析,结果为: File:

    Only support .txt, .md, .html, .pdf, .docx, pptx, .csv, .xlsx

另,将地址换成静态文件地址,如: [ "http://x.x.x.x/1.txt" ] 可正常解析。 应该是上传后的文件后续带着token导致误判文件类型导致

预期结果 能够正常解析文本

相关截图 image

c121914yu commented 1 month ago

未复现~ debug 看看日志

zkstudio commented 1 week ago

未复现~ debug 看看日志

发现是以下代码导致的,去掉前面部分,就访问不了了。 为什么要去掉呢?谢谢! @c121914yu

// Remove the origin(Make intranet requests directly) if (requestOrigin && url.startsWith(requestOrigin)) { url = url.replace(requestOrigin, ''); }

c121914yu commented 1 week ago

未复现~ debug 看看日志

发现是以下代码导致的,去掉前面部分,就访问不了了。 为什么要去掉呢?谢谢! @c121914yu

// Remove the origin(Make intranet requests directly) if (requestOrigin && url.startsWith(requestOrigin)) { url = url.replace(requestOrigin, ''); }

因为需要从服务器里的 origin 和客户端不是同一个,直接用 /api/xx文件 路径去请求文件接口,会自动补上服务端的 origin。