|
|
|
@ -2,7 +2,7 @@ import type { |
|
|
|
Generate3DNodeData, |
|
|
|
GenerateAudioNodeData, |
|
|
|
GenerateVideoNodeData, |
|
|
|
ImageGenerationCount, |
|
|
|
GenerationBatchSize, |
|
|
|
NanoBananaNodeData, |
|
|
|
SelectedModel, |
|
|
|
WorkflowNodeData, |
|
|
|
@ -12,9 +12,8 @@ import { selectedModelCapabilities, selectedModelMetadataValue } from "@/utils/s |
|
|
|
import type { GenerationInput, ModelCapability, ModelParameter } from "@/lib/providers/types"; |
|
|
|
import { buildPopiTaskBody } from "@/utils/popiserverTaskPayload"; |
|
|
|
|
|
|
|
export const IMAGE_COUNT_PARAMETER_NAMES = [ |
|
|
|
export const BATCH_SIZE_PARAMETER_NAMES = [ |
|
|
|
"batchSize", |
|
|
|
"imageCount", |
|
|
|
"numImages", |
|
|
|
"num_images", |
|
|
|
"numOutputs", |
|
|
|
@ -22,8 +21,8 @@ export const IMAGE_COUNT_PARAMETER_NAMES = [ |
|
|
|
"count", |
|
|
|
]; |
|
|
|
|
|
|
|
export function isImageCountParameterName(name: string): boolean { |
|
|
|
return IMAGE_COUNT_PARAMETER_NAMES.includes(name); |
|
|
|
export function isBatchSizeParameterName(name: string): boolean { |
|
|
|
return BATCH_SIZE_PARAMETER_NAMES.includes(name); |
|
|
|
} |
|
|
|
|
|
|
|
export function updateModelParameterValue( |
|
|
|
@ -203,7 +202,7 @@ export interface GenerationNodeConfig { |
|
|
|
prompt: string; |
|
|
|
selectedModel: SelectedModel; |
|
|
|
inputImages: string[]; |
|
|
|
imageCount: ImageGenerationCount; |
|
|
|
batchSize: GenerationBatchSize; |
|
|
|
subType?: number; |
|
|
|
audioVoiceId?: string; |
|
|
|
referenceSubjectList: ComposerReferenceSubject[]; |
|
|
|
@ -270,7 +269,7 @@ export function readImageGenerationConfig( |
|
|
|
prompt: data.inputPrompt ?? "", |
|
|
|
selectedModel: data.selectedModel ?? defaultModel, |
|
|
|
inputImages: data.inputImages ?? [], |
|
|
|
imageCount: data.imageCount ?? 1, |
|
|
|
batchSize: data.batchSize ?? 1, |
|
|
|
subType: data.subType, |
|
|
|
audioVoiceId: undefined, |
|
|
|
referenceSubjectList: data.referenceSubjectList ?? [], |
|
|
|
@ -288,7 +287,7 @@ export function readVideoGenerationConfig( |
|
|
|
prompt: data.inputPrompt ?? "", |
|
|
|
selectedModel, |
|
|
|
inputImages: data.inputImages ?? [], |
|
|
|
imageCount: 1, |
|
|
|
batchSize: data.batchSize ?? 1, |
|
|
|
subType: data.subType, |
|
|
|
audioVoiceId: undefined, |
|
|
|
referenceSubjectList: data.referenceSubjectList ?? [], |
|
|
|
@ -305,7 +304,7 @@ export function readAudioGenerationConfig( |
|
|
|
prompt: data.inputPrompt ?? "", |
|
|
|
selectedModel: data.selectedModel ?? defaultModel, |
|
|
|
inputImages: [], |
|
|
|
imageCount: 1, |
|
|
|
batchSize: 1, |
|
|
|
subType: data.subType, |
|
|
|
audioVoiceId: data.audioVoiceId ?? stringFromUnknown(data.parameters?.voiceId) ?? stringFromUnknown(data.parameters?.voice_id) ?? undefined, |
|
|
|
referenceSubjectList: data.referenceSubjectList ?? [], |
|
|
|
@ -324,7 +323,7 @@ export function buildInitialGenerationNodeData( |
|
|
|
inputPrompt: config.prompt.trim(), |
|
|
|
model: "nano-banana-pro", |
|
|
|
selectedModel: config.selectedModel, |
|
|
|
imageCount: config.imageCount, |
|
|
|
batchSize: config.batchSize, |
|
|
|
referenceSubjectList: config.referenceSubjectList, |
|
|
|
parameters: filterTaskRoutingParameters(config.parameters), |
|
|
|
extraTaskParams: config.extraTaskParams ?? {}, |
|
|
|
@ -340,6 +339,7 @@ export function buildInitialGenerationNodeData( |
|
|
|
inputImages: config.inputImages, |
|
|
|
inputPrompt: config.prompt.trim(), |
|
|
|
selectedModel: config.selectedModel, |
|
|
|
batchSize: config.batchSize, |
|
|
|
referenceSubjectList: config.referenceSubjectList, |
|
|
|
parameters: filterTaskRoutingParameters(config.parameters), |
|
|
|
extraTaskParams: config.extraTaskParams ?? {}, |
|
|
|
@ -469,6 +469,7 @@ export function buildPopiserverPricingParameterPayload( |
|
|
|
parameters: dynamicParameters, |
|
|
|
referenceSubjectList: config.referenceSubjectList, |
|
|
|
audioVoiceId: config.audioVoiceId, |
|
|
|
batchSize: config.batchSize, |
|
|
|
}; |
|
|
|
|
|
|
|
const payload = buildPopiTaskBody(input, null); |
|
|
|
|