diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 54def01cf..d38990372 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -230,7 +230,9 @@ export function PromptHints(props: { useEffect(() => { const onKeyDown = (e: KeyboardEvent) => { if (noPrompts) return; - + if (e.metaKey || e.altKey || e.ctrlKey) { + return; + } // arrow up / down to select prompt const changeIndex = (delta: number) => { e.stopPropagation(); @@ -491,7 +493,11 @@ export function Chat() { // check if should send message const onInputKeyDown = (e: React.KeyboardEvent) => { // if ArrowUp and no userInput, fill with last input - if (e.key === "ArrowUp" && userInput.length <= 0) { + if ( + e.key === "ArrowUp" && + userInput.length <= 0 && + !(e.metaKey || e.altKey || e.ctrlKey) + ) { setUserInput(localStorage.getItem(LAST_INPUT_KEY) ?? ""); e.preventDefault(); return; @@ -789,7 +795,14 @@ export function Chat() { scrollToBottom={scrollToBottom} hitBottom={hitBottom} showPromptHints={() => { + // Click again to close + if (promptHints.length > 0) { + setPromptHints([]); + return; + } + inputRef.current?.focus(); + setUserInput("/"); onSearch(""); }} /> diff --git a/app/layout.tsx b/app/layout.tsx index c56341ab4..f2e765ae0 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -13,7 +13,7 @@ export const metadata = { title: "ChatGPT Next Web", statusBarStyle: "default", }, - themeColor: "#fafafa", + viewport: "width=device-width, initial-scale=1, maximum-scale=1", }; export default function RootLayout({ @@ -25,8 +25,9 @@ export default function RootLayout({ = {}; diff --git a/app/store/access.ts b/app/store/access.ts index 79b7b9900..4e870b616 100644 --- a/app/store/access.ts +++ b/app/store/access.ts @@ -1,6 +1,7 @@ import { create } from "zustand"; import { persist } from "zustand/middleware"; import { StoreKey } from "../constant"; +import { getHeaders } from "../requests"; import { BOT_HELLO } from "./chat"; import { ALL_MODELS } from "./config"; @@ -55,6 +56,9 @@ export const useAccessStore = create()( fetch("/api/config", { method: "post", body: null, + headers: { + ...getHeaders(), + }, }) .then((res) => res.json()) .then((res: DangerConfig) => {