mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04: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)
|
prompt = instruction_template.render(messages=outer_messages)
|
||||||
suffix = get_generation_prompt(instruct_renderer, impersonate=False)[1]
|
suffix = get_generation_prompt(instruct_renderer, impersonate=False)[1]
|
||||||
prompt = prompt[:-len(suffix)]
|
if len(suffix) > 0:
|
||||||
|
prompt = prompt[:-len(suffix)]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if _continue:
|
if _continue:
|
||||||
suffix = get_generation_prompt(renderer, impersonate=impersonate)[1]
|
suffix = get_generation_prompt(renderer, impersonate=impersonate)[1]
|
||||||
prompt = prompt[:-len(suffix)]
|
if len(suffix) > 0:
|
||||||
|
prompt = prompt[:-len(suffix)]
|
||||||
else:
|
else:
|
||||||
prefix = get_generation_prompt(renderer, impersonate=impersonate)[0]
|
prefix = get_generation_prompt(renderer, impersonate=impersonate)[0]
|
||||||
if state['mode'] == 'chat' and not impersonate:
|
if state['mode'] == 'chat' and not impersonate:
|
||||||
|
Loading…
Reference in New Issue
Block a user