mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 09:19:23 +01:00
Fix prompt incorrectly set to empty when suffix is empty string (#5757)
This commit is contained in:
parent
2a92a842ce
commit
8c9aca239a
@ -161,12 +161,14 @@ def generate_chat_prompt(user_input, state, **kwargs):
|
||||
|
||||
prompt = instruction_template.render(messages=outer_messages)
|
||||
suffix = get_generation_prompt(instruct_renderer, impersonate=False)[1]
|
||||
prompt = prompt[:-len(suffix)]
|
||||
if len(suffix) > 0:
|
||||
prompt = prompt[:-len(suffix)]
|
||||
|
||||
else:
|
||||
if _continue:
|
||||
suffix = get_generation_prompt(renderer, impersonate=impersonate)[1]
|
||||
prompt = prompt[:-len(suffix)]
|
||||
if len(suffix) > 0:
|
||||
prompt = prompt[:-len(suffix)]
|
||||
else:
|
||||
prefix = get_generation_prompt(renderer, impersonate=impersonate)[0]
|
||||
if state['mode'] == 'chat' and not impersonate:
|
||||
|
Loading…
Reference in New Issue
Block a user