Add debug logs and refactor
This commit is contained in:
parent
e2e572ccab
commit
5ef9d8dfc3
@ -46,6 +46,7 @@ export async function getLocalInstalledBackends(): Promise<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.debug(local)
|
||||||
return local
|
return local
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,9 +158,8 @@ export async function listSupportedBackends(): Promise<
|
|||||||
supportedBackends.push('macos-arm64')
|
supportedBackends.push('macos-arm64')
|
||||||
}
|
}
|
||||||
// get latest backends from Github
|
// get latest backends from Github
|
||||||
const remoteBackendVersions = await fetchRemoteSupportedBackends(
|
const remoteBackendVersions =
|
||||||
supportedBackends
|
await fetchRemoteSupportedBackends(supportedBackends)
|
||||||
)
|
|
||||||
|
|
||||||
// Get locally installed versions
|
// Get locally installed versions
|
||||||
const localBackendVersions = await getLocalInstalledBackends()
|
const localBackendVersions = await getLocalInstalledBackends()
|
||||||
|
|||||||
@ -1046,6 +1046,7 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
const platformName = IS_WINDOWS ? 'win' : 'linux'
|
const platformName = IS_WINDOWS ? 'win' : 'linux'
|
||||||
const re = /^llama-(b\d+)-bin-(.+?)\.tar\.gz$/
|
const re = /^llama-(b\d+)-bin-(.+?)\.tar\.gz$/
|
||||||
const archiveName = await basename(path)
|
const archiveName = await basename(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')) {
|
||||||
const match = re.exec(archiveName)
|
const match = re.exec(archiveName)
|
||||||
@ -1055,7 +1056,11 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
throw new Error(`Invalid backend archive name: ${archiveName}`)
|
throw new Error(`Invalid backend archive name: ${archiveName}`)
|
||||||
}
|
}
|
||||||
const backendDir = await getBackendDir(backend, version)
|
const backendDir = await getBackendDir(backend, version)
|
||||||
|
try {
|
||||||
await invoke('decompress', { path: path, outputDir: backendDir })
|
await invoke('decompress', { path: path, outputDir: backendDir })
|
||||||
|
} catch (e) {
|
||||||
|
logger.error(`Failed to install: ${String(e)}`)
|
||||||
|
}
|
||||||
const binPath =
|
const binPath =
|
||||||
platformName === 'win'
|
platformName === 'win'
|
||||||
? await joinPath([backendDir, 'build', 'bin', 'llama-server.exe'])
|
? await joinPath([backendDir, 'build', 'bin', 'llama-server.exe'])
|
||||||
@ -2481,9 +2486,7 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
logger.error('Failed to validate GGUF file:', error)
|
logger.error('Failed to validate GGUF file:', error)
|
||||||
return {
|
return {
|
||||||
isValid: false,
|
isValid: false,
|
||||||
error: `Failed to read model metadata: ${
|
error: `Failed to read model metadata: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
||||||
error instanceof Error ? error.message : 'Unknown error'
|
|
||||||
}`,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user