perf: completion chatId

This commit is contained in:
archer
2023-07-23 20:07:35 +08:00
parent b7d18e38d1
commit 67e10d6f2c
35 changed files with 447 additions and 385 deletions

View File

@@ -65,12 +65,12 @@ export const useChatStore = create<State>()(
},
async delHistory(chatId) {
set((state) => {
state.history = state.history.filter((item) => item._id !== chatId);
state.history = state.history.filter((item) => item.chatId !== chatId);
});
await delChatHistoryById(chatId);
},
updateHistory(history) {
const index = get().history.findIndex((item) => item._id === history._id);
const index = get().history.findIndex((item) => item.chatId === history.chatId);
set((state) => {
const newHistory = (() => {
if (index > -1) {