Return the visible history with "Remove last"

This commit is contained in:
oobabooga 2023-08-18 09:25:51 -07:00
parent 5a6e7057b9
commit c4733000d7

View File

@ -308,8 +308,8 @@ def generate_chat_reply_wrapper(text, state, regenerate=False, _continue=False):
def remove_last_message(history): def remove_last_message(history):
if len(history['visible']) > 0 and history['internal'][-1][0] != '<|BEGIN-VISIBLE-CHAT|>': if len(history['visible']) > 0 and history['internal'][-1][0] != '<|BEGIN-VISIBLE-CHAT|>':
last = history['internal'].pop() last = history['visible'].pop()
history['visible'].pop() history['internal'].pop()
else: else:
last = ['', ''] last = ['', '']