Notas en frontend funcionando y pudiendo subir mas por sus endpoints
This commit is contained in:
@@ -33,8 +33,8 @@ def generar_tabla_nota_para_biblioteca(biblioteca_nombre: str, vector_dim: int,
|
||||
Column("conexiones", String),
|
||||
Column("texto", String),
|
||||
Column("resumen", String),
|
||||
Column("vector", Vector(vector_dim), nullable=False),
|
||||
Column("vector_resumen", Vector(vector_dim), nullable=True), # AHORA ES OPCIONAL
|
||||
Column("vector", Vector(vector_dim), nullable=True),
|
||||
Column("vector_resumen", Vector(vector_dim), nullable=True),
|
||||
)
|
||||
|
||||
class NotaModel:
|
||||
@@ -46,9 +46,12 @@ def generar_tabla_nota_para_biblioteca(biblioteca_nombre: str, vector_dim: int,
|
||||
self.texto = nota.texto
|
||||
self.resumen = nota.resumen
|
||||
self.vector = nota.vector
|
||||
self.vector_resumen = getattr(nota, "vector_resumen", None) # AHORA ES OPCIONAL
|
||||
self.vector_resumen = getattr(nota, "vector_resumen", None)
|
||||
|
||||
# Evitar mapear dos veces la misma clase
|
||||
if NotaModel not in mapper_registry._class_registry.values():
|
||||
mapper_registry.map_imperatively(NotaModel, tabla)
|
||||
|
||||
mapper_registry.map_imperatively(NotaModel, tabla)
|
||||
return tabla, NotaModel
|
||||
|
||||
|
||||
@@ -79,7 +82,7 @@ class NotaMapper:
|
||||
conexiones=model.conexiones.split(",") if model.conexiones else [],
|
||||
texto=model.texto,
|
||||
resumen=model.resumen,
|
||||
vector=list(model.vector),
|
||||
vector=list(model.vector) if model.vector is not None else None,
|
||||
vector_resumen=list(model.vector_resumen) if model.vector_resumen is not None else None
|
||||
)
|
||||
|
||||
@@ -89,6 +92,8 @@ class NotaMapper:
|
||||
|
||||
class NotaRepo:
|
||||
def __init__(self, session: Session, modelo_nota):
|
||||
if modelo_nota is None:
|
||||
raise ValueError("No se puede instanciar NotaRepo sin un modelo válido de nota.")
|
||||
self.session = session
|
||||
self.ModeloNota = modelo_nota
|
||||
|
||||
|
||||
Reference in New Issue
Block a user