diff --git a/js/main.js b/js/main.js index a5e98aef..f6520549 100644 --- a/js/main.js +++ b/js/main.js @@ -473,3 +473,13 @@ respondToRenameVisibility(renameTextArea, handleVisibilityChange); if (document.getElementById('extensions') === null) { document.getElementById("chat-tab").style.marginBottom = "-29px"; } + +//------------------------------------------------ +// Focus on the chat input after starting a new chat +//------------------------------------------------ + +document.querySelectorAll('.focus-on-chat-input').forEach(element => { + element.addEventListener('click', function() { + document.querySelector('#chat-input textarea').focus(); + }); +}); diff --git a/modules/models.py b/modules/models.py index 291383ef..21f5e5f6 100644 --- a/modules/models.py +++ b/modules/models.py @@ -154,6 +154,8 @@ def huggingface_loader(model_name): if not any([shared.args.cpu, shared.args.load_in_8bit, shared.args.load_in_4bit, shared.args.auto_devices, shared.args.disk, shared.args.deepspeed, shared.args.gpu_memory is not None, shared.args.cpu_memory is not None, shared.args.compress_pos_emb > 1, shared.args.alpha_value > 1, shared.args.disable_exllama, shared.args.disable_exllamav2]): logger.info("TRANSFORMERS_PARAMS=") pprint.PrettyPrinter(indent=4, sort_dicts=False).pprint(params) + print() + model = LoaderClass.from_pretrained(path_to_model, **params) if not (hasattr(model, 'is_loaded_in_4bit') and model.is_loaded_in_4bit): if torch.backends.mps.is_available(): diff --git a/modules/ui_chat.py b/modules/ui_chat.py index 3d3a75df..3193bd67 100644 --- a/modules/ui_chat.py +++ b/modules/ui_chat.py @@ -68,14 +68,14 @@ def create_ui(): with gr.Row(): shared.gradio['rename_chat'] = gr.Button('Rename', elem_classes='refresh-button', interactive=not mu) shared.gradio['delete_chat'] = gr.Button('🗑️', elem_classes='refresh-button', interactive=not mu) - shared.gradio['delete_chat-confirm'] = gr.Button('Confirm', variant='stop', visible=False, elem_classes='refresh-button') - shared.gradio['delete_chat-cancel'] = gr.Button('Cancel', visible=False, elem_classes='refresh-button') - shared.gradio['Start new chat'] = gr.Button('New chat', elem_classes='refresh-button') + shared.gradio['delete_chat-confirm'] = gr.Button('Confirm', variant='stop', visible=False, elem_classes=['refresh-button', 'focus-on-chat-input']) + shared.gradio['delete_chat-cancel'] = gr.Button('Cancel', visible=False, elem_classes=['refresh-button', 'focus-on-chat-input']) + shared.gradio['Start new chat'] = gr.Button('New chat', elem_classes=['refresh-button', 'focus-on-chat-input']) with gr.Row(elem_id='rename-row'): shared.gradio['rename_to'] = gr.Textbox(label='Rename to:', placeholder='New name', visible=False, elem_classes=['no-background']) - shared.gradio['rename_to-confirm'] = gr.Button('Confirm', visible=False, elem_classes='refresh-button') - shared.gradio['rename_to-cancel'] = gr.Button('Cancel', visible=False, elem_classes='refresh-button') + shared.gradio['rename_to-confirm'] = gr.Button('Confirm', visible=False, elem_classes=['refresh-button', 'focus-on-chat-input']) + shared.gradio['rename_to-cancel'] = gr.Button('Cancel', visible=False, elem_classes=['refresh-button', 'focus-on-chat-input']) with gr.Row(elem_id='chat-controls', elem_classes=['pretty_scrollbar']): with gr.Column():