fix: answer node support choose file

This commit is contained in:
Joel 2024-10-09 10:31:59 +08:00
parent 2740d68cd1
commit 12492c0d5d
4 changed files with 11 additions and 0 deletions

View File

@ -79,6 +79,7 @@ export type PromptEditorProps = {
variableBlock?: VariableBlockType
externalToolBlock?: ExternalToolBlockType
workflowVariableBlock?: WorkflowVariableBlockType
isSupportFileVar?: boolean
}
const PromptEditor: FC<PromptEditorProps> = ({
@ -99,6 +100,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
variableBlock,
externalToolBlock,
workflowVariableBlock,
isSupportFileVar,
}) => {
const { eventEmitter } = useEventEmitterContextContext()
const initialConfig = {
@ -159,6 +161,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
variableBlock={variableBlock}
externalToolBlock={externalToolBlock}
workflowVariableBlock={workflowVariableBlock}
isSupportFileVar={isSupportFileVar}
/>
<ComponentPickerBlock
triggerString='{'
@ -168,6 +171,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
variableBlock={variableBlock}
externalToolBlock={externalToolBlock}
workflowVariableBlock={workflowVariableBlock}
isSupportFileVar={isSupportFileVar}
/>
{
contextBlock?.show && (

View File

@ -40,6 +40,7 @@ type ComponentPickerProps = {
variableBlock?: VariableBlockType
externalToolBlock?: ExternalToolBlockType
workflowVariableBlock?: WorkflowVariableBlockType
isSupportFileVar?: boolean
}
const ComponentPicker = ({
triggerString,
@ -49,6 +50,7 @@ const ComponentPicker = ({
variableBlock,
externalToolBlock,
workflowVariableBlock,
isSupportFileVar,
}: ComponentPickerProps) => {
const { eventEmitter } = useEventEmitterContextContext()
const { refs, floatingStyles, isPositioned } = useFloating({
@ -178,6 +180,7 @@ const ComponentPicker = ({
handleSelectWorkflowVariable(variables)
}}
maxHeightClass='max-h-[34vh]'
isSupportFileVar={isSupportFileVar}
/>
</div>
</>

View File

@ -58,6 +58,7 @@ type Props = {
}
nodesOutputVars?: NodeOutPutVar[]
availableNodes?: Node[]
isSupportFileVar?: boolean
isSupportPromptGenerator?: boolean
onGenerated?: (prompt: string) => void
modelConfig?: ModelConfig
@ -86,6 +87,7 @@ const Editor: FC<Props> = ({
hasSetBlockStatus,
nodesOutputVars,
availableNodes = [],
isSupportFileVar,
isSupportPromptGenerator,
isSupportJinja,
editionType,
@ -245,6 +247,7 @@ const Editor: FC<Props> = ({
onBlur={setBlur}
onFocus={setFocus}
editable={!readOnly}
isSupportFileVar={isSupportFileVar}
/>
{/* to patch Editor not support dynamic change editable status */}
{readOnly && <div className='absolute inset-0 z-10'></div>}

View File

@ -38,6 +38,7 @@ const Panel: FC<NodePanelProps<AnswerNodeType>> = ({
onChange={handleAnswerChange}
nodesOutputVars={availableVars}
availableNodes={availableNodesWithParent}
isSupportFileVar
/>
</div>
)