open-webui/backend/open_webui
Alexey Rybalchenko 464a2dd58d feat: add per-group knowledge base file count and size limits
Adds optional per-group (and global default) limits on the number of
files and maximum file size for knowledge base uploads, enforced both
in the backend and early in the frontend upload pipeline.

- `WorkspacePermissions` extended with `knowledge_max_count` and
  `knowledge_max_size` (nullable int) so the group permissions endpoint
  persists and returns these values
- `DEFAULT_PERMISSIONS` in `permissions.ts` gains the two nullable fields
- Group Permissions UI shows numeric inputs for both limits beneath the
  Knowledge Access toggle (0 / empty = unlimited)
- `combine_permissions` extended to handle integer-valued permissions
  using most-permissive semantics (0 = unlimited always wins, otherwise
  max across groups)
- New `get_permission_value()` utility mirrors `has_permission` but
  returns the raw value (int/bool/None) rather than a boolean
- `/api/config` resolves and exposes `knowledge.max_count` and
  `knowledge.max_size` per-user so the frontend can gate uploads before
  any processing begins
- `KnowledgeBase.svelte` and `Models/Knowledge.svelte` check limits
  before calling `uploadFile`, preventing unnecessary text-extraction
  work on oversized files
- Backend enforces limits in both `/{id}/file/add` and
  `/{id}/files/batch/add`; admins always bypass
2026-04-22 13:52:31 +02:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal chore: format 2026-04-21 15:52:00 +09:00
migrations refac 2026-04-21 14:58:28 +09:00
models feat: add per-group knowledge base file count and size limits 2026-04-22 13:52:31 +02:00
retrieval refac 2026-04-21 16:04:48 +09:00
routers feat: add per-group knowledge base file count and size limits 2026-04-22 13:52:31 +02:00
socket refac 2026-04-17 13:29:51 +09:00
static chore: format 2026-04-19 22:45:54 +09:00
storage refac 2026-04-12 19:08:30 -05:00
test feat: add per-group knowledge base file count and size limits 2026-04-22 13:52:31 +02:00
tools refac 2026-04-21 13:46:39 +09:00
utils feat: add per-group knowledge base file count and size limits 2026-04-22 13:52:31 +02:00
__init__.py refac (#22987) 2026-03-24 15:41:26 -05:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py feat: add per-group knowledge base file count and size limits 2026-04-22 13:52:31 +02:00
constants.py chore: format 2026-04-14 17:27:31 -05:00
env.py refac 2026-04-20 09:21:30 +09:00
functions.py refac 2026-04-21 14:31:04 +09:00
main.py feat: add per-group knowledge base file count and size limits 2026-04-22 13:52:31 +02:00
tasks.py refac 2026-03-17 17:58:01 -05:00