diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index 4ba84a609..11b591bf6 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -5,7 +5,7 @@ import os from astrbot.core.computer.booters.cua_defaults import CUA_DEFAULT_CONFIG from astrbot.core.utils.astrbot_path import get_astrbot_data_path -VERSION = "4.25.6-rc.1" +VERSION = "4.25.6-rc.2" DB_PATH = os.path.join(get_astrbot_data_path(), "data_v4.db") PERSONAL_WECHAT_CONFIG_METADATA = { "weixin_oc_base_url": { diff --git a/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue b/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue index 6b57983c8..b183d12ec 100644 --- a/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue +++ b/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue @@ -55,6 +55,7 @@ let showAdvancedUpdateSettings = ref(false); let restartWaiting = ref(false); let restartStartTime = ref(null); let restartPollTimer: ReturnType | null = null; +const RESTART_START_TIME_POLL_INTERVAL_MS = 2000; type DownloadStageStatus = "pending" | "running" | "done" | "error"; type DownloadStage = { status: DownloadStageStatus; @@ -569,20 +570,25 @@ async function fetchAstrBotStartTime() { return startTime; } -function waitForAstrBotRestart(initialStartTime: number | string | null) { - if (restartWaiting.value) { +function waitForAstrBotRestart( + initialStartTime: number | string | null, + showWaiting = true, +) { + if (showWaiting && !restartWaiting.value) { + restartWaiting.value = true; + updateProgress.value = { + ...updateProgress.value, + stage: "restart", + status: "success", + message: t("core.header.updateDialog.progress.restarting"), + overall_percent: 100, + }; + } + if (restartPollTimer) { return; } - stopRestartPolling(); - restartWaiting.value = true; + restartStartTime.value = initialStartTime; - updateProgress.value = { - ...updateProgress.value, - stage: "restart", - status: "success", - message: t("core.header.updateDialog.progress.restarting"), - overall_percent: 100, - }; const poll = async () => { try { @@ -601,9 +607,10 @@ function waitForAstrBotRestart(initialStartTime: number | string | null) { } }; + void poll(); restartPollTimer = setInterval(() => { void poll(); - }, 1000); + }, RESTART_START_TIME_POLL_INTERVAL_MS); } function applyUpdateProgress(payload: UpdateProgress) { @@ -619,6 +626,9 @@ function applyUpdateProgress(payload: UpdateProgress) { installLoading.value = false; stopUpdateProgressPolling(); } + if (payload.status === "error") { + stopRestartPolling(); + } if (payload.stage === "restart") { waitForAstrBotRestart(restartStartTime.value); } @@ -667,6 +677,7 @@ async function switchVersion(targetVersion: string) { initialStartTime = commonStore.getStartTime(); } restartStartTime.value = initialStartTime; + waitForAstrBotRestart(initialStartTime, false); startUpdateProgressPolling(progressId); axios @@ -691,6 +702,12 @@ async function switchVersion(targetVersion: string) { .catch((err) => { console.log(err); stopUpdateProgressPolling(); + if (!err?.response && restartPollTimer) { + waitForAstrBotRestart(restartStartTime.value); + updateStatus.value = t("core.header.updateDialog.progress.restarting"); + return; + } + stopRestartPolling(); installLoading.value = false; updateStatus.value = err; updateProgress.value = { diff --git a/pyproject.toml b/pyproject.toml index e5e8c3e58..d207fc461 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "AstrBot" -version = "4.25.6-rc.1" +version = "4.25.6-rc.2" description = "Easy-to-use multi-platform LLM chatbot and development framework" readme = "README.md" license = { text = "AGPL-3.0-or-later" }