fix: improve maintenance and synchronize live conversations

This commit is contained in:
WangShen007 committed 2026-10-29 09:46:21 +08:00
1 parent bb541bd212
commit ef86a5d3af
297 files changed
+2983 -1274

No files matched your search

+13 -12
View File
@@ -831,18 +831,19 @@ class TicketService:
}, message_id=stored.id, source=MessageSource.SYSTEM)
if not delivery.ok:
chat_repo.mark_delivery_failed(stored.id, delivery.reason)
if ticket.first_response_at is None:
ticket.first_response_at = datetime.now(timezone.utc)
if record_activity:
self._add_activity(
ticket, TicketActivityType.CUSTOMER_NOTIFIED,
actor_type=TicketActorType.SYSTEM,
body=message,
metadata={
"session_id": str(session_record.session_id),
"channel": channel,
},
)
else:
if ticket.first_response_at is None:
ticket.first_response_at = datetime.now(timezone.utc)
if record_activity:
self._add_activity(
ticket, TicketActivityType.CUSTOMER_NOTIFIED,
actor_type=TicketActorType.SYSTEM,
body=message,
metadata={
"session_id": str(session_record.session_id),
"channel": channel,
},
)
except Exception as e:
logger.error(f"Customer notification failed for {ticket.display_number}: {e}")
# Stored but the hand-over itself raised: don't let the thread