diff --git a/src/app/api/resolve/providers/comfy/index.ts b/src/app/api/resolve/providers/comfy/index.ts index 52f06438..32389b11 100644 --- a/src/app/api/resolve/providers/comfy/index.ts +++ b/src/app/api/resolve/providers/comfy/index.ts @@ -32,7 +32,6 @@ export async function resolveSegment( ).init() if (request.segment.category === ClapSegmentCategory.STORYBOARD) { - const comfyApiWorkflow = JSON.parse( request.settings.imageGenerationWorkflow.data ) @@ -91,28 +90,28 @@ export async function resolveSegment( // to make things easier, we are going to assume that the ClapWorkflow object // is 100% correctly defined, and that we can rely on `inputFields` and `inputValues` // - // that way, the responsibility of automatically identifying the inputs from a raw JSON workflow + // that way, the responsibility of automatically identifying the inputs from a raw JSON workflow // (eg. coming from OpenArt.ai) will be done by a separate pre-processing code const inputFields = - request.settings.imageGenerationWorkflow.inputFields || [] - - // since this is a random "wild" workflow, it is possible - // that the field name is a bit different - // we try to look into the workflow input fields - // to find the best match - const promptFields = [ - inputFields.find((f) => f.id === 'prompt'), // exactMatch, - inputFields.find((f) => f.id.includes('prompt')), // similarName, - inputFields.find((f) => f.type === 'string'), // similarType - ].filter((x) => typeof x !== 'undefined') - - const promptField = promptFields[0] - if (!promptField) { - throw new Error( - `this workflow doesn't seem to have a parameter called "prompt"` - ) - } + request.settings.imageGenerationWorkflow.inputFields || [] + + // since this is a random "wild" workflow, it is possible + // that the field name is a bit different + // we try to look into the workflow input fields + // to find the best match + const promptFields = [ + inputFields.find((f) => f.id === 'prompt'), // exactMatch, + inputFields.find((f) => f.id.includes('prompt')), // similarName, + inputFields.find((f) => f.type === 'string'), // similarType + ].filter((x) => typeof x !== 'undefined') + + const promptField = promptFields[0] + if (!promptField) { + throw new Error( + `this workflow doesn't seem to have a parameter called "prompt"` + ) + } // TODO: modify the serialized workflow payload // to inject our params: diff --git a/src/app/api/resolve/providers/falai/index.ts b/src/app/api/resolve/providers/falai/index.ts index c4767b51..b3f3a97d 100644 --- a/src/app/api/resolve/providers/falai/index.ts +++ b/src/app/api/resolve/providers/falai/index.ts @@ -55,19 +55,30 @@ export async function resolveSegment( request.settings.imageGenerationWorkflow ) - // for the moment let's use FAL's predefined sizes - // but I've notived that with Flux.1 release they started to add - // support for custom sizes as well + // previous FAL used predefined sizes + // but I've notived that they started to add support for custom sizes as well + // so let's use custom sizing now + + const imageSize = { + width: + request.meta.width || + workflowValues.width || + workflowDefaultValues.width, + height: + request.meta.width || + workflowValues.height || + workflowDefaultValues.height, + } - const imageSize = + // this was the previous system + /* request.meta.orientation === ClapMediaOrientation.SQUARE ? FalAiImageSize.SQUARE_HD : request.meta.orientation === ClapMediaOrientation.PORTRAIT ? FalAiImageSize.PORTRAIT_16_9 : FalAiImageSize.LANDSCAPE_16_9 + */ - // for the moment let's use FAL's predefined sizes - // but see my previous comment above: it's temporary delete workflowDefaultValues.width delete workflowDefaultValues.height delete workflowValues.width @@ -76,6 +87,7 @@ export async function resolveSegment( if (model === 'fal-ai/pulid') { result = (await fal.run(model, { input: { + prompt: request.prompts.image.positive, reference_images: [ { image_url: request.prompts.image.identity, diff --git a/src/components/settings/constants.ts b/src/components/settings/constants.ts index c11a7704..d1b4a4f8 100644 --- a/src/components/settings/constants.ts +++ b/src/components/settings/constants.ts @@ -3,9 +3,10 @@ import { ClapWorkflowProvider } from '@aitube/clap' import { ComfyIcuAccelerator } from '@aitube/clapper-services' export const ClapWorkflowProviderShortNames = { - [ClapWorkflowProvider.BUILTIN]: 'BUilt-in', + [ClapWorkflowProvider.BUILTIN]: 'Clapper', [ClapWorkflowProvider.ANTHROPIC]: 'Anthropic', [ClapWorkflowProvider.COHERE]: 'Cohere', + [ClapWorkflowProvider.COMFYUI]: 'ComfyUI', [ClapWorkflowProvider.COMFYICU]: 'Comfy.icu', [ClapWorkflowProvider.COMFYDEPLOY]: 'ComfyDeploy.com', [ClapWorkflowProvider.CUSTOM]: 'Custom API', diff --git a/src/components/settings/provider.tsx b/src/components/settings/provider.tsx index f851b257..4a5555b1 100644 --- a/src/components/settings/provider.tsx +++ b/src/components/settings/provider.tsx @@ -118,7 +118,7 @@ export function SettingsSectionProvider() { onChange={setReplicateApiKey} type={apiKeyType} /> - +