Add default extensions to the settings

This commit is contained in:
oobabooga 2023-02-28 02:20:11 -03:00
parent 365e1089b3
commit a1429d1607
2 changed files with 14 additions and 1 deletions

View File

@ -39,6 +39,8 @@ settings = {
'name2_pygmalion': 'Kawaii', 'name2_pygmalion': 'Kawaii',
'context_pygmalion': "Kawaii's persona: Kawaii is a cheerful person who loves to make others smile. She is an optimist who loves to spread happiness and positivity wherever she goes.\n<START>", 'context_pygmalion': "Kawaii's persona: Kawaii is a cheerful person who loves to make others smile. She is an optimist who loves to spread happiness and positivity wherever she goes.\n<START>",
'stop_at_newline_pygmalion': False, 'stop_at_newline_pygmalion': False,
'default_extensions': [],
'chat_default_extensions': ["gallery"],
} }
parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=54)) parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=54))

View File

@ -151,7 +151,18 @@ available_characters = get_available_characters()
available_softprompts = get_available_softprompts() available_softprompts = get_available_softprompts()
extensions_module.available_extensions = get_available_extensions() extensions_module.available_extensions = get_available_extensions()
if shared.args.extensions is not None: # Activate the default extensions
if shared.args.chat or shared.args.cai_chat:
for extension in shared.settings['chat_default_extensions']:
shared.args.extensions = shared.args.extensions or []
if extension not in shared.args.extensions:
shared.args.extensions.append(extension)
else:
for extension in shared.settings['default_extensions']:
shared.args.extensions = shared.args.extensions or []
if extension not in shared.args.extensions:
shared.args.extensions.append(extension)
if shared.args.extensions is not None and len(shared.args.extensions) > 0:
extensions_module.load_extensions() extensions_module.load_extensions()
# Choosing the default model # Choosing the default model