Skip to content

Commit 806cbea

Browse files
deadprogramDannyDaemonic
authored andcommitted
main : switch input_noecho to input_echo to remove negation (ggml-org#979)
Signed-off-by: deadprogram <[email protected]>
1 parent bad9913 commit 806cbea

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/main/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ int main(int argc, char ** argv) {
298298
}
299299

300300
bool is_antiprompt = false;
301-
bool input_noecho = false;
301+
bool input_echo = true;
302302

303303
// HACK - because session saving incurs a non-negligible delay, for now skip re-saving session
304304
// if we loaded a session with at least 75% similarity. It's currently just used to speed up the
@@ -485,7 +485,7 @@ int main(int argc, char ** argv) {
485485
embd.push_back(id);
486486

487487
// echo this to console
488-
input_noecho = false;
488+
input_echo = true;
489489

490490
// decrement remaining sampling budget
491491
--n_remain;
@@ -503,14 +503,14 @@ int main(int argc, char ** argv) {
503503
}
504504

505505
// display text
506-
if (!input_noecho) {
506+
if (input_echo) {
507507
for (auto id : embd) {
508508
printf("%s", llama_token_to_str(ctx, id));
509509
}
510510
fflush(stdout);
511511
}
512512
// reset color to default if we there is no pending user input
513-
if (!input_noecho && (int)embd_inp.size() == n_consumed) {
513+
if (input_echo && (int)embd_inp.size() == n_consumed) {
514514
set_console_color(con_st, CONSOLE_COLOR_DEFAULT);
515515
}
516516

@@ -605,7 +605,7 @@ int main(int argc, char ** argv) {
605605
n_remain -= line_inp.size();
606606
}
607607

608-
input_noecho = true; // do not echo this again
608+
input_echo = false; // do not echo this again
609609
}
610610

611611
if (n_past > 0) {

0 commit comments

Comments
 (0)