feat: Implement AI Knowledge Sync Utilities and Event Handlers
- Added AIKnowledgeActivationStatus and AIKnowledgeSyncStatus enums to models.py for managing activation and sync states. - Introduced AIKnowledgeSync class in aiknowledge_sync_utils.py for synchronizing CAIKnowledge entities with XAI Collections, including collection lifecycle management, document synchronization, and metadata updates. - Created a daily cron job (aiknowledge_full_sync_cron_step.py) to perform a full sync of CAIKnowledge entities. - Developed an event handler (aiknowledge_sync_event_step.py) to synchronize CAIKnowledge entities with XAI Collections triggered by webhooks and cron jobs. - Implemented a webhook handler (aiknowledge_update_api_step.py) to receive updates from EspoCRM for CAIKnowledge entities and enqueue sync events. - Enhanced xai_service.py with methods for collection management, document listing, and metadata updates.
This commit is contained in:
@@ -68,6 +68,40 @@ class SalutationType(str, Enum):
|
||||
FIRMA = ""
|
||||
|
||||
|
||||
class AIKnowledgeActivationStatus(str, Enum):
|
||||
"""Activation status for CAIKnowledge collections"""
|
||||
NEW = "new" # Collection noch nicht in XAI erstellt
|
||||
ACTIVE = "active" # Collection aktiv, Sync läuft
|
||||
PAUSED = "paused" # Collection existiert, aber kein Sync
|
||||
DEACTIVATED = "deactivated" # Collection aus XAI gelöscht
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.value
|
||||
|
||||
|
||||
class AIKnowledgeSyncStatus(str, Enum):
|
||||
"""Sync status for CAIKnowledge"""
|
||||
UNCLEAN = "unclean" # Änderungen pending
|
||||
PENDING_SYNC = "pending_sync" # Sync läuft (locked)
|
||||
SYNCED = "synced" # Alles synced
|
||||
FAILED = "failed" # Sync fehlgeschlagen
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.value
|
||||
|
||||
|
||||
class JunctionSyncStatus(str, Enum):
|
||||
"""Sync status for junction tables (CAIKnowledgeCDokumente)"""
|
||||
NEW = "new"
|
||||
UNCLEAN = "unclean"
|
||||
SYNCED = "synced"
|
||||
FAILED = "failed"
|
||||
UNSUPPORTED = "unsupported"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.value
|
||||
|
||||
|
||||
# ========== Advoware Models ==========
|
||||
|
||||
class AdvowareBeteiligteBase(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user