Add KlingAI O1 model, keepOriginalSound provider setting, Reference Videos input, and useCustomDimensions dropdown
This commit is contained in:
+23
-1
@@ -1674,6 +1674,7 @@ function videoModelSearchFilterHandler(videoModelSearchNode) {
|
||||
"klingai:5@2 (KlingAI V2.1 Pro (I2V))", "klingai:5@3 (KlingAI V2.0 Master)",
|
||||
"klingai:6@1 (KlingAI 2.5 Turbo Pro)",
|
||||
"klingai:7@1 (KlingAI Lip-Sync)",
|
||||
"klingai:kling@o1 (Kling VIDEO O1)",
|
||||
],
|
||||
"Veo": [
|
||||
"google:2@0 (Veo 2.0)", "google:3@0 (Veo 3.0)", "google:3@1 (Veo 3.0 Fast)",
|
||||
@@ -1734,6 +1735,7 @@ function videoModelSearchFilterHandler(videoModelSearchNode) {
|
||||
"klingai:5@3": {"width": 1920, "height": 1080},
|
||||
"klingai:6@1": {"width": 1920, "height": 1080},
|
||||
"klingai:7@1": {"width": 0, "height": 0},
|
||||
"klingai:kling@o1": {"width": 1440, "height": 1440},
|
||||
"google:2@0": {"width": 1280, "height": 720},
|
||||
"google:3@0": {"width": 1280, "height": 720},
|
||||
"google:3@1": {"width": 1280, "height": 720},
|
||||
@@ -1795,7 +1797,10 @@ function videoModelSearchFilterHandler(videoModelSearchNode) {
|
||||
const selectedModel = videoListWidget.value;
|
||||
if (!selectedModel) return;
|
||||
|
||||
if (useCustomDimensionsWidget && !useCustomDimensionsWidget.value) {
|
||||
const useCustomDimensionsValue = useCustomDimensionsWidget ? useCustomDimensionsWidget.value : "Model Default";
|
||||
|
||||
// Handle "Disabled" option - disable widgets and set to 0 (but Python will use None in dict)
|
||||
if (useCustomDimensionsValue === "Disabled") {
|
||||
setWidthHeightEnabled(false);
|
||||
if (widthWidget.callback) widthWidget.callback(0, "customSetOperation");
|
||||
widthWidget.value = 0;
|
||||
@@ -1805,11 +1810,19 @@ function videoModelSearchFilterHandler(videoModelSearchNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle "Model Default" option - disable widgets and use model defaults
|
||||
if (useCustomDimensionsValue === "Model Default") {
|
||||
setWidthHeightEnabled(false);
|
||||
} else if (useCustomDimensionsValue === "Custom") {
|
||||
// Handle "Custom" option - enable widgets
|
||||
setWidthHeightEnabled(true);
|
||||
}
|
||||
|
||||
const modelCode = selectedModel.split(" (")[0];
|
||||
const dims = MODEL_DIMENSIONS[modelCode] || DEFAULT_DIMENSIONS;
|
||||
|
||||
// Only update dimensions if "Model Default" is selected (widgets are disabled but we show the values)
|
||||
if (useCustomDimensionsValue === "Model Default") {
|
||||
if (dims.width === 0 && dims.height === 0) {
|
||||
// Set to None when dimensions are 0,0
|
||||
if (widthWidget.callback) widthWidget.callback(null, "customSetOperation");
|
||||
@@ -1820,6 +1833,9 @@ function videoModelSearchFilterHandler(videoModelSearchNode) {
|
||||
if (heightWidget.callback) heightWidget.callback(dims.height, "customSetOperation");
|
||||
videoModelSearchNode.setDirtyCanvas(true);
|
||||
}
|
||||
}
|
||||
// For "Custom" mode, don't update - let user set their own values
|
||||
// For "Disabled" mode, already handled above (set to None and disabled)
|
||||
}
|
||||
|
||||
function filterModelList() {
|
||||
@@ -1915,6 +1931,8 @@ function klingProviderSettingsToggleHandler(klingNode) {
|
||||
const bgmPromptWidget = klingNode.widgets.find(w => w.name === "bgmPrompt");
|
||||
const useAsmrModeWidget = klingNode.widgets.find(w => w.name === "useAsmrMode");
|
||||
const asmrModeWidget = klingNode.widgets.find(w => w.name === "asmrMode");
|
||||
const useKeepOriginalSoundWidget = klingNode.widgets.find(w => w.name === "useKeepOriginalSound");
|
||||
const keepOriginalSoundWidget = klingNode.widgets.find(w => w.name === "keepOriginalSound");
|
||||
|
||||
// Helper function to toggle widget enabled state (EXACT same pattern as imageInferenceToggleHandler)
|
||||
function toggleWidgetState(useWidget, paramWidget, paramName) {
|
||||
@@ -1986,6 +2004,10 @@ function klingProviderSettingsToggleHandler(klingNode) {
|
||||
if (useAsmrModeWidget && asmrModeWidget) {
|
||||
toggleWidgetState(useAsmrModeWidget, asmrModeWidget, "asmrMode");
|
||||
}
|
||||
|
||||
if (useKeepOriginalSoundWidget && keepOriginalSoundWidget) {
|
||||
toggleWidgetState(useKeepOriginalSoundWidget, keepOriginalSoundWidget, "keepOriginalSound");
|
||||
}
|
||||
}
|
||||
|
||||
function lumaProviderSettingsToggleHandler(lumaNode) {
|
||||
|
||||
@@ -70,6 +70,16 @@ class RunwareKlingProviderSettings:
|
||||
"tooltip": "Enable ASMR mode for audio generation",
|
||||
"default": False,
|
||||
}),
|
||||
"useKeepOriginalSound": ("BOOLEAN", {
|
||||
"tooltip": "Enable to include keepOriginalSound parameter in provider settings",
|
||||
"default": False,
|
||||
}),
|
||||
"keepOriginalSound": ("BOOLEAN", {
|
||||
"tooltip": "Keep the original sound from the source video. Only used when 'Use Keep Original Sound' is enabled.",
|
||||
"default": True,
|
||||
"label_on": "Enabled",
|
||||
"label_off": "Disabled",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +99,7 @@ class RunwareKlingProviderSettings:
|
||||
useSoundEffectPrompt = kwargs.get("useSoundEffectPrompt", False)
|
||||
useBgmPrompt = kwargs.get("useBgmPrompt", False)
|
||||
useAsmrMode = kwargs.get("useAsmrMode", False)
|
||||
useKeepOriginalSound = kwargs.get("useKeepOriginalSound", False)
|
||||
|
||||
# Get value parameters
|
||||
cameraControl = kwargs.get("cameraControl", "none")
|
||||
@@ -97,6 +108,7 @@ class RunwareKlingProviderSettings:
|
||||
soundEffectPrompt = kwargs.get("soundEffectPrompt", "")
|
||||
bgmPrompt = kwargs.get("bgmPrompt", "")
|
||||
asmrMode = kwargs.get("asmrMode", False)
|
||||
keepOriginalSound = kwargs.get("keepOriginalSound", True)
|
||||
|
||||
# Build settings dictionary - only include what is enabled
|
||||
klingSettings: Dict[str, Any] = {}
|
||||
@@ -125,6 +137,10 @@ class RunwareKlingProviderSettings:
|
||||
if useAsmrMode:
|
||||
klingSettings["asmrMode"] = asmrMode
|
||||
|
||||
# Add keepOriginalSound only if useKeepOriginalSound is enabled
|
||||
if useKeepOriginalSound:
|
||||
klingSettings["keepOriginalSound"] = keepOriginalSound
|
||||
|
||||
# Clean up None values
|
||||
klingSettings = {k: v for k, v in klingSettings.items() if v is not None}
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ class videoInferenceInputs:
|
||||
"References": ("RUNWAREVIDEOINPUTSREFERENCEIMAGES", {
|
||||
"tooltip": "Connect the Video Inputs References node to provide reference images."
|
||||
}),
|
||||
"Reference Videos": ("RUNWAREREFERENCEVIDEOS", {
|
||||
"tooltip": "Connect the Reference Videos node to provide reference video mediaUUIDs."
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +52,7 @@ class videoInferenceInputs:
|
||||
frame = kwargs.get("Frame", None)
|
||||
frameImages = kwargs.get("Frame Images", None)
|
||||
references = kwargs.get("References", None)
|
||||
referenceVideos = kwargs.get("Reference Videos", None)
|
||||
|
||||
inputs = {}
|
||||
|
||||
@@ -73,4 +77,7 @@ class videoInferenceInputs:
|
||||
if references is not None and len(references) > 0:
|
||||
inputs["referenceImages"] = references
|
||||
|
||||
if referenceVideos is not None and len(referenceVideos) > 0:
|
||||
inputs["referenceVideos"] = referenceVideos
|
||||
|
||||
return (inputs,)
|
||||
|
||||
@@ -16,6 +16,7 @@ class videoModelSearch:
|
||||
"klingai:5@3 (KlingAI V2.0 Master)",
|
||||
"klingai:6@1 (KlingAI 2.5 Turbo Pro)",
|
||||
"klingai:7@1 (KlingAI Lip-Sync)",
|
||||
"klingai:kling@o1 (Kling VIDEO O1)",
|
||||
],
|
||||
"Veo": [
|
||||
"google:2@0 (Veo 2.0)",
|
||||
@@ -94,6 +95,7 @@ class videoModelSearch:
|
||||
"klingai:5@3": {"width": 1920, "height": 1080},
|
||||
"klingai:6@1": {"width": 1920, "height": 1080},
|
||||
"klingai:7@1": {"width": 0, "height": 0},
|
||||
"klingai:kling@o1": {"width": 1440, "height": 1440},
|
||||
|
||||
# Veo Models
|
||||
"google:2@0": {"width": 1280, "height": 720},
|
||||
@@ -200,11 +202,9 @@ class videoModelSearch:
|
||||
"label_on": "Enabled",
|
||||
"label_off": "Disabled",
|
||||
}),
|
||||
"useCustomDimensions": ("BOOLEAN", {
|
||||
"tooltip": "Enable to use custom Width/Height values set below. Disable to automatically use the model's recommended resolution.",
|
||||
"default": False,
|
||||
"label_on": "Custom",
|
||||
"label_off": "Model Default",
|
||||
"useCustomDimensions": (["Model Default", "Custom", "Disabled"], {
|
||||
"tooltip": "Model Default: Use model's recommended resolution. Custom: Use custom Width/Height values. Disabled: Don't pass width/height to API.",
|
||||
"default": "Model Default",
|
||||
}),
|
||||
"Width": ("INT", {
|
||||
"default": defaultDims["width"],
|
||||
@@ -247,7 +247,7 @@ class videoModelSearch:
|
||||
searchInput = kwargs.get("Model Search")
|
||||
customWidth = kwargs.get("Width", 0)
|
||||
customHeight = kwargs.get("Height", 0)
|
||||
useCustomDimensions = kwargs.get("useCustomDimensions", True)
|
||||
useCustomDimensions = kwargs.get("useCustomDimensions", "Model Default")
|
||||
|
||||
if enableSearchValue:
|
||||
modelAirCode = searchInput
|
||||
@@ -257,18 +257,28 @@ class videoModelSearch:
|
||||
|
||||
dimensions = self.MODEL_DIMENSIONS.get(modelAirCode, self.DEFAULT_DIMENSIONS)
|
||||
|
||||
if useCustomDimensions:
|
||||
if useCustomDimensions == "Custom":
|
||||
# Use custom dimensions from Width/Height widgets
|
||||
width = customWidth
|
||||
height = customHeight
|
||||
else:
|
||||
returnWidth = width
|
||||
returnHeight = height
|
||||
elif useCustomDimensions == "Disabled":
|
||||
# Don't pass width/height (use None in dict, but return 0 for INT output)
|
||||
width = None
|
||||
height = None
|
||||
returnWidth = 0
|
||||
returnHeight = 0
|
||||
else: # "Model Default"
|
||||
# Use model default dimensions
|
||||
width = dimensions["width"]
|
||||
height = dimensions["height"]
|
||||
returnWidth = width
|
||||
returnHeight = height
|
||||
|
||||
return ({
|
||||
"model": modelAirCode,
|
||||
"useCustomDimensions": useCustomDimensions,
|
||||
"width": width,
|
||||
"height": height,
|
||||
}, width, height)
|
||||
}, returnWidth, returnHeight)
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user