解决状态栏跳动的问题
This commit is contained in:
2
main.py
2
main.py
@ -71,7 +71,7 @@ def main():
|
|||||||
stopBtn = gr.Button("停止", variant="secondary"); stopBtn.style(size="sm")
|
stopBtn = gr.Button("停止", variant="secondary"); stopBtn.style(size="sm")
|
||||||
clearBtn = gr.Button("清除", variant="secondary", visible=False); clearBtn.style(size="sm")
|
clearBtn = gr.Button("清除", variant="secondary", visible=False); clearBtn.style(size="sm")
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
status = gr.Markdown(f"Tip: 按Enter提交, 按Shift+Enter换行。当前模型: {LLM_MODEL} \n {proxy_info}")
|
status = gr.Markdown(f"Tip: 按Enter提交, 按Shift+Enter换行。当前模型: {LLM_MODEL} \n {proxy_info}", elem_id="state-panel")
|
||||||
with gr.Accordion("基础功能区", open=True, elem_id="basic-panel") as area_basic_fn:
|
with gr.Accordion("基础功能区", open=True, elem_id="basic-panel") as area_basic_fn:
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
for k in functional:
|
for k in functional:
|
||||||
|
|||||||
39
theme.py
39
theme.py
@ -87,17 +87,9 @@ def adjust_theme():
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
function ChatBotHeight() {
|
function ChatBotHeight() {
|
||||||
|
|
||||||
function update_height(){
|
function update_height(){
|
||||||
const chatbot = document.querySelector('#gpt-chatbot > div.wrap.svelte-18telvq');
|
var { panel_height_target, chatbot_height, chatbot } = get_elements();
|
||||||
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');
|
|
||||||
var panel_height_target = 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);
|
|
||||||
if (panel_height_target!=chatbot_height)
|
if (panel_height_target!=chatbot_height)
|
||||||
{
|
{
|
||||||
var pixelString = panel_height_target.toString() + 'px';
|
var pixelString = panel_height_target.toString() + 'px';
|
||||||
@ -106,16 +98,7 @@ function ChatBotHeight() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_height_slow(){
|
function update_height_slow(){
|
||||||
const chatbot = document.querySelector('#gpt-chatbot > div.wrap.svelte-18telvq');
|
var { panel_height_target, chatbot_height, chatbot } = get_elements();
|
||||||
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');
|
|
||||||
var panel_height_target = 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);
|
|
||||||
if (panel_height_target!=chatbot_height)
|
if (panel_height_target!=chatbot_height)
|
||||||
{
|
{
|
||||||
new_panel_height = (panel_height_target - chatbot_height)*0.5 + chatbot_height;
|
new_panel_height = (panel_height_target - chatbot_height)*0.5 + chatbot_height;
|
||||||
@ -134,6 +117,22 @@ function ChatBotHeight() {
|
|||||||
}, 50); // 每100毫秒执行一次
|
}, 50); // 每100毫秒执行一次
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
"""
|
"""
|
||||||
# 添加一个萌萌的看板娘
|
# 添加一个萌萌的看板娘
|
||||||
|
|||||||
Reference in New Issue
Block a user