sidebar collapse when enter and generate
Browse files5121 unmodified lines512251235124512551265125512651275128512922 unmodified lines5152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815121 unmodified lines )
def begin_generation_ui(): # If beta chat UI is active, keep sidebar visible; otherwise, default behavior return [gr.update(), gr.update(visible=False)] # Collapse the sidebar when generation starts; keep status hidden return [gr.update(open=False), gr.update(visible=False)]
def end_generation_ui(): # Keep sidebar as is; hide the status22 unmodified lines outputs=[space_name_input, deploy_btn] )
# Pressing Enter in the main input should trigger generation and collapse the sidebar input.submit( begin_generation_ui, inputs=None, outputs=[sidebar, generating_status], show_progress="hidden", ).then( generation_code, inputs=[input, image_input, generation_image_input, file_input, website_url_input, setting, history, current_model, search_toggle, language_dropdown, provider_state, image_generation_toggle, image_to_image_toggle, image_to_image_prompt, text_to_image_prompt, image_to_video_toggle, image_to_video_prompt, text_to_video_toggle, text_to_video_prompt], outputs=[code_output, history, sandbox, history_output] ).then( end_generation_ui, inputs=None, outputs=[sidebar, generating_status] ).then( show_deploy_components, None, [space_name_input, sdk_dropdown, deploy_btn] ).then( preserve_space_info_for_followup, inputs=[history], outputs=[space_name_input, deploy_btn] )
# --- Chat-based sidebar controller logic --- def _find_model_by_name(name: str): for m in AVAILABLE_MODELS:app.py+26-2