@imgly/plugin-ai-generation-web
Version:
AI generation plugin for the CE.SDK editor
29 lines (28 loc) • 1.07 kB
TypeScript
import type CreativeEditorSDK from '@cesdk/cesdk-js';
import { type Output, type OutputKind } from '../core/provider';
import { ResultSuccess } from '../generation/createGenerateFunction';
export type ApplyCallbacks = {
onBefore: () => void;
onAfter: () => void;
onCancel: () => void;
onApply: () => void;
};
type GetApplyCallbacksOptions = {
kind: OutputKind;
blockIds: number[];
cesdk: CreativeEditorSDK;
abortSignal?: AbortSignal;
};
type ReturnValue = {
applyCallbacks: ApplyCallbacks;
};
/**
* This method is used in the quick action menu to handle the result of the generation
* and providing methods for the comparision of the result.
*
* Different output kinds require different handling. E.g. the text generation
* is streamed to the text block, while the image generation is applied to the fill
* block with a source set and the same crop applied.
*/
declare function getApplyCallbacks<O extends Output>(result: ResultSuccess<O>, options: GetApplyCallbacksOptions): Promise<ReturnValue>;
export default getApplyCallbacks;