mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-06-08 14:46:14 -04:00
Fix timestamp issues when editing/swiping messages
This commit is contained in:
parent
8078c41ec6
commit
dce02732a4
1 changed files with 3 additions and 1 deletions
|
@ -1508,11 +1508,12 @@ def handle_edit_message_click(state):
|
||||||
if "versions" not in history['metadata'][key] or not history['metadata'][key]["versions"]:
|
if "versions" not in history['metadata'][key] or not history['metadata'][key]["versions"]:
|
||||||
original_content = history['internal'][message_index][role_idx]
|
original_content = history['internal'][message_index][role_idx]
|
||||||
original_visible = history['visible'][message_index][role_idx]
|
original_visible = history['visible'][message_index][role_idx]
|
||||||
|
original_timestamp = history['metadata'][key].get('timestamp', get_current_timestamp())
|
||||||
|
|
||||||
history['metadata'][key]["versions"] = [{
|
history['metadata'][key]["versions"] = [{
|
||||||
"content": original_content,
|
"content": original_content,
|
||||||
"visible_content": original_visible,
|
"visible_content": original_visible,
|
||||||
"timestamp": get_current_timestamp()
|
"timestamp": original_timestamp
|
||||||
}]
|
}]
|
||||||
|
|
||||||
history['internal'][message_index][role_idx] = apply_extensions('input', new_text, state, is_chat=True)
|
history['internal'][message_index][role_idx] = apply_extensions('input', new_text, state, is_chat=True)
|
||||||
|
@ -1564,6 +1565,7 @@ def handle_navigate_version_click(state):
|
||||||
history['internal'][message_index][msg_content_idx] = version_to_load['content']
|
history['internal'][message_index][msg_content_idx] = version_to_load['content']
|
||||||
history['visible'][message_index][msg_content_idx] = version_to_load['visible_content']
|
history['visible'][message_index][msg_content_idx] = version_to_load['visible_content']
|
||||||
metadata['current_version_index'] = new_idx
|
metadata['current_version_index'] = new_idx
|
||||||
|
update_message_metadata(history['metadata'], role, message_index, timestamp=version_to_load['timestamp'])
|
||||||
|
|
||||||
# Redraw and save
|
# Redraw and save
|
||||||
html = redraw_html(history, state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu'])
|
html = redraw_html(history, state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu'])
|
||||||
|
|
Loading…
Add table
Reference in a new issue