mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 06:03:26 -05:00
[GH-ISSUE #17755] feat: Add batch upload endpoint and multi-threaded support for "Upload Directory" #57051
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?
Originally created by @shgana on GitHub (Sep 25, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17755
Check Existing Issues
Problem Description
Currently, when a user selects “Upload Directory” in the Knowledge Base UI, the files are uploaded sequentially (one POST /files call at a time).
This creates several issues:
In short: the existing “Upload Directory” looks like a batch feature but is effectively single-threaded, which limits usability at scale.
Desired Solution you'd like
Introduce a new batch upload endpoint (POST /files/batch) that accepts multiple files in one request and processes them concurrently.
Key details:
This preserves backwards compatibility while offering major performance improvements for those who want them.
Alternatives Considered
Already possible to write external tools that parallelize multiple POST /files requests
Downsides: no UI integration, separate maintenance burden, different stack.
Wrapping the existing API in another service.
Adds deployment/maintenance complexity, unintuitive for users.
Simple and safe, but too slow for larger directories.
The upstream batch upload endpoint is the cleanest long-term solution: seamless for users, opt-in concurrency, and consistent with the existing codebase.
Additional Context
The new process_in_background flag in the upload API is very helpful: with process_in_background=false, files are guaranteed usable as soon as the request returns.
However, even with synchronous mode, the current “Upload Directory” UI still uploads one file at a time.
By combining process_in_background=false with a batch/multi-threaded upload endpoint, we can resolve both performance and race-condition issues.
Proposed implementation impact:
Backend: add /files/batch endpoint, configurable concurrency, per-file error reporting.
Frontend: adjust “Upload Directory” UI to use the new endpoint.
Compatibility: safe by default, no regressions.
@tjbck commented on GitHub (Sep 25, 2025):
Open to PRs!