Add a New Block via Composition API
Step 1: Import Necessary Components
import { OAIBaseComponent, type OmniComponentFormat, WorkerContext, OmniComponentMacroTypes } from "./path_to_file"Step 2: Create a New Component Instance
const NS_OMNI = 'your_namespace'
let component = OAIBaseComponent.create(NS_OMNI, 'your_operationId')Step 3: Define Component Characteristics
component
.fromScratch()
.set('description', 'Your description')
.set('title', 'Your title')
.set('category', 'Your category')
.setMethod('Your Method')
.setMeta({
source: {
summary: 'A standard text input component with built-in URL fetching, enabling it to be connected to File (Image/Audio/Document) sockets',
authors: ['Mercenaries.ai Team'],
links: {
'Mercenaries.ai': 'https://mercenaries.ai'
}
}
})Step 4: Create and Add Inputs and Outputs
Step 5: Create and Add Controls (Optional)
Step 6: Define Execution Macro
Step 8: Export the Component
Step 9: Add the Component to App Blocks
Optional Settings:
Composing Patches
Dependencies
Last updated
Was this helpful?