AnatoliiG commited on
Commit ·
9f87737
1
Parent(s): ca9762f
ui fix chat
Browse files- src/ui/components.py +17 -16
- src/ui/styles.py +9 -1
src/ui/components.py
CHANGED
|
@@ -7,7 +7,7 @@ from src.ui.styles import CSS
|
|
| 7 |
|
| 8 |
def create_ui():
|
| 9 |
# Базовые блоки без конфликтующих флагов высоты
|
| 10 |
-
with gr.Blocks(theme=gr.themes.Soft(), css=CSS) as demo:
|
| 11 |
gr.HTML(f"<style>{CSS}</style>")
|
| 12 |
gr.HTML("<script>document.title = 'Code LLM Agent';</script>")
|
| 13 |
|
|
@@ -46,22 +46,23 @@ def create_ui():
|
|
| 46 |
)
|
| 47 |
clear = gr.Button("🗑️ Clear Chat", variant="stop")
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
|
| 66 |
input_args = [msg, chatbot]
|
| 67 |
output_args = [msg, chatbot]
|
|
|
|
| 7 |
|
| 8 |
def create_ui():
|
| 9 |
# Базовые блоки без конфликтующих флагов высоты
|
| 10 |
+
with gr.Blocks(theme=gr.themes.Soft(), css=CSS, fill_height=True) as demo:
|
| 11 |
gr.HTML(f"<style>{CSS}</style>")
|
| 12 |
gr.HTML("<script>document.title = 'Code LLM Agent';</script>")
|
| 13 |
|
|
|
|
| 46 |
)
|
| 47 |
clear = gr.Button("🗑️ Clear Chat", variant="stop")
|
| 48 |
|
| 49 |
+
# Основная область чата
|
| 50 |
+
with gr.Column(elem_id="col-chat-main"):
|
| 51 |
+
chatbot = gr.Chatbot(
|
| 52 |
+
elem_id="chatbot",
|
| 53 |
+
show_label=False,
|
| 54 |
+
scale=1, # <- Вот правильный способ растянуть чат
|
| 55 |
+
)
|
| 56 |
|
| 57 |
+
with gr.Row(elem_id="input-area"):
|
| 58 |
+
msg = gr.Textbox(
|
| 59 |
+
show_label=False,
|
| 60 |
+
placeholder="Напиши сообщение или вопрос...",
|
| 61 |
+
scale=10,
|
| 62 |
+
autofocus=True,
|
| 63 |
+
container=False,
|
| 64 |
+
)
|
| 65 |
+
submit = gr.Button("Run ➤", variant="primary", scale=1)
|
| 66 |
|
| 67 |
input_args = [msg, chatbot]
|
| 68 |
output_args = [msg, chatbot]
|
src/ui/styles.py
CHANGED
|
@@ -1,6 +1,14 @@
|
|
| 1 |
CSS = """
|
| 2 |
/* 1. Глобальный фон страницы */
|
| 3 |
-
html, body
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
background-color: #212121 !important;
|
| 5 |
margin: 0 !important;
|
| 6 |
padding: 0 !important;
|
|
|
|
| 1 |
CSS = """
|
| 2 |
/* 1. Глобальный фон страницы */
|
| 3 |
+
html, body {
|
| 4 |
+
background-color: #212121 !important;
|
| 5 |
+
margin: 0 !important;
|
| 6 |
+
padding: 0 !important;
|
| 7 |
+
height: 100vh !important; /* Жестко задаем высоту экрана */
|
| 8 |
+
overflow: hidden !important; /* Убиваем бесконечный внешний скролл */
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.gradio-container {
|
| 12 |
background-color: #212121 !important;
|
| 13 |
margin: 0 !important;
|
| 14 |
padding: 0 !important;
|