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
3b25bf57
authored
Aug 26, 2025
by
Archer
Committed by
GitHub
Aug 26, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: search key refresh parentId (#5530)
parent
830eb190
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
73 additions
and
71 deletions
+73
-71
packages/service/core/workflow/dispatch/index.ts
+0
-8
packages/service/core/workflow/dispatch/plugin/runOutput.ts
+0
-1
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/NodeTemplatesModal.tsx
+7
-3
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/NodeTemplatesPopover.tsx
+7
-3
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/components/NodeTemplates/header.tsx
+12
-34
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/components/NodeTemplates/useNodeTemplates.tsx
+40
-16
projects/app/src/pageComponents/dashboard/apps/List.tsx
+3
-4
projects/app/src/pages/api/core/app/plugin/getSystemPluginTemplates.ts
+0
-1
projects/app/src/pages/dashboard/apps/index.tsx
+4
-1
No files found.
packages/service/core/workflow/dispatch/index.ts
View file @
3b25bf57
...
...
@@ -776,14 +776,6 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
});
});
// Focus try to run pluginOutput
const
pluginOutputModule
=
runtimeNodes
.
find
(
(
item
)
=>
item
.
flowNodeType
===
FlowNodeTypeEnum
.
pluginOutput
);
if
(
pluginOutputModule
&&
data
.
mode
!==
'debug'
)
{
workflowQueue
.
nodeRunWithActive
(
pluginOutputModule
);
}
// Get interactive node response.
const
interactiveResult
=
(()
=>
{
if
(
workflowQueue
.
nodeInteractiveResponse
)
{
...
...
packages/service/core/workflow/dispatch/plugin/runOutput.ts
View file @
3b25bf57
...
...
@@ -12,7 +12,6 @@ export const dispatchPluginOutput = (props: PluginOutputProps): PluginOutputResp
return
{
[
DispatchNodeResponseKeyEnum
.
nodeResponse
]:
{
totalPoints
:
0
,
pluginOutput
:
params
}
};
...
...
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/NodeTemplatesModal.tsx
View file @
3b25bf57
...
...
@@ -24,9 +24,11 @@ const NodeTemplatesModal = ({ isOpen, onClose }: ModuleTemplateListProps) => {
const
{
templateType
,
parentId
,
searchKey
,
setSearchKey
,
templatesIsLoading
,
templates
,
loadNodeTemplates
,
onUpdateTemplateType
,
onUpdateParentId
}
=
useNodeTemplates
();
...
...
@@ -79,8 +81,10 @@ const NodeTemplatesModal = ({ isOpen, onClose }: ModuleTemplateListProps) => {
<
NodeTemplateListHeader
onClose=
{
onClose
}
templateType=
{
templateType
}
loadNodeTemplates=
{
loadNodeTemplates
}
parentId=
{
parentId
||
''
}
onUpdateTemplateType=
{
onUpdateTemplateType
}
parentId=
{
parentId
}
searchKey=
{
searchKey
}
setSearchKey=
{
setSearchKey
}
onUpdateParentId=
{
onUpdateParentId
}
/>
<
NodeTemplateList
...
...
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/NodeTemplatesPopover.tsx
View file @
3b25bf57
...
...
@@ -24,9 +24,11 @@ const NodeTemplatesPopover = () => {
const
{
templateType
,
parentId
,
searchKey
,
setSearchKey
,
templatesIsLoading
,
templates
,
loadNodeTemplates
,
onUpdateTemplateType
,
onUpdateParentId
}
=
useNodeTemplates
();
...
...
@@ -116,9 +118,11 @@ const NodeTemplatesPopover = () => {
<
NodeTemplateListHeader
isPopover=
{
true
}
templateType=
{
templateType
}
loadNodeTemplates=
{
loadNodeTemplates
}
parentId=
{
parentId
||
''
}
onUpdateTemplateType=
{
onUpdateTemplateType
}
parentId=
{
parentId
}
onUpdateParentId=
{
onUpdateParentId
}
searchKey=
{
searchKey
}
setSearchKey=
{
setSearchKey
}
/>
<
NodeTemplateList
onAddNode=
{
onAddNode
}
...
...
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/components/NodeTemplates/header.tsx
View file @
3b25bf57
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
type
{
Dispatch
,
SetStateAction
}
from
'react'
;
import
React
from
'react'
;
import
{
Box
,
Flex
,
IconButton
,
Input
,
InputGroup
,
InputLeftElement
}
from
'@chakra-ui/react'
;
import
FillRowTabs
from
'@fastgpt/web/components/common/Tabs/FillRowTabs'
;
import
MyIcon
from
'@fastgpt/web/components/common/Icon'
;
...
...
@@ -9,7 +10,7 @@ import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import
{
getSystemPluginPaths
}
from
'@/web/core/app/api/plugin'
;
import
{
getAppFolderPath
}
from
'@/web/core/app/api/app'
;
import
FolderPath
from
'@/components/common/folder/Path'
;
import
{
useDebounceEffect
}
from
'ahooks
'
;
import
type
{
ParentIdType
}
from
'@fastgpt/global/common/parentFolder/type
'
;
export
enum
TemplateTypeEnum
{
'basic'
=
'basic'
,
...
...
@@ -21,12 +22,10 @@ export type NodeTemplateListHeaderProps = {
onClose
?:
()
=>
void
;
isPopover
?:
boolean
;
templateType
:
TemplateTypeEnum
;
parentId
:
string
;
loadNodeTemplates
:
(
params
:
{
parentId
?:
string
;
type
?:
TemplateTypeEnum
;
searchVal
?:
string
;
})
=>
Promise
<
any
>
;
parentId
:
ParentIdType
;
searchKey
:
string
;
setSearchKey
:
Dispatch
<
SetStateAction
<
string
>>
;
onUpdateTemplateType
:
(
type
:
TemplateTypeEnum
)
=>
void
;
onUpdateParentId
:
(
parentId
:
string
)
=>
void
;
};
...
...
@@ -35,33 +34,15 @@ const NodeTemplateListHeader = ({
isPopover
=
false
,
templateType
,
parentId
,
loadNodeTemplates
,
searchKey
,
setSearchKey
,
onUpdateTemplateType
,
onUpdateParentId
}:
NodeTemplateListHeaderProps
)
=>
{
const
{
t
}
=
useTranslation
();
const
{
feConfigs
}
=
useSystemStore
();
const
router
=
useRouter
();
const
[
searchKey
,
setSearchKey
]
=
useState
(
''
);
useEffect
(()
=>
{
setSearchKey
(
''
);
},
[
templateType
]);
useDebounceEffect
(
()
=>
{
loadNodeTemplates
({
type
:
templateType
,
parentId
:
''
,
searchVal
:
searchKey
});
},
[
searchKey
,
loadNodeTemplates
,
templateType
],
{
wait
:
300
}
);
// Get paths
const
{
data
:
paths
=
[]
}
=
useRequest2
(
()
=>
{
...
...
@@ -80,7 +61,7 @@ const NodeTemplateListHeader = ({
{
/* Tabs */
}
<
Flex
flex=
{
'1 0 0'
}
alignItems=
{
'center'
}
gap=
{
2
}
>
<
Box
flex=
{
'1 0 0'
}
>
<
FillRowTabs
<
FillRowTabs
<
TemplateTypeEnum
>
list=
{
[
{
icon
:
'core/modules/basicNode'
,
...
...
@@ -109,10 +90,7 @@ const NodeTemplateListHeader = ({
:
{})
}
value=
{
templateType
}
onChange=
{
(
e
)
=>
{
loadNodeTemplates
({
type
:
e
as
TemplateTypeEnum
,
parentId
:
''
});
onUpdateTemplateType
(
e
);
}
}
/
>
</
Box
>
...
...
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/components/NodeTemplates/useNodeTemplates.tsx
View file @
3b25bf57
import
{
useState
,
useMemo
,
useCallback
}
from
'react'
;
import
{
useState
,
useMemo
,
useCallback
,
useRef
}
from
'react'
;
import
{
useRequest2
}
from
'@fastgpt/web/hooks/useRequest'
;
import
{
useSystemStore
}
from
'@/web/common/system/useSystemStore'
;
import
type
{
NodeTemplateListItemType
}
from
'@fastgpt/global/core/workflow/type/node'
;
...
...
@@ -8,10 +8,15 @@ import { TemplateTypeEnum } from './header';
import
{
useContextSelector
}
from
'use-context-selector'
;
import
{
WorkflowContext
}
from
'../../../context'
;
import
type
{
ParentIdType
}
from
'@fastgpt/global/common/parentFolder/type'
;
import
{
useDebounceEffect
}
from
'ahooks'
;
export
const
useNodeTemplates
=
()
=>
{
const
{
feConfigs
}
=
useSystemStore
();
const
[
templateType
,
setTemplateType
]
=
useState
(
TemplateTypeEnum
.
basic
);
const
[
searchKey
,
setSearchKey
]
=
useState
(
''
);
const
searchKeyLock
=
useRef
(
false
);
const
[
parentId
,
setParentId
]
=
useState
<
ParentIdType
>
(
''
);
const
basicNodeTemplates
=
useContextSelector
(
WorkflowContext
,
(
v
)
=>
v
.
basicNodeTemplates
);
...
...
@@ -72,9 +77,9 @@ export const useNodeTemplates = () => {
runAsync
:
loadNodeTemplates
}
=
useRequest2
(
async
({
parentId
=
''
,
parentId
,
type
=
templateType
,
searchVal
=
''
searchVal
}:
{
parentId
?:
ParentIdType
;
type
?:
TemplateTypeEnum
;
...
...
@@ -96,23 +101,40 @@ export const useNodeTemplates = () => {
}
},
{
onSuccess
(
res
,
[{
parentId
=
''
,
type
=
templateType
}])
{
setParentId
(
parentId
);
setTemplateType
(
type
);
},
refreshDeps
:
[
templateType
]
onSuccess
()
{
searchKeyLock
.
current
=
false
;
}
}
);
const
onUpdateParentId
=
useCallback
(
(
parentId
:
ParentIdType
)
=>
{
loadNodeTemplates
({
parentId
});
useDebounceEffect
(
()
=>
{
if
(
searchKeyLock
.
current
)
{
return
;
}
loadNodeTemplates
({
parentId
,
searchVal
:
searchKey
});
},
[
loadNodeTemplates
]
[
searchKey
],
{
wait
:
300
}
);
const
onUpdateParentId
=
useCallback
((
parentId
:
ParentIdType
)
=>
{
searchKeyLock
.
current
=
true
;
setSearchKey
(
''
);
setParentId
(
parentId
);
loadNodeTemplates
({
parentId
});
},
[]);
const
onUpdateTemplateType
=
useCallback
((
type
:
TemplateTypeEnum
)
=>
{
searchKeyLock
.
current
=
true
;
setSearchKey
(
''
);
setParentId
(
''
);
setTemplateType
(
type
);
loadNodeTemplates
({
type
});
},
[]);
const
templates
=
useMemo
(()
=>
{
if
(
templateType
===
TemplateTypeEnum
.
basic
)
{
return
basicNodes
||
[];
...
...
@@ -125,7 +147,9 @@ export const useNodeTemplates = () => {
parentId
,
templatesIsLoading
,
templates
,
loadNodeTemplates
,
onUpdateParentId
onUpdateParentId
,
onUpdateTemplateType
,
searchKey
,
setSearchKey
};
};
projects/app/src/pageComponents/dashboard/apps/List.tsx
View file @
3b25bf57
...
...
@@ -52,10 +52,8 @@ const ListItem = () => {
content
:
t
(
'app:move.hint'
)
});
const
{
myApps
,
loadMyApps
,
onUpdateApp
,
setMoveAppId
,
folderDetail
}
=
useContextSelector
(
AppListContext
,
(
v
)
=>
v
);
const
{
myApps
,
loadMyApps
,
onUpdateApp
,
setMoveAppId
,
folderDetail
,
setSearchKey
}
=
useContextSelector
(
AppListContext
,
(
v
)
=>
v
);
const
[
editedApp
,
setEditedApp
]
=
useState
<
EditResourceInfoFormType
>
();
const
[
editHttpPlugin
,
setEditHttpPlugin
]
=
useState
<
EditHttpPluginProps
>
();
...
...
@@ -185,6 +183,7 @@ const ListItem = () => {
}
}
onClick=
{
()
=>
{
if
(
AppFolderTypeList
.
includes
(
app
.
type
))
{
setSearchKey
(
''
);
router
.
push
({
query
:
{
...
router
.
query
,
...
...
projects/app/src/pages/api/core/app/plugin/getSystemPluginTemplates.ts
View file @
3b25bf57
...
...
@@ -41,7 +41,6 @@ async function handler(
}))
.
filter
((
item
)
=>
{
if
(
searchKey
)
{
if
(
item
.
isFolder
)
return
false
;
const
regx
=
new
RegExp
(
`
${
replaceRegChars
(
searchKey
)}
`
,
'i'
);
return
regx
.
test
(
String
(
item
.
name
))
||
regx
.
test
(
String
(
item
.
intro
||
''
));
}
...
...
projects/app/src/pages/dashboard/apps/index.tsx
View file @
3b25bf57
...
...
@@ -56,7 +56,8 @@ const MyApps = ({ MenuIcon }: { MenuIcon: JSX.Element }) => {
isFetchingApps
,
folderDetail
,
refetchFolderDetail
,
setSearchKey
setSearchKey
,
searchKey
}
=
useContextSelector
(
AppListContext
,
(
v
)
=>
v
);
const
{
userInfo
}
=
useUserStore
();
...
...
@@ -164,6 +165,7 @@ const MyApps = ({ MenuIcon }: { MenuIcon: JSX.Element }) => {
{
isPc
&&
(
<
SearchInput
maxW=
{
[
'auto'
,
'250px'
]
}
value=
{
searchKey
}
onChange=
{
(
e
)
=>
setSearchKey
(
e
.
target
.
value
)
}
placeholder=
{
t
(
'app:search_app'
)
}
maxLength=
{
30
}
...
...
@@ -244,6 +246,7 @@ const MyApps = ({ MenuIcon }: { MenuIcon: JSX.Element }) => {
{
<
SearchInput
maxW=
{
[
'auto'
,
'250px'
]
}
value=
{
searchKey
}
onChange=
{
(
e
)
=>
setSearchKey
(
e
.
target
.
value
)
}
placeholder=
{
t
(
'app:search_app'
)
}
maxLength=
{
30
}
...
...
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