diff --git a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue index e500e409e..09dba4d93 100644 --- a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue +++ b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue @@ -65,7 +65,7 @@ :is-web-widget-inbox="isAWebWidgetInbox" /> @@ -112,6 +112,7 @@ import conversationMixin, { import inboxMixin from 'shared/mixins/inboxMixin'; import configMixin from 'shared/mixins/configMixin'; import eventListenerMixins from 'shared/mixins/eventListenerMixins'; +import aiMixin from 'dashboard/mixins/aiMixin'; // utils import { getTypingUsersText } from '../../../helper/commons'; @@ -129,7 +130,13 @@ export default { Banner, ConversationLabelSuggestion, }, - mixins: [conversationMixin, inboxMixin, eventListenerMixins, configMixin], + mixins: [ + conversationMixin, + inboxMixin, + eventListenerMixins, + configMixin, + aiMixin, + ], props: { isContactPanelOpen: { type: Boolean, @@ -309,7 +316,7 @@ export default { mounted() { this.addScrollListener(); this.fetchAllAttachmentsFromCurrentChat(); - this.fetchIntegrations(); + this.fetchIntegrationsIfRequired(); }, beforeDestroy() { @@ -321,11 +328,6 @@ export default { fetchAllAttachmentsFromCurrentChat() { this.$store.dispatch('fetchAllAttachments', this.currentChat.id); }, - fetchIntegrations() { - if (!this.appIntegrations.length) { - this.$store.dispatch('integrations/get'); - } - }, removeBusListeners() { bus.$off(BUS_EVENTS.SCROLL_TO_MESSAGE, this.onScrollToMessage); bus.$off(BUS_EVENTS.SET_TWEET_REPLY, this.setSelectedTweet); diff --git a/app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue b/app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue index 5be525d02..364958385 100644 --- a/app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue +++ b/app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue @@ -141,6 +141,7 @@ export default { }, shouldShowSuggestions() { if (this.isDismissed) return false; + if (!this.isAIIntegrationEnabled) return false; return ( !this.fetchingSuggestions && @@ -167,11 +168,11 @@ export default { } this.fetchIntegrationsIfRequired().then(() => { - if (this.isAIIntegrationEnabled) { - this.fetchLabelSuggestion().then(labels => { - this.suggestedLabels = labels; - }); - } + if (!this.isAIIntegrationEnabled) return; + + this.fetchLabelSuggestion().then(labels => { + this.suggestedLabels = labels; + }); }); }, async fetchLabelSuggestion() {