Skip to content

Commit 618fda5

Browse files
committed
examples : switch input_noecho to input_echo to remove negation
Signed-off-by: deadprogram <[email protected]>
1 parent dd0eabc commit 618fda5

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
@@ -250,7 +250,7 @@ int main(int argc, char ** argv) {
250250
}
251251

252252
bool is_antiprompt = false;
253-
bool input_noecho = false;
253+
bool input_echo = true;
254254

255255
int n_past = 0;
256256
int n_remain = params.n_predict;
@@ -340,7 +340,7 @@ int main(int argc, char ** argv) {
340340
embd.push_back(id);
341341

342342
// echo this to console
343-
input_noecho = false;
343+
input_echo = true;
344344

345345
// decrement remaining sampling budget
346346
--n_remain;
@@ -358,14 +358,14 @@ int main(int argc, char ** argv) {
358358
}
359359

360360
// display text
361-
if (!input_noecho) {
361+
if (input_echo) {
362362
for (auto id : embd) {
363363
printf("%s", llama_token_to_str(ctx, id));
364364
}
365365
fflush(stdout);
366366
}
367367
// reset color to default if we there is no pending user input
368-
if (!input_noecho && (int)embd_inp.size() == n_consumed) {
368+
if (input_echo && (int)embd_inp.size() == n_consumed) {
369369
set_console_color(con_st, CONSOLE_COLOR_DEFAULT);
370370
}
371371

@@ -460,7 +460,7 @@ int main(int argc, char ** argv) {
460460
n_remain -= line_inp.size();
461461
}
462462

463-
input_noecho = true; // do not echo this again
463+
input_echo = false; // do not echo this again
464464
}
465465

466466
if (n_past > 0) {

0 commit comments

Comments
 (0)