mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
refactor(trigger): Unify the Trigger Debug interface and event handling and enhance error management
- Updated `DraftWorkflowTriggerNodeApi` to utilize the new `TriggerDebugEvent` and `TriggerDebugEventPoller` for improved event polling. - Removed deprecated `poll_debug_event` methods from `TriggerService`, `ScheduleService`, and `WebhookService`, consolidating functionality into the new event structure. - Enhanced error handling in `invoke_trigger_event` to utilize `TriggerPluginInvokeError` for better clarity on invocation issues. - Updated frontend API routes to reflect changes in trigger event handling, ensuring consistency across the application.
This commit is contained in:
@ -170,21 +170,7 @@ export const useWorkflowRun = () => {
|
||||
const isInWorkflowDebug = appDetail?.mode === 'workflow'
|
||||
|
||||
let url = ''
|
||||
if (runMode === 'schedule') {
|
||||
if (!appDetail?.id) {
|
||||
console.error('handleRun: missing app id for schedule trigger run')
|
||||
return
|
||||
}
|
||||
url = `/apps/${appDetail.id}/workflows/draft/trigger/schedule/run`
|
||||
}
|
||||
else if (runMode === 'webhook') {
|
||||
if (!appDetail?.id) {
|
||||
console.error('handleRun: missing app id for webhook trigger run')
|
||||
return
|
||||
}
|
||||
url = `/apps/${appDetail.id}/workflows/draft/trigger/webhook/run`
|
||||
}
|
||||
else if (runMode === 'plugin') {
|
||||
if (runMode === 'plugin' || runMode === 'webhook' || runMode === 'schedule') {
|
||||
if (!appDetail?.id) {
|
||||
console.error('handleRun: missing app id for trigger plugin run')
|
||||
return
|
||||
|
||||
@ -264,7 +264,7 @@ const useOneStepRun = <T>({
|
||||
}, [])
|
||||
|
||||
const runWebhookSingleRun = useCallback(async (): Promise<any | null> => {
|
||||
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/debug/webhook/run`
|
||||
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/trigger/run`
|
||||
const urlWithPrefix = `${API_PREFIX}${urlPath.startsWith('/') ? urlPath : `/${urlPath}`}`
|
||||
|
||||
webhookSingleRunActiveRef.current = true
|
||||
@ -364,7 +364,7 @@ const useOneStepRun = <T>({
|
||||
}, [flowId, id, data, handleNodeDataUpdate, cancelWebhookSingleRun])
|
||||
|
||||
const runPluginSingleRun = useCallback(async (): Promise<any | null> => {
|
||||
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/trigger`
|
||||
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/trigger/run`
|
||||
const urlWithPrefix = `${API_PREFIX}${urlPath.startsWith('/') ? urlPath : `/${urlPath}`}`
|
||||
|
||||
webhookSingleRunActiveRef.current = true
|
||||
|
||||
Reference in New Issue
Block a user