优化界面显示
This commit is contained in:
@ -21,7 +21,7 @@ crazy_fns = get_crazy_functions()
|
|||||||
gr.Chatbot.postprocess = format_io
|
gr.Chatbot.postprocess = format_io
|
||||||
|
|
||||||
# 做一些外观色彩上的调整
|
# 做一些外观色彩上的调整
|
||||||
from theme import adjust_theme, advanced_css
|
from theme import adjust_theme, advanced_css, small_and_beautiful_theme
|
||||||
|
|
||||||
set_theme = adjust_theme()
|
set_theme = adjust_theme()
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ class ChatBot(ChatBotFrame):
|
|||||||
prompt_list, devs_document = get_conf('prompt_list', 'devs_document')
|
prompt_list, devs_document = get_conf('prompt_list', 'devs_document')
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
# self.cpopyBtn = gr.Button("复制回答", variant="secondary").style(size="sm")
|
# self.cpopyBtn = gr.Button("复制回答", variant="secondary").style(size="sm")
|
||||||
self.resetBtn = gr.Button("重置Chatbot", variant="secondary").style(size="sm")
|
self.resetBtn = gr.Button("重置Chatbot", variant="secondary", elem_id='empty_btn').style(size="sm")
|
||||||
self.stopBtn = gr.Button("停止", variant="stop").style(size="sm")
|
self.stopBtn = gr.Button("停止", variant="stop").style(size="sm")
|
||||||
with gr.Tab('Function'):
|
with gr.Tab('Function'):
|
||||||
with gr.Accordion("基础功能区", open=True) as self.area_basic_fn:
|
with gr.Accordion("基础功能区", open=True) as self.area_basic_fn:
|
||||||
@ -323,7 +323,9 @@ class ChatBot(ChatBotFrame):
|
|||||||
|
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
with gr.Blocks(title="Chatbot for KSO ", theme=set_theme, analytics_enabled=False, css=advanced_css) as demo:
|
with open("docs/assets/custom.css", "r", encoding="utf-8") as f:
|
||||||
|
customCSS = f.read()
|
||||||
|
with gr.Blocks(title="Chatbot for KSO ", theme=set_theme, analytics_enabled=False, css=customCSS) as demo:
|
||||||
# 绘制页面title
|
# 绘制页面title
|
||||||
self.draw_title()
|
self.draw_title()
|
||||||
# 绘制一个ROW,row会让底下的元素自动排成一行
|
# 绘制一个ROW,row会让底下的元素自动排成一行
|
||||||
|
|||||||
@ -8,6 +8,46 @@
|
|||||||
--message-bot-background-color-light: #FFFFFF;
|
--message-bot-background-color-light: #FFFFFF;
|
||||||
--message-bot-background-color-dark: #2C2C2C;
|
--message-bot-background-color-dark: #2C2C2C;
|
||||||
}
|
}
|
||||||
|
#debug_mes {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 1; /* 设置更高的 z-index 值 */
|
||||||
|
margin-bottom: 10px !important;
|
||||||
|
}
|
||||||
|
#chat_txt {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
overflow-y: auto !important;
|
||||||
|
z-index: 3;
|
||||||
|
flex-grow: 1; /* 自动填充剩余空间 */
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 35px !important;
|
||||||
|
}
|
||||||
|
#sm_btn {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: unset !important;
|
||||||
|
gap: 5px !important;
|
||||||
|
width: var(--size-full);
|
||||||
|
}
|
||||||
|
textarea {
|
||||||
|
resize: none;
|
||||||
|
height: 100%; /* 填充父元素的高度 */
|
||||||
|
}
|
||||||
|
#main_chatbot {
|
||||||
|
height: 75vh !important;
|
||||||
|
max-height: 75vh !important;
|
||||||
|
/* overflow: auto !important; */
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
#prompt_result{
|
||||||
|
height: 60vh !important;
|
||||||
|
max-height: 60vh !important;
|
||||||
|
}
|
||||||
|
|
||||||
#app_title {
|
#app_title {
|
||||||
font-weight: var(--prose-header-text-weight);
|
font-weight: var(--prose-header-text-weight);
|
||||||
@ -68,7 +108,10 @@ footer {
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 1s ease-in-out;
|
transition: opacity 1s ease-in-out;
|
||||||
}
|
}
|
||||||
|
[class *= "message"] {
|
||||||
|
gap: 7px !important;
|
||||||
|
border-radius: var(--radius-xl) !important
|
||||||
|
}
|
||||||
/* status_display */
|
/* status_display */
|
||||||
#status_display {
|
#status_display {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -86,10 +129,25 @@ footer {
|
|||||||
#status_display {
|
#status_display {
|
||||||
transition: all 0.6s;
|
transition: all 0.6s;
|
||||||
}
|
}
|
||||||
#chuanhu_chatbot {
|
#main_chatbot {
|
||||||
transition: height 0.3s ease;
|
transition: height 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wrap.svelte-18telvq.svelte-18telvq {
|
||||||
|
padding: var(--block-padding) !important;
|
||||||
|
height: 100% !important;
|
||||||
|
max-height: 95% !important;
|
||||||
|
overflow-y: auto !important;
|
||||||
|
}
|
||||||
|
.app.svelte-1mya07g.svelte-1mya07g {
|
||||||
|
max-width: 100%;
|
||||||
|
position: relative;
|
||||||
|
/* margin: auto; */
|
||||||
|
padding: var(--size-4);
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
/* usage_display */
|
/* usage_display */
|
||||||
.insert_block {
|
.insert_block {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -221,44 +279,32 @@ ol:not(.options), ul:not(.options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 亮色(默认) */
|
/* 亮色(默认) */
|
||||||
#chuanhu_chatbot {
|
#main_chatbot {
|
||||||
background-color: var(--chatbot-background-color-light) !important;
|
background-color: var(--chatbot-background-color-light) !important;
|
||||||
color: var(--chatbot-color-light) !important;
|
color: var(--chatbot-color-light) !important;
|
||||||
}
|
}
|
||||||
[data-testid = "bot"] {
|
|
||||||
background-color: var(--message-bot-background-color-light) !important;
|
|
||||||
}
|
|
||||||
[data-testid = "user"] {
|
|
||||||
background-color: var(--message-user-background-color-light) !important;
|
|
||||||
}
|
|
||||||
/* 暗色 */
|
/* 暗色 */
|
||||||
.dark #chuanhu_chatbot {
|
.dark #main_chatbot {
|
||||||
background-color: var(--chatbot-background-color-dark) !important;
|
background-color: var(--block-background-fill) !important;
|
||||||
color: var(--chatbot-color-dark) !important;
|
color: var(--chatbot-color-dark) !important;
|
||||||
}
|
}
|
||||||
.dark [data-testid = "bot"] {
|
|
||||||
background-color: var(--message-bot-background-color-dark) !important;
|
|
||||||
}
|
|
||||||
.dark [data-testid = "user"] {
|
|
||||||
background-color: var(--message-user-background-color-dark) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 屏幕宽度大于等于500px的设备 */
|
/* 屏幕宽度大于等于500px的设备 */
|
||||||
/* update on 2023.4.8: 高度的细致调整已写入JavaScript */
|
/* update on 2023.4.8: 高度的细致调整已写入JavaScript */
|
||||||
@media screen and (min-width: 500px) {
|
@media screen and (min-width: 500px) {
|
||||||
#chuanhu_chatbot {
|
#main_chatbot {
|
||||||
height: calc(100vh - 200px);
|
height: calc(100vh - 200px);
|
||||||
}
|
}
|
||||||
#chuanhu_chatbot .wrap {
|
#main_chatbot .wrap {
|
||||||
max-height: calc(100vh - 200px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
|
max-height: calc(100vh - 200px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 屏幕宽度小于500px的设备 */
|
/* 屏幕宽度小于500px的设备 */
|
||||||
@media screen and (max-width: 499px) {
|
@media screen and (max-width: 499px) {
|
||||||
#chuanhu_chatbot {
|
#main_chatbot {
|
||||||
height: calc(100vh - 140px);
|
height: calc(100vh - 140px);
|
||||||
}
|
}
|
||||||
#chuanhu_chatbot .wrap {
|
#main_chatbot .wrap {
|
||||||
max-height: calc(100vh - 140px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
|
max-height: calc(100vh - 140px - var(--line-sm)*1rem - 2*var(--block-label-margin) );
|
||||||
}
|
}
|
||||||
[data-testid = "bot"] {
|
[data-testid = "bot"] {
|
||||||
@ -268,8 +314,8 @@ ol:not(.options), ul:not(.options) {
|
|||||||
letter-spacing: -1px; font-size: 22px;
|
letter-spacing: -1px; font-size: 22px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#chuanhu_chatbot .wrap {
|
#main_chatbot .wrap {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden
|
||||||
}
|
}
|
||||||
/* 对话气泡 */
|
/* 对话气泡 */
|
||||||
.message {
|
.message {
|
||||||
@ -418,7 +464,7 @@ thead th {
|
|||||||
display: block;
|
display: block;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
background-color: hsla(0, 0%, 0%, 80%)!important;
|
background-color: hsla(0, 0%, 20%, 70%)!important;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 1.2em 1em 0em .5em;
|
padding: 1.2em 1em 0em .5em;
|
||||||
margin: 0.6em 2em 1em 0.2em;
|
margin: 0.6em 2em 1em 0.2em;
|
||||||
@ -437,72 +483,160 @@ button.copy-button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 代码高亮样式 */
|
/* 代码高亮样式 */
|
||||||
.highlight .hll { background-color: #49483e !important }
|
.codehilite .hll { background-color: #6e7681 }
|
||||||
.highlight .c { color: #75715e !important } /* Comment */
|
.codehilite .c { color: #8b949e; font-style: italic } /* Comment */
|
||||||
.highlight .err { color: #960050 !important; background-color: #1e0010 } /* Error */
|
.codehilite .err { color: #f85149 } /* Error */
|
||||||
.highlight .k { color: #66d9ef !important} /* Keyword */
|
.codehilite .esc { color: #c9d1d9 } /* Escape */
|
||||||
.highlight .l { color: #ae81ff !important} /* Literal */
|
.codehilite .g { color: #c9d1d9 } /* Generic */
|
||||||
.highlight .n { color: #f8f8f2 !important} /* Name */
|
.codehilite .k { color: #ff7b72 } /* Keyword */
|
||||||
.highlight .o { color: #f92672 !important} /* Operator */
|
.codehilite .l { color: #a5d6ff } /* Literal */
|
||||||
.highlight .p { color: #f8f8f2 !important} /* Punctuation */
|
.codehilite .n { color: #c9d1d9 } /* Name */
|
||||||
.highlight .ch { color: #75715e !important} /* Comment.Hashbang */
|
.codehilite .o { color: #ff7b72; font-weight: bold } /* Operator */
|
||||||
.highlight .cm { color: #75715e !important} /* Comment.Multiline */
|
.codehilite .x { color: #c9d1d9 } /* Other */
|
||||||
.highlight .cp { color: #75715e !important} /* Comment.Preproc */
|
.codehilite .p { color: #c9d1d9 } /* Punctuation */
|
||||||
.highlight .cpf { color: #75715e !important} /* Comment.PreprocFile */
|
.codehilite .ch { color: #8b949e; font-style: italic } /* Comment.Hashbang */
|
||||||
.highlight .c1 { color: #75715e !important} /* Comment.Single */
|
.codehilite .cm { color: #8b949e; font-style: italic } /* Comment.Multiline */
|
||||||
.highlight .cs { color: #75715e !important} /* Comment.Special */
|
.codehilite .cp { color: #8b949e; font-weight: bold; font-style: italic } /* Comment.Preproc */
|
||||||
.highlight .gd { color: #f92672 !important} /* Generic.Deleted */
|
.codehilite .cpf { color: #8b949e; font-style: italic } /* Comment.PreprocFile */
|
||||||
.highlight .ge { font-style: italic !important} /* Generic.Emph */
|
.codehilite .c1 { color: #8b949e; font-style: italic } /* Comment.Single */
|
||||||
.highlight .gi { color: #a6e22e !important} /* Generic.Inserted */
|
.codehilite .cs { color: #8b949e; font-weight: bold; font-style: italic } /* Comment.Special */
|
||||||
.highlight .gs { font-weight: bold !important} /* Generic.Strong */
|
.codehilite .gd { color: #ffa198; background-color: #490202 } /* Generic.Deleted */
|
||||||
.highlight .gu { color: #75715e !important} /* Generic.Subheading */
|
.codehilite .ge { color: #c9d1d9; font-style: italic } /* Generic.Emph */
|
||||||
.highlight .kc { color: #66d9ef !important} /* Keyword.Constant */
|
.codehilite .gr { color: #ffa198 } /* Generic.Error */
|
||||||
.highlight .kd { color: #66d9ef !important} /* Keyword.Declaration */
|
.codehilite .gh { color: #79c0ff; font-weight: bold } /* Generic.Heading */
|
||||||
.highlight .kn { color: #f92672 !important} /* Keyword.Namespace */
|
.codehilite .gi { color: #56d364; background-color: #0f5323 } /* Generic.Inserted */
|
||||||
.highlight .kp { color: #66d9ef !important} /* Keyword.Pseudo */
|
.codehilite .go { color: #8b949e } /* Generic.Output */
|
||||||
.highlight .kr { color: #66d9ef !important} /* Keyword.Reserved */
|
.codehilite .gp { color: #8b949e } /* Generic.Prompt */
|
||||||
.highlight .kt { color: #66d9ef !important} /* Keyword.Type */
|
.codehilite .gs { color: #c9d1d9; font-weight: bold } /* Generic.Strong */
|
||||||
.highlight .ld { color: #e6db74 !important} /* Literal.Date */
|
.codehilite .gu { color: #79c0ff } /* Generic.Subheading */
|
||||||
.highlight .m { color: #ae81ff !important} /* Literal.Number */
|
.codehilite .gt { color: #ff7b72 } /* Generic.Traceback */
|
||||||
.highlight .s { color: #e6db74 !important} /* Literal.String */
|
.codehilite .g-Underline { color: #c9d1d9; text-decoration: underline } /* Generic.Underline */
|
||||||
.highlight .na { color: #a6e22e !important} /* Name.Attribute */
|
.codehilite .kc { color: #79c0ff } /* Keyword.Constant */
|
||||||
.highlight .nb { color: #f8f8f2 !important} /* Name.Builtin */
|
.codehilite .kd { color: #ff7b72 } /* Keyword.Declaration */
|
||||||
.highlight .nc { color: #a6e22e !important} /* Name.Class */
|
.codehilite .kn { color: #ff7b72 } /* Keyword.Namespace */
|
||||||
.highlight .no { color: #66d9ef !important} /* Name.Constant */
|
.codehilite .kp { color: #79c0ff } /* Keyword.Pseudo */
|
||||||
.highlight .nd { color: #a6e22e !important} /* Name.Decorator */
|
.codehilite .kr { color: #ff7b72 } /* Keyword.Reserved */
|
||||||
.highlight .ni { color: #f8f8f2 !important} /* Name.Entity */
|
.codehilite .kt { color: #ff7b72 } /* Keyword.Type */
|
||||||
.highlight .ne { color: #a6e22e !important} /* Name.Exception */
|
.codehilite .ld { color: #79c0ff } /* Literal.Date */
|
||||||
.highlight .nf { color: #a6e22e !important} /* Name.Function */
|
.codehilite .m { color: #a5d6ff } /* Literal.Number */
|
||||||
.highlight .nl { color: #f8f8f2 !important} /* Name.Label */
|
.codehilite .s { color: #a5d6ff } /* Literal.String */
|
||||||
.highlight .nn { color: #f8f8f2 !important} /* Name.Namespace */
|
.codehilite .na { color: #c9d1d9 } /* Name.Attribute */
|
||||||
.highlight .nx { color: #a6e22e !important} /* Name.Other */
|
.codehilite .nb { color: #c9d1d9 } /* Name.Builtin */
|
||||||
.highlight .py { color: #f8f8f2 !important} /* Name.Property */
|
.codehilite .nc { color: #f0883e; font-weight: bold } /* Name.Class */
|
||||||
.highlight .nt { color: #f92672 !important} /* Name.Tag */
|
.codehilite .no { color: #79c0ff; font-weight: bold } /* Name.Constant */
|
||||||
.highlight .nv { color: #f8f8f2 !important} /* Name.Variable */
|
.codehilite .nd { color: #d2a8ff; font-weight: bold } /* Name.Decorator */
|
||||||
.highlight .ow { color: #f92672 !important} /* Operator.Word */
|
.codehilite .ni { color: #ffa657 } /* Name.Entity */
|
||||||
.highlight .w { color: #f8f8f2 !important} /* Text.Whitespace */
|
.codehilite .ne { color: #f0883e; font-weight: bold } /* Name.Exception */
|
||||||
.highlight .mb { color: #ae81ff !important} /* Literal.Number.Bin */
|
.codehilite .nf { color: #d2a8ff; font-weight: bold } /* Name.Function */
|
||||||
.highlight .mf { color: #ae81ff !important} /* Literal.Number.Float */
|
.codehilite .nl { color: #79c0ff; font-weight: bold } /* Name.Label */
|
||||||
.highlight .mh { color: #ae81ff !important} /* Literal.Number.Hex */
|
.codehilite .nn { color: #ff7b72 } /* Name.Namespace */
|
||||||
.highlight .mi { color: #ae81ff !important} /* Literal.Number.Integer */
|
.codehilite .nx { color: #c9d1d9 } /* Name.Other */
|
||||||
.highlight .mo { color: #ae81ff !important} /* Literal.Number.Oct */
|
.codehilite .py { color: #79c0ff } /* Name.Property */
|
||||||
.highlight .sa { color: #e6db74 !important} /* Literal.String.Affix */
|
.codehilite .nt { color: #7ee787 } /* Name.Tag */
|
||||||
.highlight .sb { color: #e6db74 !important} /* Literal.String.Backtick */
|
.codehilite .nv { color: #79c0ff } /* Name.Variable */
|
||||||
.highlight .sc { color: #e6db74 !important} /* Literal.String.Char */
|
.codehilite .ow { color: #ff7b72; font-weight: bold } /* Operator.Word */
|
||||||
.highlight .dl { color: #e6db74 !important} /* Literal.String.Delimiter */
|
.codehilite .pm { color: #c9d1d9 } /* Punctuation.Marker */
|
||||||
.highlight .sd { color: #e6db74 !important} /* Literal.String.Doc */
|
.codehilite .w { color: #6e7681 } /* Text.Whitespace */
|
||||||
.highlight .s2 { color: #e6db74 !important} /* Literal.String.Double */
|
.codehilite .mb { color: #a5d6ff } /* Literal.Number.Bin */
|
||||||
.highlight .se { color: #ae81ff !important} /* Literal.String.Escape */
|
.codehilite .mf { color: #a5d6ff } /* Literal.Number.Float */
|
||||||
.highlight .sh { color: #e6db74 !important} /* Literal.String.Heredoc */
|
.codehilite .mh { color: #a5d6ff } /* Literal.Number.Hex */
|
||||||
.highlight .si { color: #e6db74 !important} /* Literal.String.Interpol */
|
.codehilite .mi { color: #a5d6ff } /* Literal.Number.Integer */
|
||||||
.highlight .sx { color: #e6db74 !important} /* Literal.String.Other */
|
.codehilite .mo { color: #a5d6ff } /* Literal.Number.Oct */
|
||||||
.highlight .sr { color: #e6db74 !important} /* Literal.String.Regex */
|
.codehilite .sa { color: #79c0ff } /* Literal.String.Affix */
|
||||||
.highlight .s1 { color: #e6db74 !important} /* Literal.String.Single */
|
.codehilite .sb { color: #a5d6ff } /* Literal.String.Backtick */
|
||||||
.highlight .ss { color: #e6db74 !important} /* Literal.String.Symbol */
|
.codehilite .sc { color: #a5d6ff } /* Literal.String.Char */
|
||||||
.highlight .bp { color: #f8f8f2 !important} /* Name.Builtin.Pseudo */
|
.codehilite .dl { color: #79c0ff } /* Literal.String.Delimiter */
|
||||||
.highlight .fm { color: #a6e22e !important} /* Name.Function.Magic */
|
.codehilite .sd { color: #a5d6ff } /* Literal.String.Doc */
|
||||||
.highlight .vc { color: #f8f8f2 !important} /* Name.Variable.Class */
|
.codehilite .s2 { color: #a5d6ff } /* Literal.String.Double */
|
||||||
.highlight .vg { color: #f8f8f2 !important} /* Name.Variable.Global */
|
.codehilite .se { color: #79c0ff } /* Literal.String.Escape */
|
||||||
.highlight .vi { color: #f8f8f2 !important} /* Name.Variable.Instance */
|
.codehilite .sh { color: #79c0ff } /* Literal.String.Heredoc */
|
||||||
.highlight .vm { color: #f8f8f2 !important} /* Name.Variable.Magic */
|
.codehilite .si { color: #a5d6ff } /* Literal.String.Interpol */
|
||||||
.highlight .il { color: #ae81ff !important} /* Literal.Number.Integer.Long */
|
.codehilite .sx { color: #a5d6ff } /* Literal.String.Other */
|
||||||
|
.codehilite .sr { color: #79c0ff } /* Literal.String.Regex */
|
||||||
|
.codehilite .s1 { color: #a5d6ff } /* Literal.String.Single */
|
||||||
|
.codehilite .ss { color: #a5d6ff } /* Literal.String.Symbol */
|
||||||
|
.codehilite .bp { color: #c9d1d9 } /* Name.Builtin.Pseudo */
|
||||||
|
.codehilite .fm { color: #d2a8ff; font-weight: bold } /* Name.Function.Magic */
|
||||||
|
.codehilite .vc { color: #79c0ff } /* Name.Variable.Class */
|
||||||
|
.codehilite .vg { color: #79c0ff } /* Name.Variable.Global */
|
||||||
|
.codehilite .vi { color: #79c0ff } /* Name.Variable.Instance */
|
||||||
|
.codehilite .vm { color: #79c0ff } /* Name.Variable.Magic */
|
||||||
|
.codehilite .il { color: #a5d6ff } /* Literal.Number.Integer.Long */
|
||||||
|
|
||||||
|
.dark .codehilite .hll { background-color: #2C3B41 }
|
||||||
|
.dark .codehilite .c { color: #79d618; font-style: italic } /* Comment */
|
||||||
|
.dark .codehilite .err { color: #FF5370 } /* Error */
|
||||||
|
.dark .codehilite .esc { color: #89DDFF } /* Escape */
|
||||||
|
.dark .codehilite .g { color: #EEFFFF } /* Generic */
|
||||||
|
.dark .codehilite .k { color: #BB80B3 } /* Keyword */
|
||||||
|
.dark .codehilite .l { color: #C3E88D } /* Literal */
|
||||||
|
.dark .codehilite .n { color: #EEFFFF } /* Name */
|
||||||
|
.dark .codehilite .o { color: #89DDFF } /* Operator */
|
||||||
|
.dark .codehilite .p { color: #89DDFF } /* Punctuation */
|
||||||
|
.dark .codehilite .ch { color: #79d618; font-style: italic } /* Comment.Hashbang */
|
||||||
|
.dark .codehilite .cm { color: #79d618; font-style: italic } /* Comment.Multiline */
|
||||||
|
.dark .codehilite .cp { color: #79d618; font-style: italic } /* Comment.Preproc */
|
||||||
|
.dark .codehilite .cpf { color: #79d618; font-style: italic } /* Comment.PreprocFile */
|
||||||
|
.dark .codehilite .c1 { color: #79d618; font-style: italic } /* Comment.Single */
|
||||||
|
.dark .codehilite .cs { color: #79d618; font-style: italic } /* Comment.Special */
|
||||||
|
.dark .codehilite .gd { color: #FF5370 } /* Generic.Deleted */
|
||||||
|
.dark .codehilite .ge { color: #89DDFF } /* Generic.Emph */
|
||||||
|
.dark .codehilite .gr { color: #FF5370 } /* Generic.Error */
|
||||||
|
.dark .codehilite .gh { color: #C3E88D } /* Generic.Heading */
|
||||||
|
.dark .codehilite .gi { color: #C3E88D } /* Generic.Inserted */
|
||||||
|
.dark .codehilite .go { color: #79d618 } /* Generic.Output */
|
||||||
|
.dark .codehilite .gp { color: #FFCB6B } /* Generic.Prompt */
|
||||||
|
.dark .codehilite .gs { color: #FF5370 } /* Generic.Strong */
|
||||||
|
.dark .codehilite .gu { color: #89DDFF } /* Generic.Subheading */
|
||||||
|
.dark .codehilite .gt { color: #FF5370 } /* Generic.Traceback */
|
||||||
|
.dark .codehilite .kc { color: #89DDFF } /* Keyword.Constant */
|
||||||
|
.dark .codehilite .kd { color: #BB80B3 } /* Keyword.Declaration */
|
||||||
|
.dark .codehilite .kn { color: #89DDFF; font-style: italic } /* Keyword.Namespace */
|
||||||
|
.dark .codehilite .kp { color: #89DDFF } /* Keyword.Pseudo */
|
||||||
|
.dark .codehilite .kr { color: #BB80B3 } /* Keyword.Reserved */
|
||||||
|
.dark .codehilite .kt { color: #BB80B3 } /* Keyword.Type */
|
||||||
|
.dark .codehilite .ld { color: #C3E88D } /* Literal.Date */
|
||||||
|
.dark .codehilite .m { color: #F78C6C } /* Literal.Number */
|
||||||
|
.dark .codehilite .s { color: #C3E88D } /* Literal.String */
|
||||||
|
.dark .codehilite .na { color: #BB80B3 } /* Name.Attribute */
|
||||||
|
.dark .codehilite .nb { color: #82AAFF } /* Name.Builtin */
|
||||||
|
.dark .codehilite .nc { color: #FFCB6B } /* Name.Class */
|
||||||
|
.dark .codehilite .no { color: #EEFFFF } /* Name.Constant */
|
||||||
|
.dark .codehilite .nd { color: #82AAFF } /* Name.Decorator */
|
||||||
|
.dark .codehilite .ni { color: #89DDFF } /* Name.Entity */
|
||||||
|
.dark .codehilite .ne { color: #FFCB6B } /* Name.Exception */
|
||||||
|
.dark .codehilite .nf { color: #82AAFF } /* Name.Function */
|
||||||
|
.dark .codehilite .nl { color: #82AAFF } /* Name.Label */
|
||||||
|
.dark .codehilite .nn { color: #FFCB6B } /* Name.Namespace */
|
||||||
|
.dark .codehilite .nx { color: #EEFFFF } /* Name.Other */
|
||||||
|
.dark .codehilite .py { color: #FFCB6B } /* Name.Property */
|
||||||
|
.dark .codehilite .nt { color: #FF5370 } /* Name.Tag */
|
||||||
|
.dark .codehilite .nv { color: #89DDFF } /* Name.Variable */
|
||||||
|
.dark .codehilite .ow { color: #89DDFF; font-style: italic } /* Operator.Word */
|
||||||
|
.dark .codehilite .pm { color: #89DDFF } /* Punctuation.Marker */
|
||||||
|
.dark .codehilite .w { color: #EEFFFF } /* Text.Whitespace */
|
||||||
|
.dark .codehilite .mb { color: #F78C6C } /* Literal.Number.Bin */
|
||||||
|
.dark .codehilite .mf { color: #F78C6C } /* Literal.Number.Float */
|
||||||
|
.dark .codehilite .mh { color: #F78C6C } /* Literal.Number.Hex */
|
||||||
|
.dark .codehilite .mi { color: #F78C6C } /* Literal.Number.Integer */
|
||||||
|
.dark .codehilite .mo { color: #F78C6C } /* Literal.Number.Oct */
|
||||||
|
.dark .codehilite .sa { color: #BB80B3 } /* Literal.String.Affix */
|
||||||
|
.dark .codehilite .sb { color: #C3E88D } /* Literal.String.Backtick */
|
||||||
|
.dark .codehilite .sc { color: #C3E88D } /* Literal.String.Char */
|
||||||
|
.dark .codehilite .dl { color: #EEFFFF } /* Literal.String.Delimiter */
|
||||||
|
.dark .codehilite .sd { color: #79d618; font-style: italic } /* Literal.String.Doc */
|
||||||
|
.dark .codehilite .s2 { color: #C3E88D } /* Literal.String.Double */
|
||||||
|
.dark .codehilite .se { color: #EEFFFF } /* Literal.String.Escape */
|
||||||
|
.dark .codehilite .sh { color: #C3E88D } /* Literal.String.Heredoc */
|
||||||
|
.dark .codehilite .si { color: #89DDFF } /* Literal.String.Interpol */
|
||||||
|
.dark .codehilite .sx { color: #C3E88D } /* Literal.String.Other */
|
||||||
|
.dark .codehilite .sr { color: #89DDFF } /* Literal.String.Regex */
|
||||||
|
.dark .codehilite .s1 { color: #C3E88D } /* Literal.String.Single */
|
||||||
|
.dark .codehilite .ss { color: #89DDFF } /* Literal.String.Symbol */
|
||||||
|
.dark .codehilite .bp { color: #89DDFF } /* Name.Builtin.Pseudo */
|
||||||
|
.dark .codehilite .fm { color: #82AAFF } /* Name.Function.Magic */
|
||||||
|
.dark .codehilite .vc { color: #89DDFF } /* Name.Variable.Class */
|
||||||
|
.dark .codehilite .vg { color: #89DDFF } /* Name.Variable.Global */
|
||||||
|
.dark .codehilite .vi { color: #89DDFF } /* Name.Variable.Instance */
|
||||||
|
.dark .codehilite .vm { color: #82AAFF } /* Name.Variable.Magic */
|
||||||
|
.dark .codehilite .il { color: #F78C6C } /* Literal.Number.Integer.Long */
|
||||||
|
|||||||
47
theme.py
47
theme.py
@ -25,6 +25,28 @@ CODE_HIGHLIGHT, ADD_WAIFU = get_conf('CODE_HIGHLIGHT', 'ADD_WAIFU')
|
|||||||
# gr.themes.utils.colors.pink (粉红色)
|
# gr.themes.utils.colors.pink (粉红色)
|
||||||
# gr.themes.utils.colors.rose (玫瑰色)
|
# gr.themes.utils.colors.rose (玫瑰色)
|
||||||
|
|
||||||
|
small_and_beautiful_theme = gr.themes.Soft(
|
||||||
|
).set(
|
||||||
|
# button_primary_background_fill="*primary_500",
|
||||||
|
button_primary_background_fill_dark="*primary_600",
|
||||||
|
# button_primary_background_fill_hover="*primary_400",
|
||||||
|
# button_primary_border_color="*primary_500",
|
||||||
|
button_primary_border_color_dark="*primary_600",
|
||||||
|
button_primary_text_color="wihte",
|
||||||
|
button_primary_text_color_dark="white",
|
||||||
|
button_secondary_background_fill="*neutral_100",
|
||||||
|
button_secondary_background_fill_hover="*neutral_50",
|
||||||
|
button_secondary_background_fill_dark="*neutral_900",
|
||||||
|
button_secondary_text_color="*neutral_800",
|
||||||
|
button_secondary_text_color_dark="white",
|
||||||
|
# background_fill_primary="#F7F7F7",
|
||||||
|
# background_fill_primary_dark="#1F1F1F",
|
||||||
|
# block_title_text_color="*primary_500",
|
||||||
|
block_title_background_fill_dark="*primary_900",
|
||||||
|
block_label_background_fill_dark="*primary_900",
|
||||||
|
input_background_fill="#F6F6F6",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def adjust_theme():
|
def adjust_theme():
|
||||||
|
|
||||||
@ -38,6 +60,18 @@ def adjust_theme():
|
|||||||
font_mono=["ui-monospace", "Consolas", "monospace", gr.themes.utils.fonts.GoogleFont("IBM Plex Mono")])
|
font_mono=["ui-monospace", "Consolas", "monospace", gr.themes.utils.fonts.GoogleFont("IBM Plex Mono")])
|
||||||
set_theme.set(
|
set_theme.set(
|
||||||
# Colors
|
# Colors
|
||||||
|
button_primary_background_fill_dark="*primary_600",
|
||||||
|
button_primary_border_color_dark="*primary_600",
|
||||||
|
button_primary_text_color="wihte",
|
||||||
|
button_primary_text_color_dark="white",
|
||||||
|
button_secondary_background_fill="*neutral_100",
|
||||||
|
button_secondary_background_fill_hover="*neutral_50",
|
||||||
|
button_secondary_background_fill_dark="*neutral_900",
|
||||||
|
button_secondary_text_color="*neutral_800",
|
||||||
|
button_secondary_text_color_dark="white",
|
||||||
|
block_title_background_fill_dark="*neutral_900",
|
||||||
|
block_label_background_fill_dark="*neutral_900",
|
||||||
|
input_background_fill="#F6F6F6",
|
||||||
input_background_fill_dark="*neutral_800",
|
input_background_fill_dark="*neutral_800",
|
||||||
# Transition
|
# Transition
|
||||||
button_transition="none",
|
button_transition="none",
|
||||||
@ -53,7 +87,7 @@ def adjust_theme():
|
|||||||
form_gap_width="1px",
|
form_gap_width="1px",
|
||||||
# Button borders
|
# Button borders
|
||||||
input_border_width="1px",
|
input_border_width="1px",
|
||||||
input_background_fill="white",
|
##### input_background_fill="white",
|
||||||
# Gradients
|
# Gradients
|
||||||
stat_background_fill="linear-gradient(to right, *primary_400, *primary_200)",
|
stat_background_fill="linear-gradient(to right, *primary_400, *primary_200)",
|
||||||
stat_background_fill_dark="linear-gradient(to right, *primary_400, *primary_600)",
|
stat_background_fill_dark="linear-gradient(to right, *primary_400, *primary_600)",
|
||||||
@ -64,13 +98,13 @@ def adjust_theme():
|
|||||||
checkbox_label_background_fill_hover="linear-gradient(to top, *neutral_100, white)",
|
checkbox_label_background_fill_hover="linear-gradient(to top, *neutral_100, white)",
|
||||||
checkbox_label_background_fill_hover_dark="linear-gradient(to top, *neutral_900, *neutral_800)",
|
checkbox_label_background_fill_hover_dark="linear-gradient(to top, *neutral_900, *neutral_800)",
|
||||||
button_primary_background_fill="linear-gradient(to bottom right, *primary_100, *primary_300)",
|
button_primary_background_fill="linear-gradient(to bottom right, *primary_100, *primary_300)",
|
||||||
button_primary_background_fill_dark="linear-gradient(to bottom right, *primary_500, *primary_600)",
|
##### button_primary_background_fill_dark="linear-gradient(to bottom right, *primary_500, *primary_600)",
|
||||||
button_primary_background_fill_hover="linear-gradient(to bottom right, *primary_100, *primary_200)",
|
button_primary_background_fill_hover="linear-gradient(to bottom right, *primary_100, *primary_200)",
|
||||||
button_primary_background_fill_hover_dark="linear-gradient(to bottom right, *primary_500, *primary_500)",
|
button_primary_background_fill_hover_dark="linear-gradient(to bottom right, *primary_500, *primary_500)",
|
||||||
button_primary_border_color_dark="*primary_500",
|
##### button_primary_border_color_dark="*primary_500",
|
||||||
button_secondary_background_fill="linear-gradient(to bottom right, *neutral_100, *neutral_200)",
|
##### button_secondary_background_fill="linear-gradient(to bottom right, *neutral_100, *neutral_200)",
|
||||||
button_secondary_background_fill_dark="linear-gradient(to bottom right, *neutral_600, *neutral_700)",
|
##### button_secondary_background_fill_dark="linear-gradient(to bottom right, *neutral_600, *neutral_700)",
|
||||||
button_secondary_background_fill_hover="linear-gradient(to bottom right, *neutral_100, *neutral_100)",
|
##### button_secondary_background_fill_hover="linear-gradient(to bottom right, *neutral_100, *neutral_100)",
|
||||||
button_secondary_background_fill_hover_dark="linear-gradient(to bottom right, *neutral_600, *neutral_600)",
|
button_secondary_background_fill_hover_dark="linear-gradient(to bottom right, *neutral_600, *neutral_600)",
|
||||||
button_cancel_background_fill=f"linear-gradient(to bottom right, {color_er.c100}, {color_er.c200})",
|
button_cancel_background_fill=f"linear-gradient(to bottom right, {color_er.c100}, {color_er.c200})",
|
||||||
button_cancel_background_fill_dark=f"linear-gradient(to bottom right, {color_er.c600}, {color_er.c700})",
|
button_cancel_background_fill_dark=f"linear-gradient(to bottom right, {color_er.c600}, {color_er.c700})",
|
||||||
@ -81,7 +115,6 @@ def adjust_theme():
|
|||||||
button_cancel_text_color=color_er.c600,
|
button_cancel_text_color=color_er.c600,
|
||||||
button_cancel_text_color_dark="white",
|
button_cancel_text_color_dark="white",
|
||||||
)
|
)
|
||||||
|
|
||||||
# 添加一个萌萌的看板娘
|
# 添加一个萌萌的看板娘
|
||||||
if ADD_WAIFU:
|
if ADD_WAIFU:
|
||||||
js = """
|
js = """
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import time
|
|||||||
import glob
|
import glob
|
||||||
import sys
|
import sys
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
import html
|
||||||
############################### 插件输入输出接驳区 #######################################
|
############################### 插件输入输出接驳区 #######################################
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -348,7 +349,8 @@ def markdown_convertion(txt):
|
|||||||
# cat them together
|
# cat them together
|
||||||
return pre + convert_stage_2_1 + f'{split}' + convert_stage_2_2 + suf
|
return pre + convert_stage_2_1 + f'{split}' + convert_stage_2_2 + suf
|
||||||
else:
|
else:
|
||||||
return pre + markdown.markdown(txt, extensions=['fenced_code', 'codehilite', 'tables', 'sane_lists']) + suf
|
context = markdown.markdown(txt, extensions=['fenced_code', 'codehilite', 'tables', 'sane_lists'])
|
||||||
|
return pre + context + suf
|
||||||
|
|
||||||
|
|
||||||
def close_up_code_segment_during_stream(gpt_reply):
|
def close_up_code_segment_during_stream(gpt_reply):
|
||||||
|
|||||||
Reference in New Issue
Block a user