Merge branch 'Yidadaa:main' into main

This commit is contained in:
wangfang 2023-03-29 18:47:10 +08:00 committed by GitHub
commit aa6f5d0639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 9 deletions

View File

@ -170,7 +170,7 @@ export function PromptHints(props: {
); );
} }
export function Chat(props: { showSideBar?: () => void }) { export function Chat(props: { showSideBar?: () => void, sideBarShowing?: boolean }) {
type RenderMessage = Message & { preview?: boolean }; type RenderMessage = Message & { preview?: boolean };
const chatStore = useChatStore(); const chatStore = useChatStore();
@ -446,7 +446,7 @@ export function Chat(props: { showSideBar?: () => void }) {
setAutoScroll(false); setAutoScroll(false);
setTimeout(() => setPromptHints([]), 100); setTimeout(() => setPromptHints([]), 100);
}} }}
autoFocus autoFocus={!props?.sideBarShowing}
/> />
<IconButton <IconButton
icon={<SendWhiteIcon />} icon={<SendWhiteIcon />}
@ -648,7 +648,7 @@ export function Home() {
}} }}
/> />
) : ( ) : (
<Chat key="chat" showSideBar={() => setShowSideBar(true)} /> <Chat key="chat" showSideBar={() => setShowSideBar(true)} sideBarShowing={showSideBar} />
)} )}
</div> </div>
</div> </div>

View File

@ -34,6 +34,7 @@ export function Markdown(props: { content: string }) {
components={{ components={{
pre: PreCode, pre: PreCode,
}} }}
className="line-break"
> >
{props.content} {props.content}
</ReactMarkdown> </ReactMarkdown>

View File

@ -232,7 +232,7 @@ export function Settings(props: { closeSettings: () => void }) {
> >
<input <input
type="range" type="range"
title={config.fontSize.toString() + 'px'} title={`${config.fontSize ?? 14}px`}
value={config.fontSize} value={config.fontSize}
min="12" min="12"
max="18" max="18"

View File

@ -1,3 +1,5 @@
import { SubmitKey } from "../store/app";
const cn = { const cn = {
WIP: "该功能仍在开发中……", WIP: "该功能仍在开发中……",
Error: { Error: {
@ -17,7 +19,13 @@ const cn = {
Retry: "重试", Retry: "重试",
}, },
Typing: "正在输入…", Typing: "正在输入…",
Input: (submitKey: string) => `输入消息,${submitKey} 发送`, Input: (submitKey: string) => {
var inputHints = `输入消息,${submitKey} 发送`;
if (submitKey === String(SubmitKey.Enter)) {
inputHints += ", Shift + Enter 换行";
}
return inputHints;
},
Send: "发送", Send: "发送",
}, },
Export: { Export: {

View File

@ -1,3 +1,4 @@
import { SubmitKey } from "../store/app";
import type { LocaleType } from "./index"; import type { LocaleType } from "./index";
const en: LocaleType = { const en: LocaleType = {
@ -20,8 +21,13 @@ const en: LocaleType = {
Retry: "Retry", Retry: "Retry",
}, },
Typing: "Typing…", Typing: "Typing…",
Input: (submitKey: string) => Input: (submitKey: string) => {
`Type something and press ${submitKey} to send`, var inputHints = `Type something and press ${submitKey} to send`;
if (submitKey === String(SubmitKey.Enter)) {
inputHints += ", press Shift + Enter to newline";
}
return inputHints;
},
Send: "Send", Send: "Send",
}, },
Export: { Export: {

View File

@ -1,3 +1,4 @@
import { SubmitKey } from "../store/app";
import type { LocaleType } from "./index"; import type { LocaleType } from "./index";
const tw: LocaleType = { const tw: LocaleType = {
@ -19,7 +20,13 @@ const tw: LocaleType = {
Retry: "重試", Retry: "重試",
}, },
Typing: "正在輸入…", Typing: "正在輸入…",
Input: (submitKey: string) => `輸入訊息後,按下 ${submitKey} 鍵即可發送`, Input: (submitKey: string) => {
var inputHints = `輸入訊息後,按下 ${submitKey} 鍵即可發送`;
if (submitKey === String(SubmitKey.Enter)) {
inputHints += ", Shift + Enter 鍵換行";
}
return inputHints;
},
Send: "發送", Send: "發送",
}, },
Export: { Export: {

View File

@ -1117,3 +1117,6 @@
.markdown-body ::-webkit-calendar-picker-indicator { .markdown-body ::-webkit-calendar-picker-indicator {
filter: invert(50%); filter: invert(50%);
} }
.markdown-body .line-break {
white-space: pre-wrap;
}