@@ -362,6 +362,9 @@ int main(int argc, char ** argv) {
362
362
params.interactive_first = true ;
363
363
params.antiprompt .emplace_back (" <|im_start|>user\n " );
364
364
}
365
+ else if (params.conversation ) {
366
+ params.interactive_first = true ;
367
+ }
365
368
366
369
// enable interactive mode if interactive start is specified
367
370
if (params.interactive_first ) {
@@ -733,7 +736,7 @@ int main(int argc, char ** argv) {
733
736
// display text
734
737
if (input_echo && display) {
735
738
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 );
737
740
printf (" %s" , token_str.c_str ());
738
741
739
742
if (embd.size () > 1 ) {
@@ -816,7 +819,7 @@ int main(int argc, char ** argv) {
816
819
if (n_past > 0 && is_interacting) {
817
820
LOG (" waiting for user input\n " );
818
821
819
- if (params.instruct || params.chatml ) {
822
+ if (params.conversation || params. instruct || params.chatml ) {
820
823
printf (" \n > " );
821
824
}
822
825
@@ -826,7 +829,7 @@ int main(int argc, char ** argv) {
826
829
}
827
830
828
831
std::string buffer;
829
- if (!params.input_prefix .empty ()) {
832
+ if (!params.input_prefix .empty () && !params. conversation ) {
830
833
LOG (" appending input prefix: '%s'\n " , params.input_prefix .c_str ());
831
834
printf (" %s" , params.input_prefix .c_str ());
832
835
}
@@ -850,7 +853,7 @@ int main(int argc, char ** argv) {
850
853
// Entering a empty line lets the user pass control back
851
854
if (buffer.length () > 1 ) {
852
855
// append input suffix if any
853
- if (!params.input_suffix .empty ()) {
856
+ if (!params.input_suffix .empty () && !params. conversation ) {
854
857
LOG (" appending input suffix: '%s'\n " , params.input_suffix .c_str ());
855
858
printf (" %s" , params.input_suffix .c_str ());
856
859
}
0 commit comments