mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
perf: app list (#2747)
This commit is contained in:
@@ -31,6 +31,7 @@ import SaveAndPublishModal from '../WorkflowComponents/Flow/components/SaveAndPu
|
||||
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useDebounceEffect } from 'ahooks';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const PublishHistories = dynamic(() => import('../WorkflowPublishHistoriesSlider'));
|
||||
|
||||
@@ -66,6 +67,7 @@ const Header = () => {
|
||||
future,
|
||||
setPast
|
||||
} = useContextSelector(WorkflowContext, (v) => v);
|
||||
const { appType } = useSystemStore();
|
||||
|
||||
const [isPublished, setIsPublished] = useState(false);
|
||||
useDebounceEffect(
|
||||
@@ -135,7 +137,8 @@ const Header = () => {
|
||||
router.push({
|
||||
pathname: '/app/list',
|
||||
query: {
|
||||
parentId: appDetail.parentId
|
||||
parentId: appDetail.parentId,
|
||||
type: appType
|
||||
}
|
||||
});
|
||||
} catch (error) {}
|
||||
|
@@ -23,6 +23,7 @@ import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const Header = ({
|
||||
appForm,
|
||||
@@ -36,6 +37,7 @@ const Header = ({
|
||||
const router = useRouter();
|
||||
const { toast } = useToast();
|
||||
const { appId, appDetail, onSaveApp, currentTab } = useContextSelector(AppContext, (v) => v);
|
||||
const { appType } = useSystemStore();
|
||||
|
||||
const { data: paths = [] } = useRequest2(() => getAppFolderPath(appId), {
|
||||
manual: false,
|
||||
@@ -46,11 +48,12 @@ const Header = ({
|
||||
router.push({
|
||||
pathname: '/app/list',
|
||||
query: {
|
||||
parentId
|
||||
parentId,
|
||||
type: appType
|
||||
}
|
||||
});
|
||||
},
|
||||
[router]
|
||||
[router, appType]
|
||||
);
|
||||
|
||||
const isPublished = useMemo(() => {
|
||||
|
@@ -31,6 +31,7 @@ import SaveAndPublishModal from '../WorkflowComponents/Flow/components/SaveAndPu
|
||||
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useDebounceEffect } from 'ahooks';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const PublishHistories = dynamic(() => import('../WorkflowPublishHistoriesSlider'));
|
||||
|
||||
@@ -66,6 +67,7 @@ const Header = () => {
|
||||
future,
|
||||
setPast
|
||||
} = useContextSelector(WorkflowContext, (v) => v);
|
||||
const { appType } = useSystemStore();
|
||||
|
||||
// Check if the workflow is published
|
||||
const [isPublished, setIsPublished] = useState(false);
|
||||
@@ -136,7 +138,8 @@ const Header = () => {
|
||||
router.push({
|
||||
pathname: '/app/list',
|
||||
query: {
|
||||
parentId: appDetail.parentId
|
||||
parentId: appDetail.parentId,
|
||||
type: appType
|
||||
}
|
||||
});
|
||||
} catch (error) {}
|
||||
|
@@ -43,6 +43,7 @@ import LightRowTabs from '@fastgpt/web/components/common/Tabs/LightRowTabs';
|
||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import TemplateMarketModal from './components/TemplateMarketModal';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const CreateModal = dynamic(() => import('./components/CreateModal'));
|
||||
const EditFolderModal = dynamic(
|
||||
@@ -70,6 +71,7 @@ const MyApps = () => {
|
||||
setSearchKey
|
||||
} = useContextSelector(AppListContext, (v) => v);
|
||||
const { userInfo } = useUserStore();
|
||||
const { setAppType } = useSystemStore();
|
||||
|
||||
const [createAppType, setCreateAppType] = useState<CreateAppType>();
|
||||
const {
|
||||
@@ -171,12 +173,13 @@ const MyApps = () => {
|
||||
fontSize={['sm', 'md']}
|
||||
flexShrink={0}
|
||||
onChange={(e) => {
|
||||
router.push({
|
||||
query: {
|
||||
...router.query,
|
||||
type: e
|
||||
}
|
||||
});
|
||||
setAppType(e);
|
||||
// router.push({
|
||||
// query: {
|
||||
// ...router.query,
|
||||
// type: e
|
||||
// }
|
||||
// });
|
||||
}}
|
||||
/>
|
||||
<Box flex={1} />
|
||||
|
@@ -41,12 +41,20 @@ type State = {
|
||||
reRankModelList: ReRankModelItemType[];
|
||||
whisperModel?: WhisperModelType;
|
||||
initStaticData: (e: InitDateResponse) => void;
|
||||
appType?: string;
|
||||
setAppType: (e?: string) => void;
|
||||
};
|
||||
|
||||
export const useSystemStore = create<State>()(
|
||||
devtools(
|
||||
persist(
|
||||
immer((set, get) => ({
|
||||
appType: undefined,
|
||||
setAppType(e) {
|
||||
set((state) => {
|
||||
state.appType = e;
|
||||
});
|
||||
},
|
||||
initd: false,
|
||||
setInitd() {
|
||||
set((state) => {
|
||||
|
Reference in New Issue
Block a user