Skip to content

Commit

Permalink
updated to use new import model mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
chainchompa committed Feb 27, 2024
1 parent 175cfe4 commit 110b0bc
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { ChangeEventHandler } from 'react';
import { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { PiXBold } from 'react-icons/pi';
import { type ScanFolderResponse, useImportMainModelsMutation } from 'services/api/endpoints/models';
import { type ScanFolderResponse, useInstallModelMutation } from 'services/api/endpoints/models';

import { ScanModelResultItem } from './ScanModelResultItem';

Expand All @@ -29,7 +29,7 @@ export const ScanModelsResults = ({ results }: ScanModelResultsProps) => {
const [searchTerm, setSearchTerm] = useState('');
const dispatch = useAppDispatch();

const [importMainModel] = useImportMainModelsMutation();
const [installModel] = useInstallModelMutation();

const filteredResults = useMemo(() => {
return results.filter((result) => {
Expand All @@ -51,7 +51,7 @@ export const ScanModelsResults = ({ results }: ScanModelResultsProps) => {
if (result.is_installed) {
continue;
}
importMainModel({ source: result.path, config: undefined })
installModel({ source: result.path })
.unwrap()
.then((_) => {
dispatch(
Expand All @@ -76,7 +76,7 @@ export const ScanModelsResults = ({ results }: ScanModelResultsProps) => {
}
});
}
}, [importMainModel, filteredResults, dispatch, t]);
}, [installModel, filteredResults, dispatch, t]);

return (
<>
Expand Down

0 comments on commit 110b0bc

Please sign in to comment.