mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 05:00:44 +00:00
135 lines
3.6 KiB
TypeScript
135 lines
3.6 KiB
TypeScript
import type { AuthProfileStore } from "../agents/auth-profiles/types.js";
|
|
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
import type { SsrFPolicy } from "../infra/net/ssrf.js";
|
|
import type { MediaNormalizationEntry } from "../media-generation/normalization.types.js";
|
|
|
|
export type GeneratedImageAsset = {
|
|
buffer: Buffer;
|
|
mimeType: string;
|
|
fileName?: string;
|
|
revisedPrompt?: string;
|
|
metadata?: Record<string, unknown>;
|
|
};
|
|
|
|
export type ImageGenerationResolution = "1K" | "2K" | "4K";
|
|
|
|
export type ImageGenerationQuality = "low" | "medium" | "high" | "auto";
|
|
|
|
export type ImageGenerationOutputFormat = "png" | "jpeg" | "webp";
|
|
|
|
export type ImageGenerationBackground = "transparent" | "opaque" | "auto";
|
|
|
|
export type ImageGenerationOpenAIBackground = ImageGenerationBackground;
|
|
|
|
export type ImageGenerationOpenAIModeration = "low" | "auto";
|
|
|
|
export type ImageGenerationOpenAIOptions = {
|
|
background?: ImageGenerationOpenAIBackground;
|
|
moderation?: ImageGenerationOpenAIModeration;
|
|
outputCompression?: number;
|
|
user?: string;
|
|
};
|
|
|
|
export type ImageGenerationProviderOptions = {
|
|
openai?: ImageGenerationOpenAIOptions;
|
|
};
|
|
|
|
type ImageGenerationIgnoredOverrideKey =
|
|
| "size"
|
|
| "aspectRatio"
|
|
| "resolution"
|
|
| "quality"
|
|
| "outputFormat"
|
|
| "background";
|
|
|
|
export type ImageGenerationIgnoredOverride = {
|
|
key: ImageGenerationIgnoredOverrideKey;
|
|
value: string;
|
|
};
|
|
|
|
export type ImageGenerationSourceImage = {
|
|
buffer: Buffer;
|
|
mimeType: string;
|
|
fileName?: string;
|
|
metadata?: Record<string, unknown>;
|
|
};
|
|
|
|
export type ImageGenerationProviderConfiguredContext = {
|
|
cfg?: OpenClawConfig;
|
|
agentDir?: string;
|
|
};
|
|
|
|
export type ImageGenerationRequest = {
|
|
provider: string;
|
|
model: string;
|
|
prompt: string;
|
|
cfg: OpenClawConfig;
|
|
agentDir?: string;
|
|
authStore?: AuthProfileStore;
|
|
timeoutMs?: number;
|
|
count?: number;
|
|
size?: string;
|
|
aspectRatio?: string;
|
|
resolution?: ImageGenerationResolution;
|
|
quality?: ImageGenerationQuality;
|
|
outputFormat?: ImageGenerationOutputFormat;
|
|
background?: ImageGenerationBackground;
|
|
inputImages?: ImageGenerationSourceImage[];
|
|
providerOptions?: ImageGenerationProviderOptions;
|
|
ssrfPolicy?: SsrFPolicy;
|
|
};
|
|
|
|
export type ImageGenerationResult = {
|
|
images: GeneratedImageAsset[];
|
|
model?: string;
|
|
metadata?: Record<string, unknown>;
|
|
};
|
|
|
|
type ImageGenerationModeCapabilities = {
|
|
maxCount?: number;
|
|
supportsSize?: boolean;
|
|
supportsAspectRatio?: boolean;
|
|
supportsResolution?: boolean;
|
|
};
|
|
|
|
type ImageGenerationEditCapabilities = ImageGenerationModeCapabilities & {
|
|
enabled: boolean;
|
|
maxInputImages?: number;
|
|
};
|
|
|
|
type ImageGenerationGeometryCapabilities = {
|
|
sizes?: string[];
|
|
aspectRatios?: string[];
|
|
resolutions?: ImageGenerationResolution[];
|
|
};
|
|
|
|
type ImageGenerationOutputCapabilities = {
|
|
qualities?: ImageGenerationQuality[];
|
|
formats?: ImageGenerationOutputFormat[];
|
|
backgrounds?: ImageGenerationBackground[];
|
|
};
|
|
|
|
export type ImageGenerationNormalization = {
|
|
size?: MediaNormalizationEntry<string>;
|
|
aspectRatio?: MediaNormalizationEntry<string>;
|
|
resolution?: MediaNormalizationEntry<ImageGenerationResolution>;
|
|
};
|
|
|
|
export type ImageGenerationProviderCapabilities = {
|
|
generate: ImageGenerationModeCapabilities;
|
|
edit: ImageGenerationEditCapabilities;
|
|
geometry?: ImageGenerationGeometryCapabilities;
|
|
output?: ImageGenerationOutputCapabilities;
|
|
};
|
|
|
|
export type ImageGenerationProvider = {
|
|
id: string;
|
|
aliases?: string[];
|
|
label?: string;
|
|
defaultModel?: string;
|
|
models?: string[];
|
|
capabilities: ImageGenerationProviderCapabilities;
|
|
isConfigured?: (ctx: ImageGenerationProviderConfiguredContext) => boolean;
|
|
generateImage: (req: ImageGenerationRequest) => Promise<ImageGenerationResult>;
|
|
};
|