feat: Enhance AI Knowledge sync process with full sync mode and attachment handling

This commit is contained in:
bsiggel
2026-03-12 22:35:48 +00:00
parent 6bf2343a12
commit 8f1533337c
3 changed files with 27 additions and 9 deletions

View File

@@ -69,11 +69,8 @@ async def handler(input_data: None, ctx: FlowContext[Any]) -> None:
'topic': 'aiknowledge.sync',
'data': {
'knowledge_id': entity['id'],
'source': 'daily_full_sync'
}
})
ctx.logger.info(
'source': 'daily_full_sync',
'full_sync': True # Enable Blake3 verification
f"📤 [{i}/{total}] Enqueued: {entity['name']} "
f"(syncStatus={entity.get('syncStatus')})"
)

View File

@@ -36,6 +36,7 @@ async def handler(event_data: Dict[str, Any], ctx: FlowContext[Any]) -> None:
# Extract data
knowledge_id = event_data.get('knowledge_id')
source = event_data.get('source', 'unknown')
full_sync = event_data.get('full_sync', False) # Blake3 verification mode
if not knowledge_id:
ctx.logger.error("❌ Missing knowledge_id in event data")
@@ -43,6 +44,7 @@ async def handler(event_data: Dict[str, Any], ctx: FlowContext[Any]) -> None:
ctx.logger.info(f"📋 Knowledge ID: {knowledge_id}")
ctx.logger.info(f"📋 Source: {source}")
ctx.logger.info(f"📋 Full Sync Mode: {full_sync}")
ctx.logger.info("=" * 80)
# Get Redis for locking
@@ -61,7 +63,7 @@ async def handler(event_data: Dict[str, Any], ctx: FlowContext[Any]) -> None:
try:
# Perform sync
await sync_utils.sync_knowledge_to_xai(knowledge_id, ctx)
await sync_utils.sync_knowledge_to_xai(knowledge_id, ctx, full_sync=full_sync)
ctx.logger.info("=" * 80)
ctx.logger.info("✅ AI KNOWLEDGE SYNC COMPLETED")