mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-12-06 07:12:10 +01:00
Fix chat-instruct replies leaking the bot name sometimes
This commit is contained in:
parent
a531328f7e
commit
8f660aefe3
|
|
@ -825,6 +825,12 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False, loading_mess
|
|||
|
||||
# Extract the reply
|
||||
if state['mode'] in ['chat', 'chat-instruct']:
|
||||
reply = reply.lstrip()
|
||||
if reply.startswith(state['name2'] + ':'):
|
||||
reply = reply[len(state['name2'] + ':'):]
|
||||
elif reply.startswith(state['name1'] + ':'):
|
||||
reply = reply[len(state['name1'] + ':'):]
|
||||
|
||||
visible_reply = re.sub("(<USER>|<user>|{{user}})", state['name1'], reply)
|
||||
else:
|
||||
visible_reply = reply
|
||||
|
|
|
|||
Loading…
Reference in a new issue