ui: implement elegant static labels for Qwen-TTS speaker guide using is_label

This commit is contained in:
Hawk Lee
2026-02-04 09:25:03 +08:00
parent 34fcb61a11
commit 8a60897c63
2 changed files with 13 additions and 8 deletions
+2 -2
View File
@@ -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
View File
@@ -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;