diff --git a/backend/open_webui/apps/retrieval/main.py b/backend/open_webui/apps/retrieval/main.py index e4f98b8b0..8f23ea2c5 100644 --- a/backend/open_webui/apps/retrieval/main.py +++ b/backend/open_webui/apps/retrieval/main.py @@ -1340,14 +1340,14 @@ def store_doc( ) -class ProcessDocForm(BaseModel): +class ProcessFileForm(BaseModel): file_id: str collection_name: Optional[str] = None -@app.post("/process/doc") -def process_doc( - form_data: ProcessDocForm, +@app.post("/process/file") +def process_file( + form_data: ProcessFileForm, user=Depends(get_verified_user), ): try: diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index f531a8728..2518599ca 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -921,7 +921,7 @@ CHROMA_HTTP_SSL = os.environ.get("CHROMA_HTTP_SSL", "false").lower() == "true" MILVUS_URI = os.environ.get("MILVUS_URI", f"{DATA_DIR}/vector_db/milvus.db") #################################### -# RAG +# Information Retrieval (RAG) #################################### # RAG Content Extraction diff --git a/src/lib/apis/rag/index.ts b/src/lib/apis/retrieval/index.ts similarity index 98% rename from src/lib/apis/rag/index.ts rename to src/lib/apis/retrieval/index.ts index 3c0dba4b5..ce3a0c0a5 100644 --- a/src/lib/apis/rag/index.ts +++ b/src/lib/apis/retrieval/index.ts @@ -170,10 +170,10 @@ export const updateQuerySettings = async (token: string, settings: QuerySettings return res; }; -export const processDocToVectorDB = async (token: string, file_id: string) => { +export const processFile = async (token: string, file_id: string) => { let error = null; - const res = await fetch(`${RAG_API_BASE_URL}/process/doc`, { + const res = await fetch(`${RAG_API_BASE_URL}/process/file`, { method: 'POST', headers: { Accept: 'application/json', diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 9db03ef53..e196936a6 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -52,7 +52,7 @@ updateChatById } from '$lib/apis/chats'; import { generateOpenAIChatCompletion } from '$lib/apis/openai'; - import { runWebSearch } from '$lib/apis/rag'; + import { runWebSearch } from '$lib/apis/retrieval'; import { createOpenAITextStream } from '$lib/apis/streaming'; import { queryMemory } from '$lib/apis/memories'; import { getAndUpdateUserLocation, getUserSettings } from '$lib/apis/users'; diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 0a10d5393..2ca0c8d20 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -17,7 +17,8 @@ import { blobToFile, findWordIndices } from '$lib/utils'; import { transcribeAudio } from '$lib/apis/audio'; - import { processDocToVectorDB } from '$lib/apis/rag'; + + import { processFile } from '$lib/apis/retrieval'; import { uploadFile } from '$lib/apis/files'; import { @@ -158,7 +159,7 @@ const processFileItem = async (fileItem) => { try { - const res = await processDocToVectorDB(localStorage.token, fileItem.id); + const res = await processFile(localStorage.token, fileItem.id); if (res) { fileItem.status = 'processed'; fileItem.collection_name = res.collection_name; diff --git a/src/lib/components/workspace/Documents.svelte b/src/lib/components/workspace/Documents.svelte index 38f46f745..bba4af10f 100644 --- a/src/lib/components/workspace/Documents.svelte +++ b/src/lib/components/workspace/Documents.svelte @@ -8,7 +8,7 @@ import { createNewDoc, deleteDocByName, getDocs } from '$lib/apis/documents'; import { SUPPORTED_FILE_TYPE, SUPPORTED_FILE_EXTENSIONS } from '$lib/constants'; - import { processDocToVectorDB, uploadDocToVectorDB } from '$lib/apis/rag'; + import { processFile } from '$lib/apis/rag'; import { blobToFile, transformFileName } from '$lib/utils'; import Checkbox from '$lib/components/common/Checkbox.svelte'; @@ -74,7 +74,7 @@ return null; }); - const res = await processDocToVectorDB(localStorage.token, uploadedFile.id).catch((error) => { + const res = await processFile(localStorage.token, uploadedFile.id).catch((error) => { toast.error(error); return null; }); diff --git a/src/lib/utils/rag/index.ts b/src/lib/utils/rag/index.ts index ba1f29f88..6523bb7df 100644 --- a/src/lib/utils/rag/index.ts +++ b/src/lib/utils/rag/index.ts @@ -1,4 +1,4 @@ -import { getRAGTemplate } from '$lib/apis/rag'; +import { getRAGTemplate } from '$lib/apis/retrieval'; export const RAGTemplate = async (token: string, context: string, query: string) => { let template = await getRAGTemplate(token).catch(() => {