This commit is contained in:
amb
2026-09-01 13:57:34 +08:00
parent dfd38c99a0
commit 4db2d1a411
23 changed files with 2496 additions and 140 deletions
+5 -1
View File
@@ -163,9 +163,12 @@ def kb_index_html(
doc_url = f"/k/{token}/doc/{decrypt_token(doc.doc_token_encrypted) if doc.doc_token_encrypted else ''}"
keywords_html = f'<span class="keywords">关键词:{doc.keywords}</span>' if doc.keywords else ""
summary_html = f'<p class="summary">{doc.content_summary or ""}</p>' if doc.content_summary else ""
status_badge = ""
if doc.status != "READY":
status_badge = f' <span class="status-badge">[{doc.status}]</span>'
doc_rows += f"""
<div class="doc-item">
<h3><a href="{doc_url}">{doc.title or doc.original_filename}</a></h3>
<h3><a href="{doc_url}">{doc.title or doc.original_filename}</a>{status_badge}</h3>
<p class="meta">类型:{doc.file_ext} | 更新:{doc.updated_at}</p>
{summary_html}
{keywords_html}
@@ -195,6 +198,7 @@ def kb_index_html(
.summary {{ color: #444; font-size: 0.95em; margin: 5px 0; }}
.keywords {{ color: #888; font-size: 0.85em; }}
.pagination {{ color: #666; font-size: 0.9em; text-align: center; }}
.status-badge {{ color: #e67e22; font-size: 0.8em; font-weight: normal; }}
.footer {{ margin-top: 30px; padding-top: 15px; border-top: 1px solid #eee; color: #999; font-size: 0.85em; }}
</style>
</head>
+2 -2
View File
@@ -29,9 +29,9 @@ class KbPublicService:
def list_documents(
self, kb: KnowledgeBase, *, page: int = 1, page_size: int = 50
) -> tuple[list[Document], int]:
"""获取知识库的文档列表(仅 READY 状态)。"""
"""获取知识库的文档列表(排除 DELETED)。"""
return self._doc_repo.list_by_knowledge_base(
kb.id, page=page, page_size=page_size, status="READY"
kb.id, page=page, page_size=page_size
)
def get_document_by_token(self, kb: KnowledgeBase, doc_token: str) -> Document: