From 3e0564d11a06052d8042fffc95b138dcbde5df6b Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 21 Oct 2026 19:26:37 +0200 Subject: [PATCH] fix: MinerU local mode fails every document on a 4.x server that requires an API key (#32838) A self-hosted MinerU 4.x server started with an API key rejected every document with a 401, even with the key filled in under Documents settings, because local mode never sent it. The key is now sent with the document requests to a 4.x server whenever one is set. Servers without a key are unaffected. Fixes #32836 --- backend/open_webui/retrieval/loaders/mineru.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/retrieval/loaders/mineru.py b/backend/open_webui/retrieval/loaders/mineru.py index 0a3017cbd1..7a0c3af9eb 100644 --- a/backend/open_webui/retrieval/loaders/mineru.py +++ b/backend/open_webui/retrieval/loaders/mineru.py @@ -273,8 +273,12 @@ class MinerULoader: """ Send one request to the MinerU V1 API and raise an HTTPException on failure. """ + # A 4.x server started with --api-key rejects every V1 request without it + headers = {'Authorization': f'Bearer {self.api_key}'} if self.api_key else None try: - response = requests.request(method, f'{self.api_url}{path}', timeout=self.timeout, **kwargs) + response = requests.request( + method, f'{self.api_url}{path}', headers=headers, timeout=self.timeout, **kwargs + ) response.raise_for_status() except requests.Timeout: raise HTTPException(