fix: harden WeKnora knowledge permissions and details
This commit is contained in:
1 parent
e0c09f6704
commit
b4d076a2d4
20 files changed
+1713
-298
No files matched your search
@@ -95,6 +95,29 @@ class LlmWikiRepository(LlmWikiStore):
|
||||
await session.commit()
|
||||
return _to_dict(row)
|
||||
|
||||
async def adopt_conversation_deposit_mapping(
|
||||
self,
|
||||
mapping_id: str,
|
||||
*,
|
||||
name: str,
|
||||
description: str,
|
||||
) -> dict[str, Any] | None:
|
||||
async with self._sf() as session:
|
||||
row = await session.get(LlmWikiKnowledgeBaseRow, mapping_id)
|
||||
if row is None:
|
||||
return None
|
||||
now = _now()
|
||||
row.owner_user_id = "system"
|
||||
row.name = name
|
||||
row.description = description
|
||||
row.publication_status = "published"
|
||||
row.published_by = "system"
|
||||
row.reviewed_by = None
|
||||
row.published_at = row.published_at or now
|
||||
row.updated_at = now
|
||||
await session.commit()
|
||||
return _to_dict(row)
|
||||
|
||||
async def delete_mapping(self, mapping_id: str) -> bool:
|
||||
async with self._sf() as session:
|
||||
row = await session.get(LlmWikiKnowledgeBaseRow, mapping_id)
|
||||
@@ -155,6 +178,7 @@ class LlmWikiRepository(LlmWikiStore):
|
||||
stmt = (
|
||||
select(LlmWikiKnowledgeBaseRow)
|
||||
.where(
|
||||
LlmWikiKnowledgeBaseRow.owner_user_id == "system",
|
||||
LlmWikiKnowledgeBaseRow.name == "对话沉淀",
|
||||
LlmWikiKnowledgeBaseRow.publication_status == "published",
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user