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

This commit is contained in:
非法操作 2025-11-26 22:41:52 +08:00 committed by GitHub
parent 6b8c649876
commit 6635ea62c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View File

@ -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,
],
)

View File

@ -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 }) => {