|
@@ -0,0 +1,41 @@
|
|
|
+from sqlalchemy import Column, Integer, String, DateTime, Text, BigInteger
|
|
|
+from datetime import datetime
|
|
|
+from .db import Base
|
|
|
+
|
|
|
+
|
|
|
+class KnowledgeParsingContent(Base):
|
|
|
+ __tablename__ = 'knowledge_parsing_content'
|
|
|
+ __table_args__ = {
|
|
|
+ 'comment': '内容解析表'
|
|
|
+ }
|
|
|
+
|
|
|
+ id = Column(BigInteger, primary_key=True, autoincrement=True)
|
|
|
+ content_id = Column(String(128), nullable=False)
|
|
|
+ request_id = Column(String(128), nullable=False)
|
|
|
+ task_id = Column(BigInteger, nullable=False)
|
|
|
+ parsing_data = Column(Text, comment='结构化数据')
|
|
|
+ create_time = Column(DateTime, default=datetime.now)
|
|
|
+ status = Column(Integer, default=0, comment='0: 未开始,1:处理中 2: 处理完成 3:处理失败')
|
|
|
+ indentify_data = Column(Text, comment='理解的数据')
|
|
|
+
|
|
|
+ def __repr__(self):
|
|
|
+ return f"<KnowledgeParsingContent(id={self.id}, content_id={self.content_id}, status={self.status})>"
|
|
|
+
|
|
|
+class KnowledgeExtractionContent(Base):
|
|
|
+ __tablename__ = 'knowledge_extraction_content'
|
|
|
+ __table_args__ = (
|
|
|
+ Index('idx_request_id', 'request_id'), # 创建索引
|
|
|
+ {'comment': '内容抽取表'}
|
|
|
+ )
|
|
|
+
|
|
|
+ id = Column(BigInteger, primary_key=True, autoincrement=True)
|
|
|
+ request_id = Column(String(128), nullable=False)
|
|
|
+ parsing_id = Column(BigInteger, nullable=False)
|
|
|
+ score = Column(Integer, default=-1)
|
|
|
+ reason = Column(Text, comment='打分原因')
|
|
|
+ data = Column(Text, comment='结构化数据')
|
|
|
+ create_at = Column(DateTime, default=datetime.now)
|
|
|
+ status = Column(Integer, default=0, comment='0: 未开始,1:处理中 2: 处理完成 3:处理失败')
|
|
|
+
|
|
|
+ def __repr__(self):
|
|
|
+ return f"<KnowledgeExtractionContent(id={self.id}, request_id={self.request_id}, status={self.status})>"
|