@@ -54,6 +54,7 @@ import { useShowTrainingControls } from '@/hooks/queries/general-settings'
5454import { useCodeViewerFeatures } from '@/hooks/use-code-viewer'
5555import { OUTPUT_PANEL_WIDTH , TERMINAL_HEIGHT } from '@/stores/constants'
5656import { useCopilotTrainingStore } from '@/stores/copilot-training/store'
57+ import { openCopilotWithMessage } from '@/stores/notifications/utils'
5758import type { ConsoleEntry } from '@/stores/terminal'
5859import { useTerminalConsoleStore , useTerminalStore } from '@/stores/terminal'
5960import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
@@ -226,7 +227,6 @@ const isEventFromEditableElement = (e: KeyboardEvent): boolean => {
226227 return false
227228 }
228229
229- // Check target and walk up ancestors in case editors render nested elements
230230 let el : HTMLElement | null = target
231231 while ( el ) {
232232 if ( isEditable ( el ) ) return true
@@ -1159,6 +1159,17 @@ export const Terminal = memo(function Terminal() {
11591159 clearCurrentWorkflowConsole ( )
11601160 } , [ clearCurrentWorkflowConsole ] )
11611161
1162+ const handleFixInCopilot = useCallback (
1163+ ( entry : ConsoleEntry ) => {
1164+ const errorMessage = entry . error ? String ( entry . error ) : 'Unknown error'
1165+ const blockName = entry . blockName || 'Unknown Block'
1166+ const message = `${ errorMessage } \n\nError in ${ blockName } .\n\nPlease fix this.`
1167+ openCopilotWithMessage ( message )
1168+ closeLogRowMenu ( )
1169+ } ,
1170+ [ closeLogRowMenu ]
1171+ )
1172+
11621173 const handleTrainingClick = useCallback (
11631174 ( e : React . MouseEvent ) => {
11641175 e . stopPropagation ( )
@@ -1949,6 +1960,7 @@ export const Terminal = memo(function Terminal() {
19491960 closeLogRowMenu ( )
19501961 } }
19511962 onClearConsole = { handleClearConsoleFromMenu }
1963+ onFixInCopilot = { handleFixInCopilot }
19521964 hasActiveFilters = { hasActiveFilters }
19531965 />
19541966 </ >
0 commit comments