feat: Allow using file variables directly in the LLM node and support more file types. (#10679)
Co-authored-by: Joel <iamjoel007@gmail.com>
This commit is contained in:
@@ -160,6 +160,7 @@ const CodeEditor: FC<Props> = ({
|
||||
hideSearch
|
||||
vars={availableVars}
|
||||
onChange={handleSelectVar}
|
||||
isSupportFileVar={false}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
@@ -18,6 +18,7 @@ type Props = {
|
||||
isSupportConstantValue?: boolean
|
||||
onlyLeafNodeVar?: boolean
|
||||
filterVar?: (payload: Var, valueSelector: ValueSelector) => boolean
|
||||
isSupportFileVar?: boolean
|
||||
}
|
||||
|
||||
const VarList: FC<Props> = ({
|
||||
@@ -29,6 +30,7 @@ const VarList: FC<Props> = ({
|
||||
isSupportConstantValue,
|
||||
onlyLeafNodeVar,
|
||||
filterVar,
|
||||
isSupportFileVar = true,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
@@ -94,6 +96,7 @@ const VarList: FC<Props> = ({
|
||||
defaultVarKindType={item.variable_type}
|
||||
onlyLeafNodeVar={onlyLeafNodeVar}
|
||||
filterVar={filterVar}
|
||||
isSupportFileVar={isSupportFileVar}
|
||||
/>
|
||||
{!readonly && (
|
||||
<RemoveButton
|
||||
|
@@ -59,6 +59,7 @@ type Props = {
|
||||
isInTable?: boolean
|
||||
onRemove?: () => void
|
||||
typePlaceHolder?: string
|
||||
isSupportFileVar?: boolean
|
||||
}
|
||||
|
||||
const VarReferencePicker: FC<Props> = ({
|
||||
@@ -81,6 +82,7 @@ const VarReferencePicker: FC<Props> = ({
|
||||
isInTable,
|
||||
onRemove,
|
||||
typePlaceHolder,
|
||||
isSupportFileVar = true,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const store = useStoreApi()
|
||||
@@ -382,6 +384,7 @@ const VarReferencePicker: FC<Props> = ({
|
||||
vars={outputVars}
|
||||
onChange={handleVarReferenceChange}
|
||||
itemWidth={isAddBtnTrigger ? 260 : triggerWidth}
|
||||
isSupportFileVar={isSupportFileVar}
|
||||
/>
|
||||
)}
|
||||
</PortalToFollowElemContent>
|
||||
|
@@ -8,11 +8,13 @@ type Props = {
|
||||
vars: NodeOutPutVar[]
|
||||
onChange: (value: ValueSelector, varDetail: Var) => void
|
||||
itemWidth?: number
|
||||
isSupportFileVar?: boolean
|
||||
}
|
||||
const VarReferencePopup: FC<Props> = ({
|
||||
vars,
|
||||
onChange,
|
||||
itemWidth,
|
||||
isSupportFileVar = true,
|
||||
}) => {
|
||||
// max-h-[300px] overflow-y-auto todo: use portal to handle long list
|
||||
return (
|
||||
@@ -24,7 +26,7 @@ const VarReferencePopup: FC<Props> = ({
|
||||
vars={vars}
|
||||
onChange={onChange}
|
||||
itemWidth={itemWidth}
|
||||
isSupportFileVar
|
||||
isSupportFileVar={isSupportFileVar}
|
||||
/>
|
||||
</div >
|
||||
)
|
||||
|
Reference in New Issue
Block a user