Repository navigation
fix: show CLI upgrade instructions in the WebUI #11621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import asyncio | ||
| import os | ||
| import traceback | ||
| import uuid | ||
| from collections.abc import Awaitable, Callable | ||
|
|
@@ -174,6 +175,20 @@ async def _run_update_project( | |
| reboot: Whether to restart AstrBot after applying files. | ||
| proxy: Optional GitHub proxy URL. | ||
| """ | ||
| if os.environ.get("ASTRBOT_CLI") == "1": | ||
| self.update_progress[progress_id].update( | ||
| status="error", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Older polls overwrite terminal guidance When an older running poll returns after a newer poll has returned the terminal CLI error, Prevent an older running response from replacing a terminal update state. Prompt for AI agentsIn `astrbot/dashboard/services/update_service.py` at line 185:
**Older polls overwrite terminal guidance**
When an older running poll returns after a newer poll has returned the terminal CLI error, `applyUpdateProgress` replaces the terminal error with the older running response after polling has stopped, so the panel remains stuck on a nonterminal message instead of showing upgrade instructions.
Prevent an older running response from replacing a terminal update state. |
||
| error_code="cli_update_required", | ||
| message=( | ||
| "AstrBot was started via the CLI and cannot be updated from the WebUI. " | ||
| "For a uv tool install, run uv tool upgrade astrbot. For a pip install, " | ||
| "run python -m pip install --upgrade astrbot in the original Python " | ||
| "environment. Then restart AstrBot. " | ||
| "Upgrade guide: https://docs.astrbot.app/en/deploy/update#package" | ||
| ), | ||
| ) | ||
| return | ||
|
|
||
| try: | ||
|
|
||
| async def observe_update(event: UpdateProgress) -> None: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| type MessageFields = { status: string; stage: string; message: string; error_code?: string }; | ||
|
|
||
| export function getUpdateProgressMessage(progress: MessageFields, t: (key: string) => string): string { | ||
| if (progress.status === "error") { | ||
| if (progress.error_code === "cli_update_required") { | ||
| return t("core.header.updateDialog.progress.cliUpdateRequired"); | ||
| } | ||
| return progress.message || t("core.header.updateDialog.progress.failed"); | ||
| } | ||
| if (progress.status === "success") { | ||
| return progress.message || t("core.header.updateDialog.progress.completed"); | ||
| } | ||
| if (progress.stage === "dependencies") { | ||
| return t("core.header.updateDialog.progress.dependencies"); | ||
| } | ||
| if (progress.stage === "restart") { | ||
| return t("core.header.updateDialog.progress.restart"); | ||
| } | ||
| return progress.message || t("core.header.updateDialog.progress.preparing"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium · CLI installs show generic update errors
When
ASTRBOT_CLIis truthy but not exactly"1", orASTRBOT_LAUNCHERis set, the CLI check skips the guidance branch, then the updater rejects the installation and the exception handler reports a generic update failure instead of package-manager instructions.Use the updater’s CLI-managed installation conditions for the guidance check, including truthy
ASTRBOT_CLIvalues and a setASTRBOT_LAUNCHER.Prompt for AI agents