Syntax improvement

This commit is contained in:
oobabooga 2023-05-11 16:27:50 -03:00
parent f7dbddfff5
commit 394bb253db

View File

@ -20,14 +20,11 @@ from modules.utils import replace_all
def generate_chat_prompt(user_input, state, **kwargs): def generate_chat_prompt(user_input, state, **kwargs):
# Check if an extension is sending its modified history. impersonate = kwargs.get('impersonate', False)
# If not, use the regular history _continue = kwargs.get('_continue', False)
history = state['history'] if 'history' in state else shared.history['internal'] also_return_rows = kwargs.get('also_return_rows', False)
# Define some variables history = state.get('history', shared.history['internal'])
impersonate = kwargs['impersonate'] if 'impersonate' in kwargs else False
_continue = kwargs['_continue'] if '_continue' in kwargs else False
also_return_rows = kwargs['also_return_rows'] if 'also_return_rows' in kwargs else False
is_instruct = state['mode'] == 'instruct' is_instruct = state['mode'] == 'instruct'
rows = [state['context_instruct'] if is_instruct else f"{state['context'].strip()}\n"] rows = [state['context_instruct'] if is_instruct else f"{state['context'].strip()}\n"]
min_rows = 3 min_rows = 3