Commit bfc192a3 by Sixong.Zhu

update

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