H-16: align takeover with channel AI workflow (#2)

* feat(conversations): complete manual AI takeover

* fix(conversations): align AI takeover flow with channel AI

* fix(conversations): close takeover review gaps

---------

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-12 22:57:06 +08:00
committed by GitHub
co-authored by rogee
parent 4bf6ba6b20
commit 83a8ab315a
31 changed files with 604 additions and 201 deletions
@@ -885,10 +885,14 @@ export default {
copilotAcceptedMessage = ''
) {
try {
await this.$store.dispatch(
const sentMessage = await this.$store.dispatch(
'createPendingMessageAndSend',
messagePayload
);
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);
this.removeFromDraft();
@@ -62,6 +62,29 @@ const showBotHandoffBanner = computed(
currentChat.value?.status === wootConstants.STATUS_TYPE.PENDING
);
const aiTakeoverActive = computed(
() => currentChat.value?.ai_takeover_active === true
);
const toggleAITakeover = async () => {
try {
const wasActive = aiTakeoverActive.value;
const action = wasActive ? 'exitAITakeover' : 'startAITakeover';
await store.dispatch(action, currentChat.value?.id);
useAlert(
t(
wasActive
? 'CONVERSATION.AI_TAKEOVER.EXIT_SUCCESS'
: 'CONVERSATION.AI_TAKEOVER.START_SUCCESS'
)
);
} catch (error) {
useAlert(
error?.response?.data?.error || t('CONVERSATION.AI_TAKEOVER.ERROR')
);
}
};
const botHandoffActionLabel = computed(() => {
return assignedAgent.value?.id === currentUser.value?.id
? t('CONVERSATION.BOT_HANDOFF_REOPEN_ACTION')
@@ -109,6 +132,19 @@ const onClickBotHandoff = async () => {
</script>
<template>
<div class="mx-2 mb-2 flex justify-end">
<button
type="button"
class="rounded-md border border-n-slate-5 px-3 py-1.5 text-sm font-medium text-n-slate-12 hover:bg-n-alpha-2"
@click="toggleAITakeover"
>
{{
aiTakeoverActive
? $t('CONVERSATION.AI_TAKEOVER.EXIT')
: $t('CONVERSATION.AI_TAKEOVER.START')
}}
</button>
</div>
<Banner
v-if="showSelfAssignBanner && !showBotHandoffBanner"
action-button-variant="ghost"
@@ -41,9 +41,7 @@ const assignableAgentsList = useMapGetter(
'inboxAssignableAgents/getAssignableAgents'
);
const assignableAgents = computed(() =>
assignableAgentsList
.value(props.selectedInboxes.join(','))
.filter(agent => agent.assignee_type !== 'AgentBot')
assignableAgentsList.value(props.selectedInboxes.join(','))
);
const agentMenuItems = computed(() => {