forked from XiaoMo/ChatGPT-Next-Web
fix: #641 delete wrong chat list
This commit is contained in:
parent
174c745279
commit
4a492264a1
@ -96,7 +96,7 @@ export function ChatList() {
|
|||||||
index={i}
|
index={i}
|
||||||
selected={i === selectedIndex}
|
selected={i === selectedIndex}
|
||||||
onClick={() => selectSession(i)}
|
onClick={() => selectSession(i)}
|
||||||
onDelete={chatStore.deleteSession}
|
onDelete={() => chatStore.deleteSession(i)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{provided.placeholder}
|
{provided.placeholder}
|
||||||
|
@ -127,6 +127,7 @@
|
|||||||
width: 100vw;
|
width: 100vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
.toast-content {
|
.toast-content {
|
||||||
max-width: 80vw;
|
max-width: 80vw;
|
||||||
@ -141,6 +142,7 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
pointer-events: all;
|
||||||
|
|
||||||
.toast-action {
|
.toast-action {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
|
@ -156,7 +156,7 @@ export function showToast(
|
|||||||
};
|
};
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
close();
|
// close();
|
||||||
}, delay);
|
}, delay);
|
||||||
|
|
||||||
root.render(<Toast content={content} action={action} />);
|
root.render(<Toast content={content} action={action} />);
|
||||||
|
@ -205,7 +205,7 @@ interface ChatStore {
|
|||||||
moveSession: (from: number, to: number) => void;
|
moveSession: (from: number, to: number) => void;
|
||||||
selectSession: (index: number) => void;
|
selectSession: (index: number) => void;
|
||||||
newSession: () => void;
|
newSession: () => void;
|
||||||
deleteSession: () => void;
|
deleteSession: (index?: number) => void;
|
||||||
currentSession: () => ChatSession;
|
currentSession: () => ChatSession;
|
||||||
onNewMessage: (message: Message) => void;
|
onNewMessage: (message: Message) => void;
|
||||||
onUserInput: (content: string) => Promise<void>;
|
onUserInput: (content: string) => Promise<void>;
|
||||||
@ -326,9 +326,9 @@ export const useChatStore = create<ChatStore>()(
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteSession() {
|
deleteSession(i?: number) {
|
||||||
const deletedSession = get().currentSession();
|
const deletedSession = get().currentSession();
|
||||||
const index = get().currentSessionIndex;
|
const index = i ?? get().currentSessionIndex;
|
||||||
const isLastSession = get().sessions.length === 1;
|
const isLastSession = get().sessions.length === 1;
|
||||||
if (!isMobileScreen() || confirm(Locale.Home.DeleteChat)) {
|
if (!isMobileScreen() || confirm(Locale.Home.DeleteChat)) {
|
||||||
get().removeSession(index);
|
get().removeSession(index);
|
||||||
|
Loading…
Reference in New Issue
Block a user