Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make doc extractor node also can extract text by file extension #9543

Merged
merged 7 commits into from
Oct 24, 2024

Conversation

hjlarry
Copy link
Contributor

@hjlarry hjlarry commented Oct 21, 2024

Checklist:

Important

Please review the checklist below before submitting your pull request.

  • Please open an issue before creating a PR or link to an existing issue
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Description

currently, extract doc by the mimetype is not so much reliable. for example, the markdown file will always raise error:

image

so extract doc by the filename when can't recognize the mimetype can improve success rate

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

Testing Instructions

test locally

  • Test A
  • Test B

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 💪 enhancement New feature or request labels Oct 21, 2024
@laipz8200
Copy link
Collaborator

Do you mind providing a file that will cause the error? According to my attempt, the .md file can be correctly identified as text/markdown.

@hjlarry
Copy link
Contributor Author

hjlarry commented Oct 23, 2024

Do you mind providing a file that will cause the error? According to my attempt, the .md file can be correctly identified as text/markdown.

I tried these files, the mimetype is always application/octet-stream :
2024-09-27.md
Markdown 101 (Example).md
Just chat.zip

I think this behavior is depends on the browser, I use Edge of windows11 for test

@hjlarry
Copy link
Contributor Author

hjlarry commented Oct 24, 2024

someone else encounter this issue #9757

I think for the remote_file extract by mimetype, for the local file extract by extension is more reasonable

I tried same file with firefox browser, it works, so the mimetype of local file depends on different browser

@yaoice
Copy link
Contributor

yaoice commented Oct 24, 2024

lgtm

@laipz8200 laipz8200 self-assigned this Oct 24, 2024
Copy link
Collaborator

@laipz8200 laipz8200 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 24, 2024
@laipz8200 laipz8200 merged commit 2346b0a into langgenius:main Oct 24, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants