forgot to convert prompt

This commit is contained in:
space-nuko
2023-05-18 20:26:24 -05:00
parent 6aeaa91f79
commit 3eb656d0df
3 changed files with 38 additions and 7 deletions

View File

@@ -108,6 +108,18 @@ const GroupDynamicThresholding = z.object({
}) })
export type ComfyBoxStdGroupDynamicThresholding = z.infer<typeof GroupDynamicThresholding> export type ComfyBoxStdGroupDynamicThresholding = z.infer<typeof GroupDynamicThresholding>
const GroupAestheticEmbedding = z.object({
model_name: z.string(),
lr: z.number(),
slerp: z.boolean(),
slerp_angle: z.number(),
steps: z.number(),
positive: z.string(),
negative: z.string(),
weight: z.number(),
})
export type ComfyBoxStdGroupAestheticEmbedding = z.infer<typeof GroupAestheticEmbedding>
const group = (s: ZodTypeAny) => z.optional(z.array(s).nonempty()); const group = (s: ZodTypeAny) => z.optional(z.array(s).nonempty());
const Parameters = z.object({ const Parameters = z.object({
@@ -151,4 +163,11 @@ const ComfyBoxStdPrompt = z.object({
}) })
export default ComfyBoxStdPrompt export default ComfyBoxStdPrompt
/*
* A standardized Stable Diffusion prompt and parameter format, to be used with
* an encompassing workflow. Aims to encompass an arbitrary number of parameter
* counts and types, so that most ComfyUI workflows can have parts of their
* prompts transferred between each other.
*/
export type ComfyBoxStdPrompt = z.infer<typeof ComfyBoxStdPrompt> export type ComfyBoxStdPrompt = z.infer<typeof ComfyBoxStdPrompt>

View File

@@ -33,6 +33,11 @@ export default function convertA1111ToStdPrompt(infotext: A1111ParsedInfotext):
const parameters: ComfyBoxStdParameters = {} const parameters: ComfyBoxStdParameters = {}
parameters.prompt = [{
positive: infotext.positive,
negative: infotext.negative,
}]
const hrUp = popOpt("hires upscale"); const hrUp = popOpt("hires upscale");
const hrSz = popOpt("hires resize"); const hrSz = popOpt("hires resize");
let hrScaleBy = hrUp ? parseFloat(hrUp) : undefined; let hrScaleBy = hrUp ? parseFloat(hrUp) : undefined;
@@ -138,6 +143,8 @@ export default function convertA1111ToStdPrompt(infotext: A1111ParsedInfotext):
}] }]
} }
// TODO ControlNet
for (const [extraNetworkType, extraNetworks] of Object.entries(infotext.extraNetworks)) { for (const [extraNetworkType, extraNetworks] of Object.entries(infotext.extraNetworks)) {
for (const extraNetworkParams of extraNetworks) { for (const extraNetworkParams of extraNetworks) {
let strength; let strength;
@@ -224,13 +231,6 @@ export default function convertA1111ToStdPrompt(infotext: A1111ParsedInfotext):
found = infotext.extraParams[`addnet model ${index}`] found = infotext.extraParams[`addnet model ${index}`]
} }
for (const [key, value] of Object.entries(infotext.extraParams)) {
if (key.startsWith("addnet model ")) {
const index = key.replace("addnet module ", "")
// delete infotext.extraParams[key];
}
}
const prompt: ComfyBoxStdPrompt = { const prompt: ComfyBoxStdPrompt = {
prompt: { prompt: {
metadata: { metadata: {

View File

@@ -44,6 +44,10 @@ export default class convertA1111ToStdPromptTests extends UnitTest {
a1111_shorthash: "925997e9", a1111_shorthash: "925997e9",
} }
}], }],
prompt: [{
positive: "highest quality, masterpiece, best quality, masterpiece, asuka langley sitting cross legged on a chair",
negative: "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts,signature, watermark, username, blurry, artist name"
}],
clip: [{ clip: [{
clip_skip: 2, clip_skip: 2,
}], }],
@@ -110,6 +114,10 @@ export default class convertA1111ToStdPromptTests extends UnitTest {
a1111_shorthash: "0f0eaaa61e", a1111_shorthash: "0f0eaaa61e",
} }
}], }],
prompt: [{
positive: "dreamlike fantasy landscape where everything is a shade of pink,\n dog ",
negative: "(worst quality:1.4), (low quality:1.4) , (monochrome:1.1)"
}],
clip: [{ clip: [{
clip_skip: 2, clip_skip: 2,
}], }],
@@ -204,6 +212,10 @@ export default class convertA1111ToStdPromptTests extends UnitTest {
a1111_shorthash: "0873291ac5", a1111_shorthash: "0873291ac5",
} }
}], }],
prompt: [{
positive: "1girl, pink hair",
negative: "(worst quality, low quality:1.4)",
}],
lora: [{ lora: [{
module_name: "LoRA", module_name: "LoRA",
model_name: "ElysiaV3-000002", model_name: "ElysiaV3-000002",