Fix: support hide env & conversation var in prompt editor (#7256)

This commit is contained in:
KVOJJJin 2024-08-14 15:14:39 +08:00 committed by GitHub
parent b5d472fad7
commit 429e85f5d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -7,12 +7,16 @@ import {
import type { ValueSelector, Var } from '@/app/components/workflow/types' import type { ValueSelector, Var } from '@/app/components/workflow/types'
type Params = { type Params = {
onlyLeafNodeVar?: boolean onlyLeafNodeVar?: boolean
hideEnv?: boolean
hideChatVar?: boolean
filterVar: (payload: Var, selector: ValueSelector) => boolean filterVar: (payload: Var, selector: ValueSelector) => boolean
} }
const useAvailableVarList = (nodeId: string, { const useAvailableVarList = (nodeId: string, {
onlyLeafNodeVar, onlyLeafNodeVar,
filterVar, filterVar,
hideEnv,
hideChatVar,
}: Params = { }: Params = {
onlyLeafNodeVar: false, onlyLeafNodeVar: false,
filterVar: () => true, filterVar: () => true,
@ -32,6 +36,8 @@ const useAvailableVarList = (nodeId: string, {
beforeNodes: availableNodes, beforeNodes: availableNodes,
isChatMode, isChatMode,
filterVar, filterVar,
hideEnv,
hideChatVar,
}) })
return { return {

View File

@ -23,6 +23,8 @@ const Panel: FC<NodePanelProps<AnswerNodeType>> = ({
const { availableVars, availableNodesWithParent } = useAvailableVarList(id, { const { availableVars, availableNodesWithParent } = useAvailableVarList(id, {
onlyLeafNodeVar: false, onlyLeafNodeVar: false,
hideChatVar: true,
hideEnv: true,
filterVar, filterVar,
}) })