from sqlalchemy import Column, Integer, String, DateTime, func from dev_opsgpt.orm.db import Base class KnowledgeBaseSchema(Base): """ 知识库模型 """ __tablename__ = 'knowledge_base' id = Column(Integer, primary_key=True, autoincrement=True, comment='知识库ID') kb_name = Column(String, comment='知识库名称') vs_type = Column(String, comment='嵌入模型类型') embed_model = Column(String, comment='嵌入模型名称') file_count = Column(Integer, default=0, comment='文件数量') create_time = Column(DateTime, default=func.now(), comment='创建时间') def __repr__(self): return f"""""" class KnowledgeFileSchema(Base): """ 知识文件模型 """ __tablename__ = 'knowledge_file' id = Column(Integer, primary_key=True, autoincrement=True, comment='知识文件ID') file_name = Column(String, comment='文件名') file_ext = Column(String, comment='文件扩展名') kb_name = Column(String, comment='所属知识库名称') document_loader_name = Column(String, comment='文档加载器名称') text_splitter_name = Column(String, comment='文本分割器名称') file_version = Column(Integer, default=1, comment='文件版本') create_time = Column(DateTime, default=func.now(), comment='创建时间') def __repr__(self): return f"""""" class CodeBaseSchema(Base): ''' 代码数据库模型 ''' __tablename__ = 'code_base' id = Column(Integer, primary_key=True, autoincrement=True, comment='代码库 ID') code_name = Column(String, comment='代码库名称') code_path = Column(String, comment='代码本地路径') code_graph_node_num = Column(String, comment='代码图谱节点数') code_file_num = Column(String, comment='代码解析文件数') do_interpret = Column(String, comment='是否代码解读,Y or N') create_time = Column(DateTime, default=func.now(), comment='创建时间') def __repr__(self): return f""""""