|
@@ -67,6 +67,7 @@ import {
|
|
|
isVisionModel,
|
|
isVisionModel,
|
|
|
isDalle3,
|
|
isDalle3,
|
|
|
showPlugins,
|
|
showPlugins,
|
|
|
|
|
+ safeLocalStorage,
|
|
|
} from "../utils";
|
|
} from "../utils";
|
|
|
|
|
|
|
|
import { uploadImage as uploadImageRemote } from "@/app/utils/chat";
|
|
import { uploadImage as uploadImageRemote } from "@/app/utils/chat";
|
|
@@ -109,6 +110,8 @@ import { getClientConfig } from "../config/client";
|
|
|
import { useAllModels } from "../utils/hooks";
|
|
import { useAllModels } from "../utils/hooks";
|
|
|
import { MultimodalContent } from "../client/api";
|
|
import { MultimodalContent } from "../client/api";
|
|
|
|
|
|
|
|
|
|
+const localStorage = safeLocalStorage();
|
|
|
|
|
+
|
|
|
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
|
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
|
|
loading: () => <LoadingIcon />,
|
|
loading: () => <LoadingIcon />,
|
|
|
});
|
|
});
|
|
@@ -941,7 +944,7 @@ function _Chat() {
|
|
|
.onUserInput(userInput, attachImages)
|
|
.onUserInput(userInput, attachImages)
|
|
|
.then(() => setIsLoading(false));
|
|
.then(() => setIsLoading(false));
|
|
|
setAttachImages([]);
|
|
setAttachImages([]);
|
|
|
- localStorage.setItem(LAST_INPUT_KEY, userInput);
|
|
|
|
|
|
|
+ chatStore.setLastInput(userInput);
|
|
|
setUserInput("");
|
|
setUserInput("");
|
|
|
setPromptHints([]);
|
|
setPromptHints([]);
|
|
|
if (!isMobileScreen) inputRef.current?.focus();
|
|
if (!isMobileScreen) inputRef.current?.focus();
|
|
@@ -1007,7 +1010,7 @@ function _Chat() {
|
|
|
userInput.length <= 0 &&
|
|
userInput.length <= 0 &&
|
|
|
!(e.metaKey || e.altKey || e.ctrlKey)
|
|
!(e.metaKey || e.altKey || e.ctrlKey)
|
|
|
) {
|
|
) {
|
|
|
- setUserInput(localStorage.getItem(LAST_INPUT_KEY) ?? "");
|
|
|
|
|
|
|
+ setUserInput(chatStore.lastInput ?? "");
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|