mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 15:41:05 +00:00
@@ -9,7 +9,7 @@ import { useChatStore } from '@/web/core/chat/context/useChatStore';
|
||||
import type { ChatSettingSchema } from '@fastgpt/global/core/chat/setting/type';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { createContext } from 'use-context-selector';
|
||||
|
||||
type ChatSettingReturnType = ChatSettingSchema | undefined;
|
||||
@@ -94,9 +94,15 @@ export const ChatSettingContextProvider = ({ children }: { children: React.React
|
||||
setLastPane(newPane);
|
||||
setLastChatAppId(_id);
|
||||
},
|
||||
[setLastPane, chatSettings?.appId, appId, router, pane]
|
||||
[pane, router, setLastPane, setLastChatAppId, chatSettings?.appId]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!Object.values(ChatSidebarPaneEnum).includes(pane)) {
|
||||
handlePaneChange(ChatSidebarPaneEnum.HOME);
|
||||
}
|
||||
}, [pane]);
|
||||
|
||||
const logos: Pick<ChatSettingSchema, 'wideLogoUrl' | 'squareLogoUrl'> = useMemo(
|
||||
() => ({
|
||||
wideLogoUrl: chatSettings?.wideLogoUrl,
|
||||
|
@@ -2,7 +2,7 @@ import { create, createJSONStorage, devtools, persist, immer } from '@fastgpt/we
|
||||
import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import { type OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
|
||||
import type { ChatSourceEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import type { ChatSidebarPaneEnum } from '@/pageComponents/chat/constants';
|
||||
import { ChatSidebarPaneEnum } from '@/pageComponents/chat/constants';
|
||||
|
||||
type State = {
|
||||
source?: `${ChatSourceEnum}`;
|
||||
@@ -17,7 +17,7 @@ type State = {
|
||||
chatId: string;
|
||||
setChatId: (e?: string) => any;
|
||||
|
||||
lastPane?: ChatSidebarPaneEnum;
|
||||
lastPane: ChatSidebarPaneEnum;
|
||||
setLastPane: (e: ChatSidebarPaneEnum) => any;
|
||||
|
||||
outLinkAuthData: OutLinkChatAuthProps;
|
||||
@@ -116,7 +116,7 @@ export const useChatStore = create<State>()(
|
||||
state.lastChatAppId = e;
|
||||
});
|
||||
},
|
||||
lastPane: undefined,
|
||||
lastPane: ChatSidebarPaneEnum.HOME,
|
||||
setLastPane(e) {
|
||||
set((state) => {
|
||||
state.lastPane = e;
|
||||
|
Reference in New Issue
Block a user