feat: Add logging for brain vector creation

This commit is contained in:
Stan Girard 2023-12-13 20:58:01 +01:00
parent 3ed0ea15bb
commit f723f8d729

View File

@ -1,11 +1,14 @@
import time import time
from logger import get_logger
from models import File from models import File
from models.settings import get_supabase_db from models.settings import get_supabase_db
from modules.brain.service.brain_vector_service import BrainVectorService from modules.brain.service.brain_vector_service import BrainVectorService
from packages.embeddings.vectors import Neurons from packages.embeddings.vectors import Neurons
from repository.files.upload_file import DocumentSerializable from repository.files.upload_file import DocumentSerializable
logger = get_logger(__name__)
async def process_file( async def process_file(
file: File, file: File,
@ -39,9 +42,10 @@ async def process_file(
brain_vector_service = BrainVectorService(brain_id) brain_vector_service = BrainVectorService(brain_id)
for created_vector_id in created_vector: for created_vector_id in created_vector:
brain_vector_service.create_brain_vector( result = brain_vector_service.create_brain_vector(
created_vector_id, metadata["file_sha1"] created_vector_id, metadata["file_sha1"]
) )
logger.debug(f"Brain vector created: {result}")
database.set_file_sha_from_metadata(metadata["file_sha1"]) database.set_file_sha_from_metadata(metadata["file_sha1"])