mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Use current input for Impersonate (continue impersonate feature) (#1147)
This commit is contained in:
parent
a5bb278631
commit
641500dcb9
@ -229,11 +229,11 @@ def impersonate_wrapper(text, state):
|
||||
# Defining some variables
|
||||
cumulative_reply = ''
|
||||
eos_token = '\n' if state['stop_at_newline'] else None
|
||||
prompt = generate_chat_prompt(text, state, impersonate=True)
|
||||
prompt = generate_chat_prompt('', state, impersonate=True)
|
||||
stopping_strings = get_stopping_strings(state)
|
||||
|
||||
# Yield *Is typing...*
|
||||
yield shared.processing_message
|
||||
yield text + '...'
|
||||
cumulative_reply = text
|
||||
for i in range(state['chat_generation_attempts']):
|
||||
reply = None
|
||||
for reply in generate_reply(f"{prompt}{' ' if len(cumulative_reply) > 0 else ''}{cumulative_reply}", state, eos_token=eos_token, stopping_strings=stopping_strings):
|
||||
|
@ -714,6 +714,7 @@ def create_interface():
|
||||
|
||||
gen_events.append(shared.gradio['Impersonate'].click(
|
||||
ui.gather_interface_values, [shared.gradio[k] for k in shared.input_elements], shared.gradio['interface_state']).then(
|
||||
lambda x: x, shared.gradio['textbox'], shared.gradio['Chat input'], show_progress=False).then(
|
||||
chat.impersonate_wrapper, shared.input_params, shared.gradio['textbox'], show_progress=False)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user