@imgly/plugin-ai-image-generation-web
Version:
AI image generation plugin for the CE.SDK editor
43 lines (42 loc) • 1.74 kB
TypeScript
import { type OpenAPIV3 } from 'openapi-types';
import type CreativeEditorSDK from '@cesdk/cesdk-js';
import type { CreativeEngine } from '@cesdk/cesdk-js';
import { ImageOutput, RenderCustomProperty, GetBlockInput, Provider, Middleware } from '@imgly/plugin-ai-generation-web';
import { ImageQuickActionSupportMap } from '../types';
export interface BytedanceProviderConfiguration {
proxyUrl: string;
debug?: boolean;
middlewares?: Middleware<any, any>[];
/**
* @deprecated Use `middlewares` instead.
*/
middleware?: Middleware<any, any>[];
history?: false | '@imgly/local' | '@imgly/indexedDB' | (string & {});
supportedQuickActions?: {
[quickActionId: string]: Partial<ImageQuickActionSupportMap<any>[string]> | false | null;
};
}
interface CreateProviderOptions<I extends Record<string, any>> {
providerId: string;
name: string;
schema: OpenAPIV3.Document;
inputReference: string;
useFlow?: 'placeholder' | 'generation-only';
initialize?: (context: {
cesdk?: CreativeEditorSDK;
engine: CreativeEngine;
}) => void;
renderCustomProperty?: RenderCustomProperty;
supportedQuickActions?: ImageQuickActionSupportMap<I>;
getBlockInput?: GetBlockInput<'image', I>;
getImageSize?: (input: I) => {
width: number;
height: number;
};
mapInput?: (input: I) => Record<string, unknown>;
middleware?: Middleware<I, ImageOutput>[];
headers?: Record<string, string>;
cesdk?: CreativeEditorSDK;
}
declare function createImageProvider<I extends Record<string, any>>(options: CreateProviderOptions<I>, config: BytedanceProviderConfiguration): Provider<'image', I, ImageOutput>;
export default createImageProvider;