diff --git a/gradio/external_utils.py b/gradio/external_utils.py index 8b69721aa9..97e7480cd1 100644 --- a/gradio/external_utils.py +++ b/gradio/external_utils.py @@ -251,13 +251,10 @@ def chat_fn(image, text): def chatbot_preprocess(text, state): - if not state: - return text, [], [] - return ( - text, - state["conversation"]["generated_responses"], - state["conversation"]["past_user_inputs"], - ) + if state: + convo = state["conversation"] + return text, convo["generated_responses"], convo["past_user_inputs"] + return text, [], [] def chatbot_postprocess(response):