fix: use system message in chat-instruct mode (#4648)

This commit is contained in:
Jordan Tucker 2023-11-18 17:20:13 -06:00 committed by GitHub
parent 47d9e2618b
commit baab894759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,12 @@ def generate_chat_prompt(user_input, state, **kwargs):
if state['mode'] == 'chat-instruct': if state['mode'] == 'chat-instruct':
wrapper = '' wrapper = ''
command = state['chat-instruct_command'].replace('<|character|>', state['name2'] if not impersonate else state['name1']) command = state['chat-instruct_command'].replace('<|character|>', state['name2'] if not impersonate else state['name1'])
wrapper += state['context_instruct'] context_instruct = state['context_instruct']
if state['custom_system_message'].strip() != '':
context_instruct = context_instruct.replace('<|system-message|>', state['custom_system_message'])
else:
context_instruct = context_instruct.replace('<|system-message|>', state['system_message'])
wrapper += context_instruct
wrapper += all_substrings['instruct']['user_turn'].replace('<|user-message|>', command) wrapper += all_substrings['instruct']['user_turn'].replace('<|user-message|>', command)
wrapper += all_substrings['instruct']['bot_turn_stripped'] wrapper += all_substrings['instruct']['bot_turn_stripped']
if impersonate: if impersonate: