mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Make chat API more robust
This commit is contained in:
parent
5b5ef57049
commit
28fd535f9c
@ -197,6 +197,7 @@ def chat_completions_common(body: dict, is_legacy: bool = False, stream=False) -
|
|||||||
|
|
||||||
# Instruction template
|
# Instruction template
|
||||||
instruction_template = body['instruction_template'] or shared.settings['instruction_template']
|
instruction_template = body['instruction_template'] or shared.settings['instruction_template']
|
||||||
|
instruction_template = "Alpaca" if instruction_template == "None" else instruction_template
|
||||||
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)
|
||||||
name1_instruct = body['name1_instruct'] or name1_instruct
|
name1_instruct = body['name1_instruct'] or name1_instruct
|
||||||
name2_instruct = body['name2_instruct'] or name2_instruct
|
name2_instruct = body['name2_instruct'] or name2_instruct
|
||||||
@ -205,6 +206,7 @@ def chat_completions_common(body: dict, is_legacy: bool = False, stream=False) -
|
|||||||
|
|
||||||
# Chat character
|
# Chat character
|
||||||
character = body['character'] or shared.settings['character']
|
character = body['character'] or shared.settings['character']
|
||||||
|
character = "Assistant" if character == "None" else character
|
||||||
name1 = body['name1'] or shared.settings['name1']
|
name1 = body['name1'] or shared.settings['name1']
|
||||||
name1, name2, _, greeting, context, _ = load_character_memoized(character, name1, '', instruct=False)
|
name1, name2, _, greeting, context, _ = load_character_memoized(character, name1, '', instruct=False)
|
||||||
name2 = body['name2'] or name2
|
name2 = body['name2'] or name2
|
||||||
|
Loading…
Reference in New Issue
Block a user