mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-24 13:28:59 +01:00
parent
3af3ffeb90
commit
4e4cd67223
@ -9,6 +9,7 @@ import io
|
|||||||
import base64
|
import base64
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import copy
|
import copy
|
||||||
@ -563,11 +564,12 @@ if args.chat or args.cai_chat:
|
|||||||
return _history
|
return _history
|
||||||
|
|
||||||
def save_history():
|
def save_history():
|
||||||
|
fname = f"{character or ''}{'_' if character else ''}{datetime.now().strftime('%Y%m%d-%H:%M:%S')}.json"
|
||||||
if not Path('logs').exists():
|
if not Path('logs').exists():
|
||||||
Path('logs').mkdir()
|
Path('logs').mkdir()
|
||||||
with open(Path('logs/conversation.json'), 'w') as f:
|
with open(Path(f'logs/{fname}'), 'w') as f:
|
||||||
f.write(json.dumps({'data': history['internal'], 'data_visible': history['visible']}))
|
f.write(json.dumps({'data': history['internal'], 'data_visible': history['visible']}))
|
||||||
return Path('logs/conversation.json')
|
return Path(f'logs/{fname}')
|
||||||
|
|
||||||
def upload_history(file, name1, name2):
|
def upload_history(file, name1, name2):
|
||||||
global history
|
global history
|
||||||
|
Loading…
Reference in New Issue
Block a user