-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update yml * perf: chat slider * perf: workflow name * i18n * fix: ts * fix: ts
- Loading branch information
Showing
15 changed files
with
136 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/hooks/useUtils.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { useContextSelector } from 'use-context-selector'; | ||
import { WorkflowContext } from '../../context'; | ||
import { useTranslation } from 'next-i18next'; | ||
import { useCallback } from 'react'; | ||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant'; | ||
|
||
export const useWorkflowUtils = () => { | ||
const { t } = useTranslation(); | ||
const nodeList = useContextSelector(WorkflowContext, (v) => v.nodeList); | ||
|
||
const computedNewNodeName = useCallback( | ||
({ | ||
templateName, | ||
flowNodeType, | ||
pluginId | ||
}: { | ||
templateName: string; | ||
flowNodeType: FlowNodeTypeEnum; | ||
pluginId?: string; | ||
}) => { | ||
const nodeLength = nodeList.filter((node) => { | ||
if (node.flowNodeType === flowNodeType) { | ||
if (node.flowNodeType === FlowNodeTypeEnum.pluginModule) { | ||
return node.pluginId === pluginId; | ||
} else { | ||
return true; | ||
} | ||
} | ||
}).length; | ||
return nodeLength > 0 ? `${templateName}#${nodeLength + 1}` : templateName; | ||
}, | ||
[nodeList] | ||
); | ||
|
||
return { | ||
computedNewNodeName | ||
}; | ||
}; | ||
|
||
export default function Dom() { | ||
return <></>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.