UI: do not load the "gallery" extension by default

This commit is contained in:
oobabooga 2024-04-06 12:43:21 -07:00
parent 64a76856bd
commit 168a0f4f67
4 changed files with 19 additions and 8 deletions

View File

@ -3,9 +3,14 @@ from pathlib import Path
import gradio as gr import gradio as gr
from modules.html_generator import get_image_cache 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 = [] cards = []
@ -104,7 +109,7 @@ def custom_js():
def ui(): 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="<style>" + generate_css() + "</style>") gr.HTML(value="<style>" + generate_css() + "</style>")
with gr.Row(): with gr.Row():
filter_box = gr.Textbox(label='', placeholder='Filter', lines=1, max_lines=1, container=False, elem_id='gallery-filter-box') 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="", label="",
samples=generate_html(), samples=generate_html(),
elem_classes=["character-gallery"], 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( filter_box.change(lambda: None, None, None, js=f'() => {{{custom_js()}; gotoFirstPage()}}').success(

View File

@ -464,3 +464,12 @@ function handleVisibilityChange(isVisible) {
} }
respondToRenameVisibility(renameTextArea, handleVisibilityChange); 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";
}

View File

@ -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_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|>', 'chat-instruct_command': 'Continue the chat dialogue below. Write a single reply for the character "<|character|>".\n\n<|prompt|>',
'autoload_model': False, 'autoload_model': False,
'gallery-items_per_page': 50, 'default_extensions': [],
'gallery-open': False,
'default_extensions': ['gallery'],
} }
default_settings = copy.deepcopy(settings) default_settings = copy.deepcopy(settings)

View File

@ -74,5 +74,4 @@ chat-instruct_command: |-
autoload_model: false autoload_model: false
gallery-items_per_page: 50 gallery-items_per_page: 50
gallery-open: false gallery-open: false
default_extensions: default_extensions: []
- gallery