mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-12-06 07:12:10 +01:00
Fix metadata leaking into branched chats
This commit is contained in:
parent
1831b3fb51
commit
c7dd920dc8
|
|
@ -1831,6 +1831,10 @@ def handle_branch_chat_click(state):
|
|||
history = state['history']
|
||||
history['visible'] = history['visible'][:branch_from_index + 1]
|
||||
history['internal'] = history['internal'][:branch_from_index + 1]
|
||||
# Prune the metadata dictionary to remove entries beyond the branch point
|
||||
if 'metadata' in history:
|
||||
history['metadata'] = {k: v for k, v in history['metadata'].items() if int(k.split('_')[-1]) <= branch_from_index}
|
||||
|
||||
new_unique_id = datetime.now().strftime('%Y%m%d-%H-%M-%S')
|
||||
save_history(history, new_unique_id, state['character_menu'], state['mode'])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue