Commit bfc192a3 by Sixong.Zhu

update

parent 2f3001c9
......@@ -112,8 +112,7 @@
private get currentChat() {
const chatId = this.chatId;
if (this.myChatList == null) return;
const result = this.myChatList.list.find((k) => k.chat_id === chatId);
const result = this.myChatList.find((k) => k.chat_id === chatId);
return result ?? {};
}
......
......@@ -136,7 +136,7 @@ export default {
[ChatStore.STATE_CHAT_CURRENT_USER_UID]: null,
[ChatStore.STATE_CHAT_MSG_HISTORY]: null,
[ChatStore.STATE_CHAT_SENDING_MESSAGES]: [],
[ChatStore.STATE_MY_CHAT_ROOM_LIST]: null,
[ChatStore.STATE_MY_CHAT_ROOM_LIST]: [],
[ChatStore.STATE_SINGLE_CHAT]: null,
[ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION]: null,
[ChatStore.STATE_CHAT_CURRENT_CHAT_ID]: null,
......@@ -429,10 +429,7 @@ export default {
};
if (cache && cache.length) {
commit(ChatStore.MUTATION_SAVE_CHAT_LIST, {
list: cache,
total: 9999,
});
commit(ChatStore.MUTATION_SAVE_CHAT_LIST, cache);
const ts = cache
.map((i) => Math.max(i.last_msg_ts, i.update_time))
.sort();
......@@ -473,10 +470,7 @@ export default {
buildChatItem(chat)
);
dbController.saveChatList(items);
commit(ChatStore.MUTATION_SAVE_CHAT_LIST, {
list: items,
total: 9999,
});
commit(ChatStore.MUTATION_SAVE_CHAT_LIST, items);
resolve(buildUnreadMessage(items));
});
});
......@@ -739,8 +733,9 @@ export default {
if (!chatId) {
return;
}
const chatList =
state[ChatStore.STATE_MY_CHAT_ROOM_LIST]?.list ?? [];
const chatList = state[
ChatStore.STATE_MY_CHAT_ROOM_LIST
] as ChatType[];
let wantedChatRoom = chatList.find((k) => k.chat_id === chatId);
if (!wantedChatRoom) {
......@@ -864,7 +859,7 @@ export default {
})
.execute();
await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST);
const firstChat = state[ChatStore.STATE_MY_CHAT_ROOM_LIST]?.list[0];
const firstChat = state[ChatStore.STATE_MY_CHAT_ROOM_LIST][0];
if (firstChat == null) return;
await getChatModelInfo(
firstChat.model_name,
......@@ -1103,8 +1098,7 @@ export default {
if (singleChat && singleChat.chat_id === chatId) {
return singleChat;
}
const chatList =
state[ChatStore.STATE_MY_CHAT_ROOM_LIST]?.list ?? [];
const chatList = state[ChatStore.STATE_MY_CHAT_ROOM_LIST];
return chatList.find((chat) => chat.chat_id === chatId);
},
},
......
......@@ -20,10 +20,7 @@ export namespace ChatStore {
export const STATE_CHAT_DIALOG_IS_SINGLE = "会话模块是否是单个弹窗";
export type STATE_CHAT_DIALOG_IS_SINGLE = boolean;
export const STATE_MY_CHAT_ROOM_LIST = "我的会话列表";
export type STATE_MY_CHAT_ROOM_LIST = {
list: ChatType[];
total: number;
} | null;
export type STATE_MY_CHAT_ROOM_LIST = ChatType[];
export const STATE_SINGLE_CHAT = "单独的会话";
export type STATE_SINGLE_CHAT = ChatType | null;
export const STATE_CHAT_MSG_HISTORY = "某个会话聊天记录";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment