From bb1a172da0c85b36f6551870e5af71ae7a1e5f32 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 15 Jan 2023 19:41:25 -0300 Subject: [PATCH] Fix a bug in cai mode chat --- server.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 8b59b62..c8db098 100644 --- a/server.py +++ b/server.py @@ -222,8 +222,12 @@ elif args.chat or args.cai_chat: question = context+'\n\n' for i in range(len(history)): - question += f"{name1}: {history[i][0][3:-5].strip()}\n" - question += f"{name2}: {history[i][1][3:-5].strip()}\n" + if args.cai_chat: + question += f"{name1}: {history[i][0].strip()}\n" + question += f"{name2}: {history[i][1].strip()}\n" + else: + question += f"{name1}: {history[i][0][3:-5].strip()}\n" + question += f"{name2}: {history[i][1][3:-5].strip()}\n" question += f"{name1}: {text}\n" question += f"{name2}:" @@ -294,8 +298,6 @@ elif args.chat or args.cai_chat: with gr.Row(): check = gr.Checkbox(value=settings['stop_at_newline'], label='Stop generating at new line character?') - - if args.cai_chat: btn.click(cai_chatbot_wrapper, [textbox, length_slider, preset_menu, model_menu, name1, name2, context, check], display1, show_progress=True, api_name="textgen") textbox.submit(cai_chatbot_wrapper, [textbox, length_slider, preset_menu, model_menu, name1, name2, context, check], display1, show_progress=True)