diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml
index 38c272e85..52feae50e 100644
--- a/.github/workflows/sync.yml
+++ b/.github/workflows/sync.yml
@@ -5,7 +5,7 @@ permissions:
on:
schedule:
- - cron: "0 */6 * * *" # every 6 hours
+ - cron: "0 * * * *" # every hour
workflow_dispatch:
jobs:
diff --git a/README.md b/README.md
index fef1e1158..b5ab9938c 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel.
一键免费部署你的私人 ChatGPT 网页应用。
-[演示 Demo](https://chat-gpt-next-web.vercel.app/) / [反馈 Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Join 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) / [Join 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) / [Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa)
[](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)
@@ -173,6 +173,8 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s

+## Donation
+[Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa)
## Special Thanks
### Sponsor
@@ -181,6 +183,11 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s
[@ClarenceDan](https://github.com/ClarenceDan)
[@zhangjia](https://github.com/zhangjia)
[@hoochanlon](https://github.com/hoochanlon)
+[@relativequantum](https://github.com/relativequantum)
+[@desenmeng](https://github.com/desenmeng)
+[@webees](https://github.com/webees)
+[@chazzhou](https://github.com/chazzhou)
+[@hauy](https://github.com/hauy)
### Contributor
diff --git a/README_CN.md b/README_CN.md
index cba9df9c5..efd5d56a1 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -11,7 +11,7 @@
[](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web)
-
+
@@ -29,7 +29,7 @@
1. 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys);
2. 点击右侧按钮开始部署:
- [](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;
+ [](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 和[页面访问密码](#配置页面访问密码) CODE;
3. 部署完毕后,即可开始使用;
4. (可选)[绑定自定义域名](https://vercel.com/docs/concepts/projects/domains/add-a-domain):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。
@@ -53,6 +53,8 @@
> 配置密码后,用户需要在设置页手动填写访问码才可以正常聊天,否则会通过消息提示未授权状态。
+> **警告**:请务必将密码的位数设置得足够长,最好 7 位以上,否则[会被爆破](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/518)。
+
本项目提供有限的权限控制功能,请在 Vercel 项目控制面板的环境变量页增加名为 `CODE` 的环境变量,值为用英文逗号分隔的自定义密码:
```
diff --git a/app/api/openai/route.ts b/app/api/openai/route.ts
index 3477fc270..261c20a85 100644
--- a/app/api/openai/route.ts
+++ b/app/api/openai/route.ts
@@ -17,7 +17,7 @@ async function makeRequest(req: NextRequest) {
},
{
status: 500,
- }
+ },
);
}
}
diff --git a/app/components/chat.tsx b/app/components/chat.tsx
index 88e853c4b..d218c7fa4 100644
--- a/app/components/chat.tsx
+++ b/app/components/chat.tsx
@@ -1,4 +1,4 @@
-import { useDebouncedCallback } from "use-debounce";
+import { useDebounce, useDebouncedCallback } from "use-debounce";
import { memo, useState, useRef, useEffect, useLayoutEffect } from "react";
import SendWhiteIcon from "../icons/send-white.svg";
@@ -27,6 +27,7 @@ import {
getEmojiUrl,
isMobileScreen,
selectOrCopy,
+ autoGrowTextArea,
} from "../utils";
import dynamic from "next/dynamic";
@@ -39,7 +40,7 @@ import { IconButton } from "./button";
import styles from "./home.module.scss";
import chatStyle from "./chat.module.scss";
-import { Input, Modal, showModal, showToast } from "./ui-lib";
+import { Input, Modal, showModal } from "./ui-lib";
const Markdown = dynamic(
async () => memo((await import("./markdown")).Markdown),
@@ -381,6 +382,27 @@ export function Chat(props: {
dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum;
};
+ // auto grow input
+ const [inputRows, setInputRows] = useState(2);
+ const measure = useDebouncedCallback(
+ () => {
+ const rows = inputRef.current ? autoGrowTextArea(inputRef.current) : 1;
+ const inputRows = Math.min(
+ 5,
+ Math.max(2 + Number(!isMobileScreen()), rows),
+ );
+ setInputRows(inputRows);
+ },
+ 100,
+ {
+ leading: true,
+ trailing: true,
+ },
+ );
+
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ useEffect(measure, [userInput]);
+
// only search prompts when user input is short
const SEARCH_TEXT_LIMIT = 30;
const onInput = (text: string) => {
@@ -395,9 +417,6 @@ export function Chat(props: {
// check if need to trigger auto completion
if (text.startsWith("/")) {
let searchText = text.slice(1);
- if (searchText.length === 0) {
- searchText = " ";
- }
onSearch(searchText);
}
}
@@ -679,7 +698,6 @@ export function Chat(props: {
ref={inputRef}
className={styles["chat-input"]}
placeholder={Locale.Chat.Input(submitKey)}
- rows={2}
onInput={(e) => onInput(e.currentTarget.value)}
value={userInput}
onKeyDown={onInputKeyDown}
@@ -689,6 +707,7 @@ export function Chat(props: {
setTimeout(() => setPromptHints([]), 500);
}}
autoFocus={!props?.sideBarShowing}
+ rows={inputRows}
/>