Merge branch 'Yidadaa:main' into main

This commit is contained in:
Dogtiti 2023-04-01 18:08:03 +08:00 committed by GitHub
commit 93a1f4dad3
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.selectSession,
state.removeSession,
],
]
);
return (
@ -123,7 +123,7 @@ export function ChatList() {
key={i}
selected={i === selectedIndex}
onClick={() => selectSession(i)}
onDelete={() => removeSession(i)}
onDelete={() => confirm(Locale.Home.DeleteChat) && removeSession(i)}
/>
))}
</div>
@ -204,7 +204,7 @@ export function Chat(props: {
setPromptHints(promptStore.search(text));
},
100,
{ leading: true, trailing: true },
{ leading: true, trailing: true }
);
const onPromptSelect = (prompt: Prompt) => {
@ -218,7 +218,7 @@ export function Chat(props: {
if (!dom) return;
const paddingBottomNum: number = parseInt(
window.getComputedStyle(dom).paddingBottom,
10,
10
);
dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum;
};
@ -306,7 +306,7 @@ export function Chat(props: {
preview: true,
},
]
: [],
: []
)
.concat(
userInput.length > 0
@ -318,7 +318,7 @@ export function Chat(props: {
preview: true,
},
]
: [],
: []
);
// auto scroll
@ -359,7 +359,7 @@ export function Chat(props: {
const newTopic = prompt(Locale.Chat.Rename, session.topic);
if (newTopic && newTopic !== session.topic) {
chatStore.updateCurrentSession(
(session) => (session.topic = newTopic!),
(session) => (session.topic = newTopic!)
);
}
}}
@ -476,7 +476,10 @@ export function Chat(props: {
className="markdown-body"
style={{ fontSize: `${fontSize}px` }}
onContextMenu={(e) => onRightClick(e, message)}
onDoubleClickCapture={() => setUserInput(message.content)}
onDoubleClickCapture={() => {
if (!isMobileScreen()) return;
setUserInput(message.content);
}}
>
<Markdown content={message.content} />
</div>
@ -493,7 +496,7 @@ export function Chat(props: {
</div>
);
})}
<div ref={latestMessageRef} style={{ opacity: 0, height: "4em" }}>
<div ref={latestMessageRef} style={{ opacity: 0, height: "1px" }}>
-
</div>
</div>
@ -647,7 +650,7 @@ export function Home() {
state.newSession,
state.currentSessionIndex,
state.removeSession,
],
]
);
const loading = !useHasHydrated();
const [showSideBar, setShowSideBar] = useState(true);