Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
·
a233205
1
Parent(s):
35d20c8
fix: 在特定情况下禁用自动更新按钮
Browse files
web_assets/html/chatbot_header_btn.html
CHANGED
@@ -53,7 +53,7 @@
|
|
53 |
</g>
|
54 |
</svg> -->
|
55 |
<svg width="24px" height="24px" viewBox="0 0 33.5163 33.5705" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
56 |
-
<g
|
57 |
<g fill="currentColor" fill-rule="nonzero">
|
58 |
<path d="M5.58422,33.5705 L27.9321,33.5705 C31.6493,33.5705 33.5163,31.6889 33.5163,28.0348 L33.5163,5.57367 C33.5163,1.91953 31.6493,0.0379686 27.9321,0.0379686 L5.58422,0.0379686 C1.8832,0.0379686 0,1.905 0,5.57367 L0,28.0348 C0,31.7034 1.8832,33.5705 5.58422,33.5705 Z M5.6311,30.9495 C3.67477,30.9495 2.60485,29.928 2.60485,27.907 L2.60485,5.70141 C2.60485,3.69657 3.67477,2.65899 5.6311,2.65899 L27.8852,2.65899 C29.8125,2.65899 30.9115,3.69657 30.9115,5.70141 L30.9115,27.907 C30.9115,29.928 29.8125,30.9495 27.8852,30.9495 L5.6311,30.9495 Z" fill-opacity="0.85"></path>
|
59 |
<path d="M7.69266,12.7402 L17.3438,12.7402 L17.3438,10.572 L7.69266,10.572 C7.07907,10.572 6.60047,11.0505 6.60047,11.648 C6.60047,12.2616 7.07907,12.7402 7.69266,12.7402 Z M20.021,15.3488 C22.0545,15.3488 23.704,13.683 23.704,11.6334 C23.704,9.6 22.0545,7.9343 20.021,7.9343 C17.9876,7.9343 16.3219,9.6 16.3219,11.6334 C16.3219,13.683 17.9876,15.3488 20.021,15.3488 Z M20.021,13.5841 C18.922,13.5841 18.0865,12.7179 18.0865,11.6262 C18.0865,10.5345 18.922,9.69165 20.021,9.69165 C21.0966,9.69165 21.9483,10.5345 21.9483,11.6262 C21.9483,12.7179 21.0966,13.5841 20.021,13.5841 Z M22.5487,12.7402 L25.8884,12.7402 C26.4534,12.7402 26.932,12.2616 26.932,11.648 C26.932,11.0505 26.4534,10.572 25.8884,10.572 L22.5487,10.572 L22.5487,12.7402 Z M25.8237,20.5158 L16.1726,20.5158 L16.1726,22.6913 L25.8237,22.6913 C26.4534,22.6913 26.932,22.2054 26.932,21.608 C26.932,21.0016 26.4534,20.5158 25.8237,20.5158 Z M13.4953,17.9145 C11.4781,17.9145 9.81962,19.5802 9.81962,21.6225 C9.81962,23.6559 11.4781,25.3216 13.4953,25.3216 C15.5288,25.3216 17.1945,23.6559 17.1945,21.6225 C17.1945,19.5802 15.5288,17.9145 13.4953,17.9145 Z M13.4953,19.6791 C14.5943,19.6791 15.4298,20.538 15.4298,21.6298 C15.4298,22.7288 14.5943,23.5643 13.4953,23.5643 C12.4198,23.5643 11.5842,22.7288 11.5842,21.6298 C11.5842,20.538 12.4198,19.6791 13.4953,19.6791 Z M10.9838,20.5158 L7.64415,20.5158 C7.07907,20.5158 6.60047,21.0016 6.60047,21.608 C6.60047,22.2054 7.07907,22.6913 7.64415,22.6913 L10.9838,22.6913 L10.9838,20.5158 Z" fill-opacity="0.85" transform="translate(16.7662, 16.628) scale(-1, 1) translate(-16.7662, -16.628)"></path>
|
|
|
53 |
</g>
|
54 |
</svg> -->
|
55 |
<svg width="24px" height="24px" viewBox="0 0 33.5163 33.5705" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
56 |
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
57 |
<g fill="currentColor" fill-rule="nonzero">
|
58 |
<path d="M5.58422,33.5705 L27.9321,33.5705 C31.6493,33.5705 33.5163,31.6889 33.5163,28.0348 L33.5163,5.57367 C33.5163,1.91953 31.6493,0.0379686 27.9321,0.0379686 L5.58422,0.0379686 C1.8832,0.0379686 0,1.905 0,5.57367 L0,28.0348 C0,31.7034 1.8832,33.5705 5.58422,33.5705 Z M5.6311,30.9495 C3.67477,30.9495 2.60485,29.928 2.60485,27.907 L2.60485,5.70141 C2.60485,3.69657 3.67477,2.65899 5.6311,2.65899 L27.8852,2.65899 C29.8125,2.65899 30.9115,3.69657 30.9115,5.70141 L30.9115,27.907 C30.9115,29.928 29.8125,30.9495 27.8852,30.9495 L5.6311,30.9495 Z" fill-opacity="0.85"></path>
|
59 |
<path d="M7.69266,12.7402 L17.3438,12.7402 L17.3438,10.572 L7.69266,10.572 C7.07907,10.572 6.60047,11.0505 6.60047,11.648 C6.60047,12.2616 7.07907,12.7402 7.69266,12.7402 Z M20.021,15.3488 C22.0545,15.3488 23.704,13.683 23.704,11.6334 C23.704,9.6 22.0545,7.9343 20.021,7.9343 C17.9876,7.9343 16.3219,9.6 16.3219,11.6334 C16.3219,13.683 17.9876,15.3488 20.021,15.3488 Z M20.021,13.5841 C18.922,13.5841 18.0865,12.7179 18.0865,11.6262 C18.0865,10.5345 18.922,9.69165 20.021,9.69165 C21.0966,9.69165 21.9483,10.5345 21.9483,11.6262 C21.9483,12.7179 21.0966,13.5841 20.021,13.5841 Z M22.5487,12.7402 L25.8884,12.7402 C26.4534,12.7402 26.932,12.2616 26.932,11.648 C26.932,11.0505 26.4534,10.572 25.8884,10.572 L22.5487,10.572 L22.5487,12.7402 Z M25.8237,20.5158 L16.1726,20.5158 L16.1726,22.6913 L25.8237,22.6913 C26.4534,22.6913 26.932,22.2054 26.932,21.608 C26.932,21.0016 26.4534,20.5158 25.8237,20.5158 Z M13.4953,17.9145 C11.4781,17.9145 9.81962,19.5802 9.81962,21.6225 C9.81962,23.6559 11.4781,25.3216 13.4953,25.3216 C15.5288,25.3216 17.1945,23.6559 17.1945,21.6225 C17.1945,19.5802 15.5288,17.9145 13.4953,17.9145 Z M13.4953,19.6791 C14.5943,19.6791 15.4298,20.538 15.4298,21.6298 C15.4298,22.7288 14.5943,23.5643 13.4953,23.5643 C12.4198,23.5643 11.5842,22.7288 11.5842,21.6298 C11.5842,20.538 12.4198,19.6791 13.4953,19.6791 Z M10.9838,20.5158 L7.64415,20.5158 C7.07907,20.5158 6.60047,21.0016 6.60047,21.608 C6.60047,22.2054 7.07907,22.6913 7.64415,22.6913 L10.9838,22.6913 L10.9838,20.5158 Z" fill-opacity="0.85" transform="translate(16.7662, 16.628) scale(-1, 1) translate(-16.7662, -16.628)"></path>
|
web_assets/html/close_btn.html
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
-
<button
|
2 |
-
|
3 |
-
<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round"
|
4 |
stroke-linejoin="round" height="20" width="20" xmlns="http://www.w3.org/2000/svg"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
|
5 |
</svg>
|
6 |
</button>
|
|
|
1 |
+
<button onclick='closeBtnClick("{obj}")'>
|
2 |
+
<svg class="icon-need-hover" stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round"
|
|
|
3 |
stroke-linejoin="round" height="20" width="20" xmlns="http://www.w3.org/2000/svg"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
|
4 |
</svg>
|
5 |
</button>
|
web_assets/javascript/updater.js
CHANGED
@@ -60,6 +60,7 @@ async function updateLatestVersion() {
|
|
60 |
|
61 |
const versionTime = document.getElementById('version-time').innerText;
|
62 |
const localVersionTime = versionTime !== "unknown" ? (new Date(versionTime)).getTime() : 0;
|
|
|
63 |
updateInfoGotten = true; //无论成功与否都只执行一次,否则容易api超限...
|
64 |
try {
|
65 |
const data = await getLatestRelease();
|
@@ -77,6 +78,7 @@ async function updateLatestVersion() {
|
|
77 |
if (!isInIframe) openUpdateToast();
|
78 |
gradioApp().classList.add('is-outdated');
|
79 |
}
|
|
|
80 |
} else { //如果当前版本号获取失败,使用时间比较
|
81 |
const latestVersionTime = (new Date(data.created_at)).getTime();
|
82 |
if (latestVersionTime) {
|
@@ -107,8 +109,10 @@ async function updateLatestVersion() {
|
|
107 |
}
|
108 |
currentTime = new Date().getTime();
|
109 |
localStorage.setItem('lastCheckTime', currentTime);
|
|
|
110 |
} catch (error) {
|
111 |
console.error(error);
|
|
|
112 |
}
|
113 |
}
|
114 |
|
@@ -143,7 +147,7 @@ function openUpdateToast() {
|
|
143 |
showMask("update-toast");
|
144 |
}
|
145 |
function closeUpdateToast() {
|
146 |
-
updateToast.style.setProperty('top', '-
|
147 |
showingUpdateInfo = false;
|
148 |
if (updatingInfoElement.classList.contains('hideK') === false) {
|
149 |
updatingInfoElement.classList.add('hideK');
|
|
|
60 |
|
61 |
const versionTime = document.getElementById('version-time').innerText;
|
62 |
const localVersionTime = versionTime !== "unknown" ? (new Date(versionTime)).getTime() : 0;
|
63 |
+
disableUpdateBtns();
|
64 |
updateInfoGotten = true; //无论成功与否都只执行一次,否则容易api超限...
|
65 |
try {
|
66 |
const data = await getLatestRelease();
|
|
|
78 |
if (!isInIframe) openUpdateToast();
|
79 |
gradioApp().classList.add('is-outdated');
|
80 |
}
|
81 |
+
enableUpdateBtns();
|
82 |
} else { //如果当前版本号获取失败,使用时间比较
|
83 |
const latestVersionTime = (new Date(data.created_at)).getTime();
|
84 |
if (latestVersionTime) {
|
|
|
109 |
}
|
110 |
currentTime = new Date().getTime();
|
111 |
localStorage.setItem('lastCheckTime', currentTime);
|
112 |
+
disableUpdateBtn_enableCancelBtn()
|
113 |
} catch (error) {
|
114 |
console.error(error);
|
115 |
+
disableUpdateBtn_enableCancelBtn()
|
116 |
}
|
117 |
}
|
118 |
|
|
|
147 |
showMask("update-toast");
|
148 |
}
|
149 |
function closeUpdateToast() {
|
150 |
+
updateToast.style.setProperty('top', '-600px');
|
151 |
showingUpdateInfo = false;
|
152 |
if (updatingInfoElement.classList.contains('hideK') === false) {
|
153 |
updatingInfoElement.classList.add('hideK');
|
web_assets/stylesheet/ChuanhuChat.css
CHANGED
@@ -1065,10 +1065,10 @@ input:checked + .chatbot-input-more-span {
|
|
1065 |
.show-on-outdated {
|
1066 |
display: none;
|
1067 |
}
|
1068 |
-
.outdated .show-on-latest {
|
1069 |
display: none;
|
1070 |
}
|
1071 |
-
.outdated .show-on-outdated {
|
1072 |
display: block;
|
1073 |
}
|
1074 |
|
|
|
1065 |
.show-on-outdated {
|
1066 |
display: none;
|
1067 |
}
|
1068 |
+
.is-outdated .show-on-latest {
|
1069 |
display: none;
|
1070 |
}
|
1071 |
+
.is-outdated .show-on-outdated {
|
1072 |
display: block;
|
1073 |
}
|
1074 |
|
web_assets/stylesheet/custom-components.css
CHANGED
@@ -33,7 +33,7 @@
|
|
33 |
#toast-update {
|
34 |
position: fixed;
|
35 |
display: flex;
|
36 |
-
top: -
|
37 |
width: 100%;
|
38 |
justify-content: center;
|
39 |
z-index: var(--layer-top);
|
@@ -65,10 +65,11 @@
|
|
65 |
#release-note-wrap {
|
66 |
width: 100%;
|
67 |
max-width: 400px;
|
68 |
-
height:
|
69 |
border: solid 1px var(--border-color-primary);
|
70 |
-
overflow: auto;
|
71 |
-
|
|
|
72 |
}
|
73 |
#release-note-wrap.hideK {
|
74 |
display: none;
|
|
|
33 |
#toast-update {
|
34 |
position: fixed;
|
35 |
display: flex;
|
36 |
+
top: -600px;
|
37 |
width: 100%;
|
38 |
justify-content: center;
|
39 |
z-index: var(--layer-top);
|
|
|
65 |
#release-note-wrap {
|
66 |
width: 100%;
|
67 |
max-width: 400px;
|
68 |
+
height: 240px;
|
69 |
border: solid 1px var(--border-color-primary);
|
70 |
+
overflow-y: auto;
|
71 |
+
overflow-x: hidden;
|
72 |
+
padding: 8px;
|
73 |
}
|
74 |
#release-note-wrap.hideK {
|
75 |
display: none;
|