Fix a bug in the chat API (closes #4034)

This commit is contained in:
oobabooga 2023-09-22 09:40:07 -07:00
parent 02e771403b
commit d43d150b1e

View File

@ -66,6 +66,8 @@ def build_parameters(body, chat=False):
instruction_template = body.get('instruction_template', shared.settings['instruction_template']) instruction_template = body.get('instruction_template', shared.settings['instruction_template'])
if str(instruction_template) == "None": if str(instruction_template) == "None":
instruction_template = "Vicuna-v1.1" instruction_template = "Vicuna-v1.1"
if str(character) == "None":
character = "Assistant"
name1, name2, _, greeting, context, _ = load_character_memoized(character, str(body.get('your_name', shared.settings['name1'])), '', instruct=False) name1, name2, _, greeting, context, _ = load_character_memoized(character, str(body.get('your_name', shared.settings['name1'])), '', instruct=False)
name1_instruct, name2_instruct, _, _, context_instruct, turn_template = load_character_memoized(instruction_template, '', '', instruct=True) name1_instruct, name2_instruct, _, _, context_instruct, turn_template = load_character_memoized(instruction_template, '', '', instruct=True)