[PR #13116] feature. add feat to modify metadata via dataset api #27842

Closed
opened 2026-02-21 20:42:18 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/13116

State: closed
Merged: Yes


Summary

Allow user to change document's metadata via dataset api.
closes https://github.com/langgenius/dify/issues/13114

Sample curl command to be tested.

curl --location --request POST 'http://127.0.0.1:5001/v1/datasets/${UUID}/document/create-by-file' \
--header 'Authorization: Bearer ${API_KEY}' \
--form 'data="{
  \"indexing_technique\":\"high_quality\",
  \"process_rule\":{
    \"rules\":{
      \"pre_processing_rules\":[
        {\"id\":\"remove_extra_spaces\",\"enabled\":true},
        {\"id\":\"remove_urls_emails\",\"enabled\":true}
      ],
      \"segmentation\":{
        \"separator\":\"###\",
        \"max_tokens\":500
      }
    },
    \"mode\":\"custom\"
  },
  \"doc_type\": \"book\",
  \"doc_metadata\": {
    \"title\": \"Sample Book\",
    \"author\": \"John Doe\",
    \"language\": \"English\",
    \"publisher\": \"Sample Publisher\",
    \"publication_date\": \"2024-01-01\",
    \"isbn\": \"123-456-789\",
    \"category\": \"Fiction\"
  }, \"duplicate\":false
}";type=text/plain' \
--form 'file=@"./README.md"'

Screenshots

Before After
スクリーンショット 2025-01-30 22 01 37
スクリーンショット 2025-01-30 22 01 07

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
**Original Pull Request:** https://github.com/langgenius/dify/pull/13116 **State:** closed **Merged:** Yes --- # Summary Allow user to change document's metadata via dataset api. closes https://github.com/langgenius/dify/issues/13114 Sample curl command to be tested. ```bash curl --location --request POST 'http://127.0.0.1:5001/v1/datasets/${UUID}/document/create-by-file' \ --header 'Authorization: Bearer ${API_KEY}' \ --form 'data="{ \"indexing_technique\":\"high_quality\", \"process_rule\":{ \"rules\":{ \"pre_processing_rules\":[ {\"id\":\"remove_extra_spaces\",\"enabled\":true}, {\"id\":\"remove_urls_emails\",\"enabled\":true} ], \"segmentation\":{ \"separator\":\"###\", \"max_tokens\":500 } }, \"mode\":\"custom\" }, \"doc_type\": \"book\", \"doc_metadata\": { \"title\": \"Sample Book\", \"author\": \"John Doe\", \"language\": \"English\", \"publisher\": \"Sample Publisher\", \"publication_date\": \"2024-01-01\", \"isbn\": \"123-456-789\", \"category\": \"Fiction\" }, \"duplicate\":false }";type=text/plain' \ --form 'file=@"./README.md"' ``` # Screenshots | Before | After | |--------|-------| | ![スクリーンショット 2025-01-30 22 01 37](https://github.com/user-attachments/assets/ebfdbff4-776c-4187-b360-d1a674666cda) | ![スクリーンショット 2025-01-30 22 01 07](https://github.com/user-attachments/assets/be57c767-a137-49fc-80b4-5ee2fa18faf1) | # Checklist > [!IMPORTANT] > Please review the checklist below before submitting your pull request. - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:42:18 -05:00
yindo closed this issue 2026-02-21 20:42:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#27842