diff --git a/app/components/home.tsx b/app/components/home.tsx
index eece6c67b..1c2bae296 100644
--- a/app/components/home.tsx
+++ b/app/components/home.tsx
@@ -128,7 +128,7 @@ function useSubmitHandler() {
const shouldSubmit = (e: KeyboardEvent) => {
if (e.key !== "Enter") return false;
-
+
return (
(config.submitKey === SubmitKey.AltEnter && e.altKey) ||
(config.submitKey === SubmitKey.CtrlEnter && e.ctrlKey) ||
@@ -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 };
const chatStore = useChatStore();
@@ -446,7 +446,7 @@ export function Chat(props: { showSideBar?: () => void }) {
setAutoScroll(false);
setTimeout(() => setPromptHints([]), 100);
}}
- autoFocus
+ autoFocus={!props?.sideBarShowing}
/>
}
@@ -648,7 +648,7 @@ export function Home() {
}}
/>
) : (
- setShowSideBar(true)} />
+ setShowSideBar(true)} sideBarShowing={showSideBar} />
)}
diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx
index 6e0e6d867..17e04231f 100644
--- a/app/components/markdown.tsx
+++ b/app/components/markdown.tsx
@@ -34,6 +34,7 @@ export function Markdown(props: { content: string }) {
components={{
pre: PreCode,
}}
+ className="line-break"
>
{props.content}
diff --git a/app/components/settings.tsx b/app/components/settings.tsx
index 44a67dd56..06a8db235 100644
--- a/app/components/settings.tsx
+++ b/app/components/settings.tsx
@@ -232,7 +232,7 @@ export function Settings(props: { closeSettings: () => void }) {
>
`输入消息,${submitKey} 发送`,
+ Input: (submitKey: string) => {
+ var inputHints = `输入消息,${submitKey} 发送`;
+ if (submitKey === String(SubmitKey.Enter)) {
+ inputHints += ", Shift + Enter 换行";
+ }
+ return inputHints;
+ },
Send: "发送",
},
Export: {
diff --git a/app/locales/en.ts b/app/locales/en.ts
index 8d0701fab..d16893725 100644
--- a/app/locales/en.ts
+++ b/app/locales/en.ts
@@ -1,3 +1,4 @@
+import { SubmitKey } from "../store/app";
import type { LocaleType } from "./index";
const en: LocaleType = {
@@ -20,8 +21,13 @@ const en: LocaleType = {
Retry: "Retry",
},
Typing: "Typing…",
- Input: (submitKey: string) =>
- `Type something and press ${submitKey} to send`,
+ Input: (submitKey: string) => {
+ var inputHints = `Type something and press ${submitKey} to send`;
+ if (submitKey === String(SubmitKey.Enter)) {
+ inputHints += ", press Shift + Enter to newline";
+ }
+ return inputHints;
+ },
Send: "Send",
},
Export: {
diff --git a/app/locales/tw.ts b/app/locales/tw.ts
index 58c077e1d..5899fa994 100644
--- a/app/locales/tw.ts
+++ b/app/locales/tw.ts
@@ -1,3 +1,4 @@
+import { SubmitKey } from "../store/app";
import type { LocaleType } from "./index";
const tw: LocaleType = {
@@ -19,7 +20,13 @@ const tw: LocaleType = {
Retry: "重試",
},
Typing: "正在輸入…",
- Input: (submitKey: string) => `輸入訊息後,按下 ${submitKey} 鍵即可發送`,
+ Input: (submitKey: string) => {
+ var inputHints = `輸入訊息後,按下 ${submitKey} 鍵即可發送`;
+ if (submitKey === String(SubmitKey.Enter)) {
+ inputHints += ", Shift + Enter 鍵換行";
+ }
+ return inputHints;
+ },
Send: "發送",
},
Export: {
diff --git a/app/styles/markdown.scss b/app/styles/markdown.scss
index 0a6b3bc56..579f91c59 100644
--- a/app/styles/markdown.scss
+++ b/app/styles/markdown.scss
@@ -1117,3 +1117,6 @@
.markdown-body ::-webkit-calendar-picker-indicator {
filter: invert(50%);
}
+.markdown-body .line-break {
+ white-space: pre-wrap;
+}