Skip to content

Commit 6f19b8c

Browse files
devojonyarthw
authored andcommitted
examples: fix android example cannot be generated continuously (ggml-org#8621)
When generation ends `completion_loop()` should return a NULL, not the empty string
1 parent 24404ef commit 6f19b8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/llama.android/llama/src/main/cpp/llama-android.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ Java_android_llama_cpp_LLamaAndroid_completion_1loop(
409409

410410
const auto n_cur = env->CallIntMethod(intvar_ncur, la_int_var_value);
411411
if (llama_token_is_eog(model, new_token_id) || n_cur == n_len) {
412-
return env->NewStringUTF("");
412+
return nullptr;
413413
}
414414

415415
auto new_token_chars = llama_token_to_piece(context, new_token_id);

0 commit comments

Comments
 (0)