mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-19 19:35:08 +08:00
fix: new session should insert at top
This commit is contained in:
@@ -130,11 +130,14 @@ export function Chat() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
latestMessageRef.current?.scrollIntoView(false);
|
latestMessageRef.current?.scrollIntoView({
|
||||||
|
behavior: "smooth",
|
||||||
|
block: "end",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.chat}>
|
<div className={styles.chat} key={session.topic}>
|
||||||
<div className={styles["chat-header"]}>
|
<div className={styles["chat-header"]}>
|
||||||
<div>
|
<div>
|
||||||
<div className={styles["chat-header-title"]}>{session.topic}</div>
|
<div className={styles["chat-header-title"]}>{session.topic}</div>
|
||||||
|
@@ -106,8 +106,8 @@ export const useChatStore = create<ChatStore>()(
|
|||||||
|
|
||||||
newSession() {
|
newSession() {
|
||||||
set((state) => ({
|
set((state) => ({
|
||||||
currentSessionIndex: state.sessions.length,
|
currentSessionIndex: 0,
|
||||||
sessions: state.sessions.concat([createEmptySession()]),
|
sessions: [createEmptySession()].concat(state.sessions),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user