Don't export include the example dialogue in the export json

This commit is contained in:
oobabooga 2023-01-21 02:55:13 -03:00
parent 990ee54ddd
commit 27e2d932b0

View File

@ -327,10 +327,17 @@ if args.chat or args.cai_chat:
return generate_chat_html(history, name1, name2, character)
def save_history():
_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
if not Path('logs').exists():
Path('logs').mkdir()
with open(Path('logs/conversation.json'), 'w') as f:
f.write(json.dumps({'data': history}))
f.write(json.dumps({'data': _history}))
return Path('logs/conversation.json')
def load_history(file):