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.
This commit is contained in:
Vladimir Belitskiy 2023-03-20 12:55:57 -04:00 committed by GitHub
parent a90f507abe
commit ca47e016b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,22 +142,23 @@ def generate_chat_html(history, name1, name2, character):
</div>
"""
if not (i == len(history)-1 and len(row[0]) == 0):
output += f"""
<div class="message">
<div class="circle-you">
{img_me}
</div>
<div class="text">
<div class="username">
{name1}
</div>
<div class="message-body">
{row[0]}
</div>
</div>
if not row[0]: # don't display empty user messages
continue
output += f"""
<div class="message">
<div class="circle-you">
{img_me}
</div>
<div class="text">
<div class="username">
{name1}
</div>
"""
<div class="message-body">
{row[0]}
</div>
</div>
</div>
"""
output += "</div>"
return output