This commit is contained in:
oobabooga 2025-05-29 14:11:21 -07:00
parent dce02732a4
commit acbcc12e7b
2 changed files with 3 additions and 6 deletions

View file

@ -1493,7 +1493,7 @@ def handle_edit_message_click(state):
if message_index >= len(history['internal']):
html_output = redraw_html(history, state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu'])
return [history, html_output, gr.update()] # No unique_id change
return [history, html_output]
role_idx = 0 if role == "user" else 1
@ -1521,13 +1521,10 @@ def handle_edit_message_click(state):
add_message_version(history, role, message_index, is_current=True)
# Since we are not branching, unique_id does not change.
past_chats_update = gr.update()
save_history(history, state['unique_id'], state['character_menu'], state['mode'])
html_output = redraw_html(history, state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu'])
return [history, html_output, past_chats_update]
return [history, html_output]
def handle_navigate_version_click(state):

View file

@ -314,7 +314,7 @@ def create_event_handlers():
shared.gradio['edit_message'].click(
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
chat.handle_edit_message_click, gradio('interface_state'), gradio('history', 'display', 'unique_id'), show_progress=False)
chat.handle_edit_message_click, gradio('interface_state'), gradio('history', 'display'), show_progress=False)
# Save/delete a character
shared.gradio['save_character'].click(chat.handle_save_character_click, gradio('name2'), gradio('save_character_filename', 'character_saver'), show_progress=False)