Use character settings from API properties if present (#3428)

This commit is contained in:
rafa-9 2023-08-03 14:56:40 -04:00 committed by GitHub
parent d93087adc3
commit d578baeb2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 12 deletions

View File

@ -25,9 +25,15 @@ async def run(user_input, history):
'mode': 'instruct', # Valid options: 'chat', 'chat-instruct', 'instruct' 'mode': 'instruct', # Valid options: 'chat', 'chat-instruct', 'instruct'
'character': 'Example', 'character': 'Example',
'instruction_template': 'Vicuna-v1.1', # Will get autodetected if unset 'instruction_template': 'Vicuna-v1.1', # Will get autodetected if unset
# 'context_instruct': '', # Optional
'your_name': 'You', 'your_name': 'You',
# 'name1': 'name of user', # Optional
# 'name2': 'name of character', # Optional
# 'context': 'character context', # Optional
# 'greeting': 'greeting', # Optional
# 'name1_instruct': 'You', # Optional
# 'name2_instruct': 'Assistant', # Optional
# 'context_instruct': 'context_instruct', # Optional
# 'turn_template': 'turn_template', # Optional
'regenerate': False, 'regenerate': False,
'_continue': False, '_continue': False,
'stop_at_newline': False, 'stop_at_newline': False,

View File

@ -19,9 +19,15 @@ def run(user_input, history):
'mode': 'instruct', # Valid options: 'chat', 'chat-instruct', 'instruct' 'mode': 'instruct', # Valid options: 'chat', 'chat-instruct', 'instruct'
'character': 'Example', 'character': 'Example',
'instruction_template': 'Vicuna-v1.1', # Will get autodetected if unset 'instruction_template': 'Vicuna-v1.1', # Will get autodetected if unset
# 'context_instruct': '', # Optional
'your_name': 'You', 'your_name': 'You',
# 'name1': 'name of user', # Optional
# 'name2': 'name of character', # Optional
# 'context': 'character context', # Optional
# 'greeting': 'greeting', # Optional
# 'name1_instruct': 'You', # Optional
# 'name2_instruct': 'Assistant', # Optional
# 'context_instruct': 'context_instruct', # Optional
# 'turn_template': 'turn_template', # Optional
'regenerate': False, 'regenerate': False,
'_continue': False, '_continue': False,
'stop_at_newline': False, 'stop_at_newline': False,

View File

@ -69,14 +69,14 @@ def build_parameters(body, chat=False):
'stop_at_newline': bool(body.get('stop_at_newline', shared.settings['stop_at_newline'])), 'stop_at_newline': bool(body.get('stop_at_newline', shared.settings['stop_at_newline'])),
'chat_generation_attempts': int(body.get('chat_generation_attempts', shared.settings['chat_generation_attempts'])), 'chat_generation_attempts': int(body.get('chat_generation_attempts', shared.settings['chat_generation_attempts'])),
'mode': str(body.get('mode', 'chat')), 'mode': str(body.get('mode', 'chat')),
'name1': name1, 'name1': str(body.get('name1', name1)),
'name2': name2, 'name2': str(body.get('name2', name2)),
'context': context, 'context': str(body.get('context', context)),
'greeting': greeting, 'greeting': str(body.get('greeting', greeting)),
'name1_instruct': name1_instruct, 'name1_instruct': str(body.get('name1_instruct', name1_instruct)),
'name2_instruct': name2_instruct, 'name2_instruct': str(body.get('name2_instruct', name2_instruct)),
'context_instruct': body.get('context_instruct', context_instruct), 'context_instruct': str(body.get('context_instruct', context_instruct)),
'turn_template': turn_template, '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', shared.settings['chat-instruct_command'])),
'history': body.get('history', {'internal': [], 'visible': []}) 'history': body.get('history', {'internal': [], 'visible': []})
}) })