mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-07 17:18:21 +08:00
fix: #963 config not work
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
useAccessStore,
|
||||
Theme,
|
||||
ModelType,
|
||||
useAppConfig,
|
||||
} from "../store";
|
||||
|
||||
import {
|
||||
@@ -69,7 +70,7 @@ const Emoji = dynamic(async () => (await import("emoji-picker-react")).Emoji, {
|
||||
});
|
||||
|
||||
export function Avatar(props: { role: Message["role"]; model?: ModelType }) {
|
||||
const config = useChatStore((state) => state.config);
|
||||
const config = useAppConfig();
|
||||
|
||||
if (props.role !== "user") {
|
||||
return (
|
||||
@@ -285,7 +286,7 @@ function PromptToast(props: {
|
||||
}
|
||||
|
||||
function useSubmitHandler() {
|
||||
const config = useChatStore((state) => state.config);
|
||||
const config = useAppConfig();
|
||||
const submitKey = config.submitKey;
|
||||
|
||||
const shouldSubmit = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
@@ -361,16 +362,16 @@ export function ChatActions(props: {
|
||||
scrollToBottom: () => void;
|
||||
hitBottom: boolean;
|
||||
}) {
|
||||
const chatStore = useChatStore();
|
||||
const config = useAppConfig();
|
||||
|
||||
// switch themes
|
||||
const theme = chatStore.config.theme;
|
||||
const theme = config.theme;
|
||||
function nextTheme() {
|
||||
const themes = [Theme.Auto, Theme.Light, Theme.Dark];
|
||||
const themeIndex = themes.indexOf(theme);
|
||||
const nextIndex = (themeIndex + 1) % themes.length;
|
||||
const nextTheme = themes[nextIndex];
|
||||
chatStore.updateConfig((config) => (config.theme = nextTheme));
|
||||
config.update((config) => (config.theme = nextTheme));
|
||||
}
|
||||
|
||||
// stop all responses
|
||||
@@ -428,7 +429,8 @@ export function Chat() {
|
||||
state.currentSession(),
|
||||
state.currentSessionIndex,
|
||||
]);
|
||||
const fontSize = useChatStore((state) => state.config.fontSize);
|
||||
const config = useAppConfig();
|
||||
const fontSize = config.fontSize;
|
||||
|
||||
const inputRef = useRef<HTMLTextAreaElement>(null);
|
||||
const [userInput, setUserInput] = useState("");
|
||||
@@ -492,7 +494,7 @@ export function Chat() {
|
||||
// clear search results
|
||||
if (n === 0) {
|
||||
setPromptHints([]);
|
||||
} else if (!chatStore.config.disablePromptHint && n < SEARCH_TEXT_LIMIT) {
|
||||
} else if (!config.disablePromptHint && n < SEARCH_TEXT_LIMIT) {
|
||||
// check if need to trigger auto completion
|
||||
if (text.startsWith("/")) {
|
||||
let searchText = text.slice(1);
|
||||
@@ -583,8 +585,6 @@ export function Chat() {
|
||||
inputRef.current?.focus();
|
||||
};
|
||||
|
||||
const config = useChatStore((state) => state.config);
|
||||
|
||||
const context: RenderMessage[] = session.context.slice();
|
||||
|
||||
const accessStore = useAccessStore();
|
||||
@@ -692,10 +692,10 @@ export function Chat() {
|
||||
{!isMobileScreen && (
|
||||
<div className={styles["window-action-button"]}>
|
||||
<IconButton
|
||||
icon={chatStore.config.tightBorder ? <MinIcon /> : <MaxIcon />}
|
||||
icon={config.tightBorder ? <MinIcon /> : <MaxIcon />}
|
||||
bordered
|
||||
onClick={() => {
|
||||
chatStore.updateConfig(
|
||||
config.update(
|
||||
(config) => (config.tightBorder = !config.tightBorder),
|
||||
);
|
||||
}}
|
||||
|
Reference in New Issue
Block a user