Don't replace last reply with an empty message

This commit is contained in:
oobabooga 2023-08-10 13:14:48 -07:00
parent 0789554f65
commit 8dbaa20ca8

View File

@ -347,7 +347,10 @@ def send_last_reply_to_input(history):
def replace_last_reply(text, state): def replace_last_reply(text, state):
history = state['history'] history = state['history']
if len(history['visible']) > 0:
if len(text.strip()) == 0:
return history
elif len(history['visible']) > 0:
history['visible'][-1][1] = text history['visible'][-1][1] = text
history['internal'][-1][1] = apply_extensions('input', text, state) history['internal'][-1][1] = apply_extensions('input', text, state)