knowledge_base.py 1.0 KB

123456789101112131415161718192021222324
  1. """
  2. 知识库数据库模型
  3. """
  4. from sqlalchemy import Column, String, Integer, Text, Boolean
  5. from sqlalchemy.dialects.mysql import CHAR, TINYINT
  6. from app.base.async_mysql_connection import Base
  7. from app.models.base import BaseModel
  8. class KnowledgeBase(BaseModel):
  9. """知识库模型"""
  10. __tablename__ = "t_samp_knowledge_base"
  11. name = Column(String(100), nullable=False, comment="知识库名称")
  12. collection_name = Column(String(100), nullable=False, unique=True, comment="Milvus集合名称(Table Name)")
  13. description = Column(Text, nullable=True, comment="描述")
  14. status = Column(String(20), default="normal", comment="状态: normal(正常), test(测试), disabled(禁用)")
  15. document_count = Column(Integer, default=0, comment="文档数量")
  16. is_deleted = Column(TINYINT, default=0, comment="是否删除")
  17. created_by = Column(String(128), nullable=True, comment="创建人")
  18. updated_by = Column(String(128), nullable=True, comment="修改人")
  19. def __repr__(self):
  20. return f"<KnowledgeBase {self.name}>"