From 2cf64474f2319ec009a95a96ec7d1ea799217104 Mon Sep 17 00:00:00 2001 From: jllllll <3887729+jllllll@users.noreply.github.com> Date: Sun, 6 Aug 2023 21:46:25 -0500 Subject: [PATCH] Use chat_instruct_command in API (#3482) --- api-examples/api-example-chat-stream.py | 2 +- api-examples/api-example-chat.py | 2 +- extensions/api/util.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api-examples/api-example-chat-stream.py b/api-examples/api-example-chat-stream.py index a774f907..055900bd 100644 --- a/api-examples/api-example-chat-stream.py +++ b/api-examples/api-example-chat-stream.py @@ -38,7 +38,7 @@ async def run(user_input, history): '_continue': False, 'stop_at_newline': False, 'chat_generation_attempts': 1, - 'chat-instruct_command': 'Continue the chat dialogue below. Write a single reply for the character "<|character|>".\n\n<|prompt|>', + 'chat_instruct_command': 'Continue the chat dialogue below. Write a single reply for the character "<|character|>".\n\n<|prompt|>', # Generation params. If 'preset' is set to different than 'None', the values # in presets/preset-name.yaml are used instead of the individual numbers. diff --git a/api-examples/api-example-chat.py b/api-examples/api-example-chat.py index 824bf3a0..c3d0c538 100644 --- a/api-examples/api-example-chat.py +++ b/api-examples/api-example-chat.py @@ -32,7 +32,7 @@ def run(user_input, history): '_continue': False, 'stop_at_newline': False, 'chat_generation_attempts': 1, - 'chat-instruct_command': 'Continue the chat dialogue below. Write a single reply for the character "<|character|>".\n\n<|prompt|>', + 'chat_instruct_command': 'Continue the chat dialogue below. Write a single reply for the character "<|character|>".\n\n<|prompt|>', # Generation params. If 'preset' is set to different than 'None', the values # in presets/preset-name.yaml are used instead of the individual numbers. diff --git a/extensions/api/util.py b/extensions/api/util.py index 2654d046..f36c070b 100644 --- a/extensions/api/util.py +++ b/extensions/api/util.py @@ -79,7 +79,7 @@ def build_parameters(body, chat=False): 'name2_instruct': str(body.get('name2_instruct', name2_instruct)), 'context_instruct': str(body.get('context_instruct', context_instruct)), 'turn_template': str(body.get('turn_template', turn_template)), - 'chat-instruct_command': str(body.get('chat-instruct_command', shared.settings['chat-instruct_command'])), + 'chat-instruct_command': str(body.get('chat_instruct_command', body.get('chat-instruct_command', shared.settings['chat-instruct_command']))), 'history': body.get('history', {'internal': [], 'visible': []}) })