mirror of https://github.com/langgenius/dify.git
fix: trigger timestamp show place
This commit is contained in:
parent
04b55177b5
commit
439727746c
|
|
@ -68,7 +68,7 @@ export const getGlobalVars = (isChatMode: boolean): Var[] => {
|
|||
variable: 'sys.workflow_run_id',
|
||||
type: VarType.string,
|
||||
},
|
||||
...(isInWorkflow ? [
|
||||
...((isInWorkflow && !isChatMode) ? [
|
||||
{
|
||||
variable: 'sys.trigger_timestamp',
|
||||
type: VarType.string,
|
||||
|
|
|
|||
|
|
@ -5,13 +5,35 @@ import {
|
|||
useSysVarValues,
|
||||
} from '@/service/use-workflow'
|
||||
import { FlowType } from '@/types/common'
|
||||
import { produce } from 'immer'
|
||||
import { BlockEnum } from '../types'
|
||||
|
||||
const varsAppendStartNodeKeys = ['query', 'files']
|
||||
const useInspectVarsCrud = () => {
|
||||
const nodesWithInspectVars = useStore(s => s.nodesWithInspectVars)
|
||||
const partOfNodesWithInspectVars = useStore(s => s.nodesWithInspectVars)
|
||||
const configsMap = useHooksStore(s => s.configsMap)
|
||||
const isRagPipeline = configsMap?.flowType === FlowType.ragPipeline
|
||||
const { data: conversationVars } = useConversationVarValues(configsMap?.flowType, !isRagPipeline ? configsMap?.flowId : '')
|
||||
const { data: systemVars } = useSysVarValues(configsMap?.flowType, !isRagPipeline ? configsMap?.flowId : '')
|
||||
const { data: allSystemVars } = useSysVarValues(configsMap?.flowType, !isRagPipeline ? configsMap?.flowId : '')
|
||||
const { varsAppendStartNode, systemVars } = (() => {
|
||||
if(allSystemVars?.length === 0)
|
||||
return { varsAppendStartNode: [], systemVars: [] }
|
||||
const varsAppendStartNode = allSystemVars?.filter(({ name }) => varsAppendStartNodeKeys.includes(name)) || []
|
||||
const systemVars = allSystemVars?.filter(({ name }) => !varsAppendStartNodeKeys.includes(name)) || []
|
||||
return { varsAppendStartNode, systemVars }
|
||||
})()
|
||||
const nodesWithInspectVars = (() => {
|
||||
if(!partOfNodesWithInspectVars || partOfNodesWithInspectVars.length === 0)
|
||||
return []
|
||||
|
||||
const nodesWithInspectVars = produce(partOfNodesWithInspectVars, (draft) => {
|
||||
draft.forEach((nodeWithVars) => {
|
||||
if(nodeWithVars.nodeType === BlockEnum.Start)
|
||||
nodeWithVars.vars = [...nodeWithVars.vars, ...varsAppendStartNode]
|
||||
})
|
||||
})
|
||||
return nodesWithInspectVars
|
||||
})()
|
||||
const hasNodeInspectVars = useHooksStore(s => s.hasNodeInspectVars)
|
||||
const hasSetInspectVar = useHooksStore(s => s.hasSetInspectVar)
|
||||
const fetchInspectVarValue = useHooksStore(s => s.fetchInspectVarValue)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const Panel = () => {
|
|||
description: t('workflow.globalVar.fieldsDescription.workflowRunId'),
|
||||
},
|
||||
// is workflow
|
||||
...(isWorkflowPage ? [{
|
||||
...((isWorkflowPage && !isChatMode) ? [{
|
||||
name: 'trigger_timestamp',
|
||||
value_type: 'string' as const,
|
||||
description: t('workflow.globalVar.fieldsDescription.triggerTimestamp'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue