enh/refac: show input modal by default for prompt variables

This commit is contained in:
Timothy Jaeryang Baek 2025-07-06 14:16:34 +04:00
parent 7cc2afe973
commit 44754e4c4a

View file

@ -120,6 +120,8 @@
const extractInputVariables = (text: string): Record<string, any> => {
const regex = /{{\s*([^|}\s]+)\s*\|\s*([^}]+)\s*}}/g;
const regularRegex = /{{\s*([^|}\s]+)\s*}}/g;
const variables: Record<string, any> = {};
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;
};