From 44754e4c4ab7829bb0f85a84508a39adaa74bc22 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 6 Jul 2025 14:16:34 +0400 Subject: [PATCH] enh/refac: show input modal by default for prompt variables --- src/lib/components/chat/MessageInput.svelte | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 4df86f2675..59f87b2e46 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -120,6 +120,8 @@ const extractInputVariables = (text: string): Record => { const regex = /{{\s*([^|}\s]+)\s*\|\s*([^}]+)\s*}}/g; + const regularRegex = /{{\s*([^|}\s]+)\s*}}/g; + const variables: Record = {}; let match; @@ -130,6 +132,16 @@ variables[varName] = parseVariableDefinition(definition); } + // Then, extract regular variables (without pipe) - only if not already processed + while ((match = regularRegex.exec(text)) !== null) { + const varName = match[1].trim(); + + // Only add if not already processed as custom variable + if (!variables.hasOwnProperty(varName)) { + variables[varName] = { type: 'text' }; // Default type for regular variables + } + } + return variables; };