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:
@@ -44,6 +44,8 @@ const getStoredMessage = (conversation, message) => {
|
||||
const isNewerMessage = (currentMessage, message) =>
|
||||
isNewerTimestamp(currentMessage?.updated_at, message.updated_at);
|
||||
|
||||
let inboxAssistantRequestId = 0;
|
||||
|
||||
// actions
|
||||
const actions = {
|
||||
getConversation: async ({ commit }, conversationId) => {
|
||||
@@ -56,7 +58,10 @@ const actions = {
|
||||
}
|
||||
},
|
||||
|
||||
fetchAllConversations: async ({ commit, state, dispatch }, explicitFilters) => {
|
||||
fetchAllConversations: async (
|
||||
{ commit, state, dispatch },
|
||||
explicitFilters
|
||||
) => {
|
||||
commit(types.CLEAR_LIST_ERROR_STATUS);
|
||||
commit(types.SET_LIST_LOADING_STATUS);
|
||||
try {
|
||||
@@ -574,9 +579,14 @@ const actions = {
|
||||
},
|
||||
|
||||
getInboxCaptainAssistantById: async ({ commit }, conversationId) => {
|
||||
inboxAssistantRequestId += 1;
|
||||
const requestId = inboxAssistantRequestId;
|
||||
commit(types.SET_INBOX_CAPTAIN_ASSISTANT, { assistant: null });
|
||||
try {
|
||||
const response = await ConversationApi.getInboxAssistant(conversationId);
|
||||
commit(types.SET_INBOX_CAPTAIN_ASSISTANT, response.data);
|
||||
if (requestId === inboxAssistantRequestId) {
|
||||
commit(types.SET_INBOX_CAPTAIN_ASSISTANT, response.data);
|
||||
}
|
||||
} catch (error) {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user