mirror of
https://github.com/aljazceru/enclava.git
synced 2025-12-18 07:54:29 +01:00
mega changes
This commit is contained in:
@@ -15,23 +15,36 @@ class RagCollection(Base):
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String(255), nullable=False, index=True)
|
||||
description = Column(Text, nullable=True)
|
||||
qdrant_collection_name = Column(String(255), nullable=False, unique=True, index=True)
|
||||
|
||||
qdrant_collection_name = Column(
|
||||
String(255), nullable=False, unique=True, index=True
|
||||
)
|
||||
|
||||
# Metadata
|
||||
document_count = Column(Integer, default=0, nullable=False)
|
||||
size_bytes = Column(BigInteger, default=0, nullable=False)
|
||||
vector_count = Column(Integer, default=0, nullable=False)
|
||||
|
||||
|
||||
# Status tracking
|
||||
status = Column(String(50), default='active', nullable=False) # 'active', 'indexing', 'error'
|
||||
status = Column(
|
||||
String(50), default="active", nullable=False
|
||||
) # 'active', 'indexing', 'error'
|
||||
is_active = Column(Boolean, default=True, nullable=False)
|
||||
|
||||
|
||||
# Timestamps
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)
|
||||
|
||||
created_at = Column(
|
||||
DateTime(timezone=True), server_default=func.now(), nullable=False
|
||||
)
|
||||
updated_at = Column(
|
||||
DateTime(timezone=True),
|
||||
server_default=func.now(),
|
||||
onupdate=func.now(),
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
# Relationships
|
||||
documents = relationship("RagDocument", back_populates="collection", cascade="all, delete-orphan")
|
||||
documents = relationship(
|
||||
"RagDocument", back_populates="collection", cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
"""Convert model to dictionary for API responses"""
|
||||
@@ -45,8 +58,8 @@ class RagCollection(Base):
|
||||
"status": self.status,
|
||||
"created_at": self.created_at.isoformat() if self.created_at else None,
|
||||
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
|
||||
"is_active": self.is_active
|
||||
"is_active": self.is_active,
|
||||
}
|
||||
|
||||
def __repr__(self):
|
||||
return f"<RagCollection(id={self.id}, name='{self.name}', documents={self.document_count})>"
|
||||
return f"<RagCollection(id={self.id}, name='{self.name}', documents={self.document_count})>"
|
||||
|
||||
Reference in New Issue
Block a user