fix infinite loop

This commit is contained in:
psugihara 2023-12-27 16:20:00 -08:00
parent 879b690a9e
commit 599b773654

View file

@ -25,7 +25,7 @@ class LlamaState: ObservableObject {
llamaContext = try LlamaContext.create_context(path: modelUrl.path()) llamaContext = try LlamaContext.create_context(path: modelUrl.path())
messageLog += "Loaded model \(modelUrl.lastPathComponent)\n" messageLog += "Loaded model \(modelUrl.lastPathComponent)\n"
} else { } else {
messageLog += "Could not locate model\n" messageLog += "Could not locate model, select one from the bottom list\n"
} }
} }
@ -37,7 +37,7 @@ class LlamaState: ObservableObject {
await llamaContext.completion_init(text: text) await llamaContext.completion_init(text: text)
messageLog += "\(text)" messageLog += "\(text)"
while await llamaContext.n_cur <= llamaContext.n_len { while await llamaContext.n_cur < llamaContext.n_len {
let result = await llamaContext.completion_loop() let result = await llamaContext.completion_loop()
messageLog += "\(result)" messageLog += "\(result)"
} }