适配TOP-DOWN布局
This commit is contained in:
2
main.py
2
main.py
@ -58,7 +58,7 @@ def main():
|
|||||||
with gr_L1():
|
with gr_L1():
|
||||||
with gr_L2(scale=2, elem_id="gpt-chat"):
|
with gr_L2(scale=2, elem_id="gpt-chat"):
|
||||||
chatbot = gr.Chatbot(label=f"当前模型:{LLM_MODEL}", elem_id="gpt-chatbot")
|
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([])
|
history = gr.State([])
|
||||||
with gr_L2(scale=1, elem_id="gpt-panel"):
|
with gr_L2(scale=1, elem_id="gpt-panel"):
|
||||||
with gr.Accordion("输入区", open=True, elem_id="input-panel") as area_input_primary:
|
with gr.Accordion("输入区", open=True, elem_id="input-panel") as area_input_primary:
|
||||||
|
|||||||
12
theme.py
12
theme.py
@ -1,6 +1,6 @@
|
|||||||
import gradio as gr
|
import gradio as gr
|
||||||
from toolbox import get_conf
|
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可用颜色列表
|
# gradio可用颜色列表
|
||||||
# gr.themes.utils.colors.slate (石板色)
|
# gr.themes.utils.colors.slate (石板色)
|
||||||
# gr.themes.utils.colors.gray (灰色)
|
# gr.themes.utils.colors.gray (灰色)
|
||||||
@ -82,12 +82,10 @@ def adjust_theme():
|
|||||||
button_cancel_text_color_dark="white",
|
button_cancel_text_color_dark="white",
|
||||||
)
|
)
|
||||||
|
|
||||||
# 别忘了layout的区别
|
# Layout = "LEFT-RIGHT"
|
||||||
js = """
|
js = """
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function ChatBotHeight() {
|
function ChatBotHeight() {
|
||||||
|
|
||||||
function update_height(){
|
function update_height(){
|
||||||
var { panel_height_target, chatbot_height, chatbot } = get_elements();
|
var { panel_height_target, chatbot_height, chatbot } = get_elements();
|
||||||
if (panel_height_target!=chatbot_height)
|
if (panel_height_target!=chatbot_height)
|
||||||
@ -131,10 +129,12 @@ function get_elements() {
|
|||||||
var chatbot_height = parseInt(chatbot_height);
|
var chatbot_height = parseInt(chatbot_height);
|
||||||
return { panel_height_target, chatbot_height, chatbot };
|
return { panel_height_target, chatbot_height, chatbot };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if LAYOUT=="TOP-DOWN":
|
||||||
|
js = ""
|
||||||
|
|
||||||
# 添加一个萌萌的看板娘
|
# 添加一个萌萌的看板娘
|
||||||
if ADD_WAIFU:
|
if ADD_WAIFU:
|
||||||
js += """
|
js += """
|
||||||
|
|||||||
Reference in New Issue
Block a user