diff --git a/frontend/src/components/DefaultChat/index.jsx b/frontend/src/components/DefaultChat/index.jsx index 4241ed71ea..d542f309fd 100644 --- a/frontend/src/components/DefaultChat/index.jsx +++ b/frontend/src/components/DefaultChat/index.jsx @@ -18,8 +18,10 @@ import { userFromStorage } from "@/utils/request"; import { AI_BACKGROUND_COLOR, USER_BACKGROUND_COLOR } from "@/utils/constants"; import useUser from "@/hooks/useUser"; import { useTranslation, Trans } from "react-i18next"; +import Appearance from "@/models/appearance"; export default function DefaultChatContainer() { + const { showScrollbar } = Appearance.getSettings(); const [mockMsgs, setMockMessages] = useState([]); const { user } = useUser(); const [fetchedMessages, setFetchedMessages] = useState([]); @@ -305,7 +307,9 @@ export default function DefaultChatContainer() { return (
{isMobile && } {fetchedMessages.length === 0 diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx index 99f133889d..85e45d695f 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx @@ -28,8 +28,8 @@ export default function ChatHistory({ const chatHistoryRef = useRef(null); const [textSize, setTextSize] = useState("normal"); const [isUserScrolling, setIsUserScrolling] = useState(false); - const showScrollbar = Appearance.getSettings()?.showScrollbar || false; const isStreaming = history[history.length - 1]?.animate; + const { showScrollbar } = Appearance.getSettings(); const getTextSizeClass = (size) => { switch (size) { @@ -205,7 +205,7 @@ export default function ChatHistory({ return (
{ - const settings = localStorage.getItem(APPEARANCE_SETTINGS); - return settings ? JSON.parse(settings) : { showScrollbar: false }; + try { + const settings = localStorage.getItem(APPEARANCE_SETTINGS); + return settings ? JSON.parse(settings) : Appearance.defaultSettings; + } catch (e) { + return Appearance.defaultSettings; + } }, /**