From 8f3deec759220884a4d15d9e1e3db771d8e42f67 Mon Sep 17 00:00:00 2001
From: oobabooga <112222186+oobabooga@users.noreply.github.com>
Date: Fri, 20 Jan 2023 01:59:51 -0300
Subject: [PATCH] Prevent the history from being altered by the html script
---
html_generator.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/html_generator.py b/html_generator.py
index 35fcac1..9b0ed3b 100644
--- a/html_generator.py
+++ b/html_generator.py
@@ -233,7 +233,8 @@ def generate_chat_html(history, name1, name2, character):
img = f'
'
break
- for i,row in enumerate(history[::-1]):
+ 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])