From 599b7736540eced40cd28a03c2de6f097682dec5 Mon Sep 17 00:00:00 2001 From: psugihara Date: Wed, 27 Dec 2023 16:20:00 -0800 Subject: [PATCH] fix infinite loop --- examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift b/examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift index 3393eb242..bf222ce60 100644 --- a/examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift +++ b/examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift @@ -25,7 +25,7 @@ class LlamaState: ObservableObject { llamaContext = try LlamaContext.create_context(path: modelUrl.path()) messageLog += "Loaded model \(modelUrl.lastPathComponent)\n" } 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) messageLog += "\(text)" - while await llamaContext.n_cur <= llamaContext.n_len { + while await llamaContext.n_cur < llamaContext.n_len { let result = await llamaContext.completion_loop() messageLog += "\(result)" }