mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
39 lines
821 B
TypeScript
39 lines
821 B
TypeScript
import { CodeIcon } from '@/components/icons'
|
|
import { BlockConfig } from '../types'
|
|
import { CodeExecutionOutput } from '@/tools/function/execute'
|
|
|
|
export const FunctionBlock: BlockConfig<CodeExecutionOutput> = {
|
|
type: 'function',
|
|
toolbar: {
|
|
title: 'Function',
|
|
description: 'Add custom logic',
|
|
bgColor: '#FF8D2F',
|
|
icon: CodeIcon,
|
|
category: 'advanced',
|
|
},
|
|
tools: {
|
|
access: ['function.execute']
|
|
},
|
|
workflow: {
|
|
inputs: {
|
|
code: { type: 'string', required: true }
|
|
},
|
|
outputs: {
|
|
response: {
|
|
type: {
|
|
result: 'any',
|
|
stdout: 'string'
|
|
}
|
|
}
|
|
},
|
|
subBlocks: [
|
|
{
|
|
id: 'code',
|
|
title: 'Code',
|
|
type: 'code',
|
|
layout: 'full',
|
|
placeholder: 'Enter your code here...'
|
|
}
|
|
],
|
|
},
|
|
} |