Move the chat example dialogue to the prompt

This commit is contained in:
oobabooga 2023-02-28 00:50:46 -03:00
parent 021bd55886
commit e861e68e38

View File

@ -220,7 +220,7 @@ def clear_chat_log(name1, name2):
for i in range(len(shared.history['internal'])): for i in range(len(shared.history['internal'])):
if '<|BEGIN-VISIBLE-CHAT|>' in shared.history['internal'][i][0]: if '<|BEGIN-VISIBLE-CHAT|>' in shared.history['internal'][i][0]:
shared.history['visible'] = [['', apply_extensions(shared.history['internal'][i][1], "output")]] shared.history['visible'] = [['', apply_extensions(shared.history['internal'][i][1], "output")]]
shared.history['internal'] = shared.history['internal'][:i+1] shared.history['internal'] = [shared.history['internal'][i]]
found = True found = True
break break
if not found: if not found:
@ -331,7 +331,7 @@ def load_character(_character, name1, name2):
context += f"Scenario: {data['world_scenario']}\n" context += f"Scenario: {data['world_scenario']}\n"
context = f"{context.strip()}\n<START>\n" context = f"{context.strip()}\n<START>\n"
if 'example_dialogue' in data and data['example_dialogue'] != '': if 'example_dialogue' in data and data['example_dialogue'] != '':
shared.history['internal'] = tokenize_dialogue(data['example_dialogue'], name1, name2) context += f"{data['example_dialogue'].strip()}\n"
if 'char_greeting' in data and len(data['char_greeting'].strip()) > 0: if 'char_greeting' in data and len(data['char_greeting'].strip()) > 0:
shared.history['internal'] += [['<|BEGIN-VISIBLE-CHAT|>', data['char_greeting']]] shared.history['internal'] += [['<|BEGIN-VISIBLE-CHAT|>', data['char_greeting']]]
shared.history['visible'] += [['', apply_extensions(data['char_greeting'], "output")]] shared.history['visible'] += [['', apply_extensions(data['char_greeting'], "output")]]