Improve example dialogue handling

This commit is contained in:
oobabooga 2023-01-21 15:04:13 -03:00
parent f9dbe7e08e
commit aadf4e899a
2 changed files with 17 additions and 21 deletions

View file

@ -161,7 +161,7 @@ def generate_4chan_html(f):
return output
def generate_chat_html(_history, name1, name2, character):
def generate_chat_html(history, name1, name2, character):
css = """
.chat {
margin-left: auto;
@ -234,13 +234,6 @@ def generate_chat_html(_history, name1, name2, character):
img = f'<img src="file/{i}">'
break
history = copy.deepcopy(_history)
for i in range(len(history)):
if '<|BEGIN-VISIBLE-CHAT|>' in history[i][0]:
history[i][0] = history[i][0].replace('<|BEGIN-VISIBLE-CHAT|>', '')
history = history[i:]
break
for i,_row in enumerate(history[::-1]):
row = _row.copy()
row[0] = re.sub(r"[\\]*\*", r"*", row[0])