diff --git a/extensions/gallery/script.py b/extensions/gallery/script.py index 1bb8068a..ff0242c8 100644 --- a/extensions/gallery/script.py +++ b/extensions/gallery/script.py @@ -3,9 +3,14 @@ from pathlib import Path import gradio as gr from modules.html_generator import get_image_cache -from modules.shared import gradio, settings +from modules.shared import gradio +params = { + 'items_per_page': 50, + 'open': False, +} + cards = [] @@ -104,7 +109,7 @@ def custom_js(): def ui(): - with gr.Accordion("Character gallery", open=settings["gallery-open"], elem_id='gallery-extension'): + with gr.Accordion("Character gallery", open=params["open"], elem_id='gallery-extension'): gr.HTML(value="") with gr.Row(): filter_box = gr.Textbox(label='', placeholder='Filter', lines=1, max_lines=1, container=False, elem_id='gallery-filter-box') @@ -116,7 +121,7 @@ def ui(): label="", samples=generate_html(), elem_classes=["character-gallery"], - samples_per_page=settings["gallery-items_per_page"] + samples_per_page=params["items_per_page"] ) filter_box.change(lambda: None, None, None, js=f'() => {{{custom_js()}; gotoFirstPage()}}').success( diff --git a/js/main.js b/js/main.js index 219d860e..a5e98aef 100644 --- a/js/main.js +++ b/js/main.js @@ -464,3 +464,12 @@ function handleVisibilityChange(isVisible) { } respondToRenameVisibility(renameTextArea, handleVisibilityChange); + +//------------------------------------------------ +// Adjust the chat tab margin if no extension UI +// is present at the bottom +//------------------------------------------------ + +if (document.getElementById('extensions') === null) { + document.getElementById("chat-tab").style.marginBottom = "-29px"; +} diff --git a/modules/shared.py b/modules/shared.py index a48b281c..46b6ef47 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -62,9 +62,7 @@ settings = { 'chat_template_str': "{%- for message in messages %}\n {%- if message['role'] == 'system' -%}\n {%- if message['content'] -%}\n {{- message['content'] + '\\n\\n' -}}\n {%- endif -%}\n {%- if user_bio -%}\n {{- user_bio + '\\n\\n' -}}\n {%- endif -%}\n {%- else -%}\n {%- if message['role'] == 'user' -%}\n {{- name1 + ': ' + message['content'] + '\\n'-}}\n {%- else -%}\n {{- name2 + ': ' + message['content'] + '\\n' -}}\n {%- endif -%}\n {%- endif -%}\n{%- endfor -%}", 'chat-instruct_command': 'Continue the chat dialogue below. Write a single reply for the character "<|character|>".\n\n<|prompt|>', 'autoload_model': False, - 'gallery-items_per_page': 50, - 'gallery-open': False, - 'default_extensions': ['gallery'], + 'default_extensions': [], } default_settings = copy.deepcopy(settings) diff --git a/settings-template.yaml b/settings-template.yaml index c239057f..31a0f614 100644 --- a/settings-template.yaml +++ b/settings-template.yaml @@ -74,5 +74,4 @@ chat-instruct_command: |- autoload_model: false gallery-items_per_page: 50 gallery-open: false -default_extensions: -- gallery +default_extensions: []