fix: 解决会话列表按最新操作时间倒序排序,当前会话判断失败的bug

This commit is contained in:
李超 2024-08-20 22:21:38 +08:00
parent d0b7ddc1d6
commit 2fdb35bcc8
2 changed files with 2 additions and 2 deletions

View File

@ -345,7 +345,7 @@ export const useChatStore = createPersistStore(
new Date(b.lastUpdate).getTime() - new Date(a.lastUpdate).getTime(), new Date(b.lastUpdate).getTime() - new Date(a.lastUpdate).getTime(),
); );
const currentSessionIndex = sessions.findIndex((session) => { const currentSessionIndex = sessions.findIndex((session) => {
return session && currentSession && session.id === session.id; return session && currentSession && session.id === currentSession.id;
}); });
set((state) => ({ set((state) => ({

View File

@ -150,7 +150,7 @@ const MergeStates: StateMerger = {
localState.currentSessionIndex = localState.sessions.findIndex( localState.currentSessionIndex = localState.sessions.findIndex(
(session) => { (session) => {
return session && currentSession && session.id === session.id; return session && currentSession && session.id === currentSession.id;
}, },
); );