mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-29 10:59:32 +01:00
Don't export include the example dialogue in the export json
This commit is contained in:
parent
990ee54ddd
commit
27e2d932b0
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user