mirror of https://github.com/langgenius/dify.git
refactor:simplify syncWorkflowDraft parameters
This commit is contained in:
parent
77e6e98234
commit
fb6dc14e9b
|
|
@ -12,20 +12,16 @@ import type { BlockEnum } from '@/app/components/workflow/types'
|
|||
import type { VarInInspect } from '@/types/workflow'
|
||||
import type { FlowType } from '@/types/common'
|
||||
import { getFlowPrefix } from './utils'
|
||||
import { hydrateWorkflowDraftResponse, sanitizeWorkflowDraftPayload } from './workflow-payload'
|
||||
import type { WorkflowDraftSyncParams } from './workflow-payload'
|
||||
|
||||
export const fetchWorkflowDraft = async (url: string) => {
|
||||
const response = await get(url, {}, { silent: true }) as FetchWorkflowDraftResponse
|
||||
return hydrateWorkflowDraftResponse(response)
|
||||
export const fetchWorkflowDraft = (url: string) => {
|
||||
return get(url, {}, { silent: true }) as Promise<FetchWorkflowDraftResponse>
|
||||
}
|
||||
|
||||
export const syncWorkflowDraft = ({ url, params }: {
|
||||
url: string
|
||||
params: WorkflowDraftSyncParams
|
||||
params: Pick<FetchWorkflowDraftResponse, 'graph' | 'features' | 'environment_variables' | 'conversation_variables'>
|
||||
}) => {
|
||||
const sanitizedParams = sanitizeWorkflowDraftPayload(params)
|
||||
return post<CommonResponse & { updated_at: number; hash: string }>(url, { body: sanitizedParams }, { silent: true })
|
||||
return post<CommonResponse & { updated_at: number; hash: string }>(url, { body: params }, { silent: true })
|
||||
}
|
||||
|
||||
export const fetchNodesDefaultConfigs: Fetcher<NodesDefaultConfigsResponse, string> = (url) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue