chore: detailed message when fetch invalid url (#2780)
Co-authored-by: James <james@jan.ai>
This commit is contained in:
parent
67db45ff3c
commit
97c15e6983
@ -196,7 +196,12 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
console.debug('sanitizedUrl', sanitizedUrl)
|
console.debug('sanitizedUrl', sanitizedUrl)
|
||||||
|
|
||||||
const res = await fetch(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) {
|
if (data.tags.indexOf('gguf') === -1) {
|
||||||
throw new NotSupportedModelError(
|
throw new NotSupportedModelError(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user