fix: import from HuggingFace with random string is causing app crash (#2214)

This commit is contained in:
Louis 2024-03-03 20:39:38 +07:00 committed by GitHub
parent b70e7fb917
commit 1bdf791360
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View File

@ -20,7 +20,9 @@ export const useGetHFRepoData = () => {
const data = await res.json()
setRepoData(data)
} catch (err) {
setFetchError(err as Error)
setFetchError(
Error("The repo does not exist or you don't have access to it.")
)
}
setLoading(false)
}

View File

@ -53,7 +53,7 @@ export const HuggingFaceRepoDataLoadedModal = () => {
? '❌ This model is not supported!'
: '✅ This model is supported!'}
</p>
{repoData.tags.includes('gguf') ? (
{repoData.tags?.includes('gguf') ? (
<p>...But you can import it manually!</p>
) : null}
</div>

View File

@ -18,7 +18,7 @@ export const HuggingFaceSearchErrorModal = () => {
<p className="text-2xl font-bold">Error!</p>
<p className="text-gray-500">Fetch error</p>
</div>
<p>{fetchError.message}</p>
<p className="text-center">{fetchError.message}</p>
<Button
onClick={getRepoData}
className="w-full"