Add a rename menu for chat histories
This commit is contained in:
parent
d6814d7c15
commit
d5330406fa
3 changed files with 42 additions and 1 deletions
|
@ -418,6 +418,21 @@ def save_history(history, unique_id, character, mode):
|
|||
f.write(json.dumps(history, indent=4))
|
||||
|
||||
|
||||
def rename_history(old_id, new_id, character, mode):
|
||||
if shared.args.multi_user:
|
||||
return
|
||||
|
||||
old_p = get_history_file_path(old_id, character, mode)
|
||||
new_p = get_history_file_path(new_id, character, mode)
|
||||
if new_p.parent != old_p.parent:
|
||||
logger.error(f"The following path is not allowed: {new_p}.")
|
||||
elif new_p == old_p:
|
||||
logger.info("The provided path is identical to the old one.")
|
||||
else:
|
||||
logger.info(f"Renaming {old_p} to {new_p}")
|
||||
old_p.rename(new_p)
|
||||
|
||||
|
||||
def find_all_histories(state):
|
||||
if shared.args.multi_user:
|
||||
return ['']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue