Disable the hijack after using it

This commit is contained in:
oobabooga 2023-02-25 02:36:01 -03:00
parent ad83b1b828
commit 85f914b9b9

View File

@ -96,6 +96,7 @@ def chatbot_wrapper(text, max_new_tokens, do_sample, temperature, top_p, typical
custom_prompt_generator = None custom_prompt_generator = None
for extension, _ in extensions_module.iterator(): for extension, _ in extensions_module.iterator():
if hasattr(extension, 'input_hijack') and extension.input_hijack['state'] == True: if hasattr(extension, 'input_hijack') and extension.input_hijack['state'] == True:
extension.input_hijack['state'] = False
text, visible_text = extension.input_hijack['value'] text, visible_text = extension.input_hijack['value']
if custom_prompt_generator is None and hasattr(extension, 'custom_prompt_generator'): if custom_prompt_generator is None and hasattr(extension, 'custom_prompt_generator'):
custom_prompt_generator = extension.custom_prompt_generator custom_prompt_generator = extension.custom_prompt_generator