Skip to content

Commit

Permalink
Fix prompt incorrectly set to empty when suffix is empty string (#5757)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiximail authored Mar 26, 2024
1 parent 2a92a84 commit 8c9aca2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,14 @@ def make_prompt(messages):

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:
Expand Down

0 comments on commit 8c9aca2

Please sign in to comment.