Update home.tsx

This commit is contained in:
Leedom 2023-04-02 02:54:46 +08:00 committed by GitHub
parent bce020fc8e
commit ad8e09d188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,7 +110,7 @@ export function ChatList() {
state.currentSessionIndex, state.currentSessionIndex,
state.selectSession, state.selectSession,
state.removeSession, state.removeSession,
], ]
); );
return ( return (
@ -210,7 +210,7 @@ export function Chat(props: {
setPromptHints(promptStore.search(text)); setPromptHints(promptStore.search(text));
}, },
100, 100,
{ leading: true, trailing: true }, { leading: true, trailing: true }
); );
const onPromptSelect = (prompt: Prompt) => { const onPromptSelect = (prompt: Prompt) => {
@ -224,7 +224,7 @@ export function Chat(props: {
if (!dom) return; if (!dom) return;
const paddingBottomNum: number = parseInt( const paddingBottomNum: number = parseInt(
window.getComputedStyle(dom).paddingBottom, window.getComputedStyle(dom).paddingBottom,
10, 10
); );
dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum; dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum;
}; };
@ -320,7 +320,7 @@ export function Chat(props: {
preview: true, preview: true,
}, },
] ]
: [], : []
) )
.concat( .concat(
userInput.length > 0 userInput.length > 0
@ -332,7 +332,7 @@ export function Chat(props: {
preview: true, preview: true,
}, },
] ]
: [], : []
); );
// auto scroll // auto scroll
@ -370,7 +370,7 @@ export function Chat(props: {
const newTopic = prompt(Locale.Chat.Rename, session.topic); const newTopic = prompt(Locale.Chat.Rename, session.topic);
if (newTopic && newTopic !== session.topic) { if (newTopic && newTopic !== session.topic) {
chatStore.updateCurrentSession( chatStore.updateCurrentSession(
(session) => (session.topic = newTopic!), (session) => (session.topic = newTopic!)
); );
} }
}} }}
@ -618,7 +618,7 @@ export function Home() {
(state) => [ (state) => [
state.newSession, state.newSession,
state.currentSessionIndex, state.currentSessionIndex,
state.removeSession, state.removeSession
], ],
); );
const loading = !useHasHydrated(); const loading = !useHasHydrated();