AnatoliiG commited on
Commit ·
9f87737
1
Parent(s): ca9762f
ui fix chat
Browse filesFiles changed (2)
- src/ui/components.py+17-16
- src/ui/styles.py+9-1
6 unmodified lines7891011121332 unmodified lines464748495051525354555657585960616263646566676 unmodified linesdef create_ui():# Базовые блоки без конфликтующих флагов высотыwith gr.Blocks(theme=gr.themes.Soft(), css=CSS) as demo:gr.HTML(f"<style>{CSS}</style>")gr.HTML("<script>document.title = 'Code LLM Agent';</script>")32 unmodified lines)clear = gr.Button("🗑️ Clear Chat", variant="stop")# Основная область чатаwith gr.Column(elem_id="col-chat-main"):# Нативно задаем высоту чата в Python — это защищает от циклов рендерингаchatbot = gr.Chatbot(elem_id="chatbot", show_label=False, height="calc(100vh - 180px)")with gr.Row(elem_id="input-area"):msg = gr.Textbox(show_label=False,placeholder="Напиши сообщение или вопрос...",scale=10,autofocus=True,container=False,)submit = gr.Button("Run ➤", variant="primary", scale=1)input_args = [msg, chatbot]output_args = [msg, chatbot]6 unmodified lines7891011121332 unmodified lines46474849505152535455565758596061626364656667686 unmodified linesdef create_ui():# Базовые блоки без конфликтующих флагов высотыwith gr.Blocks(theme=gr.themes.Soft(), css=CSS, fill_height=True) as demo:gr.HTML(f"<style>{CSS}</style>")gr.HTML("<script>document.title = 'Code LLM Agent';</script>")32 unmodified lines)clear = gr.Button("🗑️ Clear Chat", variant="stop")# Основная область чатаwith gr.Column(elem_id="col-chat-main"):chatbot = gr.Chatbot(elem_id="chatbot",show_label=False,scale=1, # <- Вот правильный способ растянуть чат)with gr.Row(elem_id="input-area"):msg = gr.Textbox(show_label=False,placeholder="Напиши сообщение или вопрос...",scale=10,autofocus=True,container=False,)submit = gr.Button("Run ➤", variant="primary", scale=1)input_args = [msg, chatbot]output_args = [msg, chatbot]
123456CSS = """/* 1. Глобальный фон страницы */html, body, .gradio-container {background-color: #212121 !important;margin: 0 !important;padding: 0 !important;1234567891011121314CSS = """/* 1. Глобальный фон страницы */html, body {background-color: #212121 !important;margin: 0 !important;padding: 0 !important;height: 100vh !important; /* Жестко задаем высоту экрана */overflow: hidden !important; /* Убиваем бесконечный внешний скролл */}.gradio-container {background-color: #212121 !important;margin: 0 !important;padding: 0 !important;
src/ui/components.py+17-16
src/ui/styles.py+9-1