Skip to content

Commit 8ec87c2

Browse files
authored
fix(companion): bug where temporary chat mode made Filter.inlet exit early (#209)
#202
1 parent b1571a5 commit 8ec87c2

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

plugins/filters/gemini_manifold_companion.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,25 @@ def inlet(self, body: "Body", __metadata__: dict[str, Any]) -> "Body":
232232
if __metadata__["chat_id"] == "local":
233233
# TODO toast notification
234234
log.warning(
235-
"Temporary chats don't have support for native PDF upload currently"
236-
"This chat will likely use Open WebUI's RAG."
235+
"Bypassing Open WebUI's RAG is not possible for temporary chats. "
236+
"The Manifold pipe requires a database entry to access uploaded files, "
237+
"which temporary chats do not have. Falling back to Open WebUI's RAG."
237238
)
238239
metadata_features["upload_documents"] = False
239-
return body
240+
else:
241+
log.info(
242+
"BYPASS_BACKEND_RAG is enabled, bypassing Open WebUI RAG to let the Manifold pipe handle documents."
243+
)
244+
if files := body.get("files"):
245+
log.info(
246+
f"Removing {len(files)} files from the Open WebUI RAG pipeline."
247+
)
248+
body["files"] = []
249+
metadata_features["upload_documents"] = True
250+
else:
240251
log.info(
241-
"BYPASS_BACKEND_RAG is enabled, bypassing Open WebUI RAG and allowing gemini_manifold pipe to handle the rest."
252+
"BYPASS_BACKEND_RAG is disabled. Open WebUI's RAG will be used if applicable."
242253
)
243-
if files := body.get("files"):
244-
log.info(f"Removing {len(files)} from backend's RAG pipeline.")
245-
body["files"] = []
246-
metadata_features["upload_documents"] = True
247-
else:
248254
metadata_features["upload_documents"] = False
249255

250256
# The manifold pipe requires the backend to be in streaming mode to correctly

0 commit comments

Comments
 (0)