mirror of https://github.com/langgenius/dify.git
fix: change existing node to a webhook node raise 404 (#28686)
This commit is contained in:
parent
6b8c649876
commit
6635ea62c2
|
|
@ -59,6 +59,7 @@ import {
|
|||
useWorkflowHistory,
|
||||
} from './use-workflow-history'
|
||||
import { useNodesMetaData } from './use-nodes-meta-data'
|
||||
import { useAutoGenerateWebhookUrl } from './use-auto-generate-webhook-url'
|
||||
import type { RAGPipelineVariables } from '@/models/pipeline'
|
||||
import useInspectVarsCrud from './use-inspect-vars-crud'
|
||||
import { getNodeUsedVars } from '../nodes/_base/components/variable/utils'
|
||||
|
|
@ -94,6 +95,7 @@ export const useNodesInteractions = () => {
|
|||
const { nodesMap: nodesMetaDataMap } = useNodesMetaData()
|
||||
|
||||
const { saveStateToHistory, undo, redo } = useWorkflowHistory()
|
||||
const autoGenerateWebhookUrl = useAutoGenerateWebhookUrl()
|
||||
|
||||
const handleNodeDragStart = useCallback<NodeDragHandler>(
|
||||
(_, node) => {
|
||||
|
|
@ -1401,7 +1403,14 @@ export const useNodesInteractions = () => {
|
|||
return filtered
|
||||
})
|
||||
setEdges(newEdges)
|
||||
handleSyncWorkflowDraft()
|
||||
if (nodeType === BlockEnum.TriggerWebhook) {
|
||||
handleSyncWorkflowDraft(true, true, {
|
||||
onSuccess: () => autoGenerateWebhookUrl(newCurrentNode.id),
|
||||
})
|
||||
}
|
||||
else {
|
||||
handleSyncWorkflowDraft()
|
||||
}
|
||||
|
||||
saveStateToHistory(WorkflowHistoryEvent.NodeChange, {
|
||||
nodeId: currentNodeId,
|
||||
|
|
@ -1413,6 +1422,7 @@ export const useNodesInteractions = () => {
|
|||
handleSyncWorkflowDraft,
|
||||
saveStateToHistory,
|
||||
nodesMetaDataMap,
|
||||
autoGenerateWebhookUrl,
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,11 @@ export const updateTracingStatus: Fetcher<CommonResponse, { appId: string; body:
|
|||
|
||||
// Webhook Trigger
|
||||
export const fetchWebhookUrl: Fetcher<WebhookTriggerResponse, { appId: string; nodeId: string }> = ({ appId, nodeId }) => {
|
||||
return get<WebhookTriggerResponse>(`apps/${appId}/workflows/triggers/webhook`, { params: { node_id: nodeId } })
|
||||
return get<WebhookTriggerResponse>(
|
||||
`apps/${appId}/workflows/triggers/webhook`,
|
||||
{ params: { node_id: nodeId } },
|
||||
{ silent: true },
|
||||
)
|
||||
}
|
||||
|
||||
export const fetchTracingConfig: Fetcher<TracingConfig & { has_not_configured: true }, { appId: string; provider: TracingProvider }> = ({ appId, provider }) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue