Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: change existing node to a webhook node raise 404 (#28686)

非法操作6635ea62c2bf
diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts
index 3cbdf08e437..d56b85893e9 100644
--- a/web/app/components/workflow/hooks/use-nodes-interactions.ts
+++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts
@@ -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,
],
)
diff --git a/web/service/apps.ts b/web/service/apps.ts
index b1124767ad8..7a4cfb93ffa 100644
--- a/web/service/apps.ts
+++ b/web/service/apps.ts
@@ -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 }) => {