HH-598: hide unavailable AI takeover (#155)
* fix(HH-598): hide unavailable AI takeover * fix: isolate inbox assistant availability --------- Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { computed } from 'vue';
|
||||
import { computed, watch } from 'vue';
|
||||
import { useStore } from 'vuex';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useKeyboardEvents } from 'dashboard/composables/useKeyboardEvents';
|
||||
@@ -61,6 +61,17 @@ export default {
|
||||
const store = useStore();
|
||||
const { t } = useI18n();
|
||||
const currentChat = useMapGetter('getSelectedChat');
|
||||
const inboxAssistant = useMapGetter('getCopilotAssistant');
|
||||
|
||||
watch(
|
||||
() => props.conversationId,
|
||||
conversationId => {
|
||||
if (conversationId) {
|
||||
store.dispatch('getInboxCaptainAssistantById', conversationId);
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const setReplyMode = mode => {
|
||||
emit('setReplyMode', mode);
|
||||
@@ -89,6 +100,9 @@ export default {
|
||||
const aiTakeoverActive = computed(
|
||||
() => currentChat.value?.ai_takeover_active === true
|
||||
);
|
||||
const aiTakeoverAvailable = computed(
|
||||
() => Boolean(inboxAssistant.value?.id) || aiTakeoverActive.value
|
||||
);
|
||||
|
||||
const toggleAITakeover = async () => {
|
||||
try {
|
||||
@@ -129,6 +143,7 @@ export default {
|
||||
captainTasksEnabled,
|
||||
handleCopilotAction,
|
||||
aiTakeoverActive,
|
||||
aiTakeoverAvailable,
|
||||
toggleAITakeover,
|
||||
};
|
||||
},
|
||||
@@ -177,6 +192,7 @@ export default {
|
||||
class="flex w-full flex-shrink-0 flex-wrap items-center justify-end gap-2 sm:w-auto sm:flex-nowrap"
|
||||
>
|
||||
<NextButton
|
||||
v-if="aiTakeoverAvailable"
|
||||
type="button"
|
||||
:label="
|
||||
aiTakeoverActive
|
||||
|
||||
Reference in New Issue
Block a user