mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
enh/refac: show input modal by default for prompt variables
This commit is contained in:
parent
7cc2afe973
commit
44754e4c4a
1 changed files with 12 additions and 0 deletions
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue