diff --git a/web/app/components/workflow/comment/comment-preview.tsx b/web/app/components/workflow/comment/comment-preview.tsx index 5ed78aaab1..94b356edd8 100644 --- a/web/app/components/workflow/comment/comment-preview.tsx +++ b/web/app/components/workflow/comment/comment-preview.tsx @@ -4,7 +4,7 @@ import type { FC } from 'react' import { memo } from 'react' import { UserAvatarList } from '@/app/components/base/user-avatar-list' import type { WorkflowCommentList } from '@/service/workflow-comment' -import { useFormatTimeFromNow } from '@/app/components/workflow/hooks' +import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now' type CommentPreviewProps = { comment: WorkflowCommentList diff --git a/web/app/components/workflow/comment/thread.tsx b/web/app/components/workflow/comment/thread.tsx index e20a649664..b727d8e640 100644 --- a/web/app/components/workflow/comment/thread.tsx +++ b/web/app/components/workflow/comment/thread.tsx @@ -8,7 +8,7 @@ import { RiArrowDownSLine, RiArrowUpSLine, RiCheckboxCircleFill, RiCheckboxCircl import Avatar from '@/app/components/base/avatar' import Divider from '@/app/components/base/divider' import cn from '@/utils/classnames' -import { useFormatTimeFromNow } from '@/app/components/workflow/hooks' +import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now' import type { WorkflowCommentDetail, WorkflowCommentDetailReply } from '@/service/workflow-comment' import { useAppContext } from '@/context/app-context' import { MentionInput } from './mention-input' diff --git a/web/app/components/workflow/hooks/use-workflow.ts b/web/app/components/workflow/hooks/use-workflow.ts index 4bf255636b..bedc91d8df 100644 --- a/web/app/components/workflow/hooks/use-workflow.ts +++ b/web/app/components/workflow/hooks/use-workflow.ts @@ -50,9 +50,7 @@ export const useIsChatMode = () => { } export const useWorkflow = () => { - const { t } = useTranslation() const collaborativeWorkflow = useCollaborativeWorkflow() - const workflowStore = useWorkflowStore() const { getAvailableBlocks } = useAvailableBlocks() const { nodesMap } = useNodesMetaData() @@ -258,18 +256,6 @@ export const useWorkflow = () => { return isUsed }, [isVarUsedInNodes]) - const checkParallelLimit = useCallback((nodeId: string, nodeHandle = 'source') => { - const { edges } = collaborativeWorkflow.getState() - const connectedEdges = edges.filter(edge => edge.source === nodeId && edge.sourceHandle === nodeHandle) - if (connectedEdges.length > MAX_PARALLEL_LIMIT - 1) { - const { setShowTips } = workflowStore.getState() - setShowTips(t('workflow.common.parallelTip.limit', { num: MAX_PARALLEL_LIMIT })) - return false - } - - return true - }, [collaborativeWorkflow, workflowStore, t]) - const getRootNodesById = useCallback((nodeId: string) => { const { nodes, edges } = collaborativeWorkflow.getState() const currentNode = nodes.find(node => node.id === nodeId) @@ -373,7 +359,7 @@ export const useWorkflow = () => { } return !hasCycle(targetNode) - }, [collaborativeWorkflow, checkParallelLimit, getAvailableBlocks]) + }, [collaborativeWorkflow, getAvailableBlocks]) return { getNodeById, diff --git a/web/app/components/workflow/index.tsx b/web/app/components/workflow/index.tsx index db7ee17d53..006ba8186f 100644 --- a/web/app/components/workflow/index.tsx +++ b/web/app/components/workflow/index.tsx @@ -438,7 +438,6 @@ export const Workflow: FC = memo(({ content={showConfirm.desc} /> )} - {controlMode === ControlMode.Comment && isMouseOverCanvas && ( )} diff --git a/web/app/components/workflow/panel/comments-panel/index.tsx b/web/app/components/workflow/panel/comments-panel/index.tsx index cefdb78516..1bb7e27c51 100644 --- a/web/app/components/workflow/panel/comments-panel/index.tsx +++ b/web/app/components/workflow/panel/comments-panel/index.tsx @@ -8,7 +8,7 @@ import cn from '@/utils/classnames' import { ControlMode } from '@/app/components/workflow/types' import { resolveWorkflowComment } from '@/service/workflow-comment' import { useParams } from 'next/navigation' -import { useFormatTimeFromNow } from '@/app/components/workflow/hooks' +import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now' import { useAppContext } from '@/context/app-context' import { collaborationManager } from '@/app/components/workflow/collaboration' diff --git a/web/package.json b/web/package.json index 01fd602380..90720b36cc 100644 --- a/web/package.json +++ b/web/package.json @@ -94,6 +94,7 @@ "lexical": "^0.36.2", "line-clamp": "^1.0.0", "lodash-es": "^4.17.21", + "loro-crdt": "^1.8.2", "mermaid": "11.10.0", "mime": "^4.0.4", "mitt": "^3.0.1", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 6c785b3099..17b3cebfb8 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -202,6 +202,9 @@ importers: lodash-es: specifier: ^4.17.21 version: 4.17.21 + loro-crdt: + specifier: ^1.8.2 + version: 1.8.2 mermaid: specifier: 11.10.0 version: 11.10.0 @@ -6313,6 +6316,9 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true + loro-crdt@1.8.2: + resolution: {integrity: sha512-rv33Ma8ZHGvpik9it2Zty+EJw4x/jrbtw/PWSd0Pwm/qZV3mUlB8c0a61WtlPMd/AT6rQ34i1OSg0f2UrPz3Ww==} + loupe@3.1.3: resolution: {integrity: sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==} @@ -15691,6 +15697,8 @@ snapshots: dependencies: js-tokens: 4.0.0 + loro-crdt@1.8.2: {} + loupe@3.1.3: {} lower-case@2.0.2: