@imgly/plugin-ai-generation-web
Version:
AI generation plugin for the CE.SDK editor
51 lines (50 loc) • 1.57 kB
TypeScript
import { type GetBlockInput, OutputKind, type Output } from '../core/provider';
import { Generate, Result } from './createGenerateFunction';
import CreativeEditorSDK from '@cesdk/cesdk-js';
import { Middleware } from '../middleware/middleware';
type PanelGenerationOptions<K extends OutputKind, I, O extends Output> = {
/**
* The kind to generate.
*/
kind: K;
/**
* Initialized generate function
*/
generate: Generate<I, O>;
/**
* The user flow for the generation process.
*/
userFlow: 'placeholder' | 'generation-only';
/**
* Function to get block input from the generated input.
*/
getBlockInput: GetBlockInput<K, I>;
/**
* Asset source id of the history library where a generated asset
* will be added.
*/
historyAssetSourceId?: string;
/**
* Additional middlewares added to the generation process.
*/
middlewares?: Middleware<I, O>[];
/**
* Print debug information to the console.
*/
debug?: boolean;
/**
* Enable dry run mode for testing.
*/
dryRun?: boolean;
/**
* Signal to check if process was aborted.
*/
abortSignal: AbortSignal;
cesdk: CreativeEditorSDK;
};
/**
* Handler for generating content from a panel interface.
* Creates placeholder blocks and manages the generation process.
*/
declare function handleGenerateFromPanel<K extends OutputKind, I, O extends Output>(options: PanelGenerationOptions<K, I, O>): (input: I) => Promise<Result<O>>;
export default handleGenerateFromPanel;