chore: remigrate if there is no models dir (#1038)

This commit is contained in:
Louis 2023-12-15 21:09:35 +07:00 committed by GitHub
parent 1fa05cf9ce
commit f62b0ca4ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,10 @@ export default class JanModelExtension implements ModelExtension {
private async copyModelsToHomeDir() { private async copyModelsToHomeDir() {
try { try {
if (localStorage.getItem(`${EXTENSION_NAME}-version`) === VERSION) { if (
localStorage.getItem(`${EXTENSION_NAME}-version`) === VERSION &&
(await fs.exists(JanModelExtension._homeDir))
) {
console.debug('Model already migrated') console.debug('Model already migrated')
return return
} }
@ -63,9 +66,7 @@ export default class JanModelExtension implements ModelExtension {
const reconfigureModels = (await this.getConfiguredModels()).filter((e) => const reconfigureModels = (await this.getConfiguredModels()).filter((e) =>
readyModels.includes(e.id) readyModels.includes(e.id)
) )
console.debug( console.debug('Finished updating downloaded models')
'Finished updating downloaded models'
)
// update back the status // update back the status
await Promise.all( await Promise.all(