From 611145768de184bdc1ce449d8f3660c781f869ee Mon Sep 17 00:00:00 2001 From: suurt8ll Date: Sat, 18 Oct 2025 08:00:32 +0300 Subject: [PATCH] fix(companion): bug where temporary chat mode made `Filter.inlet` exit early #202 --- plugins/filters/gemini_manifold_companion.py | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/plugins/filters/gemini_manifold_companion.py b/plugins/filters/gemini_manifold_companion.py index 7979299..2c46b56 100644 --- a/plugins/filters/gemini_manifold_companion.py +++ b/plugins/filters/gemini_manifold_companion.py @@ -224,19 +224,25 @@ def inlet(self, body: "Body", __metadata__: dict[str, Any]) -> "Body": if __metadata__["chat_id"] == "local": # TODO toast notification log.warning( - "Temporary chats don't have support for native PDF upload currently" - "This chat will likely use Open WebUI's RAG." + "Bypassing Open WebUI's RAG is not possible for temporary chats. " + "The Manifold pipe requires a database entry to access uploaded files, " + "which temporary chats do not have. Falling back to Open WebUI's RAG." ) metadata_features["upload_documents"] = False - return body + else: + log.info( + "BYPASS_BACKEND_RAG is enabled, bypassing Open WebUI RAG to let the Manifold pipe handle documents." + ) + if files := body.get("files"): + log.info( + f"Removing {len(files)} files from the Open WebUI RAG pipeline." + ) + body["files"] = [] + metadata_features["upload_documents"] = True + else: log.info( - "BYPASS_BACKEND_RAG is enabled, bypassing Open WebUI RAG and allowing gemini_manifold pipe to handle the rest." + "BYPASS_BACKEND_RAG is disabled. Open WebUI's RAG will be used if applicable." ) - if files := body.get("files"): - log.info(f"Removing {len(files)} from backend's RAG pipeline.") - body["files"] = [] - metadata_features["upload_documents"] = True - else: metadata_features["upload_documents"] = False # The manifold pipe requires the backend to be in streaming mode to correctly