Added memory block

This commit is contained in:
Emir Karabeg
2025-02-13 17:59:03 -08:00
parent d1c71e9276
commit 5dc45509c1
6 changed files with 87 additions and 14 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ export const EvaluatorBlock: BlockConfig<EvaluatorResponse> = {
type: 'evaluator',
toolbar: {
title: 'Evaluator',
description: 'Add an evaluator',
description: 'Evaluate content',
bgColor: '#2FA1FF',
icon: ChartBarIcon,
category: 'blocks',
+1 -1
View File
@@ -6,7 +6,7 @@ export const FunctionBlock: BlockConfig<CodeExecutionOutput> = {
type: 'function',
toolbar: {
title: 'Function',
description: 'Add custom logic',
description: 'Run custom logic',
bgColor: '#FF402F',
icon: CodeIcon,
category: 'blocks',
+39
View File
@@ -0,0 +1,39 @@
import { BrainIcon } from '@/components/icons'
import { BlockConfig } from '../types'
export const MemoryBlock: BlockConfig = {
type: 'memory',
toolbar: {
title: 'Memory',
description: 'Add memory store',
bgColor: '#FF65BF',
icon: BrainIcon,
category: 'blocks',
},
tools: {
access: [],
},
workflow: {
inputs: {
code: { type: 'string', required: true },
timeout: { type: 'number', required: false },
memoryLimit: { type: 'number', required: false },
},
outputs: {
response: {
type: {
result: 'any',
stdout: 'string',
executionTime: 'number',
},
},
},
subBlocks: [
{
id: 'code',
type: 'code',
layout: 'full',
},
],
},
}
+1 -1
View File
@@ -89,7 +89,7 @@ export const RouterBlock: BlockConfig<RouterResponse> = {
type: 'router',
toolbar: {
title: 'Router',
description: 'Add a router',
description: 'Route workflow',
bgColor: '#28C43F',
icon: ConnectIcon,
category: 'blocks',
+3 -11
View File
@@ -9,6 +9,7 @@ import { FunctionBlock } from './blocks/function'
import { GitHubBlock } from './blocks/github'
import { GmailBlock } from './blocks/gmail'
import { JinaBlock } from './blocks/jina'
import { MemoryBlock } from './blocks/memory'
import { NotionBlock } from './blocks/notion'
import { RouterBlock } from './blocks/router'
import { SerperBlock } from './blocks/serper'
@@ -39,6 +40,7 @@ export {
NotionBlock,
GmailBlock,
XBlock,
MemoryBlock,
}
// Registry of all block configurations
@@ -49,6 +51,7 @@ const blocks: Record<string, BlockConfig> = {
function: FunctionBlock,
router: RouterBlock,
evaluator: EvaluatorBlock,
memory: MemoryBlock,
crewai_vision: CrewAIVisionBlock,
firecrawl_scrape: FirecrawlScrapeBlock,
jina_reader: JinaBlock,
@@ -63,17 +66,6 @@ const blocks: Record<string, BlockConfig> = {
x_block: XBlock,
}
// Build a reverse mapping of tools to block types
const toolToBlockType = Object.entries(blocks).reduce(
(acc, [blockType, config]) => {
config.tools.access.forEach((toolId) => {
acc[toolId] = blockType
})
return acc
},
{} as Record<string, string>
)
// Helper functions
export const getBlock = (type: string): BlockConfig | undefined => blocks[type]
+42
View File
@@ -1310,3 +1310,45 @@ export const CrunchbaseIcon = (props: SVGProps<SVGSVGElement>) => (
<path d="M21.6 0H2.4A2.41 2.41 0 0 0 0 2.4v19.2A2.41 2.41 0 0 0 2.4 24h19.2a2.41 2.41 0 0 0 2.4-2.4V2.4A2.41 2.41 0 0 0 21.6 0zM7.045 14.465A2.11 2.11 0 0 0 9.84 13.42h1.66a3.69 3.69 0 1 1 0-1.75H9.84a2.11 2.11 0 1 0-2.795 2.795zm11.345.845a3.55 3.55 0 0 1-1.06.63 3.68 3.68 0 0 1-3.39-.38v.38h-1.51V5.37h1.5v4.11a3.74 3.74 0 0 1 1.8-.63H16a3.67 3.67 0 0 1 2.39 6.46zm-.223-2.766a2.104 2.104 0 1 1-4.207 0 2.104 2.104 0 0 1 4.207 0z" />
</svg>
)
export function BrainIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg
{...props}
width="30"
height="30"
viewBox="0 0 30 30"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M20.0553 16.4443C18.7145 16.4443 17.4286 16.977 16.4805 17.9251C15.5324 18.8732 14.9998 20.1591 14.9998 21.4999M14.9998 21.4999V22.9443M14.9998 21.4999C14.9998 20.1591 14.4671 18.8732 13.519 17.9251C12.5709 16.977 11.285 16.4443 9.94423 16.4443M14.9998 22.9443C14.9998 24.2852 15.5324 25.5711 16.4805 26.5192C17.4286 27.4673 18.7145 27.9999 20.0553 27.9999C21.3962 27.9999 22.6821 27.4673 23.6302 26.5192C24.5783 25.5711 25.1109 24.2852 25.1109 22.9443V20.3443M14.9998 22.9443C14.9998 24.2852 14.4671 25.5711 13.519 26.5192C12.5709 27.4673 11.285 27.9999 9.94423 27.9999C8.60341 27.9999 7.31751 27.4673 6.36941 26.5192C5.42131 25.5711 4.88867 24.2852 4.88867 22.9443V20.3443"
stroke="currentColor"
strokeWidth="2.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M22.9449 20.7779C24.2857 20.7779 25.5716 20.2452 26.5197 19.2971C27.4678 18.349 28.0004 17.0631 28.0004 15.7223C28.0004 14.3815 27.4678 13.0956 26.5197 12.1475C25.5716 11.1994 24.2857 10.6667 22.9449 10.6667H22.2227"
stroke="currentColor"
strokeWidth="2.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M25.1111 11.1V7.05556C25.1111 5.71474 24.5785 4.42884 23.6304 3.48074C22.6823 2.53264 21.3964 2 20.0556 2C18.7147 2 17.4288 2.53264 16.4807 3.48074C15.5326 4.42884 15 5.71474 15 7.05556M7.05556 20.7778C5.71474 20.7778 4.42884 20.2451 3.48074 19.297C2.53264 18.3489 2 17.063 2 15.7222C2 14.3814 2.53264 13.0955 3.48074 12.1474C4.42884 11.1993 5.71474 10.6667 7.05556 10.6667H7.77778"
stroke="currentColor"
strokeWidth="2.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M4.88867 11.1V7.05556C4.88867 5.71474 5.42131 4.42884 6.36941 3.48074C7.31751 2.53264 8.60341 2 9.94423 2C11.285 2 12.5709 2.53264 13.519 3.48074C14.4671 4.42884 14.9998 5.71474 14.9998 7.05556V21.5"
stroke="currentColor"
strokeWidth="2.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
}