Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions tools/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,14 +785,17 @@ int main(int argc, char ** argv) {
}

// check for reverse prompt using special tokens
llama_token last_token = common_sampler_last(smpl);
for (auto token : antiprompt_token) {
if (token == last_token) {
if (params.interactive) {
is_interacting = true;
// avoid calling common_sampler_last() if last_output is empty
if (!last_output.empty()) {
llama_token last_token = common_sampler_last(smpl);
for (auto token : antiprompt_token) {
if (token == last_token) {
if (params.interactive) {
is_interacting = true;
}
is_antiprompt = true;
break;
}
is_antiprompt = true;
break;
}
}

Expand Down
Loading