open-webui/backend/open_webui
Classic298 ecd0ff67e1
fix: apply the duplicate-content check to knowledge batch add (#31336)
Adding files through `POST /api/v1/knowledge/{id}/files/batch/add` accepted a file whose extracted text was already in the knowledge base under another file, and linked both, while the single-file add rejects the same file with "Duplicate content detected". The same text was then embedded twice and retrieval returned the same passages twice.

The batch path now runs each file's content hash through the same check the single-file path uses, now shared by both, and also against the earlier files of the same batch. A duplicate is reported as a failed file in the batch result and is not linked, while the other files of the batch still go through. Batch-added chunks now carry the content hash in their metadata, so later adds through either endpoint detect them.

Chunks written by batch add before this change have no hash, so content added that way earlier is still not detected as a duplicate.

Verified on a running instance: two files with identical text now end up with exactly one linked in every order and combination (one batch call, separate batch calls, batch mixed with single add), and re-adding the same file is still accepted.

Fixes #31333
2026-10-01 07:53:06 +04:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal fix: non-English text is missed by searches and counted six times against size limits (#31615) 2026-09-30 19:19:29 +04:00
migrations chore: format 2026-08-25 16:53:53 -04:00
models fix: shared chats can't open new files attached together with a file already in the chat (#31650) 2026-09-30 21:03:32 +04:00
retrieval fix: send the query embedding as a vector in external pgvector retrieval (#31112) 2026-10-01 07:51:32 +04:00
routers fix: apply the duplicate-content check to knowledge batch add (#31336) 2026-10-01 07:53:06 +04:00
socket refac: apply the Notes permission to live note editing (#31552) 2026-09-30 19:19:53 +04:00
static refac 2026-09-06 17:27:30 -04:00
storage fix: read S3 files with long non-ASCII names (#30418) 2026-09-23 23:30:55 -04:00
tools refac: calendar event tools use the calendar's access check (#31537) 2026-09-30 19:29:19 +04:00
utils fix: prompt cache misses after a model calls tools one after another (#31593) 2026-10-01 07:34:59 +04:00
__init__.py refactor: use secrets module for generated secret key (#30441) 2026-09-23 23:36:26 -04:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py feat: add a Tavily search depth setting (#31308) 2026-09-27 23:15:09 +04:00
constants.py fix: SSO login failures show the email/password error (#31629) 2026-09-30 19:07:49 +04:00
env.py refac 2026-10-01 03:31:20 +04:00
events.py refac 2026-10-01 03:31:20 +04:00
functions.py refac 2026-10-01 03:31:20 +04:00
main.py fix: apply the custom model fallback to chats sent from the web UI (#31353) 2026-10-01 07:52:25 +04:00
tasks.py refac 2026-09-21 08:59:39 -04:00