fix: the fields for trigger checking

This commit is contained in:
jialin
2025-04-03 18:08:43 +08:00
parent 939f46c7e6
commit b6136a092d
22 changed files with 226 additions and 73 deletions
@@ -83,6 +83,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
});
const [sortType, setSortType] = useState<string>('size');
const [current, setCurrent] = useState<string>('');
const currentPathRef = useRef<string>('');
const modelFilesSortOptions = useRef<any[]>([
{
label: intl.formatMessage({ id: 'models.sort.size' }),
@@ -100,6 +101,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
const handleSelectModelFile = (item: any) => {
props.onSelectFile?.(item);
setCurrent(item.path);
currentPathRef.current = item.path;
};
const parseFilename = (filename: string) => {
@@ -274,7 +276,13 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
evaluateResult: evaluationList[index]
};
});
handleSelectModelFile(resultList[0]);
const currentItem = _.find(
resultList,
(item: any) => item.path === currentPathRef.current
);
if (currentItem) {
handleSelectModelFile(currentItem);
}
setDataSource({ fileList: resultList, loading: false });
setIsEvaluating(false);
} catch (error) {