(({
name: rcFile.name,
status: 'uploading' as UploadFileStatus,
percent: 0,
- type: rcFile.type,
+ type: (rcFile.type && transform_file_type[rcFile.type as keyof typeof transform_file_type]) || rcFile.type || 'document',
originFileObj: rcFile,
thumbUrl: URL.createObjectURL(rcFile),
size: rcFile.size,
diff --git a/web/src/views/Workflow/components/Properties/VariableSelect.tsx b/web/src/views/Workflow/components/Properties/VariableSelect.tsx
index a5428a60..38c48dba 100644
--- a/web/src/views/Workflow/components/Properties/VariableSelect.tsx
+++ b/web/src/views/Workflow/components/Properties/VariableSelect.tsx
@@ -20,7 +20,7 @@ interface VariableSelectProps {
multiple?: boolean;
size?: 'small' | 'middle' | 'large';
placeholder?: string;
- variant?: 'outlined' | 'borderless';
+ variant?: 'outlined' | 'borderless' | 'filled';
className?: string;
onChange?: (value: string | string[], option: Suggestion | Suggestion[] | undefined) => void;
}
@@ -190,12 +190,12 @@ const VariableSelect: FC
= ({
{/* Trigger */}
setOpen(o => !o)}
diff --git a/web/src/views/Workflow/components/Properties/index.tsx b/web/src/views/Workflow/components/Properties/index.tsx
index b2a82318..1270a4de 100644
--- a/web/src/views/Workflow/components/Properties/index.tsx
+++ b/web/src/views/Workflow/components/Properties/index.tsx
@@ -38,6 +38,7 @@ import RbCard from '@/components/RbCard/Card';
import ModelConfig from './ModelConfig'
import ModelSelect from '@/components/ModelSelect'
import ListOperator from './ListOperator'
+import type { Variable } from "./VariableList/types";
/**
* Props for Properties component
@@ -229,7 +230,6 @@ const Properties: FC
= ({
}
return filteredList;
};
-
if (nodeType === 'llm') {
// For LLM nodes that are children of iteration or loop nodes, include parent variables
const parentLoopNode = selectedNode ? (() => {
@@ -790,8 +790,25 @@ const Properties: FC = ({
return nodeTypeMatch || variableNameMatch;
});
}
- if (config.onFilterVariableNames) {
- return baseVariableList.filter(variable => Array.isArray(config.onFilterVariableNames) && config.onFilterVariableNames.includes(variable.label));
+ if (config.onFilterVariableType) {
+ const types = config.onFilterVariableType as string[];
+ let list: Suggestion[] = []
+ baseVariableList.forEach((variable) => {
+ if (variable.children?.length) {
+ const filteredChildren = variable.children.filter((c: Suggestion) => types.includes(c.dataType));
+ console.log('filteredChildren', filteredChildren)
+ if (filteredChildren.length > 0) {
+ list.push({ ...variable, children: filteredChildren });
+ } else if (types.includes(variable.dataType)) {
+ list.push({ ...variable, children: [] });
+ }
+ } else if (types.includes(variable.dataType)) {
+ list.push(variable);
+ }
+ });
+
+ console.log('list', list)
+ return list
}
// Filter child nodes for iteration output
if (config.filterChildNodes && selectedNode) {
@@ -812,7 +829,7 @@ const Properties: FC = ({
}
return baseVariableList;
})()}
- onChange={(value, option) => handleChangeVariableList(value, option, key)}
+ onChange={(value, option) => handleChangeVariableList(value as string, option, key)}
size="small"
/>
: config.type === 'switch'
diff --git a/web/src/views/Workflow/constant.ts b/web/src/views/Workflow/constant.ts
index 7909d183..9621d968 100644
--- a/web/src/views/Workflow/constant.ts
+++ b/web/src/views/Workflow/constant.ts
@@ -128,7 +128,7 @@ export const nodeLibrary: NodeLibrary[] = [
},
vision_input: {
type: 'variableList',
- onFilterVariableNames: ['sys.files']
+ onFilterVariableType: ['array[file]']
}
}
},
@@ -457,7 +457,7 @@ export const nodeLibrary: NodeLibrary[] = [
file_selector: {
type: 'variableList',
placeholder: 'common.pleaseSelect',
- onFilterVariableNames: ['sys.files']
+ onFilterVariableType: ['array[file]', 'file']
}
}
},