昇腾社区首页
中文
注册

ChunkModel类

上传文档时,chunk_id和向量数据库中的id一致。

class ChunkModel(Base):
    __tablename__ = "chunks_table"

    chunk_id = Column(Integer, primary_key=True, comment="主键ID", autoincrement="auto")
    document_id = Column(Integer, comment="文档ID")
    document_name = Column(String(255), comment="文档名称")
    chunk_content = Column(TEXT, comment="文本内容")
    chunk_metadata = Column(JSON, comment="元数据")
    create_time = Column(DateTime(timezone=True), server_default=text("CURRENT_TIMESTAMP"), comment="创建时间")
    __table_args__ = (
        Index('ix_document_id', 'document_id'),
        Index('ix_create_time', 'create_time')
    )