Don't save the history for 'None' character

This commit is contained in:
oobabooga 2023-06-06 07:21:07 -03:00
parent 9f215523e2
commit 0aebc838a0

View File

@ -441,6 +441,9 @@ def save_history(mode, timestamp=False):
fname = f"Instruct_{datetime.now().strftime('%Y%m%d-%H%M%S')}.json" fname = f"Instruct_{datetime.now().strftime('%Y%m%d-%H%M%S')}.json"
else: else:
if shared.character == 'None':
return
if timestamp: if timestamp:
fname = f"{shared.character}_{datetime.now().strftime('%Y%m%d-%H%M%S')}.json" fname = f"{shared.character}_{datetime.now().strftime('%Y%m%d-%H%M%S')}.json"
else: else:
@ -452,8 +455,6 @@ def save_history(mode, timestamp=False):
with open(Path(f'logs/{fname}'), 'w', encoding='utf-8') as f: with open(Path(f'logs/{fname}'), 'w', encoding='utf-8') as f:
f.write(json.dumps({'data': shared.history['internal'], 'data_visible': shared.history['visible']}, indent=2)) f.write(json.dumps({'data': shared.history['internal'], 'data_visible': shared.history['visible']}, indent=2))
return Path(f'logs/{fname}')
def load_history(file, name1, name2): def load_history(file, name1, name2):
file = file.decode('utf-8') file = file.decode('utf-8')