From dfbca865330b4651005dfe34660a5f848e690cf1 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 30 Jan 2023 08:36:58 -0300 Subject: [PATCH] Add **bold** support in chat mode --- modules/html_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/html_generator.py b/modules/html_generator.py index 11da0689..b18ecfa0 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -242,8 +242,8 @@ def generate_chat_html(history, name1, name2, character): for i,_row in enumerate(history[::-1]): row = _row.copy() - row[0] = re.sub(r"[\\]*\*", r"*", row[0]) - row[1] = re.sub(r"[\\]*\*", r"*", row[1]) + row[0] = re.sub(r"(\*\*)([^\*\n]*)(\*\*)", r"\2", row[0]) + row[1] = re.sub(r"(\*\*)([^\*\n]*)(\*\*)", r"\2", row[1]) row[0] = re.sub(r"(\*)([^\*\n]*)(\*)", r"\2", row[0]) row[1] = re.sub(r"(\*)([^\*\n]*)(\*)", r"\2", row[1]) p = '\n'.join([f"

{x}

" for x in row[1].split('\n')])