From 6782d04f005f2de945352b78358968134d69952d Mon Sep 17 00:00:00 2001 From: AustinMroz Date: Tue, 25 Nov 2025 10:36:14 -0800 Subject: [PATCH] Support display_name on frontend (#6922) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v3 schema allows defining a `display_name` on inputs, but this was previously ignored on the frontend. It is now used to designate a default value for the label of a widget or input. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6922-Support-display_name-on-frontend-2b66d73d365081d992cbea07abc27a0f) by [Unito](https://www.unito.io) --- src/schemas/nodeDefSchema.ts | 1 + src/services/litegraphService.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/schemas/nodeDefSchema.ts b/src/schemas/nodeDefSchema.ts index fd6943b96..f1a93dadb 100644 --- a/src/schemas/nodeDefSchema.ts +++ b/src/schemas/nodeDefSchema.ts @@ -27,6 +27,7 @@ export const zBaseInputOptions = z .object({ default: z.any().optional(), defaultInput: z.boolean().optional(), + display_name: z.string().optional(), forceInput: z.boolean().optional(), tooltip: z.string().optional(), socketless: z.boolean().optional(), diff --git a/src/services/litegraphService.ts b/src/services/litegraphService.ts index 85b30ce46..6ea083df2 100644 --- a/src/services/litegraphService.ts +++ b/src/services/litegraphService.ts @@ -95,10 +95,11 @@ export const useLitegraphService = () => { ) if (widgetConstructor && !inputSpec.forceInput) return - node.addInput(inputName, inputSpec.type, { + const input = node.addInput(inputName, inputSpec.type, { shape: inputSpec.isOptional ? RenderShape.HollowCircle : undefined, localized_name: st(nameKey, inputName) }) + input.label ??= inputSpec.display_name } /** * @internal Setup stroke styles for the node under various conditions. @@ -164,7 +165,10 @@ export const useLitegraphService = () => { ) ?? {} if (widget) { - widget.label = st(nameKey, widget.label ?? inputName) + widget.label = st( + nameKey, + widget.label ?? widgetInputSpec.display_name ?? inputName + ) widget.options ??= {} Object.assign(widget.options, { advanced: inputSpec.advanced,