Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
6c2a7574
authored
Sep 20, 2024
by
Finley Ge
Committed by
GitHub
Sep 20, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: app list (#2747)
parent
ca9f36ef
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
10 deletions
+30
-10
projects/app/src/pages/app/detail/components/Plugin/Header.tsx
+4
-1
projects/app/src/pages/app/detail/components/SimpleApp/Header.tsx
+5
-2
projects/app/src/pages/app/detail/components/Workflow/Header.tsx
+4
-1
projects/app/src/pages/app/list/index.tsx
+9
-6
projects/app/src/web/common/system/useSystemStore.ts
+8
-0
No files found.
projects/app/src/pages/app/detail/components/Plugin/Header.tsx
View file @
6c2a7574
...
...
@@ -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
)
{}
...
...
projects/app/src/pages/app/detail/components/SimpleApp/Header.tsx
View file @
6c2a7574
...
...
@@ -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
(()
=>
{
...
...
projects/app/src/pages/app/detail/components/Workflow/Header.tsx
View file @
6c2a7574
...
...
@@ -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
)
{}
...
...
projects/app/src/pages/app/list/index.tsx
View file @
6c2a7574
...
...
@@ -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
}
/>
...
...
projects/app/src/web/common/system/useSystemStore.ts
View file @
6c2a7574
...
...
@@ -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
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment