Throw error when invalid file
This commit is contained in:
parent
5ef9d8dfc3
commit
0eff1bfaa9
@ -1049,6 +1049,9 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
logger.info(`Installing backend from path: ${path}`)
|
logger.info(`Installing backend from path: ${path}`)
|
||||||
|
|
||||||
if ((await fs.existsSync(path)) && path.endsWith('tar.gz')) {
|
if ((await fs.existsSync(path)) && path.endsWith('tar.gz')) {
|
||||||
|
logger.error(`Invalid path or file ${path}`)
|
||||||
|
throw new Error(`Invalid path or file ${path}`)
|
||||||
|
}
|
||||||
const match = re.exec(archiveName)
|
const match = re.exec(archiveName)
|
||||||
if (!match) throw new Error('Failed to parse archive name')
|
if (!match) throw new Error('Failed to parse archive name')
|
||||||
const [, version, backend] = match
|
const [, version, backend] = match
|
||||||
@ -1080,7 +1083,6 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override async import(modelId: string, opts: ImportOptions): Promise<void> {
|
override async import(modelId: string, opts: ImportOptions): Promise<void> {
|
||||||
const isValidModelId = (id: string) => {
|
const isValidModelId = (id: string) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user