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: exclude .txt extenstion in create_by_text API #6956

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

gijigae
Copy link
Contributor

@gijigae gijigae commented Aug 5, 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

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. Close issue syntax: Fixes #<issue number>, see documentation for more details.

Fixes #6954

This PR excludes the ".txt" extension while text is added to a vector DB via create_by_text API.

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

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • File Name does not contain .txt when the text is added via create_by_text API
image
  • Citation does not contain .txt
image

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. 💪 enhancement New feature or request labels Aug 5, 2024
@JohnJyong
Copy link
Collaborator

create_by_text this service api is used for paragraph text, so it is reasonable to use .txt as the suffix when creating the file.
@gijigae

@JohnJyong JohnJyong self-requested a review August 5, 2024 07:08
@gijigae
Copy link
Contributor Author

gijigae commented Aug 5, 2024

create_by_text this service api is used for paragraph text, so it is reasonable to use .txt as the suffix when creating the file. @gijigae

Thanks so much for reviewing the PR, @JohnJyong ! The issue here is, how file names are shown to users and how they are referenced in citations.

Let's say I scraped text from arXiv and wanted to show the file name as "attention-is-all-you-need.pdf" when the text is added via create_by_text API.

image

What happens, however, is the file name is shown as attention-is-all-you-need.pdf.txt and the same is referenced in the citation as well.

image

Saving the text file with the .txt extension makes sense. However, I feel it doesn't add value to suffix file names with ".txt" in Knowledge. This PR "excludes .txt from the name of document" that is shown in the frontend.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 5, 2024
@crazywoola crazywoola merged commit dd67686 into langgenius:main Aug 5, 2024
6 checks passed
@gijigae gijigae deleted the remove-txt-extension branch August 5, 2024 08:43
cuiks pushed a commit to cuiks/dify that referenced this pull request Aug 6, 2024
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:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exclude the ".txt" extension while adding text to vector DB via create_by_text API
3 participants