fix(conversations): sync AI takeover exit in realtime (#6)

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-13 01:28:31 +08:00
committed by GitHub
co-authored by rogee
parent d0995798f4
commit 0555b296cc
7 changed files with 83 additions and 6 deletions
@@ -891,7 +891,6 @@ export default {
);
if (sentMessage?.ai_takeover_exited) {
useAlert(this.$t('CONVERSATION.AI_TAKEOVER.EXIT_SUCCESS'));
await this.$store.dispatch('getConversation', this.conversationId);
}
emitter.emit(BUS_EVENTS.SCROLL_TO_MESSAGE);
emitter.emit(BUS_EVENTS.MESSAGE_SENT);
@@ -160,4 +160,22 @@ describe('ActionCableConnector - Copilot Tests', () => {
expect(mockDispatch).toHaveBeenCalledTimes(2);
});
});
it('updates AI takeover state from conversation.updated', () => {
const conversation = {
id: 42,
account_id: 1,
ai_takeover_active: false,
};
actionCable.onReceived({
event: 'conversation.updated',
data: conversation,
});
expect(mockDispatch).toHaveBeenCalledWith(
'updateConversation',
conversation
);
});
});