mirror of https://github.com/langgenius/dify.git
remove forceUpload
This commit is contained in:
parent
e105dc6289
commit
486a30402b
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ export type CommonHooksFnMap = {
|
|||
onError?: () => void
|
||||
onSettled?: () => void
|
||||
},
|
||||
forceUpload?: boolean,
|
||||
) => Promise<void>
|
||||
syncWorkflowDraftWhenPageClose: () => void
|
||||
handleRefreshWorkflowDraft: () => void
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Reference in New Issue