@xiaoluo_aigc0708/aigc-sdk
Version:
AI智能建筑 - 完整的AIGC图片生成SDK
111 lines • 2.93 kB
TypeScript
import { ComfyUIConfig, GenerationResult } from '../../types/src/index';
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;
}
/**
* ComfyUI客户端
*/
export declare class ComfyUIClient {
private config;
constructor(config: ComfyUIConfig);
/**
* 发送工作流请求
*/
sendWorkflowRequest(request: ComfyUIWorkflowRequest): Promise<GenerationResult>;
/**
* 获取图片URL
*/
getImageUrl(filename: string): string;
/**
* 验证工作流参数
*/
validateWorkflowParams(params: {
prompt: string;
input_image?: string;
style_image?: string;
}): {
isValid: boolean;
errors: string[];
};
/**
* 获取工作流信息
*/
getWorkflowInfo(): {
workflows: {
render_text: {
name: string;
params: string[];
};
"render_ref-text": {
name: string;
params: string[];
};
"QH_image-text": {
name: string;
params: string[];
};
"QH_image-ref-text": {
name: string;
params: string[];
};
};
apiEndpoint: string;
};
}
/**
* 工作流构建器 - 完全按照后端API规范
*/
export declare class WorkflowBuilder {
static createTextToImageRequest(params: ComfyUIRequestParams): ComfyUIWorkflowRequest;
static createTextToImageWithRefRequest(params: ComfyUIRequestParams): ComfyUIWorkflowRequest;
static createImageToImageRequest(params: ComfyUIRequestParams): ComfyUIWorkflowRequest;
static createImageToImageWithRefRequest(params: ComfyUIRequestParams): ComfyUIWorkflowRequest;
}
export declare function selectWorkflowAndCreateRequest(params: {
prompt: string;
width?: number;
height?: number;
n_iter?: number;
batch_size?: number;
input_image?: string;
style_image?: string;
}): ComfyUIWorkflowRequest;
export declare function validateWorkflowParams(params: {
prompt: string;
input_image?: string;
style_image?: string;
}): {
isValid: boolean;
errors: string[];
};
export declare function getWorkflowInfo(): {
workflows: {
render_text: {
name: string;
params: string[];
};
"render_ref-text": {
name: string;
params: string[];
};
"QH_image-text": {
name: string;
params: string[];
};
"QH_image-ref-text": {
name: string;
params: string[];
};
};
apiEndpoint: string;
};
//# sourceMappingURL=index.d.ts.map