From d9fc9cd198e8e090907c7109bd31326eae85ef3e Mon Sep 17 00:00:00 2001 From: angular-moon Date: Thu, 30 Mar 2023 10:16:00 +0800 Subject: [PATCH 1/7] onUserSubmit hide promptHints --- app/components/home.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index a44e5f16e..10f58ebe8 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -102,7 +102,7 @@ export function ChatList() { state.currentSessionIndex, state.selectSession, state.removeSession, - ], + ] ); return ( @@ -196,7 +196,7 @@ export function Chat(props: { setPromptHints(promptStore.search(text)); }, 100, - { leading: true, trailing: true }, + { leading: true, trailing: true } ); const onPromptSelect = (prompt: Prompt) => { @@ -210,7 +210,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; }; @@ -239,6 +239,7 @@ export function Chat(props: { setIsLoading(true); chatStore.onUserInput(userInput).then(() => setIsLoading(false)); setUserInput(""); + setPromptHints([]); inputRef.current?.focus(); }; @@ -299,7 +300,7 @@ export function Chat(props: { preview: true, }, ] - : [], + : [] ) .concat( userInput.length > 0 @@ -311,7 +312,7 @@ export function Chat(props: { preview: true, }, ] - : [], + : [] ); // auto scroll @@ -339,7 +340,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!) ); } }} @@ -584,7 +585,7 @@ export function Home() { state.newSession, state.currentSessionIndex, state.removeSession, - ], + ] ); const loading = !useHasHydrated(); const [showSideBar, setShowSideBar] = useState(true); From d5235c81d0bf4c15e173eabdafc846d56f1a75ed Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 11:21:44 +0800 Subject: [PATCH 2/7] Update README.md --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 022fada7b..bebb6378e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,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) +[演示 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) / [Donate](#捐赠-donate-usdt) [![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) @@ -179,6 +179,12 @@ The free trial of the OpenAI account used by the demo will expire on April 1, 20 If you would like to contribute your API key, you can email it to the author and indicate the expiration date of the API key. +## 捐赠 Donate USDT +> BNB Smart Chain (BEP 20) +``` +0x67cD02c7EB62641De576a1fA3EdB32eA0c3ffD89 +``` + ## 鸣谢 Special Thanks ### 捐赠者 Sponsor From 8d6d6bbf5ded956dd567e71212ce44a6a73de290 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 11:22:27 +0800 Subject: [PATCH 3/7] Update README.md --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index bebb6378e..5952aa33a 100644 --- a/README.md +++ b/README.md @@ -169,15 +169,6 @@ docker run -d -p 3000:3000 -e OPENAI_API_KEY="" -e CODE="" yidadaa/chatgpt-next- ![更多展示 More](./static/more.png) -## 说明 Attention - -本项目的演示地址所用的 OpenAI 账户的免费额度将于 2023-04-01 过期,届时将无法通过演示地址在线体验。 - -如果你想贡献出自己的 API Key,可以通过作者主页的邮箱发送给作者,并标注过期时间。 - -The free trial of the OpenAI account used by the demo will expire on April 1, 2023, and the demo will not be available at that time. - -If you would like to contribute your API key, you can email it to the author and indicate the expiration date of the API key. ## 捐赠 Donate USDT > BNB Smart Chain (BEP 20) From 2c5420ab9e8cdb86bda5b14cbdae35d4653d054e Mon Sep 17 00:00:00 2001 From: RugerMc <550279039@qq.com> Date: Thu, 30 Mar 2023 12:48:38 +0800 Subject: [PATCH 4/7] feat: import ramarkBreaks plugin --- app/components/markdown.tsx | 3 ++- package.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index 6e0e6d867..6d3cd0bf6 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -1,6 +1,7 @@ import ReactMarkdown from "react-markdown"; import "katex/dist/katex.min.css"; import RemarkMath from "remark-math"; +import RemarkBreaks from "remark-breaks"; import RehypeKatex from "rehype-katex"; import RemarkGfm from "remark-gfm"; import RehypePrsim from "rehype-prism-plus"; @@ -29,7 +30,7 @@ export function PreCode(props: { children: any }) { export function Markdown(props: { content: string }) { return ( Date: Thu, 30 Mar 2023 12:51:37 +0800 Subject: [PATCH 5/7] Support multi-arch docker build --- .github/workflows/docker.yml | 35 +++++++++++++++++++++++++++-------- Dockerfile | 2 +- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5b2520eb9..5baad6d1c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,6 +1,7 @@ name: Publish Docker image on: + workflow_dispatch: release: types: [published] @@ -9,25 +10,43 @@ jobs: name: Push Docker image to Docker Hub runs-on: ubuntu-latest steps: - - name: Check out the repo + - + name: Check out the repo uses: actions/checkout@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + - + name: Log in to Docker Hub + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Extract metadata (tags, labels) for Docker + - + name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v4 with: images: yidadaa/chatgpt-next-web + tags: | + type=raw,value=latest + type=semver,pattern={{version}} - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - + name: Build and push Docker image + uses: docker/build-push-action@v4 with: context: . + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 314d6c365..f97618e70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ WORKDIR /app COPY package.json yarn.lock* package-lock.json* ./ RUN \ - if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ + if [ -f yarn.lock ]; then yarn install --frozen-lockfile --network-timeout 100000; \ elif [ -f package-lock.json ]; then npm ci; \ else echo "Lockfile not found." && exit 1; \ fi From e68aaf24f13d5b4b6931bb1edd0b57ab67bbf9fa Mon Sep 17 00:00:00 2001 From: leedom Date: Thu, 30 Mar 2023 15:22:10 +0800 Subject: [PATCH 6/7] feat: setUserInput with onDoubleClickCapture in mobile phone --- app/components/home.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 10f58ebe8..7ccc4a3b5 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -102,7 +102,7 @@ export function ChatList() { state.currentSessionIndex, state.selectSession, state.removeSession, - ] + ], ); return ( @@ -196,7 +196,7 @@ export function Chat(props: { setPromptHints(promptStore.search(text)); }, 100, - { leading: true, trailing: true } + { leading: true, trailing: true }, ); const onPromptSelect = (prompt: Prompt) => { @@ -210,7 +210,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; }; @@ -300,7 +300,7 @@ export function Chat(props: { preview: true, }, ] - : [] + : [], ) .concat( userInput.length > 0 @@ -312,7 +312,7 @@ export function Chat(props: { preview: true, }, ] - : [] + : [], ); // auto scroll @@ -340,7 +340,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!), ); } }} @@ -439,6 +439,7 @@ export function Chat(props: { className="markdown-body" style={{ fontSize: `${fontSize}px` }} onContextMenu={(e) => onRightClick(e, message)} + onDoubleClickCapture={() => setUserInput(message.content)} > @@ -585,7 +586,7 @@ export function Home() { state.newSession, state.currentSessionIndex, state.removeSession, - ] + ], ); const loading = !useHasHydrated(); const [showSideBar, setShowSideBar] = useState(true); From 6e4e804af8a0483a58960d028f55e811f0d502d3 Mon Sep 17 00:00:00 2001 From: Leedom <30711792+leedom92@users.noreply.github.com> Date: Thu, 30 Mar 2023 15:32:03 +0800 Subject: [PATCH 7/7] Update home.tsx --- app/components/home.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 7ccc4a3b5..da65b1d63 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -102,7 +102,7 @@ export function ChatList() { state.currentSessionIndex, state.selectSession, state.removeSession, - ], + ] ); return ( @@ -196,7 +196,7 @@ export function Chat(props: { setPromptHints(promptStore.search(text)); }, 100, - { leading: true, trailing: true }, + { leading: true, trailing: true } ); const onPromptSelect = (prompt: Prompt) => { @@ -210,7 +210,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; }; @@ -300,7 +300,7 @@ export function Chat(props: { preview: true, }, ] - : [], + : [] ) .concat( userInput.length > 0 @@ -312,7 +312,7 @@ export function Chat(props: { preview: true, }, ] - : [], + : [] ); // auto scroll @@ -340,7 +340,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!) ); } }} @@ -586,7 +586,7 @@ export function Home() { state.newSession, state.currentSessionIndex, state.removeSession, - ], + ] ); const loading = !useHasHydrated(); const [showSideBar, setShowSideBar] = useState(true);