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:
Rogee
2026-08-24 12:49:46 +08:00
committed by GitHub
co-authored by rogee
parent 907d8ea4e1
commit a7e96afef4
6 changed files with 151 additions and 16 deletions
@@ -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
}