fix: handle unsupported document types in RAGflow sync and improve logging

This commit is contained in:
bsiggel
2026-04-01 12:06:50 +00:00
parent 4026194fc5
commit e30f55b4e5

View File

@@ -684,7 +684,13 @@ async def _run_ragflow_sync(
ctx.logger.info(
f" ⏭️ Nicht unterstützter Dateityp ({mime_type}) übersprungen"
)
if not ragflow_doc_id:
# If doc was previously uploaded to RAGflow (e.g. type changed), remove it
if ragflow_doc_id:
try:
await ragflow.remove_document(dataset_id, ragflow_doc_id)
ctx.logger.info(f" 🗑️ Aus RAGflow entfernt (nicht unterstützt): {ragflow_doc_id}")
except Exception as e:
ctx.logger.warn(f" ⚠️ RAGflow-Löschung fehlgeschlagen: {e}")
await espocrm.update_entity('CDokumente', doc_id, {
'aiSyncStatus': 'unsupported',
'aiLastSync': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),