ui: implement elegant static labels for Qwen-TTS speaker guide using is_label
This commit is contained in:
+2
-2
@@ -94,7 +94,7 @@ class AIIA_Qwen_TTS:
|
||||
"optional": {
|
||||
"speaker": (QWEN_SPEAKER_LIST, {"default": "Vivian"}),
|
||||
"instruct": ("STRING", {"multiline": True, "default": ""}),
|
||||
"preset_note": ("STRING", {"default": QWEN_PRESET_NOTE, "label_on_node": True}),
|
||||
"preset_note": ("STRING", {"default": QWEN_PRESET_NOTE, "is_label": True}),
|
||||
"reference_audio": ("AUDIO",),
|
||||
"reference_text": ("STRING", {"multiline": True, "default": ""}),
|
||||
"x_vector_only": ("BOOLEAN", {"default": False}),
|
||||
@@ -217,7 +217,7 @@ class AIIA_Qwen_Dialogue_TTS:
|
||||
"qwen_custom_model": ("QWEN_MODEL",),
|
||||
"qwen_design_model": ("QWEN_MODEL",),
|
||||
|
||||
"preset_note": ("STRING", {"default": QWEN_PRESET_NOTE, "label_on_node": True}),
|
||||
"preset_note": ("STRING", {"default": QWEN_PRESET_NOTE, "is_label": True}),
|
||||
|
||||
# Speaker A
|
||||
"speaker_A_mode": (["Clone", "Preset", "Design"], {"default": "Clone"}),
|
||||
|
||||
+11
-6
@@ -5,16 +5,21 @@ import { app } from "../../../scripts/app.js";
|
||||
app.registerExtension({
|
||||
name: "AIIA.Labels",
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
// Iterate through required inputs to find ones marked as is_label
|
||||
// Iterate through required and optional inputs to find ones marked as is_label
|
||||
const requiredInputs = nodeData.input?.required || {};
|
||||
const optionalInputs = nodeData.input?.optional || {};
|
||||
|
||||
let labelWidgetNames = [];
|
||||
for (const [name, inputDef] of Object.entries(requiredInputs)) {
|
||||
// inputDef is [type, metadata_dict]
|
||||
if (inputDef[1] && inputDef[1].is_label === true) {
|
||||
labelWidgetNames.push(name);
|
||||
const checkInputs = (inputs) => {
|
||||
for (const [name, inputDef] of Object.entries(inputs)) {
|
||||
if (inputDef[1] && inputDef[1].is_label === true) {
|
||||
labelWidgetNames.push(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
checkInputs(requiredInputs);
|
||||
checkInputs(optionalInputs);
|
||||
|
||||
if (labelWidgetNames.length > 0) {
|
||||
const onNodeCreated = nodeType.prototype.onNodeCreated;
|
||||
|
||||
Reference in New Issue
Block a user