Wrong segment number when using api to add batch segments. #1983

Closed
opened 2026-02-21 17:40:14 -05:00 by yindo · 0 comments
Owner

Originally created by @sunxichen on GitHub (Apr 9, 2024).

Originally assigned to: @JohnJyong on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a quesion, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.5.9

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

add batch segments using add segment API (http://{DIFY_URL}/v1/datasets/{DATASET_ID}/documents/{DOCUMENT_ID}/segments), and it assign same number to all segments within same batch.
request example:

for i in tqdm(range(0, len(datas), 10)):
      batch_datas = datas[i : i + 10]
      response = requests.post(
            url=DIFY_ADD_SEGMENT_URL,
            headers={
                "Content-Type": "application/json",
                "Authorization": f"Bearer {DIFY_DATASET_API_KEY}"
                },
            json={"segments": batch_datas},
      )

✔️ Expected Behavior

Different segment should have different number although they are added in the same batch.
1E27FF9D-53CA-4B71-8AA0-0A728009107C

Actual Behavior

Different segment have same number when they are added in the same batch
1E27FF9D-53CA-4B71-8AA0-0A728009107C

Originally created by @sunxichen on GitHub (Apr 9, 2024). Originally assigned to: @JohnJyong on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a quesion, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Pleas do not modify this template :) and fill in all the required fields. ### Dify version 0.5.9 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce add batch segments using add segment API (http://{DIFY_URL}/v1/datasets/{DATASET_ID}/documents/{DOCUMENT_ID}/segments), and it assign same number to all segments within same batch. request example: ```python for i in tqdm(range(0, len(datas), 10)): batch_datas = datas[i : i + 10] response = requests.post( url=DIFY_ADD_SEGMENT_URL, headers={ "Content-Type": "application/json", "Authorization": f"Bearer {DIFY_DATASET_API_KEY}" }, json={"segments": batch_datas}, ) ``` ### ✔️ Expected Behavior Different segment should have different number although they are added in the same batch. ![1E27FF9D-53CA-4B71-8AA0-0A728009107C](https://github.com/langgenius/dify/assets/18310222/f1596dc5-1efc-44cf-8880-bc44bfa4e94d) ### ❌ Actual Behavior Different segment have same number when they are added in the same batch ![1E27FF9D-53CA-4B71-8AA0-0A728009107C](https://github.com/langgenius/dify/assets/18310222/f1596dc5-1efc-44cf-8880-bc44bfa4e94d)
yindo added the 🐞 bug👻 feat:rag labels 2026-02-21 17:40:14 -05:00
yindo closed this issue 2026-02-21 17:40:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1983