Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
·
9a6e0bf
1
Parent(s):
38856b5
feat: 加入手动检查更新按钮
Browse files- ChuanhuChatbot.py +2 -0
- assets/custom.js +2 -3
- modules/utils.py +0 -2
ChuanhuChatbot.py
CHANGED
@@ -267,6 +267,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
267 |
)
|
268 |
changeProxyBtn = gr.Button(i18n("🔄 设置代理地址"))
|
269 |
default_btn = gr.Button(i18n("🔙 恢复默认设置"))
|
|
|
270 |
|
271 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
272 |
gr.HTML(get_html("footer.html").format(versions=versions_html()), elem_id="footer")
|
@@ -466,6 +467,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
466 |
[status_display],
|
467 |
show_progress=True,
|
468 |
)
|
|
|
469 |
|
470 |
logging.info(
|
471 |
colorama.Back.GREEN
|
|
|
267 |
)
|
268 |
changeProxyBtn = gr.Button(i18n("🔄 设置代理地址"))
|
269 |
default_btn = gr.Button(i18n("🔙 恢复默认设置"))
|
270 |
+
checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."))
|
271 |
|
272 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
273 |
gr.HTML(get_html("footer.html").format(versions=versions_html()), elem_id="footer")
|
|
|
467 |
[status_display],
|
468 |
show_progress=True,
|
469 |
)
|
470 |
+
checkUpdateBtn.click(fn=None, _js='()=>{manualCheckUpdate();}')
|
471 |
|
472 |
logging.info(
|
473 |
colorama.Back.GREEN
|
assets/custom.js
CHANGED
@@ -562,9 +562,6 @@ function cancelUpdate() {
|
|
562 |
function openUpdateToast() {
|
563 |
setUpdateWindowHeight();
|
564 |
showingUpdateInfo = true;
|
565 |
-
// 是的,这个逻辑是弹出窗口也算检测过更新一次。
|
566 |
-
currentTime = new Date().getTime();
|
567 |
-
localStorage.setItem('lastCheckTime', currentTime);
|
568 |
}
|
569 |
function closeUpdateToast() {
|
570 |
updateToast.style.setProperty('top', '-500px');
|
@@ -573,6 +570,8 @@ function closeUpdateToast() {
|
|
573 |
function manualCheckUpdate() {
|
574 |
openUpdateToast();
|
575 |
updateLatestVersion();
|
|
|
|
|
576 |
}
|
577 |
function noUpdate() {
|
578 |
const versionInfoElement = document.getElementById('version-info-title');
|
|
|
562 |
function openUpdateToast() {
|
563 |
setUpdateWindowHeight();
|
564 |
showingUpdateInfo = true;
|
|
|
|
|
|
|
565 |
}
|
566 |
function closeUpdateToast() {
|
567 |
updateToast.style.setProperty('top', '-500px');
|
|
|
570 |
function manualCheckUpdate() {
|
571 |
openUpdateToast();
|
572 |
updateLatestVersion();
|
573 |
+
currentTime = new Date().getTime();
|
574 |
+
localStorage.setItem('lastCheckTime', currentTime);
|
575 |
}
|
576 |
function noUpdate() {
|
577 |
const versionInfoElement = document.getElementById('version-info-title');
|
modules/utils.py
CHANGED
@@ -577,8 +577,6 @@ def versions_html():
|
|
577 |
Gradio: {gr.__version__}
|
578 |
•
|
579 |
<a style="text-decoration:none;color:inherit" href="https://github.com/GaiZhenbiao/ChuanhuChatGPT">ChuanhuChat</a>: {repo_version}
|
580 |
-
•
|
581 |
-
<span onclick="manualCheckUpdate()">Check for update...</span>
|
582 |
"""
|
583 |
|
584 |
def get_html(filename):
|
|
|
577 |
Gradio: {gr.__version__}
|
578 |
•
|
579 |
<a style="text-decoration:none;color:inherit" href="https://github.com/GaiZhenbiao/ChuanhuChatGPT">ChuanhuChat</a>: {repo_version}
|
|
|
|
|
580 |
"""
|
581 |
|
582 |
def get_html(filename):
|