@@ -362,6 +362,9 @@ int main(int argc, char ** argv) {
362362 params.interactive_first = true ;
363363 params.antiprompt .emplace_back (" <|im_start|>user\n " );
364364 }
365+ else if (params.conversation ) {
366+ params.interactive_first = true ;
367+ }
365368
366369 // enable interactive mode if interactive start is specified
367370 if (params.interactive_first ) {
@@ -733,7 +736,7 @@ int main(int argc, char ** argv) {
733736 // display text
734737 if (input_echo && display) {
735738 for (auto id : embd) {
736- const std::string token_str = llama_token_to_piece (ctx, id);
739+ const std::string token_str = llama_token_to_piece (ctx, id, !params. conversation );
737740 printf (" %s" , token_str.c_str ());
738741
739742 if (embd.size () > 1 ) {
@@ -816,7 +819,7 @@ int main(int argc, char ** argv) {
816819 if (n_past > 0 && is_interacting) {
817820 LOG (" waiting for user input\n " );
818821
819- if (params.instruct || params.chatml ) {
822+ if (params.conversation || params. instruct || params.chatml ) {
820823 printf (" \n > " );
821824 }
822825
@@ -826,7 +829,7 @@ int main(int argc, char ** argv) {
826829 }
827830
828831 std::string buffer;
829- if (!params.input_prefix .empty ()) {
832+ if (!params.input_prefix .empty () && !params. conversation ) {
830833 LOG (" appending input prefix: '%s'\n " , params.input_prefix .c_str ());
831834 printf (" %s" , params.input_prefix .c_str ());
832835 }
@@ -850,7 +853,7 @@ int main(int argc, char ** argv) {
850853 // Entering a empty line lets the user pass control back
851854 if (buffer.length () > 1 ) {
852855 // append input suffix if any
853- if (!params.input_suffix .empty ()) {
856+ if (!params.input_suffix .empty () && !params. conversation ) {
854857 LOG (" appending input suffix: '%s'\n " , params.input_suffix .c_str ());
855858 printf (" %s" , params.input_suffix .c_str ());
856859 }
0 commit comments