diff --git a/main.py b/main.py index a92860c..113884f 100644 --- a/main.py +++ b/main.py @@ -58,7 +58,7 @@ def main(): with gr_L1(): with gr_L2(scale=2, elem_id="gpt-chat"): chatbot = gr.Chatbot(label=f"当前模型:{LLM_MODEL}", elem_id="gpt-chatbot") - chatbot.style() + if LAYOUT == "TOP-DOWN": chatbot.style(height=CHATBOT_HEIGHT) history = gr.State([]) with gr_L2(scale=1, elem_id="gpt-panel"): with gr.Accordion("输入区", open=True, elem_id="input-panel") as area_input_primary: diff --git a/theme.py b/theme.py index b3aa07d..6e1de16 100644 --- a/theme.py +++ b/theme.py @@ -1,6 +1,6 @@ import gradio as gr from toolbox import get_conf -CODE_HIGHLIGHT, ADD_WAIFU = get_conf('CODE_HIGHLIGHT', 'ADD_WAIFU') +CODE_HIGHLIGHT, ADD_WAIFU, LAYOUT = get_conf('CODE_HIGHLIGHT', 'ADD_WAIFU', 'LAYOUT') # gradio可用颜色列表 # gr.themes.utils.colors.slate (石板色) # gr.themes.utils.colors.gray (灰色) @@ -82,59 +82,59 @@ def adjust_theme(): button_cancel_text_color_dark="white", ) - # 别忘了layout的区别 + # Layout = "LEFT-RIGHT" js = """ - + """ -function get_elements() { - const chatbot = document.querySelector('#gpt-chatbot > div.wrap.svelte-18telvq'); - const panel1 = document.querySelector('#input-panel'); - const panel2 = document.querySelector('#basic-panel'); - const panel3 = document.querySelector('#plugin-panel'); - const panel4 = document.querySelector('#interact-panel'); - const panel5 = document.querySelector('#input-panel2'); - const panel_active = document.querySelector('#state-panel'); - var panel_height_target = (20-panel_active.offsetHeight) + panel1.offsetHeight + panel2.offsetHeight + panel3.offsetHeight + panel4.offsetHeight + panel5.offsetHeight + 21; - var panel_height_target = parseInt(panel_height_target); - var chatbot_height = chatbot.style.height; - var chatbot_height = parseInt(chatbot_height); - return { panel_height_target, chatbot_height, chatbot }; -} - - - -""" + if LAYOUT=="TOP-DOWN": + js = "" + # 添加一个萌萌的看板娘 if ADD_WAIFU: js += """