From 68dcbc7ebda3f0d9700dde43d0d29324f5c244b1 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 8 May 2023 16:41:21 -0300 Subject: [PATCH] Fix chat history handling in instruct mode --- modules/chat.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/chat.py b/modules/chat.py index f98f524..a19eb0e 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -319,12 +319,13 @@ def clear_chat_log(name1, name2, greeting, mode, style): shared.history['visible'] = [] shared.history['internal'] = [] - if greeting != '': - shared.history['internal'] += [['<|BEGIN-VISIBLE-CHAT|>', greeting]] - shared.history['visible'] += [['', apply_extensions("output", greeting)]] + if mode != 'instruct': + if greeting != '': + shared.history['internal'] += [['<|BEGIN-VISIBLE-CHAT|>', greeting]] + shared.history['visible'] += [['', apply_extensions("output", greeting)]] + + save_history(mode) - # Save cleared logs - save_history(mode) return chat_html_wrapper(shared.history['visible'], name1, name2, mode, style)