Skip to content

Commit 02d66b3

Browse files
committed
small fixes
1 parent b5369ea commit 02d66b3

File tree

4 files changed

+40
-28
lines changed

4 files changed

+40
-28
lines changed

src/app/api/resolve/providers/comfy/index.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export async function resolveSegment(
3232
).init()
3333

3434
if (request.segment.category === ClapSegmentCategory.STORYBOARD) {
35-
3635
const comfyApiWorkflow = JSON.parse(
3736
request.settings.imageGenerationWorkflow.data
3837
)
@@ -91,28 +90,28 @@ export async function resolveSegment(
9190
// to make things easier, we are going to assume that the ClapWorkflow object
9291
// is 100% correctly defined, and that we can rely on `inputFields` and `inputValues`
9392
//
94-
// that way, the responsibility of automatically identifying the inputs from a raw JSON workflow
93+
// that way, the responsibility of automatically identifying the inputs from a raw JSON workflow
9594
// (eg. coming from OpenArt.ai) will be done by a separate pre-processing code
9695

9796
const inputFields =
98-
request.settings.imageGenerationWorkflow.inputFields || []
99-
100-
// since this is a random "wild" workflow, it is possible
101-
// that the field name is a bit different
102-
// we try to look into the workflow input fields
103-
// to find the best match
104-
const promptFields = [
105-
inputFields.find((f) => f.id === 'prompt'), // exactMatch,
106-
inputFields.find((f) => f.id.includes('prompt')), // similarName,
107-
inputFields.find((f) => f.type === 'string'), // similarType
108-
].filter((x) => typeof x !== 'undefined')
109-
110-
const promptField = promptFields[0]
111-
if (!promptField) {
112-
throw new Error(
113-
`this workflow doesn't seem to have a parameter called "prompt"`
114-
)
115-
}
97+
request.settings.imageGenerationWorkflow.inputFields || []
98+
99+
// since this is a random "wild" workflow, it is possible
100+
// that the field name is a bit different
101+
// we try to look into the workflow input fields
102+
// to find the best match
103+
const promptFields = [
104+
inputFields.find((f) => f.id === 'prompt'), // exactMatch,
105+
inputFields.find((f) => f.id.includes('prompt')), // similarName,
106+
inputFields.find((f) => f.type === 'string'), // similarType
107+
].filter((x) => typeof x !== 'undefined')
108+
109+
const promptField = promptFields[0]
110+
if (!promptField) {
111+
throw new Error(
112+
`this workflow doesn't seem to have a parameter called "prompt"`
113+
)
114+
}
116115

117116
// TODO: modify the serialized workflow payload
118117
// to inject our params:

src/app/api/resolve/providers/falai/index.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,30 @@ export async function resolveSegment(
5555
request.settings.imageGenerationWorkflow
5656
)
5757

58-
// for the moment let's use FAL's predefined sizes
59-
// but I've notived that with Flux.1 release they started to add
60-
// support for custom sizes as well
58+
// previous FAL used predefined sizes
59+
// but I've notived that they started to add support for custom sizes as well
60+
// so let's use custom sizing now
61+
62+
const imageSize = {
63+
width:
64+
request.meta.width ||
65+
workflowValues.width ||
66+
workflowDefaultValues.width,
67+
height:
68+
request.meta.width ||
69+
workflowValues.height ||
70+
workflowDefaultValues.height,
71+
}
6172

62-
const imageSize =
73+
// this was the previous system
74+
/*
6375
request.meta.orientation === ClapMediaOrientation.SQUARE
6476
? FalAiImageSize.SQUARE_HD
6577
: request.meta.orientation === ClapMediaOrientation.PORTRAIT
6678
? FalAiImageSize.PORTRAIT_16_9
6779
: FalAiImageSize.LANDSCAPE_16_9
80+
*/
6881

69-
// for the moment let's use FAL's predefined sizes
70-
// but see my previous comment above: it's temporary
7182
delete workflowDefaultValues.width
7283
delete workflowDefaultValues.height
7384
delete workflowValues.width
@@ -76,6 +87,7 @@ export async function resolveSegment(
7687
if (model === 'fal-ai/pulid') {
7788
result = (await fal.run(model, {
7889
input: {
90+
prompt: request.prompts.image.positive,
7991
reference_images: [
8092
{
8193
image_url: request.prompts.image.identity,

src/components/settings/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { ClapWorkflowProvider } from '@aitube/clap'
33
import { ComfyIcuAccelerator } from '@aitube/clapper-services'
44

55
export const ClapWorkflowProviderShortNames = {
6-
[ClapWorkflowProvider.BUILTIN]: 'BUilt-in',
6+
[ClapWorkflowProvider.BUILTIN]: 'Clapper',
77
[ClapWorkflowProvider.ANTHROPIC]: 'Anthropic',
88
[ClapWorkflowProvider.COHERE]: 'Cohere',
9+
[ClapWorkflowProvider.COMFYUI]: 'ComfyUI',
910
[ClapWorkflowProvider.COMFYICU]: 'Comfy.icu',
1011
[ClapWorkflowProvider.COMFYDEPLOY]: 'ComfyDeploy.com',
1112
[ClapWorkflowProvider.CUSTOM]: 'Custom API',

src/components/settings/provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export function SettingsSectionProvider() {
118118
onChange={setReplicateApiKey}
119119
type={apiKeyType}
120120
/>
121-
121+
122122
<FormInput
123123
label="ComfyUI API URL"
124124
value={comfyUiApiUrl}

0 commit comments

Comments
 (0)