Allow API requests to use parameter presets

This commit is contained in:
oobabooga 2023-06-13 20:34:35 -03:00
parent 8936160e54
commit 474dc7355a
8 changed files with 96 additions and 58 deletions

View file

@ -5,6 +5,7 @@ from typing import Callable, Optional
from modules import shared
from modules.chat import load_character_memoized
from modules.presets import load_preset_memoized
def build_parameters(body, chat=False):
@ -40,6 +41,13 @@ def build_parameters(body, chat=False):
'stopping_strings': body.get('stopping_strings', []),
}
preset_name = body.get('preset', 'None')
if preset_name not in ['None', None, '']:
print(preset_name)
preset = load_preset_memoized(preset_name)
print(preset)
generate_params.update(preset)
if chat:
character = body.get('character')
instruction_template = body.get('instruction_template')