mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 17:29:22 +01:00
Logging: more readable messages when renaming chat histories
This commit is contained in:
parent
faf3bf2503
commit
10aedc329f
@ -501,11 +501,11 @@ def rename_history(old_id, new_id, character, mode):
|
|||||||
old_p = get_history_file_path(old_id, character, mode)
|
old_p = get_history_file_path(old_id, character, mode)
|
||||||
new_p = get_history_file_path(new_id, character, mode)
|
new_p = get_history_file_path(new_id, character, mode)
|
||||||
if new_p.parent != old_p.parent:
|
if new_p.parent != old_p.parent:
|
||||||
logger.error(f"The following path is not allowed: {new_p}.")
|
logger.error(f"The following path is not allowed: \"{new_p}\".")
|
||||||
elif new_p == old_p:
|
elif new_p == old_p:
|
||||||
logger.info("The provided path is identical to the old one.")
|
logger.info("The provided path is identical to the old one.")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Renaming {old_p} to {new_p}")
|
logger.info(f"Renaming \"{old_p}\" to \"{new_p}\"")
|
||||||
old_p.rename(new_p)
|
old_p.rename(new_p)
|
||||||
|
|
||||||
|
|
||||||
@ -522,12 +522,13 @@ def find_all_histories(state):
|
|||||||
old_p = Path(f'logs/{character}_persistent.json')
|
old_p = Path(f'logs/{character}_persistent.json')
|
||||||
new_p = Path(f'logs/persistent_{character}.json')
|
new_p = Path(f'logs/persistent_{character}.json')
|
||||||
if old_p.exists():
|
if old_p.exists():
|
||||||
logger.warning(f"Renaming {old_p} to {new_p}")
|
logger.warning(f"Renaming \"{old_p}\" to \"{new_p}\"")
|
||||||
old_p.rename(new_p)
|
old_p.rename(new_p)
|
||||||
|
|
||||||
if new_p.exists():
|
if new_p.exists():
|
||||||
unique_id = datetime.now().strftime('%Y%m%d-%H-%M-%S')
|
unique_id = datetime.now().strftime('%Y%m%d-%H-%M-%S')
|
||||||
p = get_history_file_path(unique_id, character, state['mode'])
|
p = get_history_file_path(unique_id, character, state['mode'])
|
||||||
logger.warning(f"Moving {new_p} to {p}")
|
logger.warning(f"Moving \"{new_p}\" to \"{p}\"")
|
||||||
p.parent.mkdir(exist_ok=True)
|
p.parent.mkdir(exist_ok=True)
|
||||||
new_p.rename(p)
|
new_p.rename(p)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user