MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / KBDocument

Class KBDocument

astrbot/core/knowledge_base/models.py:59–90  ·  view source on GitHub ↗

文档表 存储上传到知识库的文档元数据。

Source from the content-addressed store, hash-verified

57
58
59class KBDocument(BaseKBModel, table=True):
60 """文档表
61
62 存储上传到知识库的文档元数据。
63 """
64
65 __tablename__ = "kb_documents" # type: ignore
66
67 id: int | None = Field(
68 primary_key=True,
69 sa_column_kwargs={"autoincrement": True},
70 default=None,
71 )
72 doc_id: str = Field(
73 max_length=36,
74 nullable=False,
75 unique=True,
76 default_factory=lambda: str(uuid.uuid4()),
77 index=True,
78 )
79 kb_id: str = Field(max_length=36, nullable=False, index=True)
80 doc_name: str = Field(max_length=255, nullable=False)
81 file_type: str = Field(max_length=20, nullable=False)
82 file_size: int = Field(nullable=False)
83 file_path: str = Field(max_length=512, nullable=False)
84 chunk_count: int = Field(default=0, nullable=False)
85 media_count: int = Field(default=0, nullable=False)
86 created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
87 updated_at: datetime = Field(
88 default_factory=lambda: datetime.now(timezone.utc),
89 sa_column_kwargs={"onupdate": datetime.now(timezone.utc)},
90 )
91
92
93class KBMedia(BaseKBModel, table=True):

Callers 2

core_lifecycle_tdFunction · 0.90
upload_documentMethod · 0.85

Calls 1

nowMethod · 0.80

Tested by 1

core_lifecycle_tdFunction · 0.72