diff --git a/app/components/chat-list.tsx b/app/components/chat-list.tsx index ab5d849f..cab8812c 100644 --- a/app/components/chat-list.tsx +++ b/app/components/chat-list.tsx @@ -96,7 +96,7 @@ export function ChatList() { index={i} selected={i === selectedIndex} onClick={() => selectSession(i)} - onDelete={chatStore.deleteSession} + onDelete={() => chatStore.deleteSession(i)} /> ))} {provided.placeholder} diff --git a/app/components/ui-lib.module.scss b/app/components/ui-lib.module.scss index 67d13d3e..457c5504 100644 --- a/app/components/ui-lib.module.scss +++ b/app/components/ui-lib.module.scss @@ -127,6 +127,7 @@ width: 100vw; display: flex; justify-content: center; + pointer-events: none; .toast-content { max-width: 80vw; @@ -141,6 +142,7 @@ margin-bottom: 20px; display: flex; align-items: center; + pointer-events: all; .toast-action { padding-left: 20px; diff --git a/app/components/ui-lib.tsx b/app/components/ui-lib.tsx index a72aa868..3179b213 100644 --- a/app/components/ui-lib.tsx +++ b/app/components/ui-lib.tsx @@ -156,7 +156,7 @@ export function showToast( }; setTimeout(() => { - close(); + // close(); }, delay); root.render(); diff --git a/app/store/app.ts b/app/store/app.ts index 02fb4b32..7c68547f 100644 --- a/app/store/app.ts +++ b/app/store/app.ts @@ -205,7 +205,7 @@ interface ChatStore { moveSession: (from: number, to: number) => void; selectSession: (index: number) => void; newSession: () => void; - deleteSession: () => void; + deleteSession: (index?: number) => void; currentSession: () => ChatSession; onNewMessage: (message: Message) => void; onUserInput: (content: string) => Promise; @@ -326,13 +326,13 @@ export const useChatStore = create()( })); }, - deleteSession() { + deleteSession(i?: number) { const deletedSession = get().currentSession(); - const index = get().currentSessionIndex; + const index = i ?? get().currentSessionIndex; const isLastSession = get().sessions.length === 1; if (!isMobileScreen() || confirm(Locale.Home.DeleteChat)) { get().removeSession(index); - + showToast(Locale.Home.DeleteToast, { text: Locale.Home.Revert, onClick() {