From 32481ec4d62f68f0fc22cb613f5711017e4bbb3f Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 10 May 2023 02:24:09 -0300 Subject: [PATCH] Fix prompt order in the dropdown --- modules/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/utils.py b/modules/utils.py index 71616477..6722022d 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -34,8 +34,9 @@ def get_available_presets(): def get_available_prompts(): prompts = [] - prompts += sorted(set((k.stem for k in Path('prompts').glob('[0-9]*.txt'))), key=natural_keys, reverse=True) - prompts += sorted(set((k.stem for k in Path('prompts').glob('*.txt'))), key=natural_keys) + files = set((k.stem for k in Path('prompts').glob('*.txt'))) + 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 += ['None'] return prompts