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