@xiaoluo_aigc0708/aigc-sdk
Version:
AI智能建筑 - 完整的AIGC图片生成SDK
142 lines • 3.18 kB
TypeScript
export interface AIGCConfig {
comfyui: ComfyUIConfig;
oss: OSSConfig;
ui?: UIConfig;
}
export interface ComfyUIConfig {
apiUrl: string;
imageServiceUrl: string;
timeout?: number;
retryTimes?: number;
}
export interface OSSConfig {
region: string;
accessKeyId: string;
accessKeySecret: string;
bucket: string;
endpoint: string;
}
export interface UIConfig {
theme?: 'light' | 'dark';
primaryColor?: string;
}
export interface ComfyUIWorkflowRequest {
workflow: string;
params: Record<string, any>;
}
export interface ComfyUIRequestParams {
prompt: string;
width?: number;
height?: number;
batch_size?: number;
image_url?: string;
ref_image_url?: string;
}
export declare enum WorkflowType {
TEXT_TO_IMAGE = "render_text",
TEXT_TO_IMAGE_WITH_REF = "render_ref-text",
IMAGE_TO_IMAGE = "QH_image-text",
IMAGE_TO_IMAGE_WITH_REF = "QH_image-ref-text"
}
export interface TextToImageParams {
prompt: string;
width?: number;
height?: number;
n_iter?: number;
styleImage?: File | null;
}
export interface ImageToImageParams {
prompt: string;
batch_size?: number;
init_images?: string[];
styleImage?: File | null;
}
export interface GenerationResult {
success: boolean;
data?: {
images: ImageResult[];
detail?: string;
prompt_id?: string;
};
error?: string;
}
export interface ImageResult {
filename: string;
url?: string;
}
export declare enum GenerationStatus {
GENERATING = "generating",
COMPLETED = "completed",
FAILED = "failed"
}
export interface GenerationRecord {
id: string;
prompt: string;
status: GenerationStatus;
images: string[];
timestamp: number;
workflow?: string;
error?: string;
progress?: number;
expectedImageCount?: number;
}
export interface SelectedImageInfo {
imageUrl: string;
recordId: string;
prompt: string;
workflow?: string;
timestamp: number;
index: number;
}
export interface OSSUploadResult {
success: boolean;
url?: string;
key?: string;
message?: string;
error?: string;
fallback?: boolean;
localFile?: {
name: string;
size: number;
type: string;
};
}
export interface OSSUploadConfig {
maxSize?: number;
allowedTypes?: string[];
path?: string;
}
export declare class AIGCError extends Error {
code: string;
details?: any;
constructor(message: string, code: string, details?: any);
}
export interface RetryConfig {
maxRetries?: number;
retryDelay?: number;
backoffFactor?: number;
}
export interface StyleLibraryItem {
id: string;
name: string;
img: string;
category?: string;
tags?: string[];
}
export interface StyleLibraryResponse {
success: boolean;
data: StyleLibraryItem[];
error?: string;
}
export interface ValidationResult {
isValid: boolean;
errors: string[];
}
export interface WorkflowInfo {
workflows: Record<WorkflowType, {
name: string;
params: string[];
}>;
apiEndpoint: string;
}
//# sourceMappingURL=index.d.ts.map