fix: Android example cannot be generated continuously

When generation ends `completion_loop()` should return a NULL, not the empty string
This commit is contained in:
devojony 2024-07-22 13:20:06 +08:00 committed by GitHub
parent 45f2c19cc5
commit d4c257d1f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -409,7 +409,7 @@ Java_android_llama_cpp_LLamaAndroid_completion_1loop(
const auto n_cur = env->CallIntMethod(intvar_ncur, la_int_var_value);
if (llama_token_is_eog(model, new_token_id) || n_cur == n_len) {
return env->NewStringUTF("");
return nullptr;
}
auto new_token_chars = llama_token_to_piece(context, new_token_id);