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

+4
View File
@@ -29,6 +29,7 @@ from app.core.auth import CHAT_MANAGE_PERMISSIONS, get_current_user, has_any_per
from app.database import get_db
from app.services.chat_notifications import notify_chat_assigned
from app.services.human_routing import notify_customer, route_session_to_human
from app.services.agent_rooms import notify_conversation_changed
from app.models.schemas.chat import ChatDetailResponse, TransferReasonType
@@ -131,6 +132,7 @@ async def takeover_chat(
# Let the customer know a human joined (external channels only), before
# the detail is read back so the notice is part of the returned thread.
await _notify_customer_of_handover(db, session, current_user)
await notify_conversation_changed(current_user.organization_id, session_id)
# Get updated chat details
chat = await chat_repo.get_chat_detail(
@@ -187,6 +189,7 @@ async def route_chat_to_human(
if not routed:
raise HTTPException(
status_code=400, detail="This chat is already waiting for a human")
await notify_conversation_changed(current_user.organization_id, session_id)
chat = await ChatRepository(db).get_chat_detail(
session_id=session_id,
@@ -249,6 +252,7 @@ async def reassign_chat(
success = session_repo.reassign_session(session_id=session_id, to_user_id=to_user_id)
if not success:
raise HTTPException(status_code=400, detail="Failed to reassign chat")
await notify_conversation_changed(current_user.organization_id, session_id)
# Fetch updated chat detail
chat_repo = ChatRepository(db)