The chunk size of the knowledge base cannot be modified through environment variables. #7595

Closed
opened 2026-02-21 18:21:24 -05:00 by yindo · 9 comments
Owner

Originally created by @Moiyu1998 on GitHub (Jan 8, 2025).

Originally assigned to: @iamjoel on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, 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).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

The chunk size of the knowledge base is limited to 4000. I changed the environment variable to 8191, but it didn't take effect; the limit is still 4000. In version 0.14.1, modifying this variable used to work.The size limit for both parent and child chunks is also 4000.
image
image
image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Moiyu1998 on GitHub (Jan 8, 2025). Originally assigned to: @iamjoel on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, 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] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce The chunk size of the knowledge base is limited to 4000. I changed the environment variable to 8191, but it didn't take effect; the limit is still 4000. In version 0.14.1, modifying this variable used to work.The size limit for both parent and child chunks is also 4000. ![image](https://github.com/user-attachments/assets/ba76925a-16b9-4709-8b50-c3a39832a0c1) ![image](https://github.com/user-attachments/assets/7d096815-4cb5-4d85-873d-4eb8098c4151) ![image](https://github.com/user-attachments/assets/ea3bc642-fa5e-4ae2-bdf9-e3d077736dd1) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:21:24 -05:00
yindo closed this issue 2026-02-21 18:21:24 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 8, 2025):

I found a similar unsolved discussion regarding an issue with modifying the maximum chunk length through environment variables. You can view it here [1].

In your case, it seems that the environment variable change to increase the chunk size limit from 4000 to 8191 is not taking effect in version 0.15.0, whereas it worked in version 0.14.2. This might indicate a change in how environment variables are handled between these versions. Unfortunately, I couldn't find specific documentation or code comments explaining the process of updating configuration settings through environment variables in the current version.

