From 8dbaa20ca8104aa5ead76dec13af3faa25f5d7e8 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 10 Aug 2023 13:14:48 -0700 Subject: [PATCH] Don't replace last reply with an empty message --- modules/chat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index c9af55db..c2a05d3f 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -347,7 +347,10 @@ def send_last_reply_to_input(history): def replace_last_reply(text, state): 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['internal'][-1][1] = apply_extensions('input', text, state)