From ca47e016b4f1651824ad5631a4dcf05ed0f5de4c Mon Sep 17 00:00:00 2001 From: Vladimir Belitskiy Date: Mon, 20 Mar 2023 12:55:57 -0400 Subject: [PATCH] Do not display empty user messages in chat mode. There doesn't seem to be much value to them - they just take up space while also making it seem like there's still some sort of pseudo-dialogue going on, instead of a monologue by the bot. --- modules/html_generator.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/modules/html_generator.py b/modules/html_generator.py index 940d5486..f8cff6d8 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -142,22 +142,23 @@ def generate_chat_html(history, name1, name2, character): """ - if not (i == len(history)-1 and len(row[0]) == 0): - output += f""" -
-
- {img_me} -
-
-
- {name1} -
-
- {row[0]} -
-
+ if not row[0]: # don't display empty user messages + continue + output += f""" +
+
+ {img_me} +
+
+
+ {name1}
- """ +
+ {row[0]} +
+
+
+ """ output += "
" return output