Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
·
d9cbe02
1
Parent(s):
92dce7d
feat: 优化checkbox样式为开关,调整高级选项卡样式
Browse files- ChuanhuChatbot.py +3 -3
- assets/custom.css +66 -1
ChuanhuChatbot.py
CHANGED
@@ -176,11 +176,12 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
176 |
downloadFile = gr.File(interactive=True)
|
177 |
|
178 |
with gr.Tab(label=i18n("高级")):
|
179 |
-
gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️\n\n如果无法使用请恢复默认设置"))
|
180 |
gr.HTML(get_html("appearance_switcher.html").format(label=i18n("切换亮暗色主题")), elem_classes="insert_block")
|
181 |
use_streaming_checkbox = gr.Checkbox(
|
182 |
-
label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION
|
183 |
)
|
|
|
|
|
184 |
with gr.Accordion(i18n("参数"), open=False):
|
185 |
temperature_slider = gr.Slider(
|
186 |
minimum=-0,
|
@@ -279,7 +280,6 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
279 |
)
|
280 |
changeProxyBtn = gr.Button(i18n("🔄 设置代理地址"))
|
281 |
default_btn = gr.Button(i18n("🔙 恢复默认设置"))
|
282 |
-
checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
|
283 |
|
284 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
285 |
gr.HTML(get_html("footer.html").format(versions=versions_html()), elem_id="footer")
|
|
|
176 |
downloadFile = gr.File(interactive=True)
|
177 |
|
178 |
with gr.Tab(label=i18n("高级")):
|
|
|
179 |
gr.HTML(get_html("appearance_switcher.html").format(label=i18n("切换亮暗色主题")), elem_classes="insert_block")
|
180 |
use_streaming_checkbox = gr.Checkbox(
|
181 |
+
label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch_checkbox"
|
182 |
)
|
183 |
+
checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
|
184 |
+
gr.Markdown(i18n("# ⚠️ 务必谨慎更改 ⚠️\n\n如果无法使用请恢复默认设置"))
|
185 |
with gr.Accordion(i18n("参数"), open=False):
|
186 |
temperature_slider = gr.Slider(
|
187 |
minimum=-0,
|
|
|
280 |
)
|
281 |
changeProxyBtn = gr.Button(i18n("🔄 设置代理地址"))
|
282 |
default_btn = gr.Button(i18n("🔙 恢复默认设置"))
|
|
|
283 |
|
284 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
285 |
gr.HTML(get_html("footer.html").format(versions=versions_html()), elem_id="footer")
|
assets/custom.css
CHANGED
@@ -7,8 +7,18 @@
|
|
7 |
--message-user-background-color-dark: #26B561;
|
8 |
--message-bot-background-color-light: #FFFFFF;
|
9 |
--message-bot-background-color-dark: #2C2C2C;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
|
|
12 |
#app_title {
|
13 |
font-weight: var(--prose-header-text-weight);
|
14 |
font-size: var(--text-xxl);
|
@@ -147,7 +157,7 @@ footer {
|
|
147 |
.insert_block {
|
148 |
position: relative;
|
149 |
margin: 0;
|
150 |
-
padding:
|
151 |
box-shadow: var(--block-shadow);
|
152 |
border-width: var(--block-border-width);
|
153 |
border-color: var(--block-border-color);
|
@@ -223,6 +233,61 @@ input:checked + .apSlider::before {
|
|
223 |
content:"🌚";
|
224 |
}
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
/* Override Slider Styles (for webkit browsers like Safari and Chrome)
|
227 |
* 好希望这份提案能早日实现 https://github.com/w3c/csswg-drafts/issues/4410
|
228 |
* 进度滑块在各个平台还是太不统一了
|
|
|
7 |
--message-user-background-color-dark: #26B561;
|
8 |
--message-bot-background-color-light: #FFFFFF;
|
9 |
--message-bot-background-color-dark: #2C2C2C;
|
10 |
+
--switch-checkbox-color-light: #e5e7eb;
|
11 |
+
--switch-checkbox-color-dark: #515151;
|
12 |
+
|
13 |
+
@media (prefers-color-scheme: light) {
|
14 |
+
--switch-checkbox-color: var(--switch-checkbox-color-light);
|
15 |
+
}
|
16 |
+
@media (prefers-color-scheme: dark) {
|
17 |
+
--switch-checkbox-color: var(--switch-checkbox-color-dark);
|
18 |
+
}
|
19 |
}
|
20 |
|
21 |
+
|
22 |
#app_title {
|
23 |
font-weight: var(--prose-header-text-weight);
|
24 |
font-size: var(--text-xxl);
|
|
|
157 |
.insert_block {
|
158 |
position: relative;
|
159 |
margin: 0;
|
160 |
+
padding: 8px 12px;
|
161 |
box-shadow: var(--block-shadow);
|
162 |
border-width: var(--block-border-width);
|
163 |
border-color: var(--block-border-color);
|
|
|
233 |
content:"🌚";
|
234 |
}
|
235 |
|
236 |
+
.switch_checkbox label {
|
237 |
+
flex-direction: row-reverse;
|
238 |
+
justify-content: space-between;
|
239 |
+
}
|
240 |
+
.switch_checkbox input[type="checkbox"] + span {
|
241 |
+
margin-left: 0 !important;
|
242 |
+
}
|
243 |
+
|
244 |
+
.switch_checkbox input[type="checkbox"] {
|
245 |
+
-moz-appearance: none;
|
246 |
+
appearance: none;
|
247 |
+
-webkit-appearance: none;
|
248 |
+
outline: none;
|
249 |
+
display: none;
|
250 |
+
}
|
251 |
+
|
252 |
+
.switch_checkbox input[type="checkbox"] {
|
253 |
+
display: inline-block !important;
|
254 |
+
position: relative !important;
|
255 |
+
border: none !important;
|
256 |
+
appearance: none !important;
|
257 |
+
background: #fff;
|
258 |
+
outline: none;
|
259 |
+
width: 48px !important;
|
260 |
+
height: 24px !important;
|
261 |
+
border-radius: 12px !important;
|
262 |
+
box-shadow: none !important;
|
263 |
+
background-image: none !important;
|
264 |
+
background-color: var(--switch-checkbox-color) !important;
|
265 |
+
transition: .2s ease background-color;
|
266 |
+
}
|
267 |
+
.dark .switch_checkbox input[type="checkbox"] {
|
268 |
+
background-color: var(--switch-checkbox-color-dark) !important;
|
269 |
+
}
|
270 |
+
.switch_checkbox input[type="checkbox"]::before {
|
271 |
+
content: "";
|
272 |
+
position: absolute;
|
273 |
+
width: 24px;
|
274 |
+
height: 24px;
|
275 |
+
top: 0;
|
276 |
+
left: 0;
|
277 |
+
background-color: #fff;
|
278 |
+
transform: scale(0.85);
|
279 |
+
border-radius: 12px !important;
|
280 |
+
transition: .4s ease all;
|
281 |
+
box-shadow: var(--input-shadow);
|
282 |
+
}
|
283 |
+
.switch_checkbox input:checked[type="checkbox"] {
|
284 |
+
background-color: var(--primary-600) !important;
|
285 |
+
}
|
286 |
+
.switch_checkbox input:checked[type="checkbox"]::before {
|
287 |
+
background-color: #fff;
|
288 |
+
left: 24px;
|
289 |
+
}
|
290 |
+
|
291 |
/* Override Slider Styles (for webkit browsers like Safari and Chrome)
|
292 |
* 好希望这份提案能早日实现 https://github.com/w3c/csswg-drafts/issues/4410
|
293 |
* 进度滑块在各个平台还是太不统一了
|