Skip to content

Commit

Permalink
fix: set file path check before auto deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali-98 committed Oct 10, 2024
1 parent 4e5e125 commit 1aaebab
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/constants/LlamaLocal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,6 @@ export namespace Llama {
})
// cull missing models
modelList.forEach(async (item) => {
if (!(await FS.getInfoAsync(item.file_path)).exists) {
Logger.log(`Model Missing, its entry will be deleted: ${item.name}`)
await db.delete(model_data).where(eq(model_data.id, item.id))
}
/**
* This check is specifically for migration from v0.8.0-beta4
* file_path was added after, hence its not null migration resulted in needing
Expand All @@ -474,6 +470,11 @@ export namespace Llama {
.set({ file_path: `${model_dir}${item.file}` })
.where(eq(model_data.id, item.id))
}

if (!(await FS.getInfoAsync(item.file_path)).exists) {
Logger.log(`Model Missing, its entry will be deleted: ${item.name}`)
await db.delete(model_data).where(eq(model_data.id, item.id))
}
})
}

Expand Down

0 comments on commit 1aaebab

Please sign in to comment.