koishi-plugin-novelai
Version:
Generate images by diffusion models
189 lines (188 loc) • 5.87 kB
TypeScript
import { Computed, Dict, Schema, Session } from 'koishi';
import { Size } from './utils';
export declare const modelMap: {
readonly safe: "safe-diffusion";
readonly nai: "nai-diffusion";
readonly furry: "nai-diffusion-furry";
readonly 'nai-v3': "nai-diffusion-3";
readonly 'nai-v4-curated-preview': "nai-diffusion-4-curated-preview";
readonly 'nai-v4-full': "nai-diffusion-4-full";
};
export declare const orientMap: {
readonly landscape: {
readonly height: 832;
readonly width: 1216;
};
readonly portrait: {
readonly height: 1216;
readonly width: 832;
};
readonly square: {
readonly height: 1024;
readonly width: 1024;
};
};
export declare const hordeModels: string[];
type Model = keyof typeof modelMap;
type Orient = keyof typeof orientMap;
export declare const models: Model[];
export declare const orients: Orient[];
export declare namespace scheduler {
const nai: readonly ["native", "karras", "exponential", "polyexponential"];
const nai4: readonly ["karras", "exponential", "polyexponential"];
const sd: readonly ["Automatic", "Uniform", "Karras", "Exponential", "Polyexponential", "SGM Uniform"];
const horde: readonly ["karras"];
const comfyUI: readonly ["normal", "karras", "exponential", "sgm_uniform", "simple", "ddim_uniform"];
}
export declare namespace sampler {
const nai: {
k_euler_a: string;
k_euler: string;
k_lms: string;
ddim: string;
plms: string;
};
const nai3: {
k_euler: string;
k_euler_a: string;
k_dpmpp_2s_ancestral: string;
k_dpmpp_2m: string;
k_dpmpp_sde: string;
ddim_v3: string;
};
const nai4: {
k_euler: string;
k_euler_a: string;
k_dpmpp_2s_ancestral: string;
k_dpmpp_2m_sde: string;
k_dpmpp_2m: string;
k_dpmpp_sde: string;
};
const sd: Dict<string>;
const horde: {
k_lms: string;
k_heun: string;
k_euler: string;
k_euler_a: string;
k_dpm_2: string;
k_dpm_2_a: string;
k_dpm_fast: string;
k_dpm_adaptive: string;
k_dpmpp_2m: string;
k_dpmpp_2s_a: string;
k_dpmpp_sde: string;
dpmsolver: string;
lcm: string;
DDIM: string;
};
const comfyui: {
euler: string;
euler_ancestral: string;
heun: string;
heunpp2: string;
dpm_2: string;
dpm_2_ancestral: string;
lms: string;
dpm_fast: string;
dpm_adaptive: string;
dpmpp_2s_ancestral: string;
dpmpp_sde: string;
dpmpp_sde_gpu: string;
dpmpp_2m: string;
dpmpp_2m_sde: string;
dpmpp_2m_sde_gpu: string;
dpmpp_3m_sde: string;
dpmpp_3m_sde_gpu: string;
ddpm: string;
lcm: string;
ddim: string;
uni_pc: string;
uni_pc_bh2: string;
};
function createSchema(map: Dict<string>): Schema<string, string>;
function sd2nai(sampler: string, model: string): string;
}
export declare const upscalers: readonly ["None", "Lanczos", "Nearest", "LDSR", "ESRGAN_4x", "R-ESRGAN General 4xV3", "R-ESRGAN General WDN 4xV3", "R-ESRGAN AnimeVideo", "R-ESRGAN 4x+", "R-ESRGAN 4x+ Anime6B", "R-ESRGAN 2x+", "ScuNET GAN", "ScuNET PSNR", "SwinIR 4x"];
export declare const latentUpscalers: string[];
export interface Options {
enhance: boolean;
model: string;
resolution: Size;
sampler: string;
seed: string;
steps: number;
scale: number;
noise: number;
strength: number;
}
export interface PromptConfig {
basePrompt?: Computed<string>;
negativePrompt?: Computed<string>;
forbidden?: Computed<string>;
defaultPromptSw?: boolean;
defaultPrompt?: Computed<string>;
placement?: Computed<'before' | 'after'>;
latinOnly?: Computed<boolean>;
translator?: boolean;
lowerCase?: boolean;
maxWords?: Computed<number>;
}
export declare const PromptConfig: Schema<PromptConfig>;
interface FeatureConfig {
anlas?: Computed<boolean>;
text?: Computed<boolean>;
image?: Computed<boolean>;
upscale?: Computed<boolean>;
}
interface ParamConfig {
model?: Model;
sampler?: string;
smea?: boolean;
smeaDyn?: boolean;
scheduler?: string;
rescale?: Computed<number>;
decrisper?: boolean;
upscaler?: string;
restoreFaces?: boolean;
hiresFix?: boolean;
hiresFixUpscaler: string;
scale?: Computed<number>;
textSteps?: Computed<number>;
imageSteps?: Computed<number>;
maxSteps?: Computed<number>;
strength?: Computed<number>;
noise?: Computed<number>;
resolution?: Computed<Orient | Size>;
maxResolution?: Computed<number>;
}
export interface Config extends PromptConfig, ParamConfig {
type: 'token' | 'login' | 'naifu' | 'sd-webui' | 'stable-horde' | 'comfyui';
token?: string;
email?: string;
password?: string;
authLv?: Computed<number>;
authLvDefault?: Computed<number>;
output?: Computed<'minimal' | 'default' | 'verbose'>;
features?: FeatureConfig;
apiEndpoint?: string;
endpoint?: string;
headers?: Dict<string>;
nsfw?: Computed<'disallow' | 'censor' | 'allow'>;
maxIterations?: number;
maxRetryCount?: number;
requestTimeout?: number;
recallTimeout?: number;
maxConcurrency?: number;
pollInterval?: number;
trustedWorkers?: boolean;
workflowText2Image?: string;
workflowImage2Image?: string;
}
export declare const Config: Schema<Config>;
interface Forbidden {
pattern: string;
strict: boolean;
}
export declare function parseForbidden(input: string): Forbidden[];
export declare function parseInput(session: Session, input: string, config: Config, override: boolean): string[];
export {};