Revert "(fix:indexes) look for the right path"

This reverts commit 5ad34e2216.
This commit is contained in:
ManishMadan2882
2025-04-23 00:52:22 +05:30
parent 5ad34e2216
commit 24c8b24b1f
4 changed files with 34 additions and 128 deletions

View File

@@ -1,6 +1,5 @@
import os
import datetime
import logging
from flask import Blueprint, request, send_from_directory
from werkzeug.utils import secure_filename
from bson.objectid import ObjectId
@@ -47,7 +46,7 @@ def upload_index_files():
sync_frequency = secure_filename(request.form["sync_frequency"]) if "sync_frequency" in request.form else None
storage = StorageCreator.create_storage(settings.STORAGE_TYPE)
if settings.VECTOR_STORE == "faiss":
if "file_faiss" not in request.files:
print("No file part")
@@ -61,18 +60,13 @@ def upload_index_files():
file_pkl = request.files["file_pkl"]
if file_pkl.filename == "":
return {"status": "no file name"}
# Save index files
storage_path_faiss = f"indexes/{str(id)}/index.faiss"
storage_path_pkl = f"indexes/{str(id)}/index.pkl"
try:
storage.save_file(file_faiss, storage_path_faiss)
storage.save_file(file_pkl, storage_path_pkl)
logging.info(f"Successfully saved FAISS index files for ID {id}")
except Exception as e:
logging.error(f"Error saving FAISS index files: {e}")
return {"status": "error", "message": str(e)}
storage.save_file(file_faiss, storage_path_faiss)
storage.save_file(file_pkl, storage_path_pkl)
existing_entry = sources_collection.find_one({"_id": ObjectId(id)})
if existing_entry: