Build lightweight AI agent admin
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"""
|
||||
知识库标注模型(Q&A 对)
|
||||
|
||||
手动添加的高优先级问答对,检索时优先匹配。
|
||||
"""
|
||||
from sqlalchemy import Column, String, Text, Integer, Boolean, Index
|
||||
|
||||
from app.base_model import BaseModel
|
||||
|
||||
|
||||
class KnowledgeAnnotation(BaseModel):
|
||||
"""
|
||||
知识库标注(Q&A 对)
|
||||
|
||||
用户手动添加的问答对,检索时优先匹配 question,返回 answer。
|
||||
"""
|
||||
__tablename__ = "ai_knowledge_annotation"
|
||||
|
||||
knowledge_base_id = Column(String(21), nullable=False, index=True, comment="所属知识库ID(逻辑外键关联ai_knowledge_base)")
|
||||
|
||||
# Q&A 内容
|
||||
question = Column(Text, nullable=False, comment="问题")
|
||||
answer = Column(Text, nullable=False, comment="答案")
|
||||
|
||||
# 向量化状态
|
||||
embedding_status = Column(String(20), default="pending", comment="向量化状态: pending/completed/failed")
|
||||
|
||||
# 状态
|
||||
enabled = Column(Boolean, default=True, comment="是否启用")
|
||||
hit_count = Column(Integer, default=0, comment="命中次数")
|
||||
|
||||
__table_args__ = (
|
||||
Index('idx_annotation_kb_enabled', 'knowledge_base_id', 'enabled'),
|
||||
)
|
||||
Reference in New Issue
Block a user