mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 09:19:23 +01:00
Create logs dir if missing when saving history (#3462)
This commit is contained in:
parent
5ee95d126c
commit
44f31731af
@ -394,6 +394,8 @@ def redraw_html(history, name1, name2, mode, style, reset_cache=False):
|
|||||||
|
|
||||||
def save_history(history, path=None):
|
def save_history(history, path=None):
|
||||||
p = path or Path('logs/exported_history.json')
|
p = path or Path('logs/exported_history.json')
|
||||||
|
if not p.parent.is_dir():
|
||||||
|
p.parent.mkdir(parents=True)
|
||||||
with open(p, 'w', encoding='utf-8') as f:
|
with open(p, 'w', encoding='utf-8') as f:
|
||||||
f.write(json.dumps(history, indent=4))
|
f.write(json.dumps(history, indent=4))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user