From 5598b28fae06afd069bc4010101ca050373d84a0 Mon Sep 17 00:00:00 2001 From: weberm1 Date: Fri, 23 May 2025 10:40:47 +0200 Subject: [PATCH] Fix: Adjusted to handle individual rag config by passing knowledge id --- backend/open_webui/routers/files.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/routers/files.py b/backend/open_webui/routers/files.py index ad556d327..ff17784ee 100644 --- a/backend/open_webui/routers/files.py +++ b/backend/open_webui/routers/files.py @@ -15,6 +15,7 @@ from fastapi import ( UploadFile, status, Query, + Form ) from fastapi.responses import FileResponse, StreamingResponse from open_webui.constants import ERROR_MESSAGES @@ -87,6 +88,7 @@ def upload_file( user=Depends(get_verified_user), file_metadata: dict = None, process: bool = Query(True), + knowledge_id: Optional[str] = Form(None) ): log.info(f"file.content_type: {file.content_type}") @@ -148,7 +150,7 @@ def upload_file( process_file( request, - ProcessFileForm(file_id=id, content=result.get("text", "")), + ProcessFileForm(file_id=id, content=result.get("text", ""), knowledge_id=knowledge_id), user=user, ) elif file.content_type not in [ @@ -159,12 +161,12 @@ def upload_file( "video/ogg", "video/quicktime", ]: - process_file(request, ProcessFileForm(file_id=id), user=user) + process_file(request, ProcessFileForm(file_id=id, knowledge_id=knowledge_id), user=user) else: log.info( f"File type {file.content_type} is not provided, but trying to process anyway" ) - process_file(request, ProcessFileForm(file_id=id), user=user) + process_file(request, ProcessFileForm(file_id=id, knowledge_id=knowledge_id), user=user) file_item = Files.get_file_by_id(id=id) except Exception as e: