sync update from LAN repo (source dhk-1 @ 3b1ec5b4)

This commit is contained in:
gozeros committed 2026-11-05 10:56:34 +08:00
1 parent da6521b6cb
commit 264e2200d6
995 files changed
+148105 -13399

No files matched your search

@@ -123,6 +123,35 @@ class SqlLlmWikiIndexStore(LlmWikiIndexStore):
async with self._sf() as session:
return [_dict(row) for row in (await session.execute(stmt)).scalars()]
async def list_pages(
self,
mapping_ids: list[str],
*,
limit: int = 500,
include_drafts: bool = False,
) -> list[dict[str, Any]]:
normalized_ids = list(
dict.fromkeys(str(item).strip() for item in mapping_ids if str(item).strip())
)
if not normalized_ids:
return []
statuses = ["published", "draft"] if include_drafts else ["published"]
stmt = (
select(LlmWikiWikiPageRow)
.where(
LlmWikiWikiPageRow.knowledge_base_mapping_id.in_(normalized_ids),
LlmWikiWikiPageRow.is_remote_deleted.is_(False),
LlmWikiWikiPageRow.status.in_(statuses),
)
.order_by(
LlmWikiWikiPageRow.remote_updated_at.desc(),
LlmWikiWikiPageRow.updated_at.desc(),
)
.limit(max(1, min(int(limit), 2000)))
)
async with self._sf() as session:
return [_dict(row) for row in (await session.execute(stmt)).scalars()]
async def replace_graph_edges(
self,
mapping_id: str,