Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
•
d9bd9f8
1
Parent(s):
1c2b5d2
WIP: chat-with-more labels when full width....
Browse files
web_assets/html/chatbot_more.html
CHANGED
@@ -1,38 +1,44 @@
|
|
1 |
<div>
|
2 |
<div id="chatbot-input-more-area">
|
3 |
-
<
|
4 |
-
<
|
5 |
-
<
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
<
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
</g>
|
26 |
-
</
|
27 |
-
</
|
28 |
-
</
|
29 |
-
</
|
30 |
-
</
|
31 |
-
</
|
32 |
</div>
|
33 |
|
34 |
<!-- get more button -->
|
35 |
-
<div>
|
36 |
<button class="chatbot-input-more-btn">
|
37 |
<!-- <svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
38 |
xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
1 |
<div>
|
2 |
<div id="chatbot-input-more-area">
|
3 |
+
<span class="chatbot-input-more-label-group">
|
4 |
+
<div class="switch-checkbox">
|
5 |
+
<label>
|
6 |
+
<input type="checkbox" name="single-session-cb" data-testid="checkbox" style="transform: scale(0.8); margin: 0;">
|
7 |
+
<span class="chatbot-input-more-span">单轮对话</span>
|
8 |
+
</label>
|
9 |
+
</div>
|
10 |
+
|
11 |
+
<div class="switch-checkbox">
|
12 |
+
<label>
|
13 |
+
<input type="checkbox" name="online-search-cb" data-testid="checkbox" style="transform: scale(0.8); margin: 0;">
|
14 |
+
<span class="chatbot-input-more-span">在线搜索</span>
|
15 |
+
</label>
|
16 |
+
</div>
|
17 |
+
</span>
|
18 |
+
|
19 |
+
<span class="chatbot-input-more-label-group">
|
20 |
+
<div class="chatbot-input-more-btn last-btn">
|
21 |
+
<label>
|
22 |
+
<button>
|
23 |
+
<span class="chatbot-input-more-span">上传文件</span>
|
24 |
+
<span class="chatbot-input-more-icon">
|
25 |
+
<svg width="17.6625708px" height="22px" viewBox="0 0 17.6625708 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
26 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
27 |
+
<g fill="currentColor" fill-rule="nonzero">
|
28 |
+
<path d="M10.6020285,2.51882667 C11.4362625,2.51882667 11.8921676,2.64807396 12.4438001,3.21682942 L16.9677143,7.80362991 C17.5473088,8.39718377 17.6625708,8.80801259 17.6625708,9.74013504 L17.6625708,17.0701838 C17.6625708,18.6697194 16.8588053,19.4835978 15.2701606,19.4835978 L9.30367012,19.4838726 C9.50801444,19.132339 9.67081559,18.754537 9.78494219,18.3575337 L15.2149282,18.3578162 C16.0814028,18.3578162 16.5329428,17.8954285 16.5329428,17.0499579 L16.5329428,9.75491554 L11.9107944,9.75491554 C10.9798389,9.75491554 10.4963609,9.29343541 10.4963609,8.34048196 L10.4963609,3.64458667 L6.87556994,3.64458667 C6.00213732,3.64458667 5.55375219,4.12267974 5.55375219,4.95246234 L5.55332282,12.0499339 C5.36755588,12.0285691 5.17882362,12.0175857 4.9877281,12.0175857 C4.79846417,12.0175857 4.61149369,12.028399 4.42740668,12.0494356 L4.42797059,4.93219317 C4.42797059,3.3327051 5.23415624,2.51882667 6.81337946,2.51882667 Z M11.552216,3.86783276 L11.552216,8.21151991 C11.552216,8.55164434 11.6926308,8.69205911 12.0359101,8.69205911 L16.3097226,8.69205911 L11.552216,3.86783276 Z" fill-opacity="0.85"></path>
|
29 |
+
<path d="M4.9877281,13.0174305 C7.17286548,13.0174305 8.97241326,14.8169783 8.97241326,17.0052706 C8.97241326,19.1904512 7.15190483,20.9970003 4.9877281,20.9970003 C2.80254317,20.9970003 0.999853452,19.1974525 0.999853452,17.0052706 C0.999853452,14.82009 2.80254317,13.0174305 4.9877281,13.0174305 Z M4.99784107,14.437007 C4.88115289,14.437007 4.7753124,14.4852382 4.64150995,14.6120393 L2.60482154,16.530609 C2.48641329,16.6350666 2.4357663,16.7447535 2.42877798,16.8911323 C2.414797,17.1440431 2.62022006,17.325342 2.87314384,17.325342 C3.00310422,17.3323433 3.12991834,17.2638862 3.21236934,17.1782716 L3.90166369,16.4757224 L4.5558954,15.8144894 L4.51466558,16.8528413 L4.51466558,19.0792085 C4.51466558,19.332854 4.73408257,19.5421148 4.99784107,19.5421148 C5.25844467,19.5421148 5.47470676,19.332854 5.47470676,19.0792085 L5.47470676,16.8528413 L5.44363313,15.8144894 L6.08075058,16.4757224 L6.78018815,17.1782716 C6.86960587,17.2638862 6.98560256,17.3183839 7.11555862,17.325342 C7.36531454,17.3393445 7.56061597,17.1440431 7.56061597,16.8911323 C7.56061597,16.7479084 7.50996466,16.6350666 7.39159099,16.530609 L5.34090431,14.6120393 C5.22352465,14.498506 5.12779713,14.437007 4.99784107,14.437007 Z" fill-opacity="0.85"></path>
|
30 |
+
</g>
|
31 |
</g>
|
32 |
+
</svg>
|
33 |
+
</span>
|
34 |
+
</button>
|
35 |
+
</label>
|
36 |
+
</div>
|
37 |
+
</span>
|
38 |
</div>
|
39 |
|
40 |
<!-- get more button -->
|
41 |
+
<div id="chatbot-input-more-btn-div">
|
42 |
<button class="chatbot-input-more-btn">
|
43 |
<!-- <svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
44 |
xmlns:xlink="http://www.w3.org/1999/xlink">
|
web_assets/javascript/ChuanhuChat.js
CHANGED
@@ -11,6 +11,7 @@ var user_input_ta = null;
|
|
11 |
var user_input_tb = null;
|
12 |
var userInfoDiv = null;
|
13 |
var appTitleDiv = null;
|
|
|
14 |
var chatbot = null;
|
15 |
var chatbotIndicator = null;
|
16 |
var chatbotWrap = null;
|
@@ -65,6 +66,7 @@ function initialize() {
|
|
65 |
user_input_tb = gradioApp().getElementById('user-input-tb');
|
66 |
userInfoDiv = gradioApp().getElementById("user-info");
|
67 |
appTitleDiv = gradioApp().getElementById("app-title");
|
|
|
68 |
chatbot = gradioApp().querySelector('#chuanhu-chatbot');
|
69 |
chatbotWrap = gradioApp().querySelector('#chuanhu-chatbot > .wrapper > .wrap');
|
70 |
apSwitch = gradioApp().querySelector('.apSwitch input[type="checkbox"]');
|
|
|
11 |
var user_input_tb = null;
|
12 |
var userInfoDiv = null;
|
13 |
var appTitleDiv = null;
|
14 |
+
var chatbotArea = null;
|
15 |
var chatbot = null;
|
16 |
var chatbotIndicator = null;
|
17 |
var chatbotWrap = null;
|
|
|
66 |
user_input_tb = gradioApp().getElementById('user-input-tb');
|
67 |
userInfoDiv = gradioApp().getElementById("user-info");
|
68 |
appTitleDiv = gradioApp().getElementById("app-title");
|
69 |
+
chatbotArea = gradioApp().querySelector('#chatbot-area');
|
70 |
chatbot = gradioApp().querySelector('#chuanhu-chatbot');
|
71 |
chatbotWrap = gradioApp().querySelector('#chuanhu-chatbot > .wrapper > .wrap');
|
72 |
apSwitch = gradioApp().querySelector('.apSwitch input[type="checkbox"]');
|
web_assets/javascript/webui.js
CHANGED
@@ -149,6 +149,7 @@ function adjustSide() {
|
|
149 |
// closeSide(toolbox);
|
150 |
}
|
151 |
}
|
|
|
152 |
adjustMask();
|
153 |
}
|
154 |
|
@@ -182,6 +183,15 @@ function adjustMask() {
|
|
182 |
}
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
/*
|
187 |
function setHistroyPanel() {
|
|
|
149 |
// closeSide(toolbox);
|
150 |
}
|
151 |
}
|
152 |
+
checkChatbotWidth();
|
153 |
adjustMask();
|
154 |
}
|
155 |
|
|
|
183 |
}
|
184 |
}
|
185 |
|
186 |
+
function checkChatbotWidth() {
|
187 |
+
// let chatbotWidth = chatbotArea.clientWidth;
|
188 |
+
// if (chatbotWidth > 488) {
|
189 |
+
if (windowWidth > 768) {
|
190 |
+
chatbotArea.classList.add('chatbot-full-width');
|
191 |
+
} else {
|
192 |
+
chatbotArea.classList.remove('chatbot-full-width');
|
193 |
+
}
|
194 |
+
}
|
195 |
|
196 |
/*
|
197 |
function setHistroyPanel() {
|
web_assets/stylesheet/ChuanhuChat.css
CHANGED
@@ -15,6 +15,8 @@
|
|
15 |
--chatbot-blur-background-color: #F3F3F366;
|
16 |
--chatbot-input-background-color: rgba(255, 255, 255, 0.32);
|
17 |
--chatbot-input-more-background-color: #FFFFFF;
|
|
|
|
|
18 |
|
19 |
--menu-width: 320px;
|
20 |
--menu-background-fill: var(--background-fill-primary);
|
@@ -26,6 +28,8 @@
|
|
26 |
--chatbot-blur-background-color: #12111166;
|
27 |
--chatbot-input-background-color: rgba(144, 144, 144, 0.32);
|
28 |
--chatbot-input-more-background-color: #3C3C3C;
|
|
|
|
|
29 |
}
|
30 |
}
|
31 |
|
@@ -370,7 +374,7 @@ body.popup-open {
|
|
370 |
/* padding: 24px; */
|
371 |
/* padding: 8px 6px; */
|
372 |
min-height: 82px;
|
373 |
-
max-height: 166px;
|
374 |
background: var(--chatbot-blur-background-color);
|
375 |
-webkit-backdrop-filter: blur(24px);
|
376 |
backdrop-filter: blur(24px);
|
@@ -405,40 +409,43 @@ button.chatbot-input-more-btn:active .sm-round-bg {
|
|
405 |
fill-opacity: 0.25;
|
406 |
}
|
407 |
|
|
|
|
|
408 |
#chatbot-input-more-area {
|
409 |
position: absolute;
|
410 |
display: flex;
|
411 |
flex-direction: column;
|
412 |
bottom: 60px;
|
413 |
min-width: 120px;
|
414 |
-
z-index:
|
415 |
border-radius: 6px;
|
416 |
box-shadow: var(--shadow-sm);
|
417 |
background: var(--chatbot-input-more-background-color);
|
418 |
|
419 |
}
|
420 |
-
#chatbot-input-more-area > div {
|
421 |
min-width: 120px;
|
422 |
padding: 2px;
|
423 |
align-content: center;
|
424 |
/* display: flex; */
|
425 |
border-bottom: 0.5px solid var(--border-color-primary);
|
426 |
}
|
427 |
-
#chatbot-input-more-area > div
|
428 |
border-bottom: none;
|
429 |
}
|
430 |
-
#chatbot-input-more-area > div > label {
|
431 |
padding: 6px 8px;
|
432 |
border-radius: 4px;
|
|
|
433 |
display: flex;
|
434 |
align-items: center;
|
435 |
justify-content: space-between;
|
436 |
cursor: pointer;
|
437 |
}
|
438 |
-
#chatbot-input-more-area > div:hover > label {
|
439 |
-
background: var(--input-background-
|
440 |
}
|
441 |
-
#chatbot-input-more-area > div > label button {
|
442 |
margin: 0;
|
443 |
width: 100%;
|
444 |
display: flex;
|
@@ -452,6 +459,51 @@ button.chatbot-input-more-btn:active .sm-round-bg {
|
|
452 |
white-space: nowrap;
|
453 |
}
|
454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
/* default invisible */
|
456 |
#menu-area, #toolbox-area {
|
457 |
width: 0;
|
|
|
15 |
--chatbot-blur-background-color: #F3F3F366;
|
16 |
--chatbot-input-background-color: rgba(255, 255, 255, 0.32);
|
17 |
--chatbot-input-more-background-color: #FFFFFF;
|
18 |
+
--chatbot-input-more-background-fullwidth-hover: #FFFFFF88;
|
19 |
+
--chatbot-input-more-background-mobilewidth-hover: #F6F6F6;
|
20 |
|
21 |
--menu-width: 320px;
|
22 |
--menu-background-fill: var(--background-fill-primary);
|
|
|
28 |
--chatbot-blur-background-color: #12111166;
|
29 |
--chatbot-input-background-color: rgba(144, 144, 144, 0.32);
|
30 |
--chatbot-input-more-background-color: #3C3C3C;
|
31 |
+
--chatbot-input-more-background-fullwidth-hover: #1F1F1F88;
|
32 |
+
--chatbot-input-more-background-mobilewidth-hover: #1F1F1F44;
|
33 |
}
|
34 |
}
|
35 |
|
|
|
374 |
/* padding: 24px; */
|
375 |
/* padding: 8px 6px; */
|
376 |
min-height: 82px;
|
377 |
+
/* max-height: 166px; */
|
378 |
background: var(--chatbot-blur-background-color);
|
379 |
-webkit-backdrop-filter: blur(24px);
|
380 |
backdrop-filter: blur(24px);
|
|
|
409 |
fill-opacity: 0.25;
|
410 |
}
|
411 |
|
412 |
+
/* 三个点号点开! */
|
413 |
+
/* no!屏幕宽度窄的时候! */
|
414 |
#chatbot-input-more-area {
|
415 |
position: absolute;
|
416 |
display: flex;
|
417 |
flex-direction: column;
|
418 |
bottom: 60px;
|
419 |
min-width: 120px;
|
420 |
+
z-index: 5000;
|
421 |
border-radius: 6px;
|
422 |
box-shadow: var(--shadow-sm);
|
423 |
background: var(--chatbot-input-more-background-color);
|
424 |
|
425 |
}
|
426 |
+
#chatbot-input-more-area > span > div {
|
427 |
min-width: 120px;
|
428 |
padding: 2px;
|
429 |
align-content: center;
|
430 |
/* display: flex; */
|
431 |
border-bottom: 0.5px solid var(--border-color-primary);
|
432 |
}
|
433 |
+
#chatbot-input-more-area > span > div.last-btn {
|
434 |
border-bottom: none;
|
435 |
}
|
436 |
+
#chatbot-input-more-area > span > div > label {
|
437 |
padding: 6px 8px;
|
438 |
border-radius: 4px;
|
439 |
+
height: 39px;
|
440 |
display: flex;
|
441 |
align-items: center;
|
442 |
justify-content: space-between;
|
443 |
cursor: pointer;
|
444 |
}
|
445 |
+
#chatbot-input-more-area > span > div:hover > label {
|
446 |
+
background: var(--chatbot-input-more-background-mobilewidth-hover);
|
447 |
}
|
448 |
+
#chatbot-input-more-area > span > div > label button {
|
449 |
margin: 0;
|
450 |
width: 100%;
|
451 |
display: flex;
|
|
|
459 |
white-space: nowrap;
|
460 |
}
|
461 |
|
462 |
+
/* 哈哈!川虎哥觉得不方便,那再写个全宽的吧!
|
463 |
+
* 再让我重写一份样式我是狗
|
464 |
+
*/
|
465 |
+
.chatbot-full-width #chatbot-input-row {
|
466 |
+
flex-direction: column;
|
467 |
+
justify-content: flex-start !important;
|
468 |
+
justify-items: start;
|
469 |
+
}
|
470 |
+
.chatbot-full-width #chatbot-input-more-area {
|
471 |
+
position: relative;
|
472 |
+
flex-direction: row-reverse;
|
473 |
+
justify-content: space-between;
|
474 |
+
height: 32px;
|
475 |
+
min-width: unset;
|
476 |
+
background: none;
|
477 |
+
box-shadow: none;
|
478 |
+
bottom: 0;
|
479 |
+
}
|
480 |
+
.chatbot-full-width #chatbot-input-more-area > span > div {
|
481 |
+
/* min-width: unset; */
|
482 |
+
border-bottom: none;
|
483 |
+
}
|
484 |
+
.chatbot-full-width #chatbot-input-more-area > span > div > label {
|
485 |
+
height: 32px;
|
486 |
+
border-radius: 8px;
|
487 |
+
}
|
488 |
+
.chatbot-full-width #chatbot-input-more-area > span > div:hover > label {
|
489 |
+
background: var(--chatbot-input-more-background-fullwidth-hover);
|
490 |
+
}
|
491 |
+
.chatbot-full-width #chatbot-input-more-btn-div {
|
492 |
+
display: none;
|
493 |
+
}
|
494 |
+
.chatbot-full-width #chatbot-input-box {
|
495 |
+
padding-top: 4px;
|
496 |
+
}
|
497 |
+
.chatbot-full-width #chatbot-input-row .gradio-html {
|
498 |
+
width: 100%;
|
499 |
+
max-width: unset;
|
500 |
+
}
|
501 |
+
.chatbot-full-width .chatbot-input-more-label-group {
|
502 |
+
flex-wrap: nowrap;
|
503 |
+
flex-direction: row-reverse;
|
504 |
+
display: inline-flex;
|
505 |
+
}
|
506 |
+
|
507 |
/* default invisible */
|
508 |
#menu-area, #toolbox-area {
|
509 |
width: 0;
|