feat(image): add OpenAI/Bifrost compatible image generation provider
This commit is contained in:
1 parent
93ae5b7342
commit
2011077fcd
10 files changed
+1019
-21
No files matched your search
Vendored
+53
-1
@@ -30,6 +30,58 @@ declare module "openclaw/plugin-sdk/video-generation" {
|
||||
}
|
||||
}
|
||||
|
||||
declare module "openclaw/plugin-sdk/image-generation" {
|
||||
export interface GeneratedImageAsset {
|
||||
buffer: Buffer;
|
||||
mimeType: string;
|
||||
fileName?: string;
|
||||
revisedPrompt?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ImageGenerationRequest {
|
||||
prompt: string;
|
||||
model?: string;
|
||||
count?: number;
|
||||
size?: string;
|
||||
aspectRatio?: string;
|
||||
resolution?: string;
|
||||
quality?: string;
|
||||
outputFormat?: string;
|
||||
background?: string;
|
||||
inputImages?: Array<{ buffer: Buffer; mimeType?: string; fileName?: string }>;
|
||||
cfg?: any;
|
||||
agentDir?: string;
|
||||
authStore?: any;
|
||||
timeoutMs?: number;
|
||||
ssrfPolicy?: any;
|
||||
providerOptions?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ImageGenerationResult {
|
||||
images: GeneratedImageAsset[];
|
||||
model?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ImageGenerationProvider {
|
||||
id: string;
|
||||
aliases?: string[];
|
||||
label?: string;
|
||||
defaultModel?: string;
|
||||
defaultTimeoutMs?: number;
|
||||
models?: string[];
|
||||
capabilities: any;
|
||||
isConfigured?: (ctx: { cfg?: any }) => boolean;
|
||||
generateImage: (req: ImageGenerationRequest) => Promise<ImageGenerationResult>;
|
||||
}
|
||||
|
||||
export function parseOpenAiCompatibleImageResponse(
|
||||
payload: unknown,
|
||||
options?: { defaultMimeType?: string; malformedResponseError?: string; fileNamePrefix?: string; sniffMimeType?: boolean },
|
||||
): GeneratedImageAsset[];
|
||||
}
|
||||
|
||||
declare module "openclaw/plugin-sdk/provider-http" {
|
||||
export function createProviderOperationDeadline(params: { timeoutMs?: number; label: string }): any;
|
||||
export function createProviderOperationTimeoutResolver(params: { deadline: any; defaultTimeoutMs: number }): () => number;
|
||||
@@ -39,7 +91,7 @@ declare module "openclaw/plugin-sdk/provider-http" {
|
||||
export function assertOkOrThrowHttpError(response: Response, message: string): Promise<void>;
|
||||
export function postMultipartRequest(params: any): Promise<{ response: Response; release: () => Promise<void> }>;
|
||||
export function postJsonRequest(params: any): Promise<{ response: Response; release: () => Promise<void> }>;
|
||||
export function readProviderJsonResponse<T = any>(response: Response, message: string): Promise<T>;
|
||||
export function readProviderJsonResponse<T = any>(response: Response, message: string, opts?: any): Promise<T>;
|
||||
export function pollProviderOperationJson<T = any>(params: any): Promise<T>;
|
||||
export function resolveProviderOperationTimeoutMs(params: any): number;
|
||||
export function resolveProviderHttpRequestConfig(params: any): any;
|
||||
|
||||
Reference in new issue
Block a user