mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-22 15:54:09 +00:00
fix: show Missing Nodes dialog for missing node prompt errors
- Detect 'missing_node_type' error from backend in queuePrompt catch block - Construct MissingNodeType with class type and contextual hint - Trigger existing showMissingNodesError() to display Missing Nodes dialog - Dialog provides 'Open Manager' and 'Install All' buttons for resolution Fixes COM-12528 Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c0df1-aa57-72e0-8193-46aa24b5a327
This commit is contained in:
@@ -1394,10 +1394,40 @@ export class ComfyApp {
|
||||
} catch (error) {}
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
useDialogService().showErrorDialog(error, {
|
||||
title: t('errorDialog.promptExecutionError'),
|
||||
reportType: 'promptExecutionError'
|
||||
})
|
||||
if (
|
||||
error instanceof PromptExecutionError &&
|
||||
typeof error.response.error === 'object' &&
|
||||
error.response.error?.type === 'missing_node_type'
|
||||
) {
|
||||
const extraInfo = (error.response.error.extra_info ?? {}) as {
|
||||
class_type?: string | null
|
||||
node_title?: string | null
|
||||
node_id?: string
|
||||
}
|
||||
const classType = extraInfo.class_type ?? 'Unknown'
|
||||
const nodeTitle = extraInfo.node_title ?? classType
|
||||
const nodeId = extraInfo.node_id
|
||||
const hint = (() => {
|
||||
if (nodeTitle !== classType && nodeId) {
|
||||
return `"${nodeTitle}" (Node ID #${nodeId})`
|
||||
} else if (nodeTitle !== classType) {
|
||||
return `"${nodeTitle}"`
|
||||
} else if (nodeId) {
|
||||
return `Node ID #${nodeId}`
|
||||
}
|
||||
return undefined
|
||||
})()
|
||||
const missingNodeType: MissingNodeType = {
|
||||
type: classType,
|
||||
...(hint && { hint })
|
||||
}
|
||||
this.showMissingNodesError([missingNodeType])
|
||||
} else {
|
||||
useDialogService().showErrorDialog(error, {
|
||||
title: t('errorDialog.promptExecutionError'),
|
||||
reportType: 'promptExecutionError'
|
||||
})
|
||||
}
|
||||
console.error(error)
|
||||
|
||||
if (error instanceof PromptExecutionError) {
|
||||
|
||||
Reference in New Issue
Block a user