dev - #6325
Conversation
There was a problem hiding this comment.
Sorry @LIghtJUNction, your pull request is larger than the review limit of 150000 diff characters
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors AstrBot's core architecture by modularizing tool management and improving the robustness of tool execution. It streamlines the integration of various tools, enhances the dashboard's configurability, and ensures more predictable behavior for LLM interactions. These changes contribute to a more maintainable, extensible, and user-friendly system. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant and well-executed refactoring of the tool management system, centered around a new ToolProvider protocol. This change decouples tool registration from the main agent logic, greatly enhancing modularity and making the system more extensible. Key improvements include the introduction of ComputerToolProvider and CronToolProvider, a new sandbox capability check to prevent the use of browser tools in unsupported environments, and deterministic tool serialization to improve caching. The command-line interface and dashboard have also been substantially improved, offering better configuration options like a backend-only mode and flexible API URL settings. Overall, these changes represent a major architectural improvement, increasing the robustness, safety, and maintainability of the codebase. The implementation is solid, and I have no specific issues to raise.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
astrbot-docs | a36e048 | Commit Preview URL Branch Preview URL |
Aug 16 2026, 09:06 AM |
# Conflicts: # astrbot/__init__.py # astrbot/core/platform/sources/mattermost/client.py # astrbot/core/platform/sources/slack/slack_event.py # astrbot/core/platform/sources/webchat/webchat_event.py # astrbot/core/platform/sources/wecom/wecom_adapter.py # astrbot/core/platform/sources/weixin_oc/weixin_oc_adapter.py
|
一次往master合一点点,慢慢减少差异 |
# Conflicts: # AGENTS.md # astrbot/__init__.py # astrbot/cli/utils/__init__.py # astrbot/core/astr_agent_tool_exec.py # astrbot/core/computer/booters/local.py # astrbot/core/cron/manager.py # astrbot/core/knowledge_base/kb_mgr.py # astrbot/core/knowledge_base/retrieval/manager.py # astrbot/core/platform/sources/discord/discord_platform_adapter.py # astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py # astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py # astrbot/core/platform/sources/qqofficial_webhook/qo_webhook_server.py # astrbot/core/platform/sources/wecom/wecom_adapter.py # astrbot/core/platform/sources/wecom_ai_bot/wecomai_adapter.py # astrbot/core/provider/func_tool_manager.py # astrbot/core/provider/sources/mimo_api_common.py # astrbot/core/star/star_manager.py # astrbot/core/tools/computer_tools/fs.py # astrbot/core/tools/computer_tools/python.py # astrbot/core/tools/computer_tools/shell.py # astrbot/core/tools/message_tools.py # astrbot/core/tools/web_search_tools.py # astrbot/core/utils/io.py # astrbot/core/utils/tencent_record_helper.py # dashboard/package.json # dashboard/src/assets/mdi-subset/materialdesignicons-subset.css # dashboard/src/assets/mdi-subset/materialdesignicons-webfont-subset.woff # dashboard/src/assets/mdi-subset/materialdesignicons-webfont-subset.woff2 # dashboard/src/components/ConfirmDialog.vue # dashboard/src/components/chat/Chat.vue # dashboard/src/components/chat/ChatInput.vue # dashboard/src/components/chat/ChatMessageList.vue # dashboard/src/components/chat/ConfigSelector.vue # dashboard/src/components/chat/MessageList.vue # dashboard/src/components/chat/ProjectDialog.vue # dashboard/src/components/chat/ProjectList.vue # dashboard/src/components/chat/ProjectView.vue # dashboard/src/components/chat/ProviderModelMenu.vue # dashboard/src/components/chat/RegenerateMenu.vue # dashboard/src/components/chat/StandaloneChat.vue # dashboard/src/components/chat/ThreadPanel.vue # dashboard/src/components/chat/ThreadedMarkdownMessagePart.vue # dashboard/src/components/chat/message_list_comps/MarkdownMessagePart.vue # dashboard/src/components/chat/message_list_comps/ReasoningTimeline.vue # dashboard/src/components/chat/message_list_comps/RefsSidebar.vue # dashboard/src/components/config/UnsavedChangesConfirmDialog.vue # dashboard/src/components/extension/MarketPluginCard.vue # dashboard/src/components/extension/McpServersSection.vue # dashboard/src/components/extension/SkillsSection.vue # dashboard/src/components/extension/componentPanel/components/DetailsDialog.vue # dashboard/src/components/extension/componentPanel/components/RenameDialog.vue # dashboard/src/components/folder/BaseCreateFolderDialog.vue # dashboard/src/components/folder/BaseFolderItemSelector.vue # dashboard/src/components/folder/BaseMoveToFolderDialog.vue # dashboard/src/components/platform/AddNewPlatform.vue # dashboard/src/components/provider/AddNewProvider.vue # dashboard/src/components/provider/ProviderModelsPanel.vue # dashboard/src/components/shared/BackupDialog.vue # dashboard/src/components/shared/ChangelogDialog.vue # dashboard/src/components/shared/ExtensionCard.vue # dashboard/src/components/shared/FileConfigItem.vue # dashboard/src/components/shared/KnowledgeBaseSelector.vue # dashboard/src/components/shared/ListConfigItem.vue # dashboard/src/components/shared/ObjectEditor.vue # dashboard/src/components/shared/PersonaForm.vue # dashboard/src/components/shared/PluginSetSelector.vue # dashboard/src/components/shared/ProviderSelector.vue # dashboard/src/components/shared/ReadmeDialog.vue # dashboard/src/components/shared/SidebarCustomizer.vue # dashboard/src/components/shared/T2ITemplateEditor.vue # dashboard/src/components/shared/UninstallConfirmDialog.vue # dashboard/src/components/shared/WaitingForRestart.vue # dashboard/src/composables/useMessages.ts # dashboard/src/composables/useProjects.ts # dashboard/src/composables/useProviderModelConfigDialog.ts # dashboard/src/composables/useProviderSources.ts # dashboard/src/i18n/locales/ru-RU/features/config-metadata.json # dashboard/src/i18n/locales/ru-RU/features/extension.json # dashboard/src/i18n/locales/ru-RU/features/provider.json # dashboard/src/layouts/full/vertical-header/VerticalHeader.vue # dashboard/src/scss/_override.scss # dashboard/src/stores/common.js # dashboard/src/stores/customizer.ts # dashboard/src/views/ConfigPage.vue # dashboard/src/views/ConversationPage.vue # dashboard/src/views/PlatformPage.vue # dashboard/src/views/SessionManagementPage.vue # dashboard/src/views/WelcomePage.vue # dashboard/src/views/alkaid/KnowledgeBase.vue # dashboard/src/views/alkaid/LongTermMemory.vue # dashboard/src/views/authentication/auth/LoginPage.vue # dashboard/src/views/extension/InstalledPluginsTab.vue # dashboard/src/views/extension/useExtensionPage.js # dashboard/src/views/knowledge-base/DocumentDetail.vue # dashboard/src/views/knowledge-base/KBList.vue # dashboard/src/views/knowledge-base/components/DocumentsTab.vue # dashboard/src/views/knowledge-base/components/SettingsTab.vue # dashboard/src/views/knowledge-base/components/TavilyKeyDialog.vue # dashboard/src/views/persona/FolderTree.vue # dashboard/src/views/persona/MoveToFolderDialog.vue # dashboard/src/views/persona/PersonaManager.vue # requirements.txt # tests/test_local_shell_component.py # tests/unit/test_func_tool_manager.py # tests/unit/test_web_search_tools.py
| "Set dashboard.host in data/cmd_config.json to enable remote access.\n" | ||
| ) | ||
| logger.info("".join(parts)) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 days ago
General fix: never log secrets (passwords/tokens/keys) in plaintext. If operators need setup guidance, log only non-sensitive fields (e.g., username) and redact or replace secret values with a safe instruction.
Best minimal fix without changing core functionality: update astrbot/dashboard/server.py in _build_dashboard_credentials_display so it no longer interpolates generated_password into credentials_display. Keep username and “change after login” messaging, plus an explicit instruction to retrieve/reset password through a secure channel/config flow if needed. Keep the existing object.__setattr__(..., None) clearing behavior unchanged.
Concrete region to change:
astrbot/dashboard/server.py, method_build_dashboard_credentials_display, lines around 500–504 wherecredentials_displayis built.
No new imports, dependencies, or helper methods are required.
| @@ -499,7 +499,7 @@ | ||
|
|
||
| credentials_display = ( | ||
| f" ➜ Initial username: {username}\n" | ||
| f" ➜ Initial password: {generated_password}\n" | ||
| " ➜ Initial password: [REDACTED]\n" | ||
| " ➜ Change it after logging in\n ✨✨✨\n" | ||
| ) | ||
| object.__setattr__(self.config, "_generated_dashboard_password", None) |
| try: | ||
| with socket.socket(family, socket.SOCK_STREAM) as s: | ||
| s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | ||
| s.bind((probe_host, port)) |
Check warning
Code scanning / CodeQL
Binding a socket to all network interfaces Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 days ago
Use explicit, defensive host normalization inside check_port_in_use so wildcard/unspecified bind targets can never reach socket.bind, even if upstream logic changes.
Best minimal fix in astrbot/dashboard/server.py:
- In
check_port_in_use, replace the currentif/elifhost mapping with a canonicalized check usinghost.strip()and an allowlist-style remap:"","0.0.0.0","::","*"→ loopback (127.0.0.1or::1).
- Keep existing functionality (port probe behavior unchanged) while making the sink-side protection self-contained.
No new imports/dependencies are needed.
| @@ -395,10 +395,11 @@ | ||
|
|
||
| def check_port_in_use(self, host: str, port: int) -> bool: | ||
| """跨平台检测端口是否被占用""" | ||
| probe_host = host | ||
| if host in ("", "0.0.0.0"): | ||
| normalized_host = host.strip() | ||
| probe_host = normalized_host | ||
| if normalized_host in ("", "0.0.0.0", "*"): | ||
| probe_host = "127.0.0.1" | ||
| elif host == "::": | ||
| elif normalized_host == "::": | ||
| probe_host = "::1" | ||
|
|
||
| family = socket.AF_INET6 if ":" in probe_host else socket.AF_INET |
Resolves 57 conflicted files across the Python backend and Vue dashboard frontend, plus two cross-file/consistency gaps uncovered during review: - astrbot/core/utils/io.py was auto-merged cleanly but silently dropped is_dashboard_dist_compatible/is_dashboard_version_compatible, which main.py's merged check_dashboard_files (taken from master) depends on — re-added both functions verbatim from master. - astrbot/core/star/base.py's Star.context class attribute was left annotated as the now-removed master-only Context type instead of dev's _ContextLike Protocol, caught by the ruff pre-commit hook (F821 undefined name). Verified: no leftover conflict markers repo-wide, all touched Python files compile and import cleanly, dashboard files pass vue-tsc with no newly introduced type errors (ConversationPage.vue's pre-existing errors confirmed byte-identical to dev's pre-merge HEAD).
# Conflicts: # astrbot/core/db/migration/migra_webchat_session.py # astrbot/core/pipeline/scheduler.py # astrbot/core/pipeline/stage.py # astrbot/core/platform/sources/telegram/tg_adapter.py # dashboard/src/components/shared/AstrBotConfig.vue # dashboard/src/i18n/locales/ru-RU/core/common.json
* chore: update readme * feat: support PowerShell 7 for Windows local shell (#9622) * feat(config): add Windows PowerShell version option * feat(computer): honor Windows PowerShell version in local runtime * fix(computer): correct stale shell comment for configurable PowerShell * refactor(computer): inline windows shell resolution per AGENTS.md * test(computer): assert windows_shell in exec_managed call * test: make shell tests cross-platform Co-authored-by: Donoym <prober13c14@gmail.com> * refactor(computer): auto-detect Windows shell instead of config * fix(computer): drop stale cmd.exe references after shell auto-detect * style: apply ruff format and import order * Update astrbot/core/astr_main_agent.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --------- Co-authored-by: Donoym <prober13c14@gmail.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * feat: add download-count sorting to plugin marketplace (#9570) * feat: 插件市场支持按下载量排序 为插件市场现有的前端本地排序补充下载量选项,复用已规范化的 download_count,不改变默认推荐顺序、后端接口和 OpenAPI。 新增稳定且不修改输入的下载量排序工具:支持升降序、未知值双向置底、非法值兜底及相同值原始顺序保留;接入市场排序控件并补齐中、英、俄三语文案。 新增 9 项专项单元测试,覆盖正常排序、零值、缺失与非法值、负数、数字字符串、小数、稳定性和输入不可变。验证通过 45 项 Dashboard Node 测试、额外性质检查、三语 JSON 校验、Vue 类型检查和生产构建。 * Delete dashboard/tests/marketPluginSort.test.mjs * refactor: 内联插件市场下载量排序 删除独立的市场下载量排序工具,将下载量比较逻辑直接放在现有市场排序分支。 缺失下载量使用默认值 0,保持前端本地排序与现有排序行为一致。 验证:vue-tsc --noEmit;pnpm run build;node --test dashboard/tests/*.test.mjs;git diff --check。 --------- Co-authored-by: C₂₂H₂₅NO₆ <Sisyphbaous-DT-Project@users.noreply.github.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * fix: improve dark theme text contrast (#9643) * fix: propagate QQ media upload failures (#9644) * feat(qqofficial): add chunked file uploads (#9646) Add a dedicated chunked uploader for large local QQ Official media. Keep C2C and group endpoints explicit, support server-provided part index bases, and retry transient upload operations. Co-authored-by: Fuyan Yuan <33221728+TheRainstorm@users.noreply.github.com> * fix(kb): support UUID fallback in get_kb_by_name and warn on missing KBs (#9636) Fixes #9529. When kb_names contains UUIDs instead of names, get_kb_by_name() would return None and check_all_kb() would silently skip retrieval with only a DEBUG-level log. Modifications: - get_kb_by_name() now falls back to UUID lookup when name match fails - check_all_kb() distinguishes None (not found) from empty KBs and logs a WARNING with the count of missing KBs - Add regression tests covering UUID lookup, name preference, and logging * fix: prevent SharedPreferences deadlocks (#9649) * fix: avoid blocking shared preference access * docs: clarify shared preference cache roles * docs: explain shared preference cache purpose * docs: link cache rationale to pull request * chore: bump version to 4.27.3 (#9650) * chore: bump version to 4.27.3 * Update changelog for version 4.27.3 Updated changelog for version 4.27.3 with new features, maintenance updates, and bug fixes. * Refactor: stat service deprecated stats (#9658) * refactor(dashboard): migrate get_stat off deprecated stats methods Rewrite StatService.get_stat to query PlatformStat directly via db_helper.get_db(), following the existing get_provider_token_stats pattern in the same file, instead of the deprecated get_base_stats/get_grouped_base_stats/get_total_message_count. - Windowed rows are fetched once with an explicit ORDER BY timestamp (the old get_base_stats relied on insertion order) - Per-platform sums and hourly time-series buckets are aggregated in Python; total message count uses func.coalesce(func.sum(...), 0) - Response shape is unchanged: platform entries keep the {name, count, timestamp} keys, now built as plain dicts so no deprecated po.Platform/Stats classes are instantiated - Verified semantically identical against the old methods with an A/B comparison over a seeded database (time series, per-platform sums, total count, and empty-window case all match) * test(dashboard): cover StatService.get_stat aggregation semantics The existing test_get_stat route test only asserts the HTTP status and the presence of the platform key, so an aggregation regression would pass unnoticed. Add focused unit tests that seed PlatformStat rows and assert the windowed per-platform sums, the global message total, the hourly time-series bucket shape, the response key set, and the empty-window behavior. * feat(provider): add SSYCloud chat completion provider (#9659) * fix: include JSON cards in group context (#9655) * fix: include JSON cards in group context * fix: allow JSON cards to trigger active replies * docs: add ShengSuanYun provider guide * fix: detect audio format from file content (#9612) * feat: log effective Windows local runtime shell (#9648) * feat: log effective Windows local runtime shell * chore: remove Windows shell logging tests --------- Co-authored-by: Soulter <905617992@qq.com> * refactor(misskey): migrate off deprecated visibility resolver alias (#9674) --------- Co-authored-by: Soulter <905617992@qq.com> Co-authored-by: Wei Chengqian <wcqqq1214@gmail.com> Co-authored-by: Donoym <prober13c14@gmail.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Co-authored-by: C₂₂H₂₅NO₆ <96930391+Sisyphbaous-DT-Project@users.noreply.github.com> Co-authored-by: C₂₂H₂₅NO₆ <Sisyphbaous-DT-Project@users.noreply.github.com> Co-authored-by: Fuyan Yuan <33221728+TheRainstorm@users.noreply.github.com> Co-authored-by: lxfight <1686540385@qq.com> Co-authored-by: Ruochen Pan <badbatch0x01@gmail.com> Co-authored-by: xxshu26 <15197757832@163.com> Co-authored-by: PeiPei233 <49641967+PeiPei233@users.noreply.github.com> Co-authored-by: xiaoxuan010 <2592053474@qq.com> Co-authored-by: C10H14N2O5 <100066858+C10H14N2O5@users.noreply.github.com>
This pull request introduces a new workflow for deploying the dashboard to GitHub Pages and makes significant improvements to the
README.mdfor clarity, completeness, and consistency. It also includes minor formatting updates to the smoke test workflow and adds some convenience commands to.envrc.Summary of changes:
README.mdwith clearer descriptions, updated instructions, improved platform/model tables, and better contribution guidelines.masterchanges into this branch.__proto__,prototype,constructor) indashboard/src/components/shared/AstrBotConfigV4.vue.Dashboard Deployment Automation
.github/workflows/deploy-dashboard.ymlto automate daily and manual dashboard builds and deployments to GitHub Pages, including build, artifact upload, and deployment steps.Documentation Improvements
README.md: clearer project description, improved feature list, updated deployment instructions, revised supported platforms/models tables, and enhanced contribution guidelines. [1] [2] [3] [4] [5]Workflow Consistency
.github/workflows/smoke_test.ymlto use consistent YAML quoting, improved comments, and clarified Python version formatting. [1] [2] [3]Developer Convenience
git pullandgit statuscommands to.envrcfor easier environment setup and status checking.Post-feedback Updates
master.AstrBotConfigV4.vue.