fix: #1363 session index after deleting

This commit is contained in:
Yidadaa
2023-05-09 23:36:30 +08:00
parent 7e8def50aa
commit 6d9abf11b8
3 changed files with 13 additions and 3 deletions

View File

@@ -180,8 +180,9 @@ export const useChatStore = create<ChatStore>()(
const sessions = get().sessions.slice();
sessions.splice(index, 1);
const currentIndex = get().currentSessionIndex;
let nextIndex = Math.min(
get().currentSessionIndex,
currentIndex - Number(index < currentIndex),
sessions.length - 1,
);