Bugfix/Handling empty strings when resolving variables (#3864)

Bugfix for how to handle empty strings when resolving variables
This commit is contained in:
supraface
2025-01-17 00:14:06 +09:00
committed by GitHub
parent c89be26024
commit 5c9f17814b
2 changed files with 3 additions and 3 deletions
@@ -249,7 +249,7 @@ const runPrediction = async (
for (const variable of inputVariables) { for (const variable of inputVariables) {
seen.push(variable) seen.push(variable)
if (promptValues[variable]) { if (promptValues[variable] != null) {
seen.pop() seen.pop()
} }
} }
+2 -2
View File
@@ -879,7 +879,7 @@ export const getVariableValue = async (
if (variableFullPath.startsWith('$vars.')) { if (variableFullPath.startsWith('$vars.')) {
const vars = await getGlobalVariable(appDataSource, flowData, availableVariables, variableOverrides) const vars = await getGlobalVariable(appDataSource, flowData, availableVariables, variableOverrides)
const variableValue = get(vars, variableFullPath.replace('$vars.', '')) const variableValue = get(vars, variableFullPath.replace('$vars.', ''))
if (variableValue) { if (variableValue != null) {
variableDict[`{{${variableFullPath}}}`] = variableValue variableDict[`{{${variableFullPath}}}`] = variableValue
returnVal = returnVal.split(`{{${variableFullPath}}}`).join(variableValue) returnVal = returnVal.split(`{{${variableFullPath}}}`).join(variableValue)
} }
@@ -887,7 +887,7 @@ export const getVariableValue = async (
if (variableFullPath.startsWith('$flow.') && flowData) { if (variableFullPath.startsWith('$flow.') && flowData) {
const variableValue = get(flowData, variableFullPath.replace('$flow.', '')) const variableValue = get(flowData, variableFullPath.replace('$flow.', ''))
if (variableValue) { if (variableValue != null) {
variableDict[`{{${variableFullPath}}}`] = variableValue variableDict[`{{${variableFullPath}}}`] = variableValue
returnVal = returnVal.split(`{{${variableFullPath}}}`).join(variableValue) returnVal = returnVal.split(`{{${variableFullPath}}}`).join(variableValue)
} }