This commit is contained in:
Timothy J. Baek 2024-09-28 01:35:31 +02:00
parent 5b7cf88915
commit a52e8cd537
7 changed files with 14 additions and 13 deletions

View File

@ -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:

View File

@ -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

View File

@ -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',

View File

@ -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';

View File

@ -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;

View File

@ -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;
});

View File

@ -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(() => {