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

fix: changed topics/keywords to topic/keywords #13544

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

Riddhimaan-Senapati
Copy link
Contributor

@Riddhimaan-Senapati Riddhimaan-Senapati commented Feb 11, 2025

Summary

The metadata with key "topic/keywords" is probably accepted and saved by the backend, but the UI won't show the value because it uses a map of metadata keys to show:

dify/web/hooks/use-metadata.ts

Line 68 in 1f38d48

'topics/keywords': { label: t(${fieldPrefix}.webPage.topicsKeywords) },
Based on the file linked in the docs: https://github.com/langgenius/dify/blob/main/api/services/dataset_service.py#L475
The correct value should probably be "topic/keywords"

The backend seems to run validation on the accepted values for doc_type https://github.com/langgenius/dify/blob/main/api/controllers/service_api/dataset/document.py#L75

BUT it allows any Dictionary-Like object for the doc_metadata https://github.com/langgenius/dify/blob/main/api/controllers/service_api/dataset/document.py#L79

It should validate the object keys based on the values in dataset_service.py https://github.com/langgenius/dify/blob/main/api/services/dataset_service.py#L476

The UI hook should be updated to target the correct key "topic/keywords"

dify/web/hooks/use-metadata.ts

Line 68 in 1f38d48

'topics/keywords': { label: t(${fieldPrefix}.webPage.topicsKeywords) },
Along with the translation key

dify/web/i18n/en-US/dataset-documents.ts

Line 136 in 1f38d48

topicsKeywords: 'Topics/Keywords',

So I updated these files and the corresponding translations to use topic/Keywords or topicKeywords

Fixes #13502

Screenshots

Before After
... ...

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🐞 bug Something isn't working labels Feb 11, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 12, 2025
@crazywoola crazywoola merged commit 786550b into langgenius:main Feb 12, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 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.

Knowledges metadata
2 participants