Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
·
e8bde23
1
Parent(s):
05d7306
feat: 调整更新后显示,后台更新加入pip
Browse files- assets/custom.js +8 -3
- modules/utils.py +2 -1
assets/custom.js
CHANGED
@@ -533,6 +533,9 @@ var statusObserver = new MutationObserver(function (mutationsList) {
|
|
533 |
if (statusDisplay.innerHTML.includes('<span id="update-status"')) {
|
534 |
if (getUpdateStatus() === "success") {
|
535 |
releaseNoteElement.innerHTML = updateSuccess_i18n.hasOwnProperty(language) ? updateSuccess_i18n[language] : updateSuccess_i18n['en'];
|
|
|
|
|
|
|
536 |
} else if (getUpdateStatus() === "failure") {
|
537 |
releaseNoteElement.innerHTML = updateFailure_i18n.hasOwnProperty(language) ? updateFailure_i18n[language] : updateFailure_i18n['en'];
|
538 |
} else {
|
@@ -679,13 +682,15 @@ function manualCheckUpdate() {
|
|
679 |
function noUpdate() {
|
680 |
localStorage.setItem('isLatestVersion', 'true');
|
681 |
isLatestVersion = true;
|
682 |
-
const versionInfoElement = document.getElementById('version-info-title');
|
683 |
const releaseNoteWrap = document.getElementById('release-note-wrap');
|
|
|
|
|
|
|
|
|
|
|
684 |
const gotoUpdateBtn = document.getElementById('goto-update-btn');
|
685 |
const closeUpdateBtn = document.getElementById('close-update-btn');
|
686 |
-
|
687 |
versionInfoElement.textContent = usingLatest_i18n.hasOwnProperty(language) ? usingLatest_i18n[language] : usingLatest_i18n['en'];
|
688 |
-
releaseNoteWrap.style.setProperty('display', 'none');
|
689 |
gotoUpdateBtn.classList.add('hideK');
|
690 |
closeUpdateBtn.classList.remove('hideK');
|
691 |
}
|
|
|
533 |
if (statusDisplay.innerHTML.includes('<span id="update-status"')) {
|
534 |
if (getUpdateStatus() === "success") {
|
535 |
releaseNoteElement.innerHTML = updateSuccess_i18n.hasOwnProperty(language) ? updateSuccess_i18n[language] : updateSuccess_i18n['en'];
|
536 |
+
noUpdateHtml();
|
537 |
+
localStorage.setItem('isLatestVersion', 'true');
|
538 |
+
isLatestVersion = true;
|
539 |
} else if (getUpdateStatus() === "failure") {
|
540 |
releaseNoteElement.innerHTML = updateFailure_i18n.hasOwnProperty(language) ? updateFailure_i18n[language] : updateFailure_i18n['en'];
|
541 |
} else {
|
|
|
682 |
function noUpdate() {
|
683 |
localStorage.setItem('isLatestVersion', 'true');
|
684 |
isLatestVersion = true;
|
|
|
685 |
const releaseNoteWrap = document.getElementById('release-note-wrap');
|
686 |
+
releaseNoteWrap.style.setProperty('display', 'none');
|
687 |
+
noUpdateHtml();
|
688 |
+
}
|
689 |
+
function noUpdateHtml() {
|
690 |
+
const versionInfoElement = document.getElementById('version-info-title');
|
691 |
const gotoUpdateBtn = document.getElementById('goto-update-btn');
|
692 |
const closeUpdateBtn = document.getElementById('close-update-btn');
|
|
|
693 |
versionInfoElement.textContent = usingLatest_i18n.hasOwnProperty(language) ? usingLatest_i18n[language] : usingLatest_i18n['en'];
|
|
|
694 |
gotoUpdateBtn.classList.add('hideK');
|
695 |
closeUpdateBtn.classList.remove('hideK');
|
696 |
}
|
modules/utils.py
CHANGED
@@ -592,8 +592,9 @@ def version_time():
|
|
592 |
|
593 |
def update_chuanhu():
|
594 |
git = os.environ.get('GIT', "git")
|
|
|
595 |
try:
|
596 |
-
run(f"{git} fetch --all && {git} stash && {git} pull https://github.com/GaiZhenbiao/ChuanhuChatGPT.git main -f && {git} stash pop")
|
597 |
logging.info("Successfully updated")
|
598 |
status = '<span id="update-status" class="hideK">success</span>'
|
599 |
return gr.Markdown.update(value=i18n("更新成功,请重启本程序")+status)
|
|
|
592 |
|
593 |
def update_chuanhu():
|
594 |
git = os.environ.get('GIT', "git")
|
595 |
+
pip = os.environ.get('PIP', "pip")
|
596 |
try:
|
597 |
+
run(f"{git} fetch --all && {git} stash && {git} pull https://github.com/GaiZhenbiao/ChuanhuChatGPT.git main -f && {git} stash pop && {pip} install -r requirements.txt")
|
598 |
logging.info("Successfully updated")
|
599 |
status = '<span id="update-status" class="hideK">success</span>'
|
600 |
return gr.Markdown.update(value=i18n("更新成功,请重启本程序")+status)
|