From 7a5c35baf3e5102c6cc9859589a10af6c911480c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E9=97=A8?= Date: Tue, 28 Mar 2023 18:48:03 +0800 Subject: [PATCH 01/14] fix: hide actions when loading --- app/components/home.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 2526f2325..696061690 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -314,7 +314,7 @@ export function Chat(props: { showSideBar?: () => void }) { )}
- {!isUser && ( + {(!isUser && !message.preview) && (
{message.streaming ? (
Date: Tue, 28 Mar 2023 18:59:03 +0800 Subject: [PATCH 02/14] fix: hide actions when loading --- app/components/home.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 696061690..7123d5d50 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -314,7 +314,7 @@ export function Chat(props: { showSideBar?: () => void }) {
)}
- {(!isUser && !message.preview) && ( + {(!isUser && !(message.preview || message.content.length === 0)) && (
{message.streaming ? (
Date: Tue, 28 Mar 2023 19:38:18 +0800 Subject: [PATCH 03/14] fix: minor fix --- app/components/home.module.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/components/home.module.scss b/app/components/home.module.scss index 730c05ef2..6fb44dea4 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -292,6 +292,7 @@ position: absolute; right: 20px; top: -26px; + left: 110px; transition: all ease 0.3s; opacity: 0; pointer-events: none; @@ -302,6 +303,7 @@ .chat-message-top-action { opacity: 0.5; color: var(--black); + white-space: nowrap; cursor: pointer; &:hover { From 1c017b8ee9119f0829fe59fc8ef0867d47ab21d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E9=97=A8?= Date: Tue, 28 Mar 2023 20:14:44 +0800 Subject: [PATCH 04/14] fix: minor fix --- app/components/home.module.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/home.module.scss b/app/components/home.module.scss index 6fb44dea4..8b26c6f74 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -292,7 +292,7 @@ position: absolute; right: 20px; top: -26px; - left: 110px; + left: 100px; transition: all ease 0.3s; opacity: 0; pointer-events: none; From f979822508b3289237383082a72471f8aa5b0939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BC=8F=E6=99=93?= Date: Tue, 28 Mar 2023 14:37:44 +0800 Subject: [PATCH 05/14] feat: add font size setting --- app/components/home.tsx | 2 ++ app/components/settings.tsx | 20 ++++++++++++++++++++ app/locales/cn.ts | 4 ++++ app/locales/en.ts | 4 ++++ app/locales/tw.ts | 4 ++++ app/store/app.ts | 3 ++- 6 files changed, 36 insertions(+), 1 deletion(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 828ee1916..d25b5f5cb 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -178,6 +178,7 @@ export function Chat(props: { showSideBar?: () => void }) { state.currentSession(), state.currentSessionIndex, ]); + const fontSize = useChatStore((state) => state.config.fontSize); const inputRef = useRef(null); const [userInput, setUserInput] = useState(""); @@ -406,6 +407,7 @@ export function Chat(props: { showSideBar?: () => void }) { ) : (
onRightClick(e, message)} > diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 2eb8a0665..44a67dd56 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -226,6 +226,26 @@ export function Settings(props: { closeSettings: () => void }) { + + + updateConfig( + (config) => + (config.fontSize = Number.parseInt(e.currentTarget.value)) + ) + } + > + +
`当前版本:${x}`, IsLatest: "已是最新版本", diff --git a/app/locales/en.ts b/app/locales/en.ts index 8eb379c2b..8d0701fab 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -55,6 +55,10 @@ const en: LocaleType = { }, }, Avatar: "Avatar", + FontSize: { + Title: "Font Size", + SubTitle: "Adjust font size of chat content", + }, Update: { Version: (x: string) => `Version: ${x}`, IsLatest: "Latest version", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index 65145d898..58c077e1d 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -53,6 +53,10 @@ const tw: LocaleType = { }, }, Avatar: "大頭貼", + FontSize: { + Title: "字型大小", + SubTitle: "聊天內容的字型大小", + }, Update: { Version: (x: string) => `當前版本:${x}`, IsLatest: "已是最新版本", diff --git a/app/store/app.ts b/app/store/app.ts index 6759afb80..8a978c0a4 100644 --- a/app/store/app.ts +++ b/app/store/app.ts @@ -31,12 +31,12 @@ export enum Theme { } export interface ChatConfig { - maxToken?: number; historyMessageCount: number; // -1 means all compressMessageLengthThreshold: number; sendBotMessages: boolean; // send bot's message or not submitKey: SubmitKey; avatar: string; + fontSize: number; theme: Theme; tightBorder: boolean; @@ -123,6 +123,7 @@ const DEFAULT_CONFIG: ChatConfig = { sendBotMessages: true as boolean, submitKey: SubmitKey.CtrlEnter as SubmitKey, avatar: "1f603", + fontSize: 14, theme: Theme.Auto as Theme, tightBorder: false, From 71f119c9e8b545a27683f935c3ce36cf56c913ec Mon Sep 17 00:00:00 2001 From: iSource Date: Wed, 29 Mar 2023 15:45:31 +0800 Subject: [PATCH 06/14] fix: mobile textarea autofocus ui error --- app/components/home.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 828ee1916..c2ead8c18 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -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(); @@ -444,7 +444,7 @@ export function Chat(props: { showSideBar?: () => void }) { setAutoScroll(false); setTimeout(() => setPromptHints([]), 100); }} - autoFocus + autoFocus={!props?.sideBarShowing} /> } @@ -646,7 +646,7 @@ export function Home() { }} /> ) : ( - setShowSideBar(true)} /> + setShowSideBar(true)} sideBarShowing={showSideBar} /> )}
From ca0082856af03c0dfdb22409bb0a87eb6280574c Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Wed, 29 Mar 2023 16:06:22 +0800 Subject: [PATCH 07/14] Update settings.tsx --- app/components/settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 }) { > Date: Wed, 29 Mar 2023 17:19:30 +0800 Subject: [PATCH 08/14] feat: supports the display of line breaks in Markdown --- app/components/home.tsx | 2 +- app/components/markdown.tsx | 1 + app/locales/cn.ts | 2 +- app/locales/en.ts | 3 +-- app/locales/tw.ts | 2 +- app/styles/markdown.scss | 3 +++ 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 828ee1916..accf76a42 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) || 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/locales/cn.ts b/app/locales/cn.ts index 0c81c75dd..12abb6c36 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -17,7 +17,7 @@ const cn = { Retry: "重试", }, Typing: "正在输入…", - Input: (submitKey: string) => `输入消息,${submitKey} 发送`, + Input: (submitKey: string) => `输入消息,${submitKey} 发送, Shift + Enter 换行`, Send: "发送", }, Export: { diff --git a/app/locales/en.ts b/app/locales/en.ts index 8eb379c2b..2daf418a2 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -20,8 +20,7 @@ const en: LocaleType = { Retry: "Retry", }, Typing: "Typing…", - Input: (submitKey: string) => - `Type something and press ${submitKey} to send`, + Input: (submitKey: string) => `Type something and press ${submitKey} to send, press Shift + Enter to newline`, Send: "Send", }, Export: { diff --git a/app/locales/tw.ts b/app/locales/tw.ts index 65145d898..a5f79011a 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -19,7 +19,7 @@ const tw: LocaleType = { Retry: "重試", }, Typing: "正在輸入…", - Input: (submitKey: string) => `輸入訊息後,按下 ${submitKey} 鍵即可發送`, + Input: (submitKey: string) => `輸入訊息後,按下 ${submitKey} 鍵即可發送, Shift + Enter 鍵換行`, 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; +} From 974c455bf9a20f4595dcb30d03e7247a43688250 Mon Sep 17 00:00:00 2001 From: RugerMc <550279039@qq.com> Date: Wed, 29 Mar 2023 17:53:52 +0800 Subject: [PATCH 09/14] feat: display line break hints in enter mode --- app/locales/cn.ts | 10 +++++++++- app/locales/en.ts | 9 ++++++++- app/locales/tw.ts | 9 ++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 12abb6c36..8449c2957 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -1,3 +1,5 @@ +import { SubmitKey } from "../store/app"; + const cn = { WIP: "该功能仍在开发中……", Error: { @@ -17,7 +19,13 @@ const cn = { Retry: "重试", }, Typing: "正在输入…", - Input: (submitKey: string) => `输入消息,${submitKey} 发送, Shift + Enter 换行`, + 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 2daf418a2..a5a6d1b16 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,7 +21,13 @@ const en: LocaleType = { Retry: "Retry", }, Typing: "Typing…", - Input: (submitKey: string) => `Type something and press ${submitKey} to send, press Shift + Enter to newline`, + 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 a5f79011a..49598dd1b 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} 鍵即可發送, Shift + Enter 鍵換行`, + Input: (submitKey: string) => { + var inputHints = `輸入訊息後,按下 ${submitKey} 鍵即可發送`; + if (submitKey === String(SubmitKey.Enter)) { + inputHints += ", Shift + Enter 鍵換行"; + } + return inputHints; + }, Send: "發送", }, Export: { From cac604aee3e77a6d8b23fc4f7f2828ee49629c65 Mon Sep 17 00:00:00 2001 From: HimiCos Date: Wed, 29 Mar 2023 19:31:34 +0800 Subject: [PATCH 10/14] chore: standardize input box punctuation --- app/locales/cn.ts | 2 +- app/locales/tw.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/locales/cn.ts b/app/locales/cn.ts index d65e36e17..b93ec859b 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -22,7 +22,7 @@ const cn = { Input: (submitKey: string) => { var inputHints = `输入消息,${submitKey} 发送`; if (submitKey === String(SubmitKey.Enter)) { - inputHints += ", Shift + Enter 换行"; + inputHints += ",Shift + Enter 换行"; } return inputHints; }, diff --git a/app/locales/tw.ts b/app/locales/tw.ts index 5899fa994..29f5ec22a 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -23,7 +23,7 @@ const tw: LocaleType = { Input: (submitKey: string) => { var inputHints = `輸入訊息後,按下 ${submitKey} 鍵即可發送`; if (submitKey === String(SubmitKey.Enter)) { - inputHints += ", Shift + Enter 鍵換行"; + inputHints += ",Shift + Enter 鍵換行"; } return inputHints; }, From 380f818285d2a0add330d50fe4df4c08e4819649 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Wed, 29 Mar 2023 20:00:23 +0800 Subject: [PATCH 11/14] fix: #159 temperature should range 0 - 2 --- app/components/settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 06a8db235..241cebae6 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -389,7 +389,7 @@ export function Settings(props: { closeSettings: () => void }) { type="range" value={config.modelConfig.temperature.toFixed(1)} min="0" - max="1" + max="2" step="0.1" onChange={(e) => { updateConfig( From c47e90004ad7b34f8d70b9bb8cf1cac17219d23c Mon Sep 17 00:00:00 2001 From: GOWxx Date: Wed, 29 Mar 2023 20:37:21 +0800 Subject: [PATCH 12/14] fix: send button covering the text in the textarea --- app/components/home.module.scss | 2 +- app/components/home.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/home.module.scss b/app/components/home.module.scss index c1b08d25c..fb96bd451 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -410,7 +410,7 @@ background-color: var(--white); color: var(--black); font-family: inherit; - padding: 10px 14px; + padding: 10px 14px 50px; resize: none; outline: none; } diff --git a/app/components/home.tsx b/app/components/home.tsx index 55376dfd7..909e54068 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -206,6 +206,11 @@ export function Chat(props: { showSideBar?: () => void, sideBarShowing?: boolean // only search prompts when user input is short const SEARCH_TEXT_LIMIT = 30; const onInput = (text: string) => { + const textareaDom = inputRef.current + if (textareaDom) { + const paddingBottomNum: number = parseInt(window.getComputedStyle(textareaDom).paddingBottom, 10); + textareaDom.scrollTop = textareaDom.scrollHeight - textareaDom.offsetHeight + paddingBottomNum; + } setUserInput(text); const n = text.trim().length; if (n === 0 || n > SEARCH_TEXT_LIMIT) { From 752c083905d642b964b87fcf599faf4a6f4f8f2a Mon Sep 17 00:00:00 2001 From: HimiCos Date: Wed, 29 Mar 2023 20:53:23 +0800 Subject: [PATCH 13/14] fix: dialog height --- app/components/markdown.tsx | 1 - app/styles/markdown.scss | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index 17e04231f..6e0e6d867 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -34,7 +34,6 @@ export function Markdown(props: { content: string }) { components={{ pre: PreCode, }} - className="line-break" > {props.content} diff --git a/app/styles/markdown.scss b/app/styles/markdown.scss index 579f91c59..107c1b80d 100644 --- a/app/styles/markdown.scss +++ b/app/styles/markdown.scss @@ -1116,7 +1116,4 @@ .markdown-body ::-webkit-calendar-picker-indicator { filter: invert(50%); -} -.markdown-body .line-break { - white-space: pre-wrap; -} +} \ No newline at end of file From be4706d02db66df2f08b927b2db12f1d38517b12 Mon Sep 17 00:00:00 2001 From: gtang8 <74369627+gtang8@users.noreply.github.com> Date: Wed, 29 Mar 2023 21:18:31 +0800 Subject: [PATCH 14/14] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a6f9d5fa8..b18028d78 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ One-Click to deploy your own ChatGPT web UI. [演示 Demo](https://chat-gpt-next-web.vercel.app/) / [反馈 Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [加入 Discord](https://discord.gg/zrhvHCr79N) / [QQ 群](https://user-images.githubusercontent.com/16968934/228190818-7dd00845-e9b9-4363-97e5-44c507ac76da.jpeg) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) @@ -40,7 +40,7 @@ One-Click to deploy your own ChatGPT web UI. 1. 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys); 2. 点击右侧按钮开始部署: - [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web),直接使用 Github 账号登陆即可,记得在环境变量页填入 API Key; + [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web),直接使用 Github 账号登陆即可,记得在环境变量页填入 API Key; 3. 部署完毕后,即可开始使用; 4. (可选)[绑定自定义域名](https://vercel.com/docs/concepts/projects/domains/add-a-domain):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。 @@ -48,7 +48,7 @@ One-Click to deploy your own ChatGPT web UI. 1. Get [OpenAI API Key](https://platform.openai.com/account/api-keys); 2. Click - [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web); + [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web); 3. Enjoy :) ## 保持更新 Keep Updated