mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 17:02:01 -05:00
[PR #23992] [CLOSED] feat: add per-group knowledge base file count and size limits #82342
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23992
Author: @rbx
Created: 4/22/2026
Status: ❌ Closed
Base:
dev← Head:kb-limits📝 Commits (1)
464a2ddfeat: add per-group knowledge base file count and size limits📊 Changes
13 files changed (+346 additions, -25 deletions)
View changed files
📝
backend/open_webui/config.py(+20 -0)📝
backend/open_webui/main.py(+23 -1)📝
backend/open_webui/models/knowledge.py(+12 -0)📝
backend/open_webui/routers/knowledge.py(+51 -1)📝
backend/open_webui/routers/users.py(+3 -1)➕
backend/open_webui/test/util/conftest.py(+5 -0)➕
backend/open_webui/test/util/test_access_control.py(+125 -0)📝
backend/open_webui/utils/access_control/__init__.py(+58 -0)📝
src/lib/components/admin/Users/Groups/Permissions.svelte(+28 -1)📝
src/lib/components/workspace/Knowledge/KnowledgeBase.svelte(+12 -10)📝
src/lib/components/workspace/Models/Knowledge.svelte(+3 -11)📝
src/lib/constants/permissions.ts(+2 -0)📝
src/lib/i18n/locales/en-US/translation.json(+4 -0)📄 Description
Resolves #23848
Description
Adds optional per-group (and global default) limits on the number of files and maximum file size for knowledge base uploads. Limits are enforced both in the backend and early in the frontend upload pipeline (before text extraction begins). Admins always bypass both limits.
Pull Request Checklist
devcombine_permissionsandget_permission_valuedevfeat:Changelog Entry
Description
Adds per-group knowledge base upload limits: maximum file count and maximum file size per knowledge base. Configured via Group Permissions UI; enforced in backend and frontend. Admins bypass all limits.
Added
WorkspacePermissionsextended withknowledge_max_countandknowledge_max_size(nullable int fields)DEFAULT_PERMISSIONSinpermissions.tsgains the two nullable fields0/ empty = unlimited)get_permission_value()utility inaccess_control- mirrorshas_permissionbut returns a raw value (int/bool/None) instead of a boolean/api/configresolves and exposesknowledge.max_countandknowledge.max_sizeper-userUSER_PERMISSIONS_WORKSPACE_KNOWLEDGE_MAX_COUNTandUSER_PERMISSIONS_WORKSPACE_KNOWLEDGE_MAX_SIZEenv vars to set default limits at startup (0= unlimited, unset = unlimited)get_permission_valueChanged
combine_permissionsextended to handle integer-valued permissions using most-permissive semantics:0= unlimited always wins, otherwise the maximum across groupsKnowledgeBase.svelteandModels/Knowledge.sveltecheck limits before callinguploadFile/{id}/file/addand/{id}/files/batch/addAdditional Information
0(unlimited) always takes precedence over any finite capScreenshots or Videos
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.