chore: detailed message when fetch invalid url (#2780)

Co-authored-by: James <james@jan.ai>
This commit is contained in:
NamH 2024-04-22 21:42:31 +07:00 committed by GitHub
parent 67db45ff3c
commit 97c15e6983
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -196,7 +196,12 @@ export default class JanModelExtension extends ModelExtension {
console.debug('sanitizedUrl', sanitizedUrl)
const res = await fetch(sanitizedUrl)
const data = (await res.json()) as HuggingFaceRepoData
const response = await res.json()
if (response['error'] != null) {
throw new Error(response['error'])
}
const data = response as HuggingFaceRepoData
if (data.tags.indexOf('gguf') === -1) {
throw new NotSupportedModelError(