Skip to content

Commit

Permalink
fix: autoload failing on first try due to never reassigning context
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali-98 committed Jul 18, 2024
1 parent 18990b8 commit 852f48a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions constants/APIState/LocalAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ class LocalAPI extends APIBase {
}

inference = async () => {
const context = Llama.useLlama.getState().context
let context = Llama.useLlama.getState().context
if (!context && mmkv.getBoolean(AppSettings.AutoLoadLocal)) {
const model = mmkv.getString(Global.LocalModel)
const params = this.getObject(Global.LocalPreset)
if (model && params) await Llama.useLlama.getState().load(model ?? '', params)
if (model && params) {
await Llama.useLlama.getState().load(model ?? '', params)
context = Llama.useLlama.getState().context
}
}

if (!context) {
Expand Down

0 comments on commit 852f48a

Please sign in to comment.