remove forceUpload

This commit is contained in:
hjlarry 2026-01-23 14:33:15 +08:00
parent e105dc6289
commit 486a30402b
5 changed files with 5 additions and 17 deletions

View File

@ -331,7 +331,6 @@ class DraftWorkflowApi(Resource):
account=current_user,
environment_variables=environment_variables,
conversation_variables=conversation_variables,
force_upload=args.get("force_upload", False),
)
except WorkflowHashNotEqualError:
raise DraftWorkflowNotSync()

View File

@ -200,17 +200,15 @@ class WorkflowService:
account: Account,
environment_variables: Sequence[VariableBase],
conversation_variables: Sequence[VariableBase],
force_upload: bool = False,
) -> Workflow:
"""
Sync draft workflow
:param force_upload: Skip hash validation when True (for restore operations)
:raises WorkflowHashNotEqualError
"""
# fetch draft workflow by app_model
workflow = self.get_draft_workflow(app_model=app_model)
if workflow and workflow.unique_hash != unique_hash and not force_upload:
if workflow and workflow.unique_hash != unique_hash:
raise WorkflowHashNotEqualError()
# validate features structure

View File

@ -118,7 +118,6 @@ export const useNodesSyncDraft = () => {
onError?: () => void
onSettled?: () => void
},
forceUpload?: boolean,
) => {
if (getNodesReadOnly())
return
@ -126,8 +125,8 @@ export const useNodesSyncDraft = () => {
// Check leader status at sync time
const currentIsLeader = isCollaborationEnabled ? collaborationManager.getIsLeader() : true
// If not leader and not forcing upload, request the leader to sync
if (isCollaborationEnabled && !currentIsLeader && !forceUpload) {
// If not leader, request the leader to sync
if (isCollaborationEnabled && !currentIsLeader) {
if (isCollaborationEnabled)
collaborationManager.emitSyncRequest()
callback?.onSettled?.()
@ -141,16 +140,10 @@ export const useNodesSyncDraft = () => {
setDraftUpdatedAt,
} = workflowStore.getState()
// Add force_upload parameter if needed
const finalParams = {
...postParams.params,
...(forceUpload && { force_upload: true }),
}
try {
const res = await syncWorkflowDraft({
url: postParams.url,
params: finalParams,
params: postParams.params,
})
setSyncWorkflowDraftHash(res.hash)
setDraftUpdatedAt(res.updated_at)

View File

@ -40,7 +40,6 @@ export type CommonHooksFnMap = {
onError?: () => void
onSettled?: () => void
},
forceUpload?: boolean,
) => Promise<void>
syncWorkflowDraftWhenPageClose: () => void
handleRefreshWorkflowDraft: () => void

View File

@ -24,7 +24,6 @@ export const useNodesSyncDraft = () => {
onError?: () => void
onSettled?: () => void
},
forceUpload?: boolean,
) => {
if (getNodesReadOnly())
return
@ -36,7 +35,7 @@ export const useNodesSyncDraft = () => {
}
if (sync)
doSyncWorkflowDraft(notRefreshWhenSyncError, callback, forceUpload)
doSyncWorkflowDraft(notRefreshWhenSyncError, callback)
else
debouncedSyncWorkflowDraft(doSyncWorkflowDraft)
}, [debouncedSyncWorkflowDraft, doSyncWorkflowDraft, getNodesReadOnly])