Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
·
a294e14
1
Parent(s):
0c0edf5
WIP: 重写侧边栏样式与开关逻辑
Browse files- ChuanhuChatbot.py +49 -49
- web_assets/javascript/ChuanhuChat.js +4 -0
- web_assets/javascript/webui.js +117 -85
- web_assets/stylesheet/ChuanhuChat.css +35 -25
- web_assets/stylesheet/override-gradio.css +9 -0
ChuanhuChatbot.py
CHANGED
@@ -96,7 +96,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
96 |
gr.HTML(get_html("func_nav.html"))
|
97 |
|
98 |
with gr.Column(elem_id="chuanhu-area", scale=5):
|
99 |
-
with gr.Column(
|
100 |
with gr.Row():
|
101 |
chatbot = gr.Chatbot(label="Chuanhu Chat", elem_id="chuanhu-chatbot", latex_delimiters=latex_delimiters_set, height=700, avatar_images=[config.user_avatar, config.bot_avatar])
|
102 |
with gr.Row():
|
@@ -126,54 +126,54 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
126 |
with gr.Column(min_width=20, scale=1):
|
127 |
dislikeBtn = gr.Button(i18n("👎"))
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
|
178 |
with gr.Row(elem_id="popup-wrapper"):
|
179 |
with gr.Box(elem_id="chuanhu-popup"):
|
|
|
96 |
gr.HTML(get_html("func_nav.html"))
|
97 |
|
98 |
with gr.Column(elem_id="chuanhu-area", scale=5):
|
99 |
+
with gr.Column(elem_id="chatbot-area"):
|
100 |
with gr.Row():
|
101 |
chatbot = gr.Chatbot(label="Chuanhu Chat", elem_id="chuanhu-chatbot", latex_delimiters=latex_delimiters_set, height=700, avatar_images=[config.user_avatar, config.bot_avatar])
|
102 |
with gr.Row():
|
|
|
126 |
with gr.Column(min_width=20, scale=1):
|
127 |
dislikeBtn = gr.Button(i18n("👎"))
|
128 |
|
129 |
+
with gr.Column(elem_id="toolbox-area", scale=1):
|
130 |
+
with gr.Box(elem_id="chuanhu-toolbox"): # For CSS setting, there is an extra box. Don't remove it.
|
131 |
+
with gr.Row():
|
132 |
+
gr.Markdown("## 🛠️ Toolbox")
|
133 |
+
gr.HTML(get_html("close_btn.html").format(obj="toolbox"), elem_classes="close-btn")
|
134 |
+
with gr.Tabs(elem_id="chuanhu-toolbox-tabs"):
|
135 |
+
with gr.Tab(label=i18n("Prompt")):
|
136 |
+
# with gr.Accordion(label="Prompt", open=True):
|
137 |
+
systemPromptTxt = gr.Textbox(
|
138 |
+
show_label=True,
|
139 |
+
placeholder=i18n("在这里输入System Prompt..."),
|
140 |
+
label="System prompt",
|
141 |
+
value=INITIAL_SYSTEM_PROMPT,
|
142 |
+
lines=10
|
143 |
+
)
|
144 |
+
with gr.Accordion(label=i18n("加载Prompt模板"), open=True):
|
145 |
+
with gr.Column():
|
146 |
+
with gr.Row():
|
147 |
+
with gr.Column(scale=6):
|
148 |
+
templateFileSelectDropdown = gr.Dropdown(
|
149 |
+
label=i18n("选择Prompt模板集合文件"),
|
150 |
+
choices=get_template_names(plain=True),
|
151 |
+
multiselect=False,
|
152 |
+
value=get_template_names(plain=True)[0],
|
153 |
+
container=False,
|
154 |
+
)
|
155 |
+
with gr.Column(scale=1):
|
156 |
+
templateRefreshBtn = gr.Button(i18n("🔄 刷新"))
|
157 |
+
with gr.Row():
|
158 |
+
with gr.Column():
|
159 |
+
templateSelectDropdown = gr.Dropdown(
|
160 |
+
label=i18n("从Prompt模板中加载"),
|
161 |
+
choices=load_template(
|
162 |
+
get_template_names(plain=True)[0], mode=1
|
163 |
+
),
|
164 |
+
multiselect=False,
|
165 |
+
container=False,
|
166 |
+
)
|
167 |
+
with gr.Tab(label=i18n("Parameters")):
|
168 |
+
gr.Markdown("will be here soon...")
|
169 |
+
with gr.Tab(label=i18n("Extensions")):
|
170 |
+
gr.Markdown("no, not yet...")
|
171 |
+
with gr.Tab(label=i18n("不知道还有啥tab")):
|
172 |
+
gr.Markdown("I am Keldos. Hello, world!")
|
173 |
+
|
174 |
+
# changeAPIURLBtn = gr.Button(i18n("🔄 切换API地址"))
|
175 |
+
updateChuanhuBtn = gr.Button(visible=False, elem_classes="invisible-btn", elem_id="update-chuanhu-btn")
|
176 |
+
historySelectBtn = gr.Button(visible=False, elem_classes="invisible-btn", elem_id="history-select-btn")
|
177 |
|
178 |
with gr.Row(elem_id="popup-wrapper"):
|
179 |
with gr.Box(elem_id="chuanhu-popup"):
|
web_assets/javascript/ChuanhuChat.js
CHANGED
@@ -112,6 +112,9 @@ function initialize() {
|
|
112 |
settingBox.classList.add('hideBox');
|
113 |
trainingBox.classList.add('hideBox');
|
114 |
// trainBody.classList.add('hide-body');
|
|
|
|
|
|
|
115 |
return true;
|
116 |
}
|
117 |
|
@@ -322,6 +325,7 @@ window.addEventListener("DOMContentLoaded", function () {
|
|
322 |
window.addEventListener('resize', ()=>{
|
323 |
setChatbotHeight();
|
324 |
setPopupBoxPosition();
|
|
|
325 |
windowWidth = window.innerWidth;
|
326 |
});
|
327 |
window.addEventListener('scroll', ()=>{setChatbotHeight(); setUpdateWindowHeight();setPopupBoxPosition();});
|
|
|
112 |
settingBox.classList.add('hideBox');
|
113 |
trainingBox.classList.add('hideBox');
|
114 |
// trainBody.classList.add('hide-body');
|
115 |
+
|
116 |
+
adjustSide();
|
117 |
+
|
118 |
return true;
|
119 |
}
|
120 |
|
|
|
325 |
window.addEventListener('resize', ()=>{
|
326 |
setChatbotHeight();
|
327 |
setPopupBoxPosition();
|
328 |
+
adjustSide();
|
329 |
windowWidth = window.innerWidth;
|
330 |
});
|
331 |
window.addEventListener('scroll', ()=>{setChatbotHeight(); setUpdateWindowHeight();setPopupBoxPosition();});
|
web_assets/javascript/webui.js
CHANGED
@@ -25,77 +25,12 @@ function showMask() {
|
|
25 |
});
|
26 |
}
|
27 |
|
28 |
-
|
29 |
-
function showSideMask() {
|
30 |
-
const oldSideMask = gradioApp().querySelector('.chuanhu-side-mask');
|
31 |
-
if (oldSideMask) {
|
32 |
-
showOrHideSideMask(oldSideMask);
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
function showOrHideSideMask(sideMask) {
|
38 |
-
if (document.querySelector('.showSide')) {
|
39 |
-
|
40 |
-
if (windowWidth < 1024) {
|
41 |
-
if (menu.classList.contains('showSide') && toolbox.classList.contains('showSide')) {
|
42 |
-
toolbox.classList.remove('showSide');
|
43 |
-
chuanhuHeader.classList.remove('under-box');
|
44 |
-
// if both menu and toolbox are open, close toolbox...
|
45 |
-
}
|
46 |
-
}
|
47 |
-
// console.log("test in showSide")
|
48 |
-
if (windowWidth <= 768) {
|
49 |
-
document.body.classList.add('popup-open');
|
50 |
-
// sideMask.style.opacity = '0';
|
51 |
-
if (document.querySelector('.chuanhu-side-mask')) {
|
52 |
-
sideMask.style.display = 'block';
|
53 |
-
// setTimeout(() => {sideMask.style.opacity = '0.5'; }, 200);
|
54 |
-
setTimeout(() => {sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';}, 200);
|
55 |
-
sideMask.classList.add('mask-blur');
|
56 |
-
} else {
|
57 |
-
// sideMask.style.opacity = '0.5';
|
58 |
-
sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
|
59 |
-
sideMask.classList.add('mask-blur');
|
60 |
-
}
|
61 |
-
// sideMask.style.display = 'block';
|
62 |
-
// // sideMask.style.opacity = '0.5';
|
63 |
-
// setTimeout(() => {sideMask.style.opacity = '0.5'; }, 100);
|
64 |
-
|
65 |
-
// sideMask.style.display = 'block';
|
66 |
-
} else {
|
67 |
-
// sideMask.style.display = 'none';
|
68 |
-
document.body.classList.remove('popup-open');
|
69 |
-
// sideMask.style.opacity = '0';
|
70 |
-
sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0)';
|
71 |
-
// sideMask.style.display = 'none';
|
72 |
-
// note: 动画卡,气死我了
|
73 |
-
setTimeout(() => {sideMask.style.display = 'none'; }, 100);
|
74 |
-
}
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
const sideMask = document.createElement('div');
|
79 |
-
sideMask.classList.add('chuanhu-side-mask');
|
80 |
-
window.addEventListener('resize', () => {
|
81 |
-
showOrHideSideMask(sideMask);
|
82 |
-
});
|
83 |
-
|
84 |
-
gradioApp().appendChild(sideMask);
|
85 |
-
showOrHideSideMask(sideMask);
|
86 |
-
|
87 |
-
|
88 |
-
sideMask.addEventListener('click', () => {
|
89 |
-
closeSide(menu);
|
90 |
-
closeSide(toolbox);
|
91 |
-
});
|
92 |
-
}
|
93 |
-
|
94 |
function closeBtnClick(obj) {
|
95 |
if (obj == "box") {
|
96 |
closeBox();
|
97 |
} else if (obj == "toolbox") {
|
98 |
closeSide(toolbox);
|
|
|
99 |
}
|
100 |
}
|
101 |
|
@@ -109,43 +44,139 @@ function closeBox() {
|
|
109 |
}
|
110 |
|
111 |
function closeSide(sideArea) {
|
112 |
-
|
113 |
-
document.querySelector('.chuanhu-side-mask').style.opacity = '0';
|
114 |
-
setTimeout(() => {document.querySelector('.chuanhu-side-mask').remove();}, 300);
|
115 |
document.body.classList.remove('popup-open');
|
116 |
-
|
117 |
sideArea.classList.remove('showSide');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
|
123 |
function menuClick() {
|
124 |
-
|
125 |
-
if (
|
126 |
-
menu.classList.remove('showSide');
|
127 |
closeSide(menu);
|
|
|
128 |
} else {
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
131 |
}
|
|
|
132 |
}
|
133 |
|
134 |
function toolboxClick() {
|
135 |
-
|
136 |
-
|
137 |
-
chuanhuHeader.classList.remove('under-box');
|
138 |
closeSide(toolbox);
|
|
|
139 |
} else {
|
140 |
-
if (
|
141 |
-
menu
|
|
|
142 |
}
|
143 |
-
toolbox
|
144 |
-
|
145 |
-
showSideMask();
|
146 |
}
|
|
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
function setHistroyPanel() {
|
150 |
const historySelectorInput = gradioApp().querySelector('#history-select-dropdown input');
|
151 |
const historyPanel = document.createElement('div');
|
@@ -170,6 +201,7 @@ function setHistroyPanel() {
|
|
170 |
}
|
171 |
});
|
172 |
}
|
|
|
173 |
|
174 |
// function addHistoryPanelListener(historyPanel){
|
175 |
// historyPanel.querySelectorAll('ul.options > li').forEach((historyItem) => {
|
|
|
25 |
});
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
function closeBtnClick(obj) {
|
29 |
if (obj == "box") {
|
30 |
closeBox();
|
31 |
} else if (obj == "toolbox") {
|
32 |
closeSide(toolbox);
|
33 |
+
wantOpenToolbox = false;
|
34 |
}
|
35 |
}
|
36 |
|
|
|
44 |
}
|
45 |
|
46 |
function closeSide(sideArea) {
|
|
|
|
|
|
|
47 |
document.body.classList.remove('popup-open');
|
|
|
48 |
sideArea.classList.remove('showSide');
|
49 |
+
if (sideArea == toolbox) {
|
50 |
+
chuanhuHeader.classList.remove('under-box');
|
51 |
+
toolboxOpening = false;
|
52 |
+
} else if (sideArea == menu) {
|
53 |
+
menuOpening = false;
|
54 |
+
}
|
55 |
+
}
|
56 |
|
57 |
+
function openSide(sideArea) {
|
58 |
+
sideArea.classList.add('showSide');
|
59 |
+
if (sideArea == toolbox) {
|
60 |
+
chuanhuHeader.classList.add('under-box');
|
61 |
+
toolboxOpening = true;
|
62 |
+
} else if (sideArea == menu) {
|
63 |
+
menuOpening = true;
|
64 |
+
}
|
65 |
+
// document.body.classList.add('popup-open');
|
66 |
}
|
67 |
|
68 |
function menuClick() {
|
69 |
+
shouldAutoClose = false;
|
70 |
+
if (menuOpening) {
|
|
|
71 |
closeSide(menu);
|
72 |
+
wantOpenMenu = false;
|
73 |
} else {
|
74 |
+
if (windowWidth < 1024 && toolboxOpening) {
|
75 |
+
closeSide(toolbox);
|
76 |
+
wantOpenToolbox = false;
|
77 |
+
}
|
78 |
+
openSide(menu);
|
79 |
+
wantOpenMenu = true;
|
80 |
}
|
81 |
+
adjustSide();
|
82 |
}
|
83 |
|
84 |
function toolboxClick() {
|
85 |
+
shouldAutoClose = false;
|
86 |
+
if (toolboxOpening) {
|
|
|
87 |
closeSide(toolbox);
|
88 |
+
wantOpenToolbox = false;
|
89 |
} else {
|
90 |
+
if (windowWidth < 1024 && menuOpening) {
|
91 |
+
closeSide(menu);
|
92 |
+
wantOpenMenu = false;
|
93 |
}
|
94 |
+
openSide(toolbox);
|
95 |
+
wantOpenToolbox = true;
|
|
|
96 |
}
|
97 |
+
adjustSide();
|
98 |
}
|
99 |
|
100 |
+
var menuOpening = false;
|
101 |
+
var toolboxOpening = false;
|
102 |
+
var shouldAutoClose = true;
|
103 |
+
var wantOpenMenu = windowWidth > 768;
|
104 |
+
var wantOpenToolbox = false;
|
105 |
+
|
106 |
+
function adjustSide() {
|
107 |
+
if (windowWidth >= 1024) {
|
108 |
+
shouldAutoClose = true;
|
109 |
+
if (wantOpenMenu) {
|
110 |
+
openSide(menu);
|
111 |
+
} else if (wantOpenToolbox) {
|
112 |
+
openSide(toolbox);
|
113 |
+
} else {
|
114 |
+
closeSide(menu);
|
115 |
+
closeSide(toolbox);
|
116 |
+
}
|
117 |
+
} else if (windowWidth > 768 && windowWidth < 1024 ) {
|
118 |
+
shouldAutoClose = true;
|
119 |
+
if (wantOpenToolbox) {
|
120 |
+
if (wantOpenMenu) {
|
121 |
+
closeSide(toolbox);
|
122 |
+
openSide(menu);
|
123 |
+
} else {
|
124 |
+
closeSide(menu);
|
125 |
+
openSide(toolbox);
|
126 |
+
}
|
127 |
+
} else if (wantOpenMenu) {
|
128 |
+
if (wantOpenToolbox) {
|
129 |
+
closeSide(menu);
|
130 |
+
openSide(toolbox);
|
131 |
+
} else {
|
132 |
+
closeSide(toolbox);
|
133 |
+
openSide(menu);
|
134 |
+
}
|
135 |
+
} else if (!wantOpenMenu && !wantOpenToolbox){
|
136 |
+
closeSide(menu);
|
137 |
+
closeSide(toolbox);
|
138 |
+
}
|
139 |
+
} else { // windowWidth <= 768
|
140 |
+
if (shouldAutoClose) {
|
141 |
+
closeSide(menu);
|
142 |
+
// closeSide(toolbox);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
adjustMask();
|
146 |
+
}
|
147 |
+
|
148 |
+
function adjustMask() {
|
149 |
+
var sideMask = null;
|
150 |
+
if (!gradioApp().querySelector('.chuanhu-side-mask')) {
|
151 |
+
sideMask = document.createElement('div');
|
152 |
+
sideMask.classList.add('chuanhu-side-mask');
|
153 |
+
gradioApp().appendChild(sideMask);
|
154 |
+
sideMask.addEventListener('click', () => {
|
155 |
+
closeSide(menu);
|
156 |
+
closeSide(toolbox);
|
157 |
+
});
|
158 |
+
}
|
159 |
+
sideMask = gradioApp().querySelector('.chuanhu-side-mask');
|
160 |
+
|
161 |
+
if (windowWidth > 768) {
|
162 |
+
sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0)';
|
163 |
+
setTimeout(() => {sideMask.style.display = 'none'; }, 100);
|
164 |
+
return;
|
165 |
+
}
|
166 |
+
// if (windowWidth <= 768)
|
167 |
+
if (menuOpening || toolboxOpening) {
|
168 |
+
document.body.classList.add('popup-open');
|
169 |
+
sideMask.style.display = 'block';
|
170 |
+
setTimeout(() => {sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';}, 200);
|
171 |
+
sideMask.classList.add('mask-blur');
|
172 |
+
} else if (!menuOpening && !toolboxOpening) {
|
173 |
+
sideMask.style.backgroundColor = 'rgba(0, 0, 0, 0)';
|
174 |
+
setTimeout(() => {sideMask.style.display = 'none'; }, 100);
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
|
179 |
+
/*
|
180 |
function setHistroyPanel() {
|
181 |
const historySelectorInput = gradioApp().querySelector('#history-select-dropdown input');
|
182 |
const historyPanel = document.createElement('div');
|
|
|
201 |
}
|
202 |
});
|
203 |
}
|
204 |
+
*/
|
205 |
|
206 |
// function addHistoryPanelListener(historyPanel){
|
207 |
// historyPanel.querySelectorAll('ul.options > li').forEach((historyItem) => {
|
web_assets/stylesheet/ChuanhuChat.css
CHANGED
@@ -10,8 +10,8 @@
|
|
10 |
--switch-checkbox-color-light: #e5e7eb;
|
11 |
--switch-checkbox-color-dark: #515151;
|
12 |
|
13 |
-
--menu-width:
|
14 |
-
--menu-background-fill:
|
15 |
--toolbox-width: 280px;
|
16 |
}
|
17 |
|
@@ -198,10 +198,10 @@ body.popup-open {
|
|
198 |
border-bottom: 1px solid var(--border-color-primary);
|
199 |
|
200 |
@media screen and (max-width: 639px) {
|
201 |
-
padding: 6px
|
202 |
}
|
203 |
@media screen and (min-width: 640px) {
|
204 |
-
padding: 6px
|
205 |
}
|
206 |
/* @media screen and (min-width: 1024px) {
|
207 |
padding: 6px 96px;
|
@@ -216,13 +216,26 @@ body.popup-open {
|
|
216 |
gap: 0;
|
217 |
overflow: hidden;
|
218 |
display: inline-flex;
|
|
|
219 |
/* margin-top: 54px; */
|
220 |
/* height: calc(100vh - 72px); */
|
221 |
position: absolute;
|
222 |
top: 48px;
|
223 |
}
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
/* default invisible */
|
@@ -245,34 +258,28 @@ body.popup-open {
|
|
245 |
#menu-area > div {
|
246 |
width: var(--menu-width);
|
247 |
}
|
248 |
-
#toolbox-area > div {
|
249 |
-
width: var(--toolbox-width);
|
250 |
-
}
|
251 |
#menu-area.showSide {
|
252 |
width: var(--menu-width);
|
|
|
253 |
height: 100%;
|
254 |
visibility: visible;
|
255 |
-
margin-right: 16px;
|
256 |
}
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
#toolbox-area.showSide {
|
259 |
width: var(--toolbox-width);
|
260 |
height: 100%;
|
261 |
visibility: visible;
|
262 |
-
margin-left: 16px;
|
263 |
-
}
|
264 |
-
|
265 |
-
#chuanhu-area {
|
266 |
-
flex: unset;
|
267 |
-
width: 100%;
|
268 |
-
flex-wrap: nowrap;
|
269 |
-
gap: 0;
|
270 |
-
justify-content: center;
|
271 |
-
overflow: hidden;
|
272 |
-
flex-direction: row;
|
273 |
-
padding-bottom: 6px;
|
274 |
}
|
275 |
|
|
|
276 |
@media screen and (max-width: 767px) {
|
277 |
#menu-area {
|
278 |
position: fixed;
|
@@ -283,8 +290,6 @@ body.popup-open {
|
|
283 |
}
|
284 |
#menu-area.showSide {
|
285 |
left: 0;
|
286 |
-
/* box-shadow: 0 2px 64px 4px rgba(0, 0, 0, 0.2); */
|
287 |
-
/* margin-left: -16px; */
|
288 |
}
|
289 |
|
290 |
#toolbox-area {
|
@@ -331,6 +336,9 @@ body.popup-open {
|
|
331 |
padding: 24px !important;
|
332 |
border-bottom: 1.8px solid var(--border-color-primary);
|
333 |
}
|
|
|
|
|
|
|
334 |
|
335 |
#toolbox-area > .gradio-box > .gradio-row > .close-btn,
|
336 |
#chuanhu-popup > .gradio-box > .gradio-row > .close-btn {
|
@@ -381,6 +389,7 @@ body.popup-open {
|
|
381 |
color: var(--button-primary-text-color);
|
382 |
}
|
383 |
|
|
|
384 |
@media screen and (max-width: 767px) {
|
385 |
|
386 |
#popup-wrapper.showBox {
|
@@ -484,7 +493,8 @@ body.popup-open {
|
|
484 |
transform: translateX(-50%);
|
485 |
}
|
486 |
}
|
487 |
-
|
|
|
488 |
@media screen and (min-width: 768px) {
|
489 |
#toolbox-area {
|
490 |
border-left: 1px solid var(--border-color-primary);
|
|
|
10 |
--switch-checkbox-color-light: #e5e7eb;
|
11 |
--switch-checkbox-color-dark: #515151;
|
12 |
|
13 |
+
--menu-width: 320px;
|
14 |
+
--menu-background-fill: transparent;
|
15 |
--toolbox-width: 280px;
|
16 |
}
|
17 |
|
|
|
198 |
border-bottom: 1px solid var(--border-color-primary);
|
199 |
|
200 |
@media screen and (max-width: 639px) {
|
201 |
+
padding: 6px 16px;
|
202 |
}
|
203 |
@media screen and (min-width: 640px) {
|
204 |
+
padding: 6px 24px;
|
205 |
}
|
206 |
/* @media screen and (min-width: 1024px) {
|
207 |
padding: 6px 96px;
|
|
|
216 |
gap: 0;
|
217 |
overflow: hidden;
|
218 |
display: inline-flex;
|
219 |
+
justify-content: space-between;
|
220 |
/* margin-top: 54px; */
|
221 |
/* height: calc(100vh - 72px); */
|
222 |
position: absolute;
|
223 |
top: 48px;
|
224 |
}
|
225 |
+
|
226 |
+
#chuanhu-area {
|
227 |
+
flex: unset;
|
228 |
+
width: 100%;
|
229 |
+
flex-wrap: nowrap;
|
230 |
+
/* gap: 0; */
|
231 |
+
justify-content: center;
|
232 |
+
overflow: hidden;
|
233 |
+
flex-direction: row;
|
234 |
+
padding-bottom: 6px;
|
235 |
+
margin: 0 16px;
|
236 |
+
}
|
237 |
+
#chatbot-area {
|
238 |
+
max-width: 1024px;
|
239 |
}
|
240 |
|
241 |
/* default invisible */
|
|
|
258 |
#menu-area > div {
|
259 |
width: var(--menu-width);
|
260 |
}
|
|
|
|
|
|
|
261 |
#menu-area.showSide {
|
262 |
width: var(--menu-width);
|
263 |
+
max-width: var(--menu-width);
|
264 |
height: 100%;
|
265 |
visibility: visible;
|
266 |
+
/* margin-right: 16px; */
|
267 |
}
|
268 |
|
269 |
+
#toolbox-area {
|
270 |
+
|
271 |
+
}
|
272 |
+
#toolbox-area > div {
|
273 |
+
width: var(--toolbox-width);
|
274 |
+
}
|
275 |
#toolbox-area.showSide {
|
276 |
width: var(--toolbox-width);
|
277 |
height: 100%;
|
278 |
visibility: visible;
|
279 |
+
/* margin-left: 16px; */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
}
|
281 |
|
282 |
+
/* When screen width <= 768 */
|
283 |
@media screen and (max-width: 767px) {
|
284 |
#menu-area {
|
285 |
position: fixed;
|
|
|
290 |
}
|
291 |
#menu-area.showSide {
|
292 |
left: 0;
|
|
|
|
|
293 |
}
|
294 |
|
295 |
#toolbox-area {
|
|
|
336 |
padding: 24px !important;
|
337 |
border-bottom: 1.8px solid var(--border-color-primary);
|
338 |
}
|
339 |
+
#chuanhu-popup > .gradio-box > .gradio-row:first-of-type * {
|
340 |
+
margin: 0;
|
341 |
+
}
|
342 |
|
343 |
#toolbox-area > .gradio-box > .gradio-row > .close-btn,
|
344 |
#chuanhu-popup > .gradio-box > .gradio-row > .close-btn {
|
|
|
389 |
color: var(--button-primary-text-color);
|
390 |
}
|
391 |
|
392 |
+
/* 小屏幕的tab样式 */
|
393 |
@media screen and (max-width: 767px) {
|
394 |
|
395 |
#popup-wrapper.showBox {
|
|
|
493 |
transform: translateX(-50%);
|
494 |
}
|
495 |
}
|
496 |
+
|
497 |
+
/* 下面是大屏幕的 toolbox tab 样式 */
|
498 |
@media screen and (min-width: 768px) {
|
499 |
#toolbox-area {
|
500 |
border-left: 1px solid var(--border-color-primary);
|
web_assets/stylesheet/override-gradio.css
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
/* 解决container=False时的错误填充 */
|
3 |
div.form {
|
@@ -14,6 +19,10 @@ footer {
|
|
14 |
font-size: 85%;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
17 |
/* 覆盖 gradio 丑陋的复制按钮样式 */
|
18 |
.message .code_wrap button[title="copy"] {
|
19 |
border-radius: 5px !important;
|
|
|
1 |
+
.gradio-container {
|
2 |
+
max-width: unset !important;
|
3 |
+
padding-left: 0 !important;
|
4 |
+
padding-right: 0 !important;
|
5 |
+
}
|
6 |
|
7 |
/* 解决container=False时的错误填充 */
|
8 |
div.form {
|
|
|
19 |
font-size: 85%;
|
20 |
}
|
21 |
|
22 |
+
.api-docs-wrap {
|
23 |
+
margin-top: 64px;
|
24 |
+
}
|
25 |
+
|
26 |
/* 覆盖 gradio 丑陋的复制按钮样式 */
|
27 |
.message .code_wrap button[title="copy"] {
|
28 |
border-radius: 5px !important;
|