From 18c0eb7e381e2bf99c2077d258c27b565e0d2cf5 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 1 Jun 2025 19:36:14 -0700 Subject: [PATCH] Fix counting tokens with an empty history --- modules/ui_chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui_chat.py b/modules/ui_chat.py index a8eaadfa..0d5a2c18 100644 --- a/modules/ui_chat.py +++ b/modules/ui_chat.py @@ -18,7 +18,7 @@ def create_ui(): mu = shared.args.multi_user shared.gradio['Chat input'] = gr.State() - shared.gradio['history'] = gr.State() + shared.gradio['history'] = gr.State({'internal': [], 'visible': [], 'metadata': {}}) with gr.Tab('Chat', id='Chat', elem_id='chat-tab'): with gr.Row(elem_id='past-chats-row', elem_classes=['pretty_scrollbar']):