fix: harden WeKnora knowledge permissions and details

This commit is contained in:
吉鑫升 committed 2026-08-12 15:45:28 +08:00
1 parent e0c09f6704
commit b4d076a2d4
20 files changed
+1713 -298

No files matched your search

@@ -76,6 +76,31 @@ class MemoryLlmWikiStore(LlmWikiStore):
row["updated_at"] = _now()
return dict(row)
async def adopt_conversation_deposit_mapping(
self,
mapping_id: str,
*,
name: str,
description: str,
) -> dict[str, Any] | None:
row = self._rows.get(mapping_id)
if row is None:
return None
now = _now()
row.update(
{
"owner_user_id": "system",
"name": name,
"description": description,
"publication_status": "published",
"published_by": "system",
"reviewed_by": None,
"published_at": row.get("published_at") or now,
"updated_at": now,
}
)
return dict(row)
async def delete_mapping(self, mapping_id: str) -> bool:
return self._rows.pop(mapping_id, None) is not None
@@ -118,7 +143,11 @@ class MemoryLlmWikiStore(LlmWikiStore):
async def get_conversation_deposit_mapping(self) -> dict[str, Any] | None:
for row in self._rows.values():
if row.get("name") == "对话沉淀" and row.get("publication_status") == "published":
if (
row.get("owner_user_id") == "system"
and row.get("name") == "对话沉淀"
and row.get("publication_status") == "published"
):
return dict(row)
return None