[Feature] 知识库文档上传单文件大小上限(当前固定 1000MB)希望支持环境变量配置
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22.8k
- Forks
- 3.2k
- Avg merge
- 45m
- Merged PRs (30d)
- 270
Description
背景与需求
企业私有化部署场景中,用户需要向知识库上传较大的文档(如扫描版 PDF、原始日志、数据导出 Excel/CSV 等)。当前单文件大小上限为 1000MB,且该上限在代码中写死,无法按部署环境调整。希望能将上限开放为可配置项。
当前行为(基于源码)
- 知识库设置「上传的每个文档最大(MB)」滑杆范围为 1~1000,默认 100:
- 前端
ui/src/views/knowledge/KnowledgeSetting.vue:el-slider :min="1" :max="1000",tooltip 已提示"建议根据服务器配置调整,否则可能会造成服务宕机" - 上传页提示文案(如"每个文件不超过 100 MB")来自当前知识库的
file_size_limit值
- 前端
- 后端:
Knowledge.file_size_limit(apps/knowledge/models/knowledge.py,default=100),校验逻辑在apps/knowledge/serializers/document.py:if f.size > 1024 * 1024 * knowledge.file_size_limit
期望
- 将 1000MB 的滑杆上限改为可配置(如环境变量
FILE_SIZE_LIMIT_MAX,默认仍为 1000),企业部署可按需上调; - 或放宽滑杆上限,并在文档中说明大文件的内存/磁盘风险;
- 文档补充配套配置说明:调大该值时需要同步调整反向代理
client_max_body_size、DjangoDATA_UPLOAD_MAX_MEMORY_SIZE等,否则前端限制放开了仍会在代理层被拒。
环境信息
- MaxKB 版本:v2.10.x-lts
- 部署方式:私有化 offline 安装
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ui/src/views/knowledge/KnowledgeSetting.vue, apps/knowledge/models/knowledge.py, and apps/knowledge/serializers/document.py, then inspect the project’s existing environment-variable configuration patterns. Update the maximum consistently while preserving the default, verify the slider and upload validation behavior, and document related reverse-proxy and Django upload limits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- backend, documentation, frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100