feat: H-CITE + H-RET + H-DATA-LIFE — evidence references in ask_knowledge, knowledge retention ARQ cron job (daily 05:00), re-extraction hook on wiki.article.updated
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
@@ -40,6 +40,22 @@ class KnowledgePlugin(BasePlugin):
|
||||
source_title=title, source_text=content,
|
||||
)
|
||||
register_action("wiki.article.created", on_wiki_create, priority=20, owner_tag="knowledge")
|
||||
# H-DATA-LIFE: Re-extract when wiki article is updated
|
||||
async def on_wiki_update(*args, **kwargs):
|
||||
article_id = kwargs.get("article_id") or kwargs.get("entity_id")
|
||||
tenant_id = kwargs.get("tenant_id")
|
||||
title = kwargs.get("title", "")
|
||||
content = kwargs.get("content", "")
|
||||
if article_id and tenant_id and content:
|
||||
from app.core.db import get_worker_session_factory
|
||||
factory = get_worker_session_factory()
|
||||
async with factory() as session:
|
||||
await extract_knowledge(
|
||||
db=session, tenant_id=uuid.UUID(str(tenant_id)),
|
||||
source_type="wiki_article", source_id=uuid.UUID(str(article_id)),
|
||||
source_title=title, source_text=content,
|
||||
)
|
||||
register_action("wiki.article.updated", on_wiki_update, priority=20, owner_tag="knowledge")
|
||||
logger.info("Registered knowledge extraction hooks")
|
||||
except Exception:
|
||||
logger.exception("Failed to register knowledge hooks")
|
||||
|
||||
Reference in New Issue
Block a user