You might want to check if there are any recent changes in the codebase related to the chunk size configuration or how environment variables are applied. If the issue persists, consider reviewing the code to ensure that the environment variable is correctly set and applied in the configuration.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 8, 2025): <!-- Answer --> I found a similar unsolved discussion regarding an issue with modifying the maximum chunk length through environment variables. You can view it [here](https://github.com/langgenius/dify/discussions/4080) <sup>[[1]](https://github.com/langgenius/dify/discussions/4080)</sup>. In your case, it seems that the environment variable change to increase the chunk size limit from 4000 to 8191 is not taking effect in version 0.15.0, whereas it worked in version 0.14.2. This might indicate a change in how environment variables are handled between these versions. Unfortunately, I couldn't find specific documentation or code comments explaining the process of updating configuration settings through environment variables in the current version. You might want to check if there are any recent changes in the codebase related to the chunk size configuration or how environment variables are applied. If the issue persists, consider reviewing the code to ensure that the environment variable is correctly set and applied in the configuration. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=other)</sup>
Author
Owner

@Moiyu1998 commented on GitHub (Jan 8, 2025):

I found a similar unsolved discussion regarding an issue with modifying the maximum chunk length through environment variables. You can view it here [1].

In your case, it seems that the environment variable change to increase the chunk size limit from 4000 to 8191 is not taking effect in version 0.15.0, whereas it worked in version 0.14.2. This might indicate a change in how environment variables are handled between these versions. Unfortunately, I couldn't find specific documentation or code comments explaining the process of updating configuration settings through environment variables in the current version.

You might want to check if there are any recent changes in the codebase related to the chunk size configuration or how environment variables are applied. If the issue persists, consider reviewing the code to ensure that the environment variable is correctly set and applied in the configuration.

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sorry, I made a mistake. It is version 0.14.1.

@Moiyu1998 commented on GitHub (Jan 8, 2025): > I found a similar unsolved discussion regarding an issue with modifying the maximum chunk length through environment variables. You can view it [here](https://github.com/langgenius/dify/discussions/4080) [[1]](https://github.com/langgenius/dify/discussions/4080). > > In your case, it seems that the environment variable change to increase the chunk size limit from 4000 to 8191 is not taking effect in version 0.15.0, whereas it worked in version 0.14.2. This might indicate a change in how environment variables are handled between these versions. Unfortunately, I couldn't find specific documentation or code comments explaining the process of updating configuration settings through environment variables in the current version. > > You might want to check if there are any recent changes in the codebase related to the chunk size configuration or how environment variables are applied. If the issue persists, consider reviewing the code to ensure that the environment variable is correctly set and applied in the configuration. > > _To continue talking to [Dosu](https://dosu.dev), mention @dosu._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/ca2d8c52-8bbd-4c12-b260-b6728a4e16ca?feedback_type=other) Sorry, I made a mistake. It is version 0.14.1.
Author
Owner
@crazywoola commented on GitHub (Jan 8, 2025): https://github.com/langgenius/dify/blob/49feff082fd785ce26d5124a2e19d93816a9e8f3/web/app/components/datasets/create/step-two/inputs.tsx#L41-L55
Author
Owner

@Moiyu1998 commented on GitHub (Jan 8, 2025):

https://github.com/langgenius/dify/blob/49feff082fd785ce26d5124a2e19d93816a9e8f3/web/app/components/datasets/create/step-two/inputs.tsx#L41-L55

Sorry, modifying this file does not take effect. Due to network restrictions, I am unable to rebuild the image. Is there any other way to resolve this issue? Alternatively, could this issue be fixed as soon as possible?

@Moiyu1998 commented on GitHub (Jan 8, 2025): > https://github.com/langgenius/dify/blob/49feff082fd785ce26d5124a2e19d93816a9e8f3/web/app/components/datasets/create/step-two/inputs.tsx#L41-L55 Sorry, modifying this file does not take effect. Due to network restrictions, I am unable to rebuild the image. Is there any other way to resolve this issue? Alternatively, could this issue be fixed as soon as possible?
Author
Owner

@Moiyu1998 commented on GitHub (Jan 13, 2025):

@crazywoola Please fix this bug. Currently, modifying the environment variable does not take effect, which prevents me from uploading documents longer than 4000 tokens. The environment variable should be linked instead of using the fixed value of 4000.

@Moiyu1998 commented on GitHub (Jan 13, 2025): @crazywoola Please fix this bug. Currently, modifying the environment variable does not take effect, which prevents me from uploading documents longer than 4000 tokens. The environment variable should be linked instead of using the fixed value of 4000.
Author
Owner

@iamjoel commented on GitHub (Jan 14, 2025):

@Moiyu1998 It's under testing. If you're in a hurry, you can merge this branch: https://github.com/langgenius/dify/tree/feat/chunk-length-support-env

@iamjoel commented on GitHub (Jan 14, 2025): @Moiyu1998 It's under testing. If you're in a hurry, you can merge this branch: https://github.com/langgenius/dify/tree/feat/chunk-length-support-env
Author
Owner

@Moiyu1998 commented on GitHub (Jan 20, 2025):

@Moiyu1998 It's under testing. If you're in a hurry, you can merge this branch: https://github.com/langgenius/dify/tree/feat/chunk-length-support-env

Can this issue be resolved in the next version? It shouldn't be a very complex problem—just linking the environment variable should suffice.Please fix this issue in the next version; it's currently unusable.

@Moiyu1998 commented on GitHub (Jan 20, 2025): > [@Moiyu1998](https://github.com/Moiyu1998) It's under testing. If you're in a hurry, you can merge this branch: https://github.com/langgenius/dify/tree/feat/chunk-length-support-env Can this issue be resolved in the next version? It shouldn't be a very complex problem—just linking the environment variable should suffice.Please fix this issue in the next version; it's currently unusable.
Author
Owner

@iamjoel commented on GitHub (Jan 21, 2025):

Please have some patience.

@iamjoel commented on GitHub (Jan 21, 2025): Please have some patience.
Author
Owner

@Moiyu1998 commented on GitHub (Jan 21, 2025):

Please have some patience.

This is not a very complex issue, so why is it taking so long?

@Moiyu1998 commented on GitHub (Jan 21, 2025): > Please have some patience. This is not a very complex issue, so why is it taking so long?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7595