From 3cc66903563b742b485c0905884b425301f00555 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Mon, 3 Nov 2025 17:12:58 +0800 Subject: [PATCH] fix(trigger): global var dialogue_count and timestamp auto converted to string --- web/app/components/workflow/constants.ts | 2 +- .../workflow/nodes/_base/components/variable/utils.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/app/components/workflow/constants.ts b/web/app/components/workflow/constants.ts index 79f5816e60..ad498ff65b 100644 --- a/web/app/components/workflow/constants.ts +++ b/web/app/components/workflow/constants.ts @@ -71,7 +71,7 @@ export const getGlobalVars = (isChatMode: boolean): Var[] => { ...((isInWorkflow && !isChatMode) ? [ { variable: 'sys.timestamp', - type: VarType.integer, + type: VarType.number, }, ] : []), ] diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index fd8df9cbbd..3bd43bd29a 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -1063,7 +1063,8 @@ export const getVarType = ({ if (valueSelector[1] === 'index') return VarType.number } - const isInStartNodeSysVar = isSystemVar(valueSelector) && !isGlobalVar(valueSelector) + const isGlobal = isGlobalVar(valueSelector) + const isInStartNodeSysVar = isSystemVar(valueSelector) && !isGlobal const isEnv = isENV(valueSelector) const isChatVar = isConversationVar(valueSelector) const isSharedRagVariable @@ -1077,6 +1078,7 @@ export const getVarType = ({ const targetVarNodeId = (() => { if (isInStartNodeSysVar) return startNode?.id + if (isGlobal) return 'global' if (isInNodeRagVariable) return valueSelector[1] return valueSelector[0] })() @@ -1089,7 +1091,7 @@ export const getVarType = ({ let type: VarType = VarType.string let curr: any = targetVar.vars - if (isInStartNodeSysVar || isEnv || isChatVar || isSharedRagVariable) { + if (isInStartNodeSysVar || isEnv || isChatVar || isSharedRagVariable || isGlobal) { return curr.find( (v: any) => v.variable === (valueSelector as ValueSelector).join('.'), )?.type