fix(web): llm/document-extractor support file type variable

This commit is contained in:
zhaoying
2026-04-07 12:05:20 +08:00
parent 3ece83d419
commit 2e7ebf174b
3 changed files with 27 additions and 10 deletions

View File

@@ -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<PropertiesProps> = ({
}
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<PropertiesProps> = ({
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<PropertiesProps> = ({
}
return baseVariableList;
})()}
onChange={(value, option) => handleChangeVariableList(value, option, key)}
onChange={(value, option) => handleChangeVariableList(value as string, option, key)}
size="small"
/>
: config.type === 'switch'