Skip to content

Commit

Permalink
fix(ios): incorrect sent_token_probs_index
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Aug 22, 2023
1 parent d296d09 commit ac7c554
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ios/RNLlamaContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ - (NSDictionary *)completion:(NSDictionary *)params
rnllama::STOP_PARTIAL);
}

const std::string to_send = self->llama->generated_text.substr(pos, stop_pos);
const std::string to_send = stop_pos == std::string::npos ?
self->llama->generated_text.substr(pos, std::string::npos) :
""; // just don't send anything if we're not done
sent_count += to_send.size();

std::vector<rnllama::completion_token_output> probs_output = {};
Expand Down

0 comments on commit ac7c554

Please sign in to comment.