feat: adapt image tuning by engine
This commit is contained in:
@@ -42,6 +42,7 @@ export type SubmitImageJobInput = {
|
||||
max_ratio?: number;
|
||||
force_single?: boolean;
|
||||
resolution?: "4k" | "8k";
|
||||
quality?: string;
|
||||
seed?: number;
|
||||
retryOf?: string;
|
||||
idempotencyKey?: string;
|
||||
|
||||
@@ -35,6 +35,7 @@ export type PublicJobCreateBody = {
|
||||
max_ratio?: number;
|
||||
force_single?: boolean;
|
||||
resolution?: "4k" | "8k";
|
||||
quality?: string;
|
||||
seed?: number;
|
||||
};
|
||||
|
||||
@@ -101,6 +102,7 @@ export async function createPublicGenerationJob(input: {
|
||||
max_ratio: asNumber(input.body.max_ratio),
|
||||
force_single: Boolean(input.body.force_single),
|
||||
resolution: input.body.resolution,
|
||||
quality: normalizeQuality(input.body.quality),
|
||||
seed: asNumber(input.body.seed)
|
||||
} satisfies SubmitImageJobInput, input.origin);
|
||||
return { job, reused: false };
|
||||
@@ -132,6 +134,12 @@ function asNumber(value: unknown): number | undefined {
|
||||
return Number.isFinite(parsed) ? parsed : undefined;
|
||||
}
|
||||
|
||||
function normalizeQuality(value: unknown): string | undefined {
|
||||
if (typeof value !== "string") return undefined;
|
||||
const normalized = value.trim().toLowerCase();
|
||||
return ["low", "medium", "high"].includes(normalized) ? normalized : undefined;
|
||||
}
|
||||
|
||||
function fingerprintBody(body: PublicJobCreateBody): string {
|
||||
const { idempotencyKey: _idempotencyKey, ...fingerprintSource } = body;
|
||||
return createHash("sha256").update(stableStringify(fingerprintSource)).digest("hex");
|
||||
|
||||
Reference in New Issue
Block a user