diff --git a/.env.template b/.env.template new file mode 100644 index 000000000..5f3fc02da --- /dev/null +++ b/.env.template @@ -0,0 +1,29 @@ + +# Your openai api key. (required) +OPENAI_API_KEY=sk-xxxx + +# Access passsword, separated by comma. (optional) +CODE=your-password + +# You can start service behind a proxy +PROXY_URL=http://localhost:7890 + +# Override openai api request base url. (optional) +# Default: https://api.openai.com +# Examples: http://your-openai-proxy.com +BASE_URL= + +# Specify OpenAI organization ID.(optional) +# Default: Empty +# If you do not want users to input their own API key, set this value to 1. +OPENAI_ORG_ID= + +# (optional) +# Default: Empty +# If you do not want users to input their own API key, set this value to 1. +HIDE_USER_API_KEY= + +# (optional) +# Default: Empty +# If you do not want users to use GPT-4, set this value to 1. +DISABLE_GPT4= diff --git a/.gitignore b/.gitignore index 37f6b9029..3c55f8c78 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,7 @@ dev public/prompts.json .vscode -.idea \ No newline at end of file +.idea + +# docker-compose env files +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7755b1a53..21adff9bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,6 +50,8 @@ CMD if [ -n "$PROXY_URL" ]; then \ echo "remote_dns_subnet 224" >> $conf; \ echo "tcp_read_time_out 15000" >> $conf; \ echo "tcp_connect_time_out 8000" >> $conf; \ + echo "localnet 127.0.0.0/255.0.0.0" >> $conf; \ + echo "localnet ::1/128" >> $conf; \ echo "[ProxyList]" >> $conf; \ echo "$protocol $host $port" >> $conf; \ cat /etc/proxychains.conf; \ diff --git a/README.md b/README.md index a3c10a339..4e2658727 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel. 一键免费部署你的私人 ChatGPT 网页应用。 -[Demo](https://chatgpt.nextweb.fun/) / [Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Join Discord](https://discord.gg/zrhvHCr79N) / [Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa) +[Demo](https://chatgpt.nextweb.fun/) / [Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa) -[演示](https://chatgpt.nextweb.fun/) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [QQ 群](https://user-images.githubusercontent.com/16968934/236402186-fa76e930-64f5-47ae-b967-b0f04b1fbf56.jpg) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) +[演示](https://chatgpt.nextweb.fun/) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [QQ 群](https://github.com/Yidadaa/ChatGPT-Next-Web/assets/16968934/3ff423d5-5703-4772-8b6d-abec7eec3a4b) / [QQ 频道](https://github.com/Yidadaa/ChatGPT-Next-Web/assets/16968934/debfbee7-e682-4814-a601-f4403dac6d1d) / [打赏开发者](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&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) diff --git a/app/client/platforms/openai.ts b/app/client/platforms/openai.ts index 99f365202..cc8b5b6f6 100644 --- a/app/client/platforms/openai.ts +++ b/app/client/platforms/openai.ts @@ -61,7 +61,7 @@ export class ChatGPTApi implements LLMApi { }; // make a fetch request - const reqestTimeoutId = setTimeout( + const requestTimeoutId = setTimeout( () => controller.abort(), REQUEST_TIMEOUT_MS, ); @@ -78,7 +78,7 @@ export class ChatGPTApi implements LLMApi { fetchEventSource(chatPath, { ...chatPayload, async onopen(res) { - clearTimeout(reqestTimeoutId); + clearTimeout(requestTimeoutId); if (res.status === 401) { let extraInfo = { error: undefined }; try { @@ -119,7 +119,7 @@ export class ChatGPTApi implements LLMApi { }); } else { const res = await fetch(chatPath, chatPayload); - clearTimeout(reqestTimeoutId); + clearTimeout(requestTimeoutId); const resJson = await res.json(); const message = this.extractMessage(resJson); diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 94baf1b66..f2cd8cc49 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -502,7 +502,7 @@ export function Chat() { e.preventDefault(); return; } - if (shouldSubmit(e)) { + if (shouldSubmit(e) && promptHints.length === 0) { doSubmit(userInput); e.preventDefault(); } diff --git a/app/components/model-config.tsx b/app/components/model-config.tsx index fbc96d4d7..0392621d9 100644 --- a/app/components/model-config.tsx +++ b/app/components/model-config.tsx @@ -68,8 +68,8 @@ export function ModelConfigList(props: { >