Changes Documents - llm and languagefields on tenant, processing on documents

first version of Adding Documents (excl. embeddings)
This commit is contained in:
Josako
2024-05-02 00:12:27 +02:00
parent 8e4e4d8586
commit 659588deab
17 changed files with 331 additions and 51 deletions

View File

@@ -55,6 +55,12 @@ class DocumentVersion(db.Model):
updated_at = db.Column(db.DateTime, nullable=False, server_default=db.func.now(), onupdate=db.func.now())
updated_by = db.Column(db.Integer, db.ForeignKey(User.id))
# Processing Information
processing = db.Column(db.Boolean, nullable=False, default=False)
processing_started_at = db.Column(db.DateTime, nullable=True)
processing_finished_at = db.Column(db.DateTime, nullable=True)
processing_error = db.Column(db.String(255), nullable=True)
# Relations
embeddings = db.relationship('EmbeddingMistral', backref='document_version', lazy=True)
@@ -62,7 +68,7 @@ class DocumentVersion(db.Model):
return f"<DocumentVersion {self.document_language.document_id}.{self.document_language.language}>.{self.id}>"
def calc_file_location(self):
return f"{self.document_language.document.tenant.id}/{self.document_language.document.id}/{self.document_language.language}"
return f"{self.document_language.document.tenant_id}/{self.document_language.document.id}/{self.document_language.language}"
def calc_file_name(self):
return f"{self.id}.{self.file_type}"