Skip to content

Commit

Permalink
fix: allow model hub to be able to search for hugging face url
Browse files Browse the repository at this point in the history
Signed-off-by: James <[email protected]>
  • Loading branch information
James committed Apr 15, 2024
1 parent 89b947a commit ccb6ff5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
17 changes: 6 additions & 11 deletions web/screens/ExploreModels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
configuredModelsAtom,
downloadedModelsAtom,
} from '@/helpers/atoms/Model.atom'
import ModelSearch from '../Settings/Models/ModelSearch'

Check failure on line 26 in web/screens/ExploreModels/index.tsx

View workflow job for this annotation

GitHub Actions / test-on-macos

`../Settings/Models/ModelSearch` import should occur before import of `./ExploreModelList`

Check failure on line 26 in web/screens/ExploreModels/index.tsx

View workflow job for this annotation

GitHub Actions / test-on-ubuntu

`../Settings/Models/ModelSearch` import should occur before import of `./ExploreModelList`

Check failure on line 26 in web/screens/ExploreModels/index.tsx

View workflow job for this annotation

GitHub Actions / test-on-windows-pr

`../Settings/Models/ModelSearch` import should occur before import of `./ExploreModelList`

const sortMenu = ['All Models', 'Recommended', 'Downloaded']

Expand Down Expand Up @@ -54,6 +55,10 @@ const ExploreModelsScreen = () => {
setImportModelStage('SELECTING_MODEL')
}, [setImportModelStage])

const onSearchUpdate = useCallback((input: string) => {
setsearchValue(input)
}, [])

return (
<div
className="flex h-full w-full overflow-y-auto bg-background"
Expand All @@ -70,17 +75,7 @@ const ExploreModelsScreen = () => {
/>
<div className="absolute left-1/2 top-1/2 w-1/3 -translate-x-1/2 -translate-y-1/2 space-y-2">
<div className="flex flex-row space-x-2">
<div className="relative">
<SearchIcon
size={20}
className="absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"
/>
<Input
placeholder="Search models"
className="bg-white pl-9 dark:bg-background"
onChange={(e) => setsearchValue(e.target.value)}
/>
</div>
<ModelSearch onSearchLocal={onSearchUpdate} />
<Button
themes="outline"
className="gap-2 bg-white dark:bg-secondary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const ModelDownloadRow: React.FC<Props> = ({
])

return (
<div className="flex w-[662px] flex-row items-center justify-between rounded border border-border p-3">
<div className="flex w-[662px] flex-row items-center justify-between space-x-1 rounded border border-border p-3">
<div className="flex">
{quantization && <Badge className="mr-1">{quantization}</Badge>}

Expand Down
5 changes: 4 additions & 1 deletion web/screens/Settings/Models/ModelSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ const ModelSearch: React.FC<Props> = ({ onSearchLocal }) => {
<div className="flex flex-row items-center space-x-4">
<Input
placeholder="Search or paste Hugging Face URL"
className={twMerge('pl-8', loading ? 'pr-8' : '')}
className={twMerge(
'bg-white pl-8 dark:bg-background',
loading ? 'pr-8' : ''
)}
onChange={onSearchChanged}
onKeyDown={onKeyDown}
/>
Expand Down

0 comments on commit ccb6ff5

Please sign in to comment.