File tree Expand file tree Collapse file tree 4 files changed +14
-26
lines changed Expand file tree Collapse file tree 4 files changed +14
-26
lines changed Original file line number Diff line number Diff line change @@ -18,13 +18,7 @@ import { openInExplorer } from "../../utils/fileExplorer";
1818
1919interface RecommendedModelsProps {
2020 recommendedModels : UnifiedModel [ ] ;
21- startDownload : (
22- repoId : string ,
23- modelType : string ,
24- path : string | null ,
25- allowPatterns : string [ ] | null ,
26- ignorePatterns : string [ ] | null
27- ) => void ;
21+ startDownload : ( model : UnifiedModel ) => void ;
2822}
2923
3024const RecommendedModels : React . FC < RecommendedModelsProps > = ( {
@@ -113,15 +107,7 @@ const RecommendedModels: React.FC<RecommendedModelsProps> = ({
113107 compactView = { true }
114108 key = { model . id }
115109 model = { model }
116- onDownload = { ( ) =>
117- startDownload (
118- model . repo_id || "" ,
119- model . type || "hf.model" ,
120- model . path ?? null ,
121- model . allow_patterns ?? null ,
122- model . ignore_patterns ?? null
123- )
124- }
110+ onDownload = { ( ) => startDownload ( model ) }
125111 />
126112 ) ;
127113 } ) }
Original file line number Diff line number Diff line change @@ -53,13 +53,7 @@ interface RecommendedModelsDialogProps {
5353 open : boolean ;
5454 onClose : ( ) => void ;
5555 recommendedModels : UnifiedModel [ ] ;
56- startDownload : (
57- repoId : string ,
58- modelType : string ,
59- path : string | null ,
60- allowPatterns : string [ ] | null ,
61- ignorePatterns : string [ ] | null
62- ) => void ;
56+ startDownload : ( model : UnifiedModel ) => void ;
6357}
6458
6559const RecommendedModelsDialog : React . FC < RecommendedModelsDialogProps > = ( {
Original file line number Diff line number Diff line change @@ -15,13 +15,22 @@ const ModelRecommendationsButton: React.FC<ModelRecommendationsButtonProps> = ({
1515 recommendedModels
1616} ) => {
1717 const [ openModelDialog , setOpenModelDialog ] = useState ( false ) ;
18- const { startDownload } = useModelDownloadStore ( ) ;
18+ const { startDownload, openDialog } = useModelDownloadStore ( ) ;
1919 const handleOpenModelDialog = useCallback ( ( ) => setOpenModelDialog ( true ) , [ ] ) ;
2020 const handleCloseModelDialog = useCallback (
2121 ( ) => setOpenModelDialog ( false ) ,
2222 [ ]
2323 ) ;
2424
25+ const onStartDownload = React . useCallback (
26+ ( model : UnifiedModel ) => {
27+ const repoId = model . repo_id || model . id ;
28+ startDownload ( repoId , model . type ?? "" , model . path ?? undefined ) ;
29+ openDialog ( ) ;
30+ } ,
31+ [ startDownload , openDialog ]
32+ ) ;
33+
2534 if ( recommendedModels . length === 0 ) {
2635 return null ;
2736 }
@@ -65,7 +74,7 @@ const ModelRecommendationsButton: React.FC<ModelRecommendationsButtonProps> = ({
6574 open = { openModelDialog }
6675 onClose = { handleCloseModelDialog }
6776 recommendedModels = { recommendedModels }
68- startDownload = { startDownload }
77+ startDownload = { onStartDownload }
6978 />
7079 </ >
7180 ) ;
Original file line number Diff line number Diff line change @@ -280,7 +280,6 @@ const root = ReactDOM.createRoot(
280280
281281const AppWrapper = ( ) => {
282282 const [ status , setStatus ] = useState < string > ( "pending" ) ;
283- const { state } = useAuth ( ) ;
284283
285284 useEffect ( ( ) => {
286285 // Existing effect for loading metadata
You can’t perform that action at this time.
0 commit comments