From 4e75064b1c8325fa9b8d3bc6cc8c722dfb10e4e5 Mon Sep 17 00:00:00 2001 From: relhamdi Date: Thu, 21 May 2026 23:40:51 +0200 Subject: [PATCH] Add js for extra_options --- web/prompt_option_picker.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/prompt_option_picker.js b/web/prompt_option_picker.js index c582821..6fe6623 100644 --- a/web/prompt_option_picker.js +++ b/web/prompt_option_picker.js @@ -8,6 +8,7 @@ const attachOptionPicker = (node) => { const optionsWidget = node.widgets?.find((w) => w.name === "options"); const selectedWidget = node.widgets?.find((w) => w.name === "selected"); + const extraWidget = node.widgets?.find((w) => w.name === "extra_options"); if (!optionsWidget || !selectedWidget) return; if (optionsWidget._optionPickerAttached) return; @@ -15,7 +16,12 @@ const attachOptionPicker = (node) => { const parseOptions = () => { const raw = optionsWidget.value ?? ""; - if (!raw.trim()) return null; + const extra = extraWidget?.value ?? ""; + + // Prepend external options + const combined = extra.trim() ? extra.trim() + "\n" + raw : raw; + + if (!combined.trim()) return null; const lines = raw.split("\n").map((l) => l.trim()); const hasContent = lines.some((l) => l !== ""); @@ -42,6 +48,9 @@ const attachOptionPicker = (node) => { }; hookWidget(optionsWidget, () => refreshDropdown()); + if (extraWidget) { + hookWidget(extraWidget, () => refreshDropdown()); + } // Initial refresh refreshDropdown();