move tools at the bottom and make it collapsed by default

This commit is contained in:
Adil Hafeez 2024-10-29 00:10:11 -07:00
parent bd4e72b48e
commit 9d9ed42c5a
2 changed files with 13 additions and 17 deletions

View file

@ -2,7 +2,7 @@ import json
import os
import logging
import yaml
from common import get_arch_messages
from common import get_arch_messages, get_prompt_targets
import gradio as gr
from typing import List, Optional, Tuple

View file

@ -26,11 +26,9 @@ log.info(f"CHAT_COMPLETION_ENDPOINT: {CHAT_COMPLETION_ENDPOINT}")
CSS_STYLE = """
.json-container {
height: 95vh !important;
overflow-y: auto !important;
}
.chatbot {
height: calc(95vh - 100px) !important;
overflow-y: auto !important;
}
footer {visibility: hidden}
@ -101,34 +99,32 @@ def main():
fill_height=True,
css=CSS_STYLE,
) as demo:
with gr.Row(equal_height=True):
with gr.Row():
state = gr.State({})
with gr.Column(scale=4):
gr.JSON(
value=get_prompt_targets(),
open=True,
show_indices=False,
label="Available Tools",
scale=1,
min_height="95vh",
elem_classes="json-container",
)
with gr.Column(scale=6):
with gr.Column():
chatbot = gr.Chatbot(
label="Arch Chatbot",
scale=1,
elem_classes="chatbot",
)
textbox = gr.Textbox(
show_label=False,
placeholder="Enter text and press enter",
scale=1,
autofocus=True,
)
textbox.submit(chat, [textbox, chatbot, state], [textbox, chatbot, state])
with gr.Row():
with gr.Accordion("See available tools", open=False):
with gr.Column(scale=1):
gr.JSON(
value=get_prompt_targets(),
show_indices=False,
label="Available Tools",
elem_classes="json-container",
)
demo.launch(server_name="0.0.0.0", server_port=8080, show_error=True, debug=True)