File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ const toggleExpanded = () => {
159159
160160const removeTask = async (task : TaskItemImpl ) => {
161161 if (task .isRunning ) {
162- await api .interrupt ()
162+ await api .interrupt (task . promptId )
163163 }
164164 await queueStore .delete (task )
165165}
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import { useDialogService } from '@/services/dialogService'
1919import { useLitegraphService } from '@/services/litegraphService'
2020import { useWorkflowService } from '@/services/workflowService'
2121import type { ComfyCommand } from '@/stores/commandStore'
22+ import { useExecutionStore } from '@/stores/executionStore'
2223import { useCanvasStore , useTitleEditorStore } from '@/stores/graphStore'
2324import { useQueueSettingsStore , useQueueStore } from '@/stores/queueStore'
2425import { useSettingStore } from '@/stores/settingStore'
@@ -39,6 +40,7 @@ export function useCoreCommands(): ComfyCommand[] {
3940 const firebaseAuthActions = useFirebaseAuthActions ( )
4041 const toastStore = useToastStore ( )
4142 const canvasStore = useCanvasStore ( )
43+ const executionStore = useExecutionStore ( )
4244 const getTracker = ( ) => workflowStore . activeWorkflow ?. changeTracker
4345
4446 const getSelectedNodes = ( ) : LGraphNode [ ] => {
@@ -203,7 +205,7 @@ export function useCoreCommands(): ComfyCommand[] {
203205 icon : 'pi pi-stop' ,
204206 label : 'Interrupt' ,
205207 function : async ( ) => {
206- await api . interrupt ( )
208+ await api . interrupt ( executionStore . activePromptId )
207209 toastStore . add ( {
208210 severity : 'info' ,
209211 summary : t ( 'g.interrupted' ) ,
Original file line number Diff line number Diff line change @@ -689,7 +689,8 @@ export class ComfyApi extends EventTarget {
689689 Running : data . queue_running . map ( ( prompt : Record < number , any > ) => ( {
690690 taskType : 'Running' ,
691691 prompt,
692- remove : { name : 'Cancel' , cb : ( ) => api . interrupt ( ) }
692+ // prompt[1] is the prompt id
693+ remove : { name : 'Cancel' , cb : ( ) => api . interrupt ( prompt [ 1 ] ) }
693694 } ) ) ,
694695 Pending : data . queue_pending . map ( ( prompt : Record < number , any > ) => ( {
695696 taskType : 'Pending' ,
@@ -770,10 +771,15 @@ export class ComfyApi extends EventTarget {
770771 }
771772
772773 /**
773- * Interrupts the execution of the running prompt
774+ * Interrupts the execution of the running prompt. If runningPromptId is provided,
775+ * it is included in the payload as a helpful hint to the backend.
776+ * @param {string | null } [runningPromptId] Optional Running Prompt ID to interrupt
774777 */
775- async interrupt ( ) {
776- await this . #postItem( 'interrupt' , null )
778+ async interrupt ( runningPromptId : string | null ) {
779+ await this . #postItem(
780+ 'interrupt' ,
781+ runningPromptId ? { prompt_id : runningPromptId } : undefined
782+ )
777783 }
778784
779785 /**
You can’t perform that action at this time.
0 commit comments