mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-10 23:48:09 -05:00
Updated block config structure
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useCallback } from 'react'
|
||||
import { useCallback } from 'react'
|
||||
import ReactFlow, {
|
||||
Background,
|
||||
Controls,
|
||||
NodeProps,
|
||||
NodeTypes,
|
||||
EdgeTypes,
|
||||
Connection,
|
||||
Edge,
|
||||
addEdge,
|
||||
useNodesState,
|
||||
useEdgesState,
|
||||
XYPosition,
|
||||
useReactFlow,
|
||||
ReactFlowProvider,
|
||||
ConnectionLineType,
|
||||
|
||||
@@ -11,20 +11,22 @@ export const AgentBlock: BlockConfig = {
|
||||
category: 'basic',
|
||||
},
|
||||
workflow: {
|
||||
inputs: {
|
||||
prompt: 'string',
|
||||
context: 'string',
|
||||
},
|
||||
outputs: {
|
||||
response: 'string',
|
||||
tokens: 'number',
|
||||
outputType: {
|
||||
default: 'string',
|
||||
dependsOn: {
|
||||
subBlockId: 'responseFormat',
|
||||
condition: {
|
||||
whenEmpty: 'string',
|
||||
whenFilled: 'json'
|
||||
}
|
||||
}
|
||||
},
|
||||
subBlocks: [
|
||||
{
|
||||
title: 'System Prompt',
|
||||
type: 'long-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter prompt',
|
||||
placeholder: 'Enter prompt'
|
||||
},
|
||||
{
|
||||
title: 'Context',
|
||||
@@ -53,10 +55,11 @@ export const AgentBlock: BlockConfig = {
|
||||
password: true
|
||||
},
|
||||
{
|
||||
id: 'responseFormat',
|
||||
title: 'Response Format',
|
||||
type: 'code',
|
||||
layout: 'full',
|
||||
},
|
||||
],
|
||||
},
|
||||
layout: 'full'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -11,15 +11,8 @@ export const ApiBlock: BlockConfig = {
|
||||
category: 'basic',
|
||||
},
|
||||
workflow: {
|
||||
inputs: {
|
||||
url: 'string',
|
||||
method: 'string',
|
||||
headers: 'object',
|
||||
body: 'string',
|
||||
},
|
||||
outputs: {
|
||||
response: 'string',
|
||||
statusCode: 'number',
|
||||
outputType: {
|
||||
default: 'json'
|
||||
},
|
||||
subBlocks: [
|
||||
{
|
||||
|
||||
@@ -11,13 +11,8 @@ export const ConditionalBlock: BlockConfig = {
|
||||
category: 'basic',
|
||||
},
|
||||
workflow: {
|
||||
inputs: {
|
||||
condition: 'boolean',
|
||||
value: 'any',
|
||||
},
|
||||
outputs: {
|
||||
result: 'any',
|
||||
path: 'string',
|
||||
outputType: {
|
||||
default: 'boolean'
|
||||
},
|
||||
subBlocks: [
|
||||
{
|
||||
|
||||
@@ -4,21 +4,35 @@ import type { JSX } from 'react'
|
||||
export type BlockType = 'agent' | 'api' | 'conditional'
|
||||
export type BlockIcon = (props: SVGProps<SVGSVGElement>) => JSX.Element
|
||||
export type BlockCategory = 'basic' | 'advanced'
|
||||
export type OutputType = 'string' | 'number' | 'json' | 'boolean'
|
||||
|
||||
export type SubBlockType = 'short-input' | 'long-input' | 'dropdown' | 'slider' | 'table' | 'code'
|
||||
export type SubBlockLayout = 'full' | 'half'
|
||||
|
||||
export interface SubBlockConfig {
|
||||
id?: string
|
||||
title: string
|
||||
type: SubBlockType
|
||||
layout?: SubBlockLayout
|
||||
options?: string[]
|
||||
min?: number
|
||||
max?: number
|
||||
layout?: SubBlockLayout
|
||||
columns?: string[]
|
||||
placeholder?: string
|
||||
password?: boolean
|
||||
}
|
||||
|
||||
export interface OutputTypeConfig {
|
||||
default: OutputType
|
||||
dependsOn?: {
|
||||
subBlockId: string
|
||||
condition: {
|
||||
whenEmpty: OutputType
|
||||
whenFilled: OutputType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface BlockConfig {
|
||||
type: BlockType
|
||||
toolbar: {
|
||||
@@ -29,8 +43,7 @@ export interface BlockConfig {
|
||||
category: BlockCategory
|
||||
}
|
||||
workflow: {
|
||||
inputs: Record<string, string>
|
||||
outputs: Record<string, string>
|
||||
outputType: OutputTypeConfig
|
||||
subBlocks: SubBlockConfig[]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user