Move character settings to a new 'Character' main tab

This commit is contained in:
oobabooga 2025-06-16 07:21:25 -07:00
parent f77f1504f5
commit c9c3b716fb
4 changed files with 14 additions and 7 deletions

View file

@ -1647,13 +1647,17 @@ button:focus {
}
#character-context textarea {
height: calc((100vh - 400px) * 2/3) !important;
height: calc((100vh - 350px) * 2/3) !important;
}
#character-greeting textarea {
height: calc((100vh - 400px) * 1/3) !important;
height: calc((100vh - 350px) * 1/3) !important;
}
#user-description textarea {
height: calc(100vh - 281px) !important;
height: calc(100vh - 231px) !important;
}
#character-tab {
border: 0;
}

View file

@ -111,9 +111,9 @@ def create_ui():
shared.gradio['edit_message'] = gr.Button(elem_id="Edit-message")
def create_chat_settings_ui():
def create_character_settings_ui():
mu = shared.args.multi_user
with gr.Tab('Chat'):
with gr.Tab('Character', elem_id="character-tab"):
with gr.Row():
with gr.Column(scale=8):
with gr.Tab("Character"):
@ -163,6 +163,9 @@ def create_chat_settings_ui():
shared.gradio['character_picture'] = gr.Image(label='Character picture', type='pil', interactive=not mu)
shared.gradio['your_picture'] = gr.Image(label='Your picture', type='pil', value=Image.open(Path('user_data/cache/pfp_me.png')) if Path('user_data/cache/pfp_me.png').exists() else None, interactive=not mu)
def create_chat_settings_ui():
mu = shared.args.multi_user
with gr.Tab('Instruction template'):
with gr.Row():
with gr.Column():
@ -186,7 +189,7 @@ def create_chat_settings_ui():
shared.gradio['send_instruction_to_negative_prompt'] = gr.Button('Send to negative prompt', elem_classes=['small-button'])
with gr.Column():
shared.gradio['chat_template_str'] = gr.Textbox(value=shared.settings['chat_template_str'], label='Chat template', lines=22, elem_classes=['add_scrollbar', 'monospace'])
shared.gradio['chat_template_str'] = gr.Textbox(value=shared.settings['chat_template_str'], label='Chat template', lines=22, elem_classes=['add_scrollbar', 'monospace'], info='Defines how the chat prompt in chat/chat-instruct modes is generated.')
def create_event_handlers():

View file

@ -93,7 +93,6 @@ def create_ui():
with gr.Column():
shared.gradio['truncation_length'] = gr.Number(precision=0, step=256, value=get_truncation_length(), label='Truncate the prompt up to this length', info='The leftmost tokens are removed if the prompt exceeds this length.')
shared.gradio['seed'] = gr.Number(value=shared.settings['seed'], label='Seed (-1 for random)')
shared.gradio['custom_stopping_strings'] = gr.Textbox(lines=2, value=shared.settings["custom_stopping_strings"] or None, label='Custom stopping strings', info='Written between "" and separated by commas.', placeholder='"\\n", "\\nYou:"')
shared.gradio['custom_token_bans'] = gr.Textbox(value=shared.settings['custom_token_bans'] or None, label='Token bans', info='Token IDs to ban, separated by commas. The IDs can be found in the Default or Notebook tab.')
shared.gradio['negative_prompt'] = gr.Textbox(value=shared.settings['negative_prompt'], label='Negative prompt', info='For CFG. Only used when guidance_scale is different than 1.', lines=3, elem_classes=['add_scrollbar'])

View file

@ -150,6 +150,7 @@ def create_interface():
ui_notebook.create_ui()
ui_parameters.create_ui() # Parameters tab
ui_chat.create_character_settings_ui() # Character tab
ui_model_menu.create_ui() # Model tab
if not shared.args.portable:
training.create_ui() # Training tab