Fix prompt order in the dropdown

This commit is contained in:
oobabooga 2023-05-10 02:24:09 -03:00
parent dfd9ba3e90
commit 32481ec4d6

View File

@ -34,8 +34,9 @@ def get_available_presets():
def get_available_prompts(): def get_available_prompts():
prompts = [] prompts = []
prompts += sorted(set((k.stem for k in Path('prompts').glob('[0-9]*.txt'))), key=natural_keys, reverse=True) files = set((k.stem for k in Path('prompts').glob('*.txt')))
prompts += sorted(set((k.stem for k in Path('prompts').glob('*.txt'))), key=natural_keys) prompts += sorted([k for k in files if re.match('^[0-9]', k)], key=natural_keys, reverse=True)
prompts += sorted([k for k in files if re.match('^[^0-9]', k)], key=natural_keys)
prompts += ['Instruct-' + k for k in get_available_instruction_templates() if k != 'None'] prompts += ['Instruct-' + k for k in get_available_instruction_templates() if k != 'None']
prompts += ['None'] prompts += ['None']
return prompts return prompts