Fixed icons showing in console for every block

This commit is contained in:
Emir Karabeg
2025-01-31 16:15:48 -08:00
parent 1c87d39311
commit 68b1e3c327
5 changed files with 13 additions and 6 deletions

View File

@@ -28,10 +28,9 @@ export function ConsoleEntry({ entry, consoleWidth }: ConsoleEntryProps) {
)
const blockConfig = useMemo(() => {
if (!entry.blockName) return null
const blockType = entry.blockName.split(' ')[0].toLowerCase()
return getBlock(blockType)
}, [entry.blockName])
if (!entry.blockType) return null
return getBlock(entry.blockType)
}, [entry.blockType])
const BlockIcon = blockConfig?.toolbar.icon

View File

@@ -45,7 +45,8 @@ export function useWorkflowExecution() {
endedAt: log.endedAt,
workflowId: activeWorkflowId,
timestamp: log.startedAt,
blockName: log.blockTitle
blockName: log.blockTitle,
blockType: log.blockType
})
})
}

View File

@@ -18,6 +18,7 @@ import {
BlockLog
} from './types'
import { tools } from '@/tools'
import { getBlockTypeForTool } from '@/blocks'
export class Executor {
constructor(
@@ -185,10 +186,14 @@ export class Executor {
...inputs,
})
// Get the block type from the tool ID using the helper function
const blockType = getBlockTypeForTool(toolId)
// Prepare a new blockLog entry
const blockLog: Partial<BlockLog> = {
blockId: block.id,
blockTitle: block.metadata?.title || 'Unnamed Block',
blockType: blockType,
startedAt: new Date().toISOString(),
}

View File

@@ -12,6 +12,7 @@ export interface BlockLog {
endedAt: string
durationMs: number
output?: any
blockType?: string
}
/**

View File

@@ -5,9 +5,10 @@ export interface ConsoleEntry {
durationMs: number
startedAt: string
endedAt: string
workflowId?: string | null
workflowId: string | null
timestamp: string
blockName?: string
blockType?: string
}
export interface ConsoleStore {