Clear instruction template before loading new one

This commit is contained in:
oobabooga 2023-08-29 13:11:32 -07:00
parent 36864cb3e8
commit 2b58a89f6a

View File

@ -462,12 +462,17 @@ def load_character(character, name1, name2, instruct=False):
greeting_field = 'greeting'
picture = None
# Deleting the profile picture cache, if any
# Delete the profile picture cache, if any
if Path("cache/pfp_character.png").exists() and not instruct:
Path("cache/pfp_character.png").unlink()
if instruct:
name1 = name2 = ''
folder = 'instruction-templates'
else:
folder = 'characters'
if character not in ['None', '', None]:
folder = 'characters' if not instruct else 'instruction-templates'
picture = generate_pfp_cache(character)
filepath = None
for extension in ["yml", "yaml", "json"]: