mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-01-30 20:34:32 +01:00
Fix continue/start reply with when using translation extensions (#6944)
--------- Co-authored-by: oobabooga <oobabooga4@gmail.com>
This commit is contained in:
parent
331d03c33f
commit
ec73121020
|
|
@ -760,7 +760,18 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False, loading_mess
|
|||
if is_stream:
|
||||
yield output
|
||||
|
||||
output['visible'][-1][1] = apply_extensions('output', output['visible'][-1][1], state, is_chat=True)
|
||||
if _continue:
|
||||
# Reprocess the entire internal text for extensions (like translation)
|
||||
full_internal = output['internal'][-1][1]
|
||||
if state['mode'] in ['chat', 'chat-instruct']:
|
||||
full_visible = re.sub("(<USER>|<user>|{{user}})", state['name1'], full_internal)
|
||||
else:
|
||||
full_visible = full_internal
|
||||
|
||||
full_visible = html.escape(full_visible)
|
||||
output['visible'][-1][1] = apply_extensions('output', full_visible, state, is_chat=True)
|
||||
else:
|
||||
output['visible'][-1][1] = apply_extensions('output', output['visible'][-1][1], state, is_chat=True)
|
||||
|
||||
# Final sync for version metadata (in case streaming was disabled)
|
||||
if regenerate:
|
||||
|
|
|
|||
Loading…
Reference in a new issue