From 55f37248f7dc7be70a30daa39f902e3dfc7adf17 Mon Sep 17 00:00:00 2001 From: iSource Date: Tue, 28 Mar 2023 10:50:50 +0800 Subject: [PATCH 01/82] fix: code copy button position --- app/styles/markdown.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/styles/markdown.scss b/app/styles/markdown.scss index d90555a5..ec2052c4 100644 --- a/app/styles/markdown.scss +++ b/app/styles/markdown.scss @@ -839,7 +839,7 @@ .markdown-body .highlight pre, .markdown-body pre { - padding: 16px; + padding: 16px 16px 8px 16px; overflow: auto; font-size: 85%; line-height: 1.45; @@ -849,11 +849,11 @@ .markdown-body pre code, .markdown-body pre tt { - display: inline; - max-width: auto; + display: inline-block; + max-width: 100%; padding: 0; margin: 0; - overflow: visible; + overflow-x: scroll; line-height: inherit; word-wrap: normal; background-color: transparent; From 306f0850e925bd75201085341eb6700dac8a4ca2 Mon Sep 17 00:00:00 2001 From: iSource Date: Tue, 28 Mar 2023 11:25:47 +0800 Subject: [PATCH 02/82] feat: add robots.txt --- public/robots.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 public/robots.txt diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 00000000..d4fc2a4b --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: / +User-agent: vitals.vercel-insights.com +Allow: / \ No newline at end of file From 684a3c41efb1ec4f975aec365ed8e9bffbb4159c Mon Sep 17 00:00:00 2001 From: AprilNEA Date: Tue, 28 Mar 2023 11:51:36 +0800 Subject: [PATCH 03/82] fix: fix #82, close sidebar after new session --- app/components/home.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 2526f232..8396438a 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -561,7 +561,10 @@ export function Home() { } text={Locale.Home.NewChat} - onClick={createNewSession} + onClick={()=>{ + createNewSession(); + setShowSideBar(false); + }} /> From d822f333c2e7291b21217e7fa3933adbd773aa47 Mon Sep 17 00:00:00 2001 From: xiaotianxt Date: Tue, 28 Mar 2023 00:22:33 +0800 Subject: [PATCH 04/82] feat(SubmitKey): add MetaEnter option Add another option for MacOS user who prefer Cmd+Enter or Linux user who prefer Meta+Enter. --- app/components/home.tsx | 1 + app/store/app.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/app/components/home.tsx b/app/components/home.tsx index 8396438a..9c7e45f1 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -131,6 +131,7 @@ function useSubmitHandler() { (config.submitKey === SubmitKey.AltEnter && e.altKey) || (config.submitKey === SubmitKey.CtrlEnter && e.ctrlKey) || (config.submitKey === SubmitKey.ShiftEnter && e.shiftKey) || + (config.submitKey === SubmitKey.MetaEnter && e.metaKey) || (config.submitKey === SubmitKey.Enter && !e.altKey && !e.ctrlKey && diff --git a/app/store/app.ts b/app/store/app.ts index 703078ad..d7ff2ff7 100644 --- a/app/store/app.ts +++ b/app/store/app.ts @@ -21,6 +21,7 @@ export enum SubmitKey { CtrlEnter = "Ctrl + Enter", ShiftEnter = "Shift + Enter", AltEnter = "Alt + Enter", + MetaEnter = "Meta + Enter", } export enum Theme { From a2807c9815d88febad341e23b55f553e73234c27 Mon Sep 17 00:00:00 2001 From: xiaotianxt Date: Tue, 28 Mar 2023 01:26:49 +0800 Subject: [PATCH 05/82] fix(scroll): scroll after click submit button The behavior of SubmitKey and SubmitButton should be the same --- app/components/home.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 9c7e45f1..74434eb0 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -204,9 +204,21 @@ export function Chat(props: { showSideBar?: () => void }) { // for auto-scroll const latestMessageRef = useRef(null); + const inputPanelRef = useRef(null); // wont scroll while hovering messages const [autoScroll, setAutoScroll] = useState(false); + useEffect(() => { + const handleMouseDown = (e: MouseEvent) => { + // check if click on input panel + setAutoScroll( + !!inputPanelRef.current && + inputPanelRef.current.contains(e.target as HTMLElement) + ); + }; + document.addEventListener("mousedown", handleMouseDown); + return () => document.removeEventListener("mousedown", handleMouseDown); + }); // preview messages const messages = (session.messages as RenderMessage[]) @@ -369,7 +381,7 @@ export function Chat(props: { showSideBar?: () => void }) { -
+