- Add At component handling in _parse_to_qqofficial method
- Convert At(qq=openid) to <@openid> plain_text format
- Maintain original message chain order by appending
- Skip At(qq='all') since QQ Official API may not support it
Closes#8982
- Add ExaWebSearchTool (web_search_exa) with keyword/semantic search,
category filters, domain restrictions, and date range support
- Add ExaGetContentsTool (exa_get_contents) for extracting web page content
- Add _exa_search() and _exa_get_contents() API helpers hitting
https://api.exa.ai/search and https://api.exa.ai/contents
- Add _EXA_KEY_ROTATOR for multi-key rotation
- Register Exa tools in _apply_web_search_tools() dispatch
- Add Exa to WEB_SEARCH_CITATION_TOOL_NAMES for citation support
- Add websearch_exa_key config default and provider option
- Add i18n metadata for en-US, zh-CN, ru-RU
- Add Exa section to docs (en + zh)
- Add 6 unit tests covering search, contents, error handling, and
legacy config migration
Closes#5621
* fix: tool definition does not pass back to gemini properly, causing repeated tool calls.
fixes: #8789fixes: #8773fixes: #7111fixes: #6402fixes: #7684
* fix: remove unnecessary logging and improve log messages in Gemini source
* fix: improve type checking for tool calls in Google Gemini provider
Add QQ Official Bot QR binding registration flow for the WebSocket adapter, wire dashboard credential autofill, and mark the WebSocket template as recommended.
Updates the aiocqhttp platform adapter and message event handler to include self_id routing parameters across multiple API calls, including message sending, forwarding, and fetching group/user details. It also adds handling to ignore mface message types. The review feedback suggests refactoring the duplicate self_id extraction logic in the message forwarding code to reduce redundancy and improve maintainability.
* refactor: migrate to fastapi
* structure refactor
* fix: pyright fix
* refactor: improve error handling and public messages in plugin services
* feat(api): refactor API client integration and enhance request handling
- Updated API client configuration to use a dedicated HTTP client.
- Introduced utility functions for generating options, queries, and form data for API requests.
- Refactored multiple API methods to utilize the new utility functions for improved consistency and readability.
- Renamed types for clarity and updated import statements accordingly.
feat(docs): add script to update OpenAPI JSON from YAML spec
- Created a Python script to convert OpenAPI YAML specification to JSON format.
- The script supports customizable input and output paths.
- Ensured the script handles directory creation for output paths and validates the YAML structure.
* fix
* feat(auth): implement rate limiting for v1 login endpoint and enhance request handling
* Refactor dashboard API routers to use legacy_router for backward compatibility
- Changed all instances of dashboard_router to legacy_router across multiple API modules including platform, plugins, providers, sessions, skills, stats, subagents, t2i, tools, updates, and asgi_runtime.
- Updated route definitions to ensure existing endpoints remain functional under the new router structure.
- Introduced support for Quart request context in asgi_runtime to enhance compatibility with existing Quart-based plugins.
- Added a test case to validate the functionality of the new Quart request context handling in plugin extensions.
* chore: remove cli test
* fix: update dashboard tests for fastapi migration
* chore: satisfy ruff checks
* fix: update openapi api key scopes
* fix: sync config scope chip selection
* fix: restore quart dependency
* docs: clarify quart plugin api compatibility
* docs: update openapi scope documentation
* fix: use singular skill openapi scope
* fix: hide update service exception details
* fix: address fastapi review comments
* fix: address dashboard review findings
* docs: revert unrelated package deployment changes
* docs: update agent api generation guidance
* feat: add plugin page web api helpers
* docs: add plugin page bridge demo
* fix: type plugin upload files
* fix: stabilize plugin page uploads
* fix: type plugin web request proxy
* docs: remove plugin page docs example
* fix: authenticate plugin page SSE bridge
* fix: unify media reference handling
* fix: accept bare base64 record media refs
* chore: update agents.md
* fix: unify file URI handling across media components and utilities
* fix: unify media reference type handling with MediaRefStr alias
* Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization'
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* Update astrbot/core/platform/sources/discord/discord_platform_adapter.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* fix: unify media handling and improve base64 decoding across components
* fix: simplify client_kwargs type definition and enhance media message handling in platform adapter
* fix: unify media utility documentation and enhance function descriptions
* perf: drop "pilk" requirement, improve audio outbound for tencent-related IM apps which using silk
* fix: unify Tencent Silk audio handling and enhance media resolver functionality
---
- Centralize media reference materialization and base64 resolution for local paths, http(s), base64://, data URIs, and legacy bare base64 payloads.
- Normalize incoming Record audio to wav and Image media to temporary jpg during preprocess, with event-scoped cleanup.
- Reuse the shared media resolver across OpenAI, Gemini, Anthropic, MiMo, DeerFlow, STT, and platform media paths while sanitizing logs and cleaning temporary conversion outputs.
- Ensure generated TTS audio is tracked for cleanup after the event finishes.
fix#8676fix#8543fix#7588fix#7580fix#8030fix#8034fix#7461fix#7565fix#6509fix#7144fix#7795
---------
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* feat: show quoted message content in group chat context
Include Reply component content in _format_message so the LLM can
see what message was quoted when someone replies to the bot.
- Add Reply import
- Handle Reply in _format_message with message_str or chain fallback
- Add _describe_chain helper for non-text quoted content (images, etc.)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: use isinstance, add truncation, unify language to English
- Replace string class-name checks with isinstance() for robustness
- Add _truncate_reply_text to prevent long quoted content inflating context
- Unify markers to English ([Image], [Voice], [Quote] etc.)
- Import Record, Video, File for isinstance checks
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: add Forward, AtAll, Face to _describe_chain for completeness
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* style: format group chat context
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Soulter <905617992@qq.com>
* fix: preserve repo source on plugin reinstall
* fix(dashboard): align extension market matching with repo identity
Use normalized repo keys as the primary identity when matching
installed extensions with marketplace plugins in useExtensionPage.
Only fall back to name matching for installed extensions that do
not have a repo, and normalize name lookups consistently on both
sides. Also clear stale online_version when no marketplace plugin
is matched.
* fix: defer faiss C library import to prevent process hang on startup
Move top-level `import faiss` from embedding_storage.py to __init__() method,
and make the EmbeddingStorage import in vec_db.py lazy. This prevents the faiss
C library from being loaded at module import time, which can cause process hang
(SIGILL or deadlock) with faiss-cpu 1.14.2 on certain CPU architectures.
Ref #8695
* chore: apply review suggestions
- Preserve original exception context with `from e` when re-raising ImportError
- Move EmbeddingStorage import back to top level in vec_db.py (safe now that
faiss is no longer imported at module level in embedding_storage.py)
* ci: trigger re-run
---------
Co-authored-by: Blueteemo <Blueteemo@users.noreply.github.com>
Address feedback from Sourcery AI and Gemini Code Assist:
- Only apply fallback path to known plugin naming patterns (astrbot_plugin_*)
- Add defensive check for None/empty tool.__module__
- Fallback to tool.__module__ if _parts is empty
* feat(plugin): support icon field in metadata.yaml for sidebar icon
* feat(sidebar): add isRawTitle support for non-i18n sidebar titles
* feat(sidebar): add usePluginSidebarItems composable for dynamic plugin WebUI entries
* feat(sidebar): inject plugin WebUI items into sidebar before More group
* refactor(plugin-page): remove header, make iframe full-screen
* feat(sidebar): restore plugin WebUI collapsible group
* fix(plugin-page): prevent iframe from capturing mousemove during sidebar resize
- Use absolute positioning instead of negative margin for full-screen layout
- Zero container padding for plugin page route in FullLayout
- Disable pointer-events on iframe during sidebar drag to avoid event capture
* refactor(sidebar): share plugin state reactively instead of polling
- Replace polling + events with module-level reactive shared state
- useExtensionPage.getExtensions() populates pluginSidebarState
- usePluginSidebarItems uses computed() to derive sidebar menu
- Zero additional API calls, updates instantly on any plugin change
* fix(sidebar): restore initial plugin data fetch on sidebar mount
* feat(sidebar): render plugin icons via MDI SVG CDN instead of subset font
- Plugin icons loaded from https://cdn.jsdelivr.net/npm/@mdi/svg@7/svg/
- Removes subset limitation - plugins can use any MDI icon
- Fallback to subset font class for built-in sidebar items
- Default icon remains mdi-puzzle when plugin doesn't specify one
* fix(sidebar): render plugin icons as inline SVG with currentColor for theme matching
* docs: add plugin sidebar icon documentation
* docs: require mdi- prefix for plugin icon field
* chore: ruff format
* fix: address review feedback
- Add SVG sanitization to prevent XSS via v-html (reject <script>, event handlers)
- Extract MORE_GROUP_KEY shared constant to avoid hardcoded i18n key
- Parallel SVG loading with Promise.all instead of serial
- Pure buildPluginItems, mutate iconSvg in place to avoid redundant rebuilds
- Fallback to default icon SVG when loading fails
- Revert accidental pnpm-lock.yaml changes
* chore: remove webui icon
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat(plugin): pass theme through plugin page asset URLs and initial context
Add theme query parameter propagation through the plugin page asset pipeline
so that the bridge SDK initial context includes isDark.
* feat(plugin): inject data-theme and color-scheme into plugin page HTML
Set data-theme on <html> and add color-scheme meta tag server-side
to prevent flash when entering plugin pages in dark mode.
* feat(webui): add isDark getter to customizer store
* feat(webui): sync theme to plugin iframe via URL param and postMessage
Append theme query parameter to iframe src URL and include isDark
in the postMessage context. Watch uiTheme changes to re-send context.
* feat(bridge): auto-apply data-theme from context in plugin bridge SDK
Set data-theme attribute on document.documentElement when context
includes isDark, enabling live theme switching via postMessage.
* docs: add light/dark theme adaptation guide for plugin pages
Add theme adaptation section to existing plugin-pages docs in both
Chinese and English, covering CSS variables and onContext() usage.
* test: add theme sync tests for plugin page bridge and content
Verify isDark in bridge SDK initial context with various theme params,
and verify data-theme and color-scheme injection in rewritten HTML.
* fix(plugin): use case-insensitive regex for head tag in HTML rewrite
Replace string match for <head> with case-insensitive regex to handle
uppercase tags and tags with attributes, preventing duplicate injection
of color-scheme meta tag.
* refactor(webui): generalize isDark getter to support any dark theme
Replace hardcoded PurpleThemeDark check with suffix-based detection
so all dark theme variants are recognized automatically.
* refactor(plugin): extract theme helpers for HTML rewriting
Extract _get_request_theme and _apply_theme_to_html to eliminate
duplicate theme-parsing logic and isolate HTML mutation. Use case-
insensitive regex for head tag detection to prevent duplicate
injection when tags use mixed casing.
* style: apply ruff formatting to plugin page tests
Wrap long function call lines for consistency with project style.
* fix(plugin): handle existing data-theme and case-sensitive fallback in HTML rewrite
Strip any existing data-theme attribute before adding the new one to
prevent duplicate attributes. Use case-insensitive regex for the
<head> fallback insertion to avoid corrupting <html> tag attributes.
* fix(webui): add null guard to isDark getter
Guard against undefined uiTheme to prevent TypeError when the
theme config has not been initialized.
* fix(webui): centralize theme mapping and preserve hash in plugin page URL
Extract themeParam computed to avoid drift between URL and context.
Include hash fragment in iframe URL to support SPA hash routing.
* fix(webui): address CR feedback - deduplicate color-scheme meta, harden isDark getter, consolidate theme source
- _apply_theme_to_html: strip existing color-scheme meta before injecting to
avoid duplicates; merge data-theme strip+add into single-pass regex callback
- customizer.ts: replace brittle endsWith('Dark') with explicit theme name check
- _rewrite_plugin_page_html: use _get_request_theme() directly instead of
reading theme from extra_query_params
* fix(webui): 简化 isDark 推导、优化查询参数构建、使用暗色主题集合
- isDark 推导简化为 theme == "dark"(None == "dark" 为 False,去掉多余三元表达式)
- _prepare_plugin_page_query_params 改为线性构建,先计算再构建字典
- isDark getter 改用显式 DARK_THEMES Set,替代硬编码单值比较
---------
Co-authored-by: lxfight <lxfight@192.168.5.50>
* Enhance Reply chain handling for Record components
Added processing for Record components within Reply chains, including WAV conversion and STT functionality.
* Refactor STT processing for Record components
* Add STT record function for voice-to-text processing
* Update stage.py
* Update stage.py
* Update stage.py
* feat: future task UI
* fix: update filter label for UMO in English and Chinese locales
* feat: enhance cron job management with delivery target handling and UI improvements
* fix: update session label to indicate optional delivery target
* feat: add tooltip for last run time and error in cron job display
* fix(dashboard): relax frame security headers when running under launcher
When AstrBot is launched by the AstrBot Launcher, the dashboard is
embedded in a cross-origin iframe (the Tauri webview). The plugin page
responses set X-Frame-Options: SAMEORIGIN and CSP frame-ancestors
'self', both of which inspect the *entire* ancestor chain — not just the
immediate parent. Because the top-level Tauri webview has a different
origin, these headers block the plugin page from loading inside the
nested iframe, resulting in 'localhost refused to connect'.
Fix: skip the restrictive frame headers when ASTRBOT_LAUNCHER=1 is set,
which the launcher already injects as an environment variable. Other
security measures (iframe sandbox, JWT asset_token, postMessage bridge)
remain in place.
* fix(dashboard): preserve object-src and base-uri CSP directives under launcher
Keep object-src 'none' and base-uri 'self' in the CSP header even when
ASTRBOT_LAUNCHER is set. Only frame-ancestors and X-Frame-Options need
to be relaxed because the Tauri webview is a cross-origin ancestor.
* fix(dashboard): tighten ASTRBOT_LAUNCHER check and always emit CSP
Use explicit value check ('1' / 'true') instead of truthiness for the
ASTRBOT_LAUNCHER env var. Always emit a Content-Security-Policy header
and only conditionally prepend frame-ancestors 'self' — this keeps
object-src 'none' and base-uri 'self' active under the launcher.
* fix(context): restore turn cap, serialize content parts and tool calls for llm compress, fix AftCompact debug log
Three context-compaction regression fixes after #8226:
1. Restore max_context_length -> enforce_max_turns propagation so
normal turn-based truncation works again.
2. Serialize ContentPart and ToolCall objects into plain dicts in
_message_to_dict so llm_compress no longer fails with JSON
serialization errors.
3. Print _provider_messages (compacted) instead of run_context.messages
(unchanged) in AftCompact debug log; truncate long role lists to
first4,...,last4 to avoid log spam.
Assertions in tests are also hardened to avoid coupling to exact prompt
wording.
* fix(tool_loop_agent_runner): simplify context handling by removing redundant provider messages
* fix(tool_loop_agent_runner): rename context manager variables for clarity
* fix: update context compression to use recent token ratio instead of fixed count
* fix: enhance LLMSummaryCompressor to sanitize contexts and improve message handling
* ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
* fix(provider): wrap batch embedding texts in Content to avoid collapse on gemini-embedding-2
* fix(gemini_embedding): format list comprehension for better readability
---------
Co-authored-by: Rat0323 <Rat0323@users.noreply.github.com>
Co-authored-by: Soulter <905617992@qq.com>
Refactor file handling to resolve sources more effectively, including decoding file URIs and handling base64 data. Update methods to ensure compatibility with different file formats and paths.
* fix(ltm): prevent wake commands from being recorded as group chat context
* test: fix mock event get_extra return value in group context wiring tests
* test: strengthen group context mock and add slash-command skip test
* fix(console): use toast for pip-install error display
The pip-install dialog displayed error messages as unstyled inline
<small> text with no color differentiation from success messages.
Replaced with useToast() to show errors as red snackbar, consistent
with the rest of the dashboard.
* fix(console): use i18n for pip-install toast fallback messages
Set MiniMax-M3 as the default fallback model for the Token Plan provider.
The model list itself is already fetched dynamically from the MiniMax API,
so all available models including M3 are auto-discovered. This change just
updates the hardcoded fallback used when no model is configured to the
current flagship.
MiniMax-M2.7 remains fully usable; users can still configure it explicitly.
* feat: add TOTP two-factor authentication for dashboard login
* fix: ensure TOTP verification uses UTC for accurate time comparison
* fix: update recovery code validation logic for disabling TOTP
* test: add unit tests for TOTP functionality and recovery code validation
* chore: format
* feat: add trust_proxy_headers switch for auth rate-limit IP source
* feat: make dashboard auth rate-limit configurable via system settings
Add auth_rate_limit config block to dashboard settings with enable
(default: true), average_interval (default: 1.0s), and max_burst
(default: 3) options. The dashboard auth middleware now reads from
config instead of using hardcoded values. The average_interval and
max_burst fields are conditionally shown only when rate limiting is
enabled.
* fix: normalize dashboard client IP from trusted proxy headers
* refactor: encapsulate rate limiter state into registry, add TTL
* feat: show dynamic page title during two-factor verification
* fix: require two-factor verification for protected config saves
* chore: format
* refactor: reorganize TOTP verification UI components for better layout
* refactor: clean up recovery stage UI by removing unused styles and improving label handling
* docs: add TOTP two-factor authentication documentation for WebUI
---------
Co-authored-by: Soulter <905617992@qq.com>
* fix: improve template list config handling
* feat(webui): show template list display item
* feat(webui): allow hiding template list hints
* docs: document template list metadata fields
* fix: support file fields in template list configs
* refactor(ltm): redesign long-term memory with context compaction
- Add raw_records / contexts / summaries data model per group
- Add LLM summary compaction strategy alongside truncation
- Add turn-based (_split_into_rounds) granularity
- Add image caption integration into LTM history
- Add tool_call / tool_result persistence into raw_records
- Add active reply support driven by LTM state
- Improve summary injection prefix with system note and delimiters
- Add info-level logging for summary compaction lifecycle
- Clarify default summary prompt with explicit preserve/drop rules
- Add context_guard for history overflow protection in agent runner
- Add internal agent history compaction in agent_sub_stages
- Add comprehensive LTM unit tests and compaction test suites
* fix(ltm): handle malformed JSON in tool args and clean up lock on session removal
* fix(ltm): guard against duplicate system prompt note injection
* fix(ltm): fall back to user message when internal marker parsing fails
- Treat lines starting with <T:CALL>, <T:RES, or <BOT/ as regular user
messages when their respective parsers return None, instead of silently
dropping them. Defensive guard against malformed internal markers.
* fix(ltm): release session lock during LLM summary generation
* fix(ltm): trim raw_records in handle_message to prevent unbounded growth
* perf(ltm): use len(s) instead of len(s.encode()) in trim loop
Avoid allocating a new bytes object for every string when calculating
buffer size in _trim_raw_records. Character count is sufficient for
the approximate memory cap.
* feat(ltm): make user segment truncation limits configurable
* feat(ltm): pre-fill default LTM summary prompt in config and i18n
* refactor(ltm): hardcode internal segment/trim constants
* refactor(ltm): unify compaction strategy with main agent runner
* feat(ltm): add @mention weight marker for group chat messages
* test: fix test failures from LTM compaction unification
* chore(dashboard): remove obsolete LTM compaction i18n metadata
* chore: shrink codebase
* feat(group-chat): implement group chat context management and related functionality
---------
Co-authored-by: Tsukumi <112180165+Tsukumi233@users.noreply.github.com>
Co-authored-by: zenfun <zenfun510@gmail.com>
Co-authored-by: Soulter <905617992@qq.com>
* fix: plugin name in the marketplace does not match the local plugin
* chore: update test
* Update astrbot/dashboard/routes/plugin.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Update astrbot/dashboard/routes/plugin.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Update astrbot/dashboard/routes/plugin.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* chore: reformat code
* Clean up unused variables in useExtensionPage.js
Removed unused sets for installed repositories and names.
* fix: 统一repo匹配逻辑,移除fallback
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* feat(plugin): add pages field to plugin list API response
Include discovered page names for each plugin in the /api/plugin/get
response, so the frontend can determine whether a plugin has a WebUI
without an extra detail request.
* feat(webui): add direct WebUI access button on plugin cards
- Add "open-webui" button on plugin cards when plugin has pages
- Navigate to plugin's first page directly from the card
- Adjust PluginPagePage iframe height for better UX
- Add i18n labels (zh-CN/en-US/ru-RU)
* perf(plugin): use asyncio.gather for concurrent page discovery
Replace sequential await loop with concurrent processing to avoid
blocking on disk I/O when discovering plugin pages.
* fix(webui): disable open plugin UI button when plugin is deactivated
Prevent navigation to a disabled plugin's WebUI page which would
result in an error.
* test: update plugin API tests to match pages field in list response
- test_plugin_get_excludes_scanned_pages: expect pages field now present
- test_plugins: use name-based lookup instead of exact count assertion
---------
Co-authored-by: lxfight <lxfight@192.168.5.50>
Only overwrite tool-call-related fields from the re-query response, preserving the original completion_text and reasoning_content that were already sent to the user.
* fix: handle delta=None chunks in streaming to prevent SDK to_dict() error
When certain OpenAI-compatible providers (Gemini, DeepSeek, some proxies)
return chunks with choice.delta=None (e.g. ContentBlockDeltaEvent),
ChatCompletionStreamState._convert_initial_chunk_into_snapshot internally
calls choice.delta.to_dict() at line 747, causing:
'NoneType' object has no attribute 'to_dict'
Fix:
1. Skip handle_chunk when delta is None (delta=None chunks have no
content contribution anyway)
2. Wrap get_final_completion in try/except to gracefully fall back to
empty ChatCompletion if SDK state is corrupted
Refs: openai-python#5069, openai-python#5047
* fix: resolve bugs found by Sourcery and gemini-code-assist review
- Remove orphan logger.error that caused NameError on every chunk
- Replace broken empty ChatCompletion fallback with clean return;
streamed content already yielded, no data loss
Co-authored-by: sourcery-ai[bot] <sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <gemini-code-assist[bot]@users.noreply.github.com>
* fix: properly replace get_final_completion fallback in _query_stream
Previous fix_pr_v3 wrongly injected code into terminate() instead.
Now correctly:
1. Replace empty ChatCompletion fallback with clean return in _query_stream
2. Revert terminate() to original (await self.client.close() only)
* fix: revert corrupted terminate() to original
Previous fix_pr_v3 injected wrong-indentation code into terminate().
---------
Co-authored-by: sourcery-ai[bot] <sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <gemini-code-assist[bot]@users.noreply.github.com>
- Updated the VitePress configuration to include links to CLI commands in both English and Chinese.
- Enhanced the AstrBot deployment documentation with instructions for installing it as a system service.
- Created comprehensive CLI commands documentation covering initialization, service management, configuration, and plugin management.
- Added tests for CLI command aliases and service functionalities to ensure proper command registration and behavior.
- Implemented service log management features, including enabling application logging and controlling log visibility.
PR #8015 added 'Noto Sans' to the Google Fonts link and CJK fallback list,
but the font was placed at the end of $cjk-sans-fallback where browsers
never reach it for Cyrillic text. The global $body-font-family also lacked
'Outfit' entirely, causing Vuetify to use CJK fonts as the primary face.
Changes:
- Remove 'Noto Sans' from the end of $cjk-sans-fallback (it is not a CJK font)
- Add 'Outfit' and 'Noto Sans' to $body-font-family before CJK fallbacks
- Update .Outfit class in _container.scss to match the new stack
This ensures:
- Latin text → Outfit
- Cyrillic text → Noto Sans (loaded by vite-plugin-webfont-dl)
- CJK text → Noto Sans SC / PingFang SC etc.
Fixes follow-up to #8015.
The WebUI only loaded Noto Sans SC (Simplified Chinese), which lacks
Cyrillic glyphs. Russian text fell back to system sans-serif, causing
poor rendering depending on the OS.
Changes:
- Load Noto Sans (regular) from Google Fonts alongside Noto Sans SC
- Add 'Noto Sans' at the END of $cjk-sans-fallback (after CJK fonts)
so Chinese text still renders with system CJK fonts first,
while Cyrillic text falls through to Noto Sans.
This ensures both Chinese and Cyrillic text render correctly.
* feat(lark): implement app registration and bot info retrieval
- Add app registration functionality for Lark and Feishu platforms, including endpoints and request handling.
- Introduce polling mechanism for app registration status.
- Create bot info retrieval functionality to fetch bot details after successful registration.
- Enhance dashboard with new UI components for one-click QR setup and manual setup options.
- Update internationalization files to support new features and actions.
- Add unit tests for app registration endpoint resolution and data handling.
* feat(weixin_oc): add WeChat login registration and QR code handling
* fix: handle None tool arguments returned by Claude API for no-parameter tools
* fix: handle None tool arguments from Claude API for no-parameter tools
* fix: generalize None tool args comment
* fix: generalize None tool args comment
* 去除空格,以保证格式正确
- Added advanced settings option in update dialog for better user control.
- Implemented detailed progress tracking for update stages including download size and speed.
- Updated localization files for English, Russian, and Chinese to include new strings for update progress and advanced settings.
- Improved UI for update dialog with better layout and responsiveness.
- Enhanced test coverage for update process including progress tracking.
* fix(webui): enforce 12-char dashboard password policy with backend+frontend validation
* fix(i18n): update password policy hints and validation rules for improved security
* test: adapt dashboard auth fixtures for hashed default password
* fix(security): increase PBKDF2 iterations
* feat(auth): implement secure login challenge and proof verification
* chore: ruff format
* fix(auth): update md5 import syntax for consistency
* feat(dashboard): implement random password generation for empty dashboard password
* feat(auth): enforce plaintext password requirement for legacy MD5 hashes
* fix(i18n): update password hint texts to reflect auto-generated initial passwords
* feat(dashboard): implement password change requirement and reset logic
* feat(auth): implement account setup flow and password change requirements
* feat: Implement legacy password support and upgrade mechanism
- Added `hash_legacy_dashboard_password` function for MD5 hashing of passwords.
- Updated configuration handling to store both PBKDF2 and legacy password hashes.
- Introduced logic to check if password storage has been upgraded and if a password change is required.
- Modified dashboard authentication routes to handle legacy password checks and prompts for upgrades.
- Updated frontend to display warnings for legacy password storage and required upgrades.
- Enhanced tests to cover scenarios for legacy password handling and migration to new storage format.
* fix(logo): update text color styles to use CSS variables for consistency
* feat(dashboard): upgrade password storage and enforce change requirement
* fix(dashboard): update minimum password length from 12 to 10 characters
* fix(dashboard): update minimum password length from 10 to 8 characters
---------
Co-authored-by: RC-CHN <1051989940@qq.com>
When both aiohttp and httpx are installed, google-genai prefers aiohttp
as the async HTTP backend. In error response paths, the aiohttp backend
returns raw aiohttp.ClientResponse objects that google-genai cannot handle,
masking real API errors with:
Unsupported response type: <class 'aiohttp.client_reqrep.ClientResponse'>
This fix explicitly creates an httpx.AsyncClient and passes it via
HttpOptions.httpx_async_client, ensuring the chat provider always uses
the httpx backend. The managed client is closed in terminate().
- Preserve HTTP_PROXY/HTTPS_PROXY support via trust_env=True.
- Preserve provider-level proxy via httpx.AsyncClient(proxy=...).
- Avoid logging full proxy URLs for security.
Fixes#7564
Add documentation to clarify the 16MB zip size limit for plugin
marketplace submissions, along with practical recommendations:
- Compress static assets like images
- Clean up unnecessary files (.git, __pycache__, etc.)
- Optimize dependency sizes
- Use .gitattributes or release branches
Also mention the option to contact maintainers for manual bypass
when the limit cannot be met.
Co-authored-by: Seio <seio@astrbot.app>
The websearch_firecrawl_key config key was added in PR #7764 (Firecrawl
web search provider) but was missing from DEFAULT_CONFIG in default.py.
Because AstrBotConfig.check_config_integrity() removes keys that exist
in the user's cmd_config.json but are absent from DEFAULT_CONFIG, the
firecrawl API key is silently deleted on every container restart.
Fixes: unreported issue (config key removed on restart)
* fix: update contributors image max count to 210
* fix: remove BOM from all README files
PR #8000 follow-up: Sourcery and codereview agent flagged UTF-8 BOM
in 6 README files. BOM is unnecessary in UTF-8 and may cause
compatibility issues with Markdown parsers.
* fix: update contributors image to 300 with 15 columns
---------
Co-authored-by: Blueteemo <Blueteemo@users.noreply.github.com>
* feat: enhance plugin page internationalization
- Updated PluginRoute to read initial context from JWT and set it in the bridge SDK.
- Added methods to retrieve locale and plugin metadata for better i18n support.
- Enhanced pluginI18n utility to resolve page-specific translations and added new functions for page titles and descriptions.
- Modified PluginPagePage and PluginDetailPage to utilize new i18n features for dynamic content rendering.
- Improved documentation for plugin page i18n structure and usage.
- Added tests to verify the correct integration of i18n in plugin pages and context handling.
* fix test
* feat: supports plugin to add skills
* fix tests
* fix: fs tools
* Add tests for plugin skills handling and improve skill management
- Implement test for restricted local member reading plugin skill inventory even if the plugin is inactive.
- Ensure that the skill synchronization process retains built-in skills when local skills are empty, including proper handling of plugin paths.
- Update dashboard tests to verify that plugin details include components when requested.
- Enhance skill metadata enrichment tests to include inactive plugin-provided skills for inventory.
- Add filtering tests for plugin skills based on current configuration, ensuring only allowed plugins are considered and inactive plugins are skipped.
Co-authored-by: Copilot <copilot@github.com>
* fix: handle PPIO platform context-length error messages (#7888)
* fix: 压缩算法删除 user 消息 Bug 修复
* perf: improve truncate algo
* fix: improve context length error detection for PPIO platform compatibility
- Extend error detection to handle PPIO's error message format:
'The input is longer than the model's context length'
- Add case-insensitive matching using .lower() for robustness
- Maintain backward compatibility with existing 'maximum context length' check
This fixes the issue where PPIO platform models (e.g., ppio/zai-org/glm-5-turbo)
would fail with AgentState.ERROR due to unrecognized context length errors.
---------
Co-authored-by: Soulter <905617992@qq.com>
* fix: 支持微信客服文件消息 (#7923)
* fix: 支持微信客服文件消息
* fix: remove WeCom file message placeholder
* fix(provider): fix Anthropic custom headers and system prompt compatibility (#7587)
* fix(provider): fix Anthropic custom headers and system prompt compatibility
- Pass custom_headers via AsyncAnthropic's `default_headers` parameter
instead of creating a separate httpx.AsyncClient. This avoids
`isinstance` check failures when multiple httpx installations exist
on sys.path (e.g. bundled Python + system Python).
- Use list format for the `system` parameter (`[{"type": "text", ...}]`)
instead of a plain string. The list format is supported by the official
Anthropic API and is also compatible with third-party API proxies that
reject the string format.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(provider): fix Anthropic custom headers and system prompt compatibility
- Pass custom_headers via AsyncAnthropic's `default_headers` parameter
instead of creating a separate httpx.AsyncClient. This avoids
`isinstance` check failures when multiple httpx installations exist
on sys.path (e.g. bundled Python + system Python).
- Use list format for the `system` parameter (`[{"type": "text", ...}]`)
instead of a plain string. The list format is supported by the official
Anthropic API and is also compatible with third-party API proxies that
reject the string format.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add test unit
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* perf: improve logic of adding models
Co-authored-by: piexian <piexian@users.noreply.github.com>
* chore: remove redundant logger messages and improve log clarity
Co-authored-by: Copilot <copilot@github.com>
* chore: ruff format
* docs: update knowledge base docs
closes: #7962
* fix(#7907): send_message_to_user cron 场景下 session 容错 (#7911)
* fix: send_message_to_user cron 场景下 session 容错 (#7907)
- LLM 在主动场景可能只传 session_id 而非完整三段式,
from_str 失败时用 current_session 补全前两段。
Co-authored-by: Copilot <copilot@github.com>
* fix: 限制 session 补全仅对裸 session_id 生效,避免误修带冒号的错误输入 (#7907)
* feat: add session information to cron job payload
Co-authored-by: Copilot <copilot@github.com>
* fix: improve clarity and consistency of safety mode prompts
Co-authored-by: Copilot <copilot@github.com>
---------
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Weilong Liao <37870767+Soulter@users.noreply.github.com>
Co-authored-by: Soulter <905617992@qq.com>
* perf: tool rendering in conversation page (#7937)
* fix(dashboard): route conversation history tool messages through ToolCallCard
When viewing conversation history, large tool outputs (e.g. a single
git log --stat producing tens of KB) caused the browser renderer to
freeze. Root cause: formattedMessages mapped every role (including
tool / system / _checkpoint) into user/bot bubbles, and bot plain
strings went through markstream-vue's MarkdownRender. Single 88KB
tool messages plus 88-of-them adding up to ~349KB of synchronous
markdown parsing was enough to block the main thread for 5+ seconds.
This patch:
- Indexes tool-role messages by tool_call_id
- Filters formattedMessages to user/assistant only — tool, system and
_checkpoint roles no longer render as standalone bubbles
- Converts assistant.tool_calls (OpenAI shape, with tc.name/tc.arguments
fallbacks) into the existing tool_call MessagePart, attaching the
paired result so MessageList's ToolCallCard renders it (default
collapsed, no longer feeds large strings into the markdown renderer)
- Drops empty placeholder plain parts when an assistant message only
carries tool_calls
- Sets ts/finished_ts to 0 as a sentinel: ToolCallCard.toolCallDuration
returns "" when startTime <= 0, suppressing a misleading "0ms"
duration that would otherwise appear because conversation history
has no real timing data
Behavior change: tool results are now embedded in their assistant's
ToolCallCard.result instead of appearing as separate bot bubbles.
This matches the main chat UI's behavior.
Fixes#7929
Refs #7372#7456
* style(dashboard): use single scrollbar in conversation history preview
ToolCallCard's result/args panes have their own max-height + overflow,
which produced a nested scrollbar when nested inside the history
preview's already-scrollable .conversation-messages-container. Override
those constraints inside the preview only — the outer 500px-bounded
container already provides scroll bounds, so a single scrollbar feels
cleaner. The main chat UI is unaffected.
---------
Co-authored-by: wanger <wanger@example.com>
* fix: ruff format
* feat: add python tool timeout param (#7953)
* feat: add python tool timeout param
* Update python.py
---------
Co-authored-by: Weilong Liao <37870767+Soulter@users.noreply.github.com>
* fix: 钉钉连接超时后自动重连失败 (#7924)
* fix: improve DingTalk adapter error handling in run() method
* fix: add retry logic for DingTalk SDK task unexpected exit
* fix: use task.add_done_callback to wake thread on task completion, handle UnboundLocalError
* refactor: extract retry logic into handle_retry helper function
---------
Co-authored-by: Blueteemo <Blueteemo@users.noreply.github.com>
---------
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: leonforcode <leonbeyourside01@gmail.com>
Co-authored-by: AstralSolipsism <134063164+AstralSolipsism@users.noreply.github.com>
Co-authored-by: Pink YuDeer <wer00001@outlook.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: piexian <piexian@users.noreply.github.com>
Co-authored-by: NayukiMeko <ChibaNayuki@163.com>
Co-authored-by: wanger <122891289+10knamesmore@users.noreply.github.com>
Co-authored-by: wanger <wanger@example.com>
Co-authored-by: Haoran Xu <3230105281@zju.edu.cn>
Co-authored-by: 千岚之夏 <108566281+Blueteemo@users.noreply.github.com>
Co-authored-by: Blueteemo <Blueteemo@users.noreply.github.com>
* fix(dashboard): route conversation history tool messages through ToolCallCard
When viewing conversation history, large tool outputs (e.g. a single
git log --stat producing tens of KB) caused the browser renderer to
freeze. Root cause: formattedMessages mapped every role (including
tool / system / _checkpoint) into user/bot bubbles, and bot plain
strings went through markstream-vue's MarkdownRender. Single 88KB
tool messages plus 88-of-them adding up to ~349KB of synchronous
markdown parsing was enough to block the main thread for 5+ seconds.
This patch:
- Indexes tool-role messages by tool_call_id
- Filters formattedMessages to user/assistant only — tool, system and
_checkpoint roles no longer render as standalone bubbles
- Converts assistant.tool_calls (OpenAI shape, with tc.name/tc.arguments
fallbacks) into the existing tool_call MessagePart, attaching the
paired result so MessageList's ToolCallCard renders it (default
collapsed, no longer feeds large strings into the markdown renderer)
- Drops empty placeholder plain parts when an assistant message only
carries tool_calls
- Sets ts/finished_ts to 0 as a sentinel: ToolCallCard.toolCallDuration
returns "" when startTime <= 0, suppressing a misleading "0ms"
duration that would otherwise appear because conversation history
has no real timing data
Behavior change: tool results are now embedded in their assistant's
ToolCallCard.result instead of appearing as separate bot bubbles.
This matches the main chat UI's behavior.
Fixes#7929
Refs #7372#7456
* style(dashboard): use single scrollbar in conversation history preview
ToolCallCard's result/args panes have their own max-height + overflow,
which produced a nested scrollbar when nested inside the history
preview's already-scrollable .conversation-messages-container. Override
those constraints inside the preview only — the outer 500px-bounded
container already provides scroll bounds, so a single scrollbar feels
cleaner. The main chat UI is unaffected.
---------
Co-authored-by: wanger <wanger@example.com>
* fix(provider): fix Anthropic custom headers and system prompt compatibility
- Pass custom_headers via AsyncAnthropic's `default_headers` parameter
instead of creating a separate httpx.AsyncClient. This avoids
`isinstance` check failures when multiple httpx installations exist
on sys.path (e.g. bundled Python + system Python).
- Use list format for the `system` parameter (`[{"type": "text", ...}]`)
instead of a plain string. The list format is supported by the official
Anthropic API and is also compatible with third-party API proxies that
reject the string format.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(provider): fix Anthropic custom headers and system prompt compatibility
- Pass custom_headers via AsyncAnthropic's `default_headers` parameter
instead of creating a separate httpx.AsyncClient. This avoids
`isinstance` check failures when multiple httpx installations exist
on sys.path (e.g. bundled Python + system Python).
- Use list format for the `system` parameter (`[{"type": "text", ...}]`)
instead of a plain string. The list format is supported by the official
Anthropic API and is also compatible with third-party API proxies that
reject the string format.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add test unit
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* fix: 压缩算法删除 user 消息 Bug 修复
* perf: improve truncate algo
* fix: improve context length error detection for PPIO platform compatibility
- Extend error detection to handle PPIO's error message format:
'The input is longer than the model's context length'
- Add case-insensitive matching using .lower() for robustness
- Maintain backward compatibility with existing 'maximum context length' check
This fixes the issue where PPIO platform models (e.g., ppio/zai-org/glm-5-turbo)
would fail with AgentState.ERROR due to unrecognized context length errors.
---------
Co-authored-by: Soulter <905617992@qq.com>
- New config item fallback_max_context_tokens (default 128k)
- When max_context_tokens is 0 and model not in LLM_METADATAS,
use fallback_max_context_tokens as the context window limit
- Unified global config under provider_settings, in truncate_and_compress section
- i18n: zh-CN, en-US, ru-RU
Co-authored-by: AstrBot <astrbot@container>
* fix: clarify context management UI text to explain execution order
* fix: update hint references to match updated description names
---------
Co-authored-by: Blueteemo <Blueteemo@users.noreply.github.com>
* feat: supports to download plugins via astrbot official plugin storage
* fix: improve exception message for missing root directory name in PluginUpdator
* feat: Implement plugin internationalization support
- Added support for plugins to provide localized names, descriptions, and configuration texts through JSON files in the `.astrbot-plugin/i18n` directory.
- Updated various components to utilize the new internationalization functions, including `ConfigItemRenderer`, `ExtensionCard`, `ItemCard`, `ObjectEditor`, `PluginSetSelector`, and `TemplateListEditor`.
- Enhanced the `usePluginI18n` utility to resolve plugin-specific translations based on the current locale.
- Modified the `common` store to include an `i18n` field for plugin metadata.
- Updated documentation to include guidelines for plugin internationalization.
- Added tests to ensure proper loading of localization files and integration with plugin metadata.
* perf: code quality
* feat: update config path handling for internationalization support
* fix: guard against None system_prompt in _ensure_persona_and_skills
ProviderRequest.system_prompt defaults to None. When a persona with a
prompt is configured, _ensure_persona_and_skills calls
``req.system_prompt += ...`` which crashes with ``TypeError`` when
system_prompt is None.
Added a None guard before the persona prompt injection and skills prompt
appending sections so they always operate on a string.
* chore: delete tests/unit/test_system_prompt_none_bug.py
---------
Co-authored-by: Weilong Liao <37870767+Soulter@users.noreply.github.com>
* feat: update ExtensionCard variant to outlined and adjust InstalledPluginsTab layout for better responsiveness
* feat: update MCP servers management UI and add descriptions for better clarity
* feat: enhance OutlinedActionListItem component with clickable functionality and new slots
feat(i18n): update English, Russian, and Chinese translations for extension and knowledge base features
fix: improve DocumentDetail and KBDetail views with outlined card styles and remove unnecessary dividers
refactor: streamline KBList component to use OutlinedActionListItem for better UI consistency
style: adjust styles for knowledge base components and improve responsive design
test: add security tests for skill file browser and editor to prevent path traversal and file size issues
* feat: update UI components and styles for improved layout and readability
* feat: add PluginDetailPage component for detailed plugin information display
refactor: remove extension preference storage management and related tests
chore: clean up useExtensionPage by removing unused preference storage logic
* feat: add getHandlerDisplayName function for improved handler name display
When the dashboard password is still the default (not configured),
the user's first login attempt automatically saves their chosen
username and password as the admin credentials, eliminating the
need to pre-set a password via CLI.
* fix(dashboard): use v-autocomplete for list+options config field (#7884)
Replace v-select with v-autocomplete in the list+options branch of
ConfigItemRenderer. v-select's keyboard typeahead auto-toggles the
first prefix-matching item in multiple mode, which is unusable for
long option lists (e.g. plugin language pickers). v-autocomplete
filters the dropdown by typed text instead.
Bind v-model:search and clear it in @update:model-value so the search
box resets after each selection, allowing consecutive keyword search.
* perf(dashboard): memoize list config select items via computed
Wrap getSelectItems(itemMeta) in a computed so the options array
is only re-mapped when itemMeta changes, not on every keystroke
in the v-autocomplete search input. Avoids quadratic-ish work for
long option lists
---------
Co-authored-by: wanger <wanger@example.com>
Run `pnpm lint:check` before build to catch format and import issues early.
Biome's noUnusedVariables is disabled for Vue files since biome cannot
detect variables used in <template> blocks.
* fix: warn when default chat provider is unset
* fix: align startup warning with provider fallback
* refactor: simplify default chat provider warning guard checks
* feat: warn when default chat provider id is invalid or missing
- Emit a warning when `default_provider_id` points to a
non-existent enabled provider, preventing silent fallback to
an unexpected model.
- Reset the warning guard before each
`provider_manager.initialize()` so configuration reloads
trigger a fresh re-evaluation.
- Harden guard checks to handle `None` `provider_settings` and
`None` provider IDs gracefully.
* test: cover fallback and invalid default provider id warnings
- Add case for `curr_provider_inst=None` to verify fallback to
`providers[0]`.
- Add case for a `default_provider_id` that does not match any enabled
provider.
* style: format default chat provider warning
---------
Co-authored-by: RC-CHN <1051989940@qq.com>
- 22 unit test files added/modified across all core modules
- Fix jsonschema ValidationError import in test_tool
- Coverage increased from 23% to ~35% overall
Class-level list vars caused cross-instance sharing. Tests expecting
isolated registration containers failed. Move to __init__ and add the
reset_runtime_registrations helper that tests depend on.
InitialLoader.start now calls lifecycle.initialize() (not initialize_core).
Updated test mocks and assertions accordingly. 3 tests remain that assume
a split-phase bootstrap_runtime call that no longer exists in the current
InitialLoader.
Real bash subprocess via PersistentShellSession binds stdin/stdout to the
creating event loop. pytest-asyncio's per-function loop switching caused
'Future attached to a different loop' errors. Mock the session instead.
Also remove the unused session-level cleanup fixture and patch.
This function was dropped during merge, causing ImportError in
test_upload_filename_sanitization.py and breaking upload handling.
Re-implemented with null-byte removal, path traversal stripping,
fakepath prefix removal, and empty-fallback to UUID.
BaseDatabase added 5 new abstract methods (list_sdk_platform_message_history,
delete_platform_message_before, delete_platform_message_after,
delete_all_platform_message_history, find_platform_message_history_by_idempotency_key)
but SQLiteDatabase did not implement them, causing TypeError on startup.
All methods follow the existing codebase patterns using async SQLAlchemy sessions
with the delete/select helpers.
* feat: add inline message editing and regeneration functionality for webui
- Implemented inline editing for user messages in the chat component.
- Added a regenerate menu for retrying messages with different models.
- Enhanced message handling to include llm_checkpoint_id for better tracking.
- Updated localization files to include new actions for retrying and model selection.
- Introduced tests for checkpoint message handling and chat route functionality.
* feat: thread mode in webui
* feat: enhance message editing functionality to allow only the latest user message to be edited
* feat: add error handling and user feedback for thread creation in chat component
* feat: add thread count display and localization support in chat component
* feat: add RefsSidebar component and integrate reference management in chat UI
* feat: improve message editing validation and cleanup for bot messages
* feat: enhance checkpoint message handling with binding and dumping functionality
# Conflicts:
# astrbot/core/agent/message.py
# astrbot/core/agent/runners/tool_loop_agent_runner.py
# astrbot/core/astr_main_agent.py
# astrbot/core/db/sqlite.py
# astrbot/core/pipeline/process_stage/method/agent_sub_stages/internal.py
# astrbot/core/platform/sources/webchat/webchat_adapter.py
# astrbot/dashboard/routes/chat.py
# astrbot/dashboard/routes/live_chat.py
# dashboard/src/components/chat/Chat.vue
# dashboard/src/components/chat/ChatInput.vue
# dashboard/src/components/chat/ChatMessageList.vue
# dashboard/src/components/chat/ProviderModelMenu.vue
# dashboard/src/components/shared/StyledMenu.vue
# dashboard/src/composables/useMessages.ts
# dashboard/src/i18n/locales/ru-RU/features/chat.json
- clearStaged({ revokeUrls: false }) to preserve blob URLs during send
- File type icon helpers (fileTypeStyles, fileExtension, filePresentation)
- CSS transitions for input container and textarea
- File dedup via SHA-256 signature in useMediaHandling
- Replace LocalShellComponent's one-shot subprocess.run() with a
PersistentShellSession that wraps a long-running bash process per UMO.
cd/export/source now persist naturally within a conversation.
- Support background task execution via nohup.
- Remove unused ToolSessionManager / ToolSessionState (dead code,
never wired to any consumer).
- Fix performance benchmark: separate throughput and memory measurement
so tracemalloc doesn't distort timing (was 7x slower).
- Optimize bool validation in CommandFilter with frozenset + isinstance
short-circuit.
* fix(core): security fix - restrict send_message_to_user to current session only
Closes#7822
SECURITY: Remove the user-controlled 'session' parameter from the
send_message_to_user tool. Previously, a regular user could ask the
LLM to send messages to any arbitrary session (group chat) by
providing a crafted session string, which is a high-risk
vulnerability.
Changes:
- Remove 'session' parameter from tool schema (LLM can no longer
propose it)
- Always use context.context.event.unified_msg_origin as the target
session
- Update description to clearly state that messages can only be sent
to the current user's session
* fix: restore session param but restrict to admin only
- Re-add the parameter removed in the original PR
- Non-admin users can only send to their own session (current_session)
- Admin users can send to any session via the param
- Uses from computer_tools.util (same pattern as fs.py)
- Ref: https://github.com/AstrBotDevs/AstrBot/issues/7822
Co-authored-by: Soulter <soulter@astrbot.app>
* Update message_tools.py
---------
Co-authored-by: AstrBot <bot@astrbot.app>
* feat(shell): add background command execution with output redirection and timeout support
* feat(shell): update timeout parameter to be optional in shell execution methods
* feat(shell): set default timeout for shell execution to 10,000,000 milliseconds
* feat(shell): set default timeout to 300s for shell execution
* feat(shell): reorder timeout parameter in ExecuteShellTool configuration
* feat(shell): implement background command execution with detached shell command support
Co-authored-by: Copilot <copilot@github.com>
* test(shell): remove obsolete test for background shell command output redirection
* fix: reorder import statements in shell.py for consistency
* fix: wrap command in parentheses for background output redirection
---------
Co-authored-by: Copilot <copilot@github.com>
* feat: add one-line deploy script (deploy-cli.sh) and update cli.md
- Add docs/scripts/deploy-cli.sh for one-command deployment (Linux/macOS/WSL)
- Update docs/zh/deploy/astrbot/cli.md to reference local script
- Replace non-existent https://astrbot.app/deploy.sh with raw.githubusercontent.com URL
- Add local run tip and WSL-based Windows support
* fix: address PR review feedback for deploy-cli.sh
- Replace sort -V with Python-native version check (macOS BSD compat)
- Bump Python requirement from >=3.10 to >=3.12 (match pyproject.toml)
- Detect current directory as project root (avoid nested clone)
- Handle existing non-git directory explicitly
- Add curl dependency check
- Support ASTRBOT_REPO and ASTRBOT_DIR env vars for forks/mirrors
- Update cli.md version description to match
* feat: add Windows PowerShell deploy script and update docs
- Add deploy-cli.ps1 for Windows native environment (PowerShell 7+)
- Update cli.md to document Windows one-liner deployment
- Add local script execution instructions for both bash and ps1
* refactor: standardize log messages and improve clarity in various modules
Co-authored-by: Copilot <copilot@github.com>
* docs: 移除一行命令快速部署部分,简化安装说明
* feat: 添加脚本以复制部署 CLI 文件并更新构建命令
* refactor: 更新日志消息以提高可读性,统一英文提示信息
---------
Co-authored-by: Soulter <905617992@qq.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Weilong Liao <37870767+Soulter@users.noreply.github.com>
* fix(dashboard): add tooltip for truncated command/tool descriptions in WebUI
- CommandTable.vue: add :title binding to description div
- ToolTable.vue: add :title binding to description and origin_name divs
Fixes#7583 - Webui中超出显示长度的指令描述无法以任何方式看到
* docs: add pre-commit setup guide to AGENTS.md
Extract the pre-commit and ruff setup instructions from README.md
into AGENTS.md so AI agents have a complete reference for
setting up the development environment.
---------
Co-authored-by: AstrBot Fixer <astrbot@fix-bot.local>
Co-authored-by: AstrBot Fixer <astrbot-fixer@users.noreply.github.com>
* fix: restore T2I text template rendering
- keep using {{ text | safe }} instead of text_base64
- inject Shiki runtime by default for T2I templates
- update built-in templates to read markdown from a hidden textarea
- improve WebUI preview sample text and Shiki runtime serving
- add regression tests for template rendering and runtime injection
* fix: prevent injected Shiki runtime from breaking T2I templates
* fix(t2i): restore raw text template rendering
* test(t2i): remove test
* fix(t2i): restore previewText
* fix(stats): TPM now only counts output tokens
- Add range_total_output_tokens accumulation, separate from total tokens
- Change range_avg_tpm formula to use output tokens only
- Update i18n labels to reflect Output TPM
* fix(stats): range
* fix: update reasoning_content handling to support empty string values
* fix: add reasoning_content field for DeepSeek v4 models in assistant messages
PR #7202 added empty-assistant filtering in `_query` so strict
providers (Moonshot, etc.) wouldn't 400 on history with blank
assistant entries. The streaming sibling `_query_stream` was
never updated, so DeepSeek Reasoner — which returns reasoning only
during tool calls, leaving serialized content as `""` — blew up with
`Invalid assistant message: content or tool_calls must be set` on
the next turn.
Hoisted the filter into a `_sanitize_assistant_messages` helper and
called it from both paths. Also widened the empty check to cover
`content == []`, which the original filter missed and which shows up
with providers that emit content as a list of parts.
* feat: add Firecrawl web search and extract tools, update configuration and tests
* feat: implement Firecrawl API integration and error handling in web search tools
* feat: enhance Firecrawl web search with session management and payload validation
* feat: Firecrawl web search to use aiohttp.ClientSession directly for improved session management as it was
* feat: update Firecrawl search to handle grouped web data response and add corresponding tests
* feat: refactor Firecrawl web search to use aiohttp.ClientSession for improved error handling and session management
* feat: remove unused coercion function and update Firecrawl search to use default limit in payload
* perf: improve tool calls in reasoning and multiple tool calls display
- Updated LiveChatRoute and OpenApiRoute to replace manual message accumulation with BotMessageAccumulator.
- Simplified message saving logic by using build_bot_history_content and collect_plain_text_from_message_parts.
- Enhanced message processing to handle various message types (plain, image, record, file, video) more efficiently.
- Improved reasoning handling by extracting thinking parts and displaying them correctly in the UI components.
- Refactored message normalization and reasoning extraction logic in useMessages composable for better clarity and maintainability.
- Updated ChatMessageList, MessageList, StandaloneChat, and ReasoningBlock components to accommodate new message structure and rendering logic.
* feat(chat): reasoning activity panel
- Introduced a new ReasoningSidebar component for displaying reasoning details.
- Refactored MessageList and StandaloneChat components to utilize renderBlocks for improved message part handling.
- Added ReasoningTimeline component to visualize reasoning steps.
- Updated message handling logic to differentiate between thinking and content blocks.
- Enhanced localization for reasoning-related terms in English, Russian, and Chinese.
- Improved styling for various components to ensure consistency and readability.
* Update astrbot/dashboard/routes/chat.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
remove deprecated API modules and example scripts; update core modules
(agents, providers, tools, platform adapters, utils), dashboard package
and components, and unit tests.
* fix: handle reasoning_content when completion_text is empty (kimi-for-coding thinking mode)
* fix: use elif for result_chain/completion_text to avoid duplication, keep reasoning_content independent per review feedback
---------
Co-authored-by: Blueteemo <Blueteemo@users.noreply.github.com>
* fix: add ConnectionError and OSError to retry decorator for QQ Official API
* fix: remove redundant ConnectionError and add asyncio.TimeoutError per review feedback
* fix: rename decorator back to _qqofficial_retry
---------
Co-authored-by: Blueteemo <Blueteemo@users.noreply.github.com>
* feat: add inline message editing and regeneration functionality for webui
- Implemented inline editing for user messages in the chat component.
- Added a regenerate menu for retrying messages with different models.
- Enhanced message handling to include llm_checkpoint_id for better tracking.
- Updated localization files to include new actions for retrying and model selection.
- Introduced tests for checkpoint message handling and chat route functionality.
* feat: thread mode in webui
* feat: enhance message editing functionality to allow only the latest user message to be edited
* feat: add error handling and user feedback for thread creation in chat component
* feat: add thread count display and localization support in chat component
* feat: add RefsSidebar component and integrate reference management in chat UI
* feat: improve message editing validation and cleanup for bot messages
* feat: enhance checkpoint message handling with binding and dumping functionality
* feat: update FileReadTool description to mention image and PDF support
Add explicit mention of image (OCR) and PDF (text extraction) support
to the FileReadTool description for better discoverability.
* feat: update FileReadTool description to include support for docx and epub files; change base64 decoding to utf-8
* feat: enhance ToolLoopAgentRunner to support image and audio modalities; add context sanitization logic
* fix: accept both str and re.Pattern in RegexFilter
RegexFilter.__init__ now handles compiled re.Pattern objects by
extracting .pattern for regex_str, preventing TypeError during
JSON serialization in the dashboard plugin API.
* perf: 精简代码
* fix: prevent path traversal in backup importer (CWE-22)
Validate that all file write targets resolve within their expected
base directories before writing. This prevents crafted backup ZIP
files from writing to arbitrary filesystem locations via malicious
path values in attachment records, media file paths, or directory
entries.
* fix: use Path.is_relative_to for robust path containment check
* fix: add explicit strict=False to Path.resolve() calls
* style: format backup importer
---------
Co-authored-by: 邹永赫 <1259085392@qq.com>
* feat: add EPUB parsing support for knowledge base and file reader
* feat: update supported file formats for document upload in knowledge base
* feat: enhance EPUB parser to support spine order and generic containers
* makeitdown parse epub
* update parser
* fix
Improve robustness of tool call handling in OpenAI completions and agent tool loop by avoiding premature filtering and surfacing clearer errors when tools are missing.
* Refactor tool call argument handling in openai_source.py
* Improve error logging for missing tools
Log available tools when a specified tool is not found.
* fix: prevent Telegram media group exceptions from being silently swallowed
process_media_group() is invoked by APScheduler via add_job(). If
convert_message() or handle_msg() raises (e.g. get_file() network
timeout, file download failure), APScheduler catches the exception
internally and only logs it through its own logger, which is often
not configured in AstrBot. The result is that the media group
silently disappears with no trace in the application logs.
Two changes:
- Wrap the body of process_media_group() in try/except so failures
are logged through AstrBot's own logger with full traceback.
- Register an EVENT_JOB_ERROR listener on the scheduler as a
safety net, so any future scheduled job that throws will also
surface in the logs.
Fixes#7512
* ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: implement FTS5 support in DocumentStorage and SparseRetriever with tokenizer enhancements
* feat: optimize FTS row handling in DocumentStorage and update query tokenization in SparseRetriever
* feat: add MiniMax Token Plan provider with hardcoded model list (fix#7585)
- Add new provider 'minimax_token_plan' for MiniMax Token Plan users
- Inherit ProviderAnthropic to reuse all chat/completion logic
- Hardcode api_base to https://api.minimaxi.com/anthropic
- get_models() returns hardcoded list: MiniMax-M2.7, M2.5, M2.1, M2
- Highspeed models excluded (require premium tier)
- Reason for hardcoding: Token Plan API does not expose /models endpoint
- Fixes: https://github.com/AstrBotDevs/AstrBot/issues/7585
* fix: remove api_base from config template and add model validation
- Remove api_base from default_config_tmpl (always overridden, misleading)
- Add model validation against MINIMAX_TOKEN_PLAN_MODELS
- Raise clear ValueError if user configures an unsupported model
Addressed Sourcery AI review comments.
* fix: use custom_headers for Bearer token auth instead of auth_header
MiniMax Token Plan requires Authorization: Bearer <token> header.
Use custom_headers to inject the correct auth header instead of
the non-functional auth_header key.
Addressed Gemini Code Assist review comment.
* fix: update MiniMax Token Plan provider adapter and documentation to English
* feat: add MiniMax Token Plan configuration and icon support
* feat: remove default configuration template from MiniMax Token Plan provider adapter
---------
Co-authored-by: Soulter <905617992@qq.com>
When a numeric input field was focused but not edited, the blur handler
called toNumber(null) which returned 0 via parseFloat(null) → NaN → 0.
Now we skip emitting the update when numericTemp is null (no edits made).
- ToolSet.add() now protects active tools from inactive overrides
- Add missing _has_meaningful_content() method in RespondStage
- Remove is_local=True from ExecuteShellTool (no longer supported)
- Fix ToolSet() missing namespace argument in get_full_tool_set()
- Rewrite tests to match new tool architecture (cron_tools, func_tool_manager, tool_conflict_resolution)
* fix: improve error handling for knowledge base upload
- Log details field in KnowledgeBaseUploadError for better debugging
- Distinguish between empty pre-chunked text and empty chunking result
with appropriate error messages
* style: format code
- Remove TUI platform adapter and web API routes
- Add DiscordEmbed, DiscordButton, DiscordReference, DiscordView to ComponentType enum
- Fix Platform.terminate() and Platform.get_client() with proper implementations
- Fix AstrBotMessage.raw_message type from object to Any
- Add Any type annotation to CONFIG_METADATA_2
* feat: filesystem grep, read, edit file
* feat: add file write tool and enhance file read functionality
* feat: enhance tool prompt formatting and add escaped text decoding for file editing
* feat: remove redundant safe path tests from security restrictions
* feat: implement file read tool with support for text and image files, including validation for large files
* feat: add file read utilities and integrate with filesystem tools
* refactor: move computer tools to builtin tools registry
* refactor: remove unused plugin_context parameter from _apply_sandbox_tools
* feat: supports to display enabled builtin tools in configs
* feat: add tooltip for disabled builtin tools and update localization strings
* feat: add workspace extra prompt handling in message processing
* feat: add ripgrep installation to Dockerfile
* perf: shell executed in workspace dir in local env
* feat: enhance file reading capabilities to support PDF and DOCX parsing, including workspace storage for long documents
* feat: update converted text notice to suggest using grep for large files
* feat: implement handling for large tool results with overflow file writing and read tool integration
* fix: test
* feat: enhance onboarding steps to include computer access configuration and related help information
* feat: add support for additional temporary path in restricted environment checks
* feat: update computer access hints and add detailed configuration instructions
* feat(discord): add configurable bot message filtering
Add `discord_allow_bot_messages` config option to allow receiving
messages from other Discord bots. This is useful for bot-to-bot
communication scenarios like message forwarding between channels.
By default, bot messages are still ignored (backward compatible).
Usage: Set `discord_allow_bot_messages: true` in your Discord
platform configuration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(discord): add WebUI config for discord_allow_bot_messages
Add configuration option to the dashboard for the new
discord_allow_bot_messages feature. Users can now enable/disable
this option through the WebUI in all supported languages
(zh-CN, en-US, ru-RU).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(discord): use typed constructor argument for allow_bot_messages
Address code review feedback:
- Add `allow_bot_messages` as a typed constructor argument in DiscordBotClient
- Simplify the on_message check by using the instance attribute directly
- Pass the parameter in constructor instead of using setattr
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: MinaraAgent <minara-agent@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
- Move logo and print_logo to new astrbot/cli/banner.py module
to avoid circular imports
- Add is_interactive() helper to detect TTY
- Show ASCII logo in run/init commands only in interactive mode
- Show WeChat QR code ASCII art only in interactive mode;
non-interactive mode shows just the QR link
- Add `astrbot version` subcommand showing:
- AstrBot version
- Python version
- System/machine info
- Git branch and commit
- AstrBot root path
- Platform details
- Also works with `astrbot --version` flag
Resolved all conflicts using dev (HEAD) version:
- func_tool_manager.py: migrated old implementation into new architecture
- tool_loop_agent_runner.py: preserve lazy_load mode, remove step limit
- Platform adapters, dashboard, core modules: use HEAD version
* perf: replace cron tools with FutureTaskTool for improved task management
* feat: enhance FutureTaskTool with edit functionality and improve descriptions
* feat: add edit functionality for cron jobs and update related UI components
When user installs a dev/beta/alpha/rc version (e.g. 4.25.0-dev),
check_update would skip prerelease releases and compare against the
latest stable (e.g. 4.24.0). Since 4.25.0-dev > 4.24.0 in semver
comparison (numeric part takes precedence), it incorrectly prompted
to update.
Now checks if current version is prerelease and already newer than
the latest stable - in that case, no update prompt is shown.
Fixes: update button shown to users running dev/unstable versions
AstrBot uses a lock file (astrbot.lock) to prevent concurrent instances.
Before allowing a password change via `astrbot conf admin`, the CLI now
attempts to acquire the lock with a 1-second timeout. If acquisition fails
(another process holds it), the command is rejected with a clear error
message instructing the user to stop astrbot first.
Previously, a URL like api.lightjunction.online:3000 (without https://)
was stored as-is and treated as a relative path, causing requests to
hit the frontend origin instead of the configured backend. URLs with a
single slash like https:/api... were also incorrectly normalized.
Now normalizeConfiguredApiBaseUrl always prepends https:// if the input
doesn't start with http:// or https://, and apiStore.setApiBaseUrl also
normalizes before storing to keep state and localStorage consistent.
Before login attempts, check if apiBaseUrl is configured. If empty,
emit openServerConfig event so LoginPage opens the server config dialog
instead of silently sending requests to the frontend origin (causing 405).
collect_commands() was defined as a sync def but erroneously contained
SDK bridge command registration logic with await sync_commands() inside.
Extract SDK bridge registration into async _register_sdk_commands() and
keep collect_commands() as pure sync (returns command list only).
Also adds missing cast import.
Resolved merge conflicts in:
- func_tool_manager.py: kept origin version (full implementation)
- astr_main_agent*.py: kept HEAD version (complete refactor)
- cron_tools.py: kept HEAD version (with get_all_tools)
- config/default.py: kept HEAD version (DEFAULT_WEB_SEARCH_PROVIDER)
- dashboard/*.vue: kept HEAD version
- web_searcher engines: kept HEAD version
- Added new tools: knowledge_base_tools, message_tools, registry, web_search_tools
* feat: Refactor astrbot builtin tool management
- Introduced a new registry for builtin tools to streamline their management.
- Added `SendMessageToUserTool`, `KnowledgeBaseQueryTool`, and various web search tools as builtin tools.
- Updated `FunctionToolManager` to cache and retrieve builtin tools efficiently.
- Modified `CronJobManager` to utilize the new `SendMessageToUserTool`.
- Enhanced the dashboard to display readonly status for builtin tools and prevent toggling their state.
- Added tests for builtin tool injection and retrieval to ensure proper functionality.
* fix: escape file path in shell command to prevent injection vulnerabilities
* feat:Brave Search API adapted
* Modified hint message
* Modified according to AI reviews
* chore: revert compose.yml changes
---------
Co-authored-by: Soulter <905617992@qq.com>
When streaming is enabled, markdownify() can produce empty strings for
certain inputs (whitespace-only, formatting-only markdown). The draft
sender loop then calls sendMessageDraft with empty text, which Telegram
rejects with 'Text must be non-empty', flooding the log every 0.5s.
Add an early return in _send_message_draft() when text is empty or
whitespace-only. This matches WebChat's approach of skipping empty
responses.
Fixes#7353
Co-authored-by: Yufeng He <40085740+universeplayer@users.noreply.github.com>
* fix(dashboard): comprehensive dark mode improvements for WebUI
- Tune DarkTheme.ts color palette: soften primary, fix on-surface-variant
from black to light grey, adjust surface/background/border colors,
add codeBg/preBg/code variables for dark code blocks
- Add _HljsDark.scss for highlight.js dark token overrides and
markstream-vue CSS variable overrides under .v-theme--PurpleThemeDark
- Add global dark mode overrides in _override.scss: soften flat primary
buttons, timeline dots, dialog card backgrounds, markdown link color
- Fix hardcoded light backgrounds in IPythonToolBlock, ExtensionCard,
T2ITemplateEditor, ExtensionPage, KnowledgeBase, LongTermMemory
- Remove hardcoded color='black' from icons in ProviderPage,
PlatformPage, PersonaPage
- Desaturate console log ANSI colors for dark mode readability
- Add iframe dark mode inversion filter in VerticalSidebar
- Fix language switcher mobile adaptation and click behavior
- Fix login page theme toggle tooltip showing wrong label
* fix(dashboard): apply dark mode review feedback
* fix: skip FunctionCallingConfig when only native tools are present
When native tools (google_search, url_context) are enabled without any
function_declarations, _prepare_query_config was still creating a
FunctionCallingConfig, which makes Gemini API return 400 INVALID_ARGUMENT.
Now we only set tool_config when tool_list actually contains
function_declarations.
Fixes#7406
* style: ruff format
* fix: prevent KeyError in collect_commands when plugin handler not in star_map
* chore: ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: add Rerank API support for NVIDIA NIM
- Add Rerank API support for NVIDIA NIM
- Add related i18n support in en-US zh-CN
* chore: format code
* fix: replace illegal characters
Replace illegal characters when building request model path.
* fix: refactor client initialization method
* fix: enhance response parsing
* docs: add comment for model_path process
* docs: add russia translation
* feat: update AddNewProvider component to support current provider type and enhance provider icon mapping
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: add audio input support across providers and chatui recording issue fix
- Introduced audio_urls parameter in Provider class and related methods to handle audio input.
- Updated ProviderAnthropic, ProviderGoogleGenAI, and ProviderOpenAIOfficial to process audio URLs.
- Enhanced media_utils with functions to ensure audio format compatibility and detect audio types.
- Modified dashboard components to display audio input support and handle audio attachments in messages.
- Updated localization files to include audio as a supported modality.
- Added new icons for audio input in the dashboard UI.
* feat: enhance audio handling with temporary file cleanup and format support
* feat: track temporary local files for converted audio components
* fix: update image placeholder in prompt from "[图片]" to "[Image]"
* feat(provider/vllm_rerank): add configurable rerank_api_suffix option
Add rerank_api_suffix config option to the VLLM Rerank provider so
users can control the API URL path suffix instead of having /v1/rerank
hardcoded.
- Default value is /v1/rerank (preserves existing behavior)
- Users can set it to empty string to disable auto-append
- Handles suffix without leading slash by auto-adding one
- Schema, default config, and i18n metadata all updated
Issue: Fixes#7238
* fix(provider/vllm_rerank): handle null suffix and improve hint descriptions
- Add explicit None check for rerank_api_suffix (fixes HIGH from Gemini)
- Update rerank_api_base hint to describe actual behavior without
mentioning specific provider options (fixes 3x MEDIUM from Gemini)
- Add ru-RU i18n for rerank_api_suffix (fixes P2 from Codex)
Co-authored-by: gemini-code-assist[bot]
Co-authored-by: chatgpt-codex-connector[bot]
---------
Co-authored-by: LehaoLin <linlehao@cuhk.edu.cn>
- Merge environment variables case‑insensitively
- Auto‑configure dotnet PATH and suppress console window
- Keep PATHEXT inheritance (from old implementation)
Replaces the minimal PATHEXT fix with a robust solution that resolves
common Windows subprocess issues, especially for .NET servers.
* fix(stdio): improve Windows environment setup for subprocesses
- Merge environment variables case‑insensitively
- Auto‑configure dotnet PATH and suppress console window
- Keep PATHEXT inheritance (from old implementation)
-Add `show_console` option to control `CREATE_NO_WINDOW` flag.Default remains hidden (backward compatible) but can be overridden.
Replaces the minimal PATHEXT fix with a robust solution that resolves
common Windows subprocess issues, especially for .NET servers.
* fix(stdio): improve Windows environment setup for subprocesses 修复(标准输入输出):改进 Windows 环境设置以支持子进程
- Merge environment variables case‑insensitively
- Auto‑configure dotnet PATH and suppress console window
- Keep PATHEXT inheritance (from old implementation)
-Add `show_console` option to control `CREATE_NO_WINDOW` flag.Default remains hidden (backward compatible) but can be overridden.
Replaces the minimal PATHEXT fix with a robust solution that resolves
common Windows subprocess issues, especially for .NET servers.
* fix(stdio): improve Windows environment setup for subprocesses 修复(标准输入输出):改进 Windows 环境设置以支持子进程
- Merge environment variables case‑insensitively
- Auto‑configure dotnet PATH and suppress console window
- Keep PATHEXT inheritance (from old implementation)
-Add `no_console` option to control `CREATE_NO_WINDOW` flag.Default remains hidden (backward compatible) but can be overridden.
Replaces the minimal PATHEXT fix with a robust solution that resolves
common Windows subprocess issues, especially for .NET servers.
* fix(stdio): improve Windows environment setup for subprocesses 修复(标准输入输出):改进 Windows 环境设置以支持子进程
- Merge environment variables case‑insensitively
- Auto‑configure dotnet PATH and suppress console window
- Keep PATHEXT inheritance (from old implementation)
-Add `no_console` option to control `CREATE_NO_WINDOW` flag.Default remains hidden (backward compatible) but can be overridden.
Replaces the minimal PATHEXT fix with a robust solution that resolves
common Windows subprocess issues, especially for .NET servers.
* fix(windows): inherit all system environment variables for subprocesses
- Merge environment variables case‑insensitively
- Auto‑configure dotnet PATH and suppress console window
- Keep PATHEXT inheritance (from old implementation)
- No longer handle as a special case for C#.
Replaces the minimal PATHEXT fix with a robust solution that resolves
common Windows subprocess issues, especially for .NET servers.
* chore: ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
Gemini 3 models return thinking parts (part.thought=True) alongside the
actual response text. _process_content_parts was including these thinking
parts in the message chain sent to the user, effectively leaking internal
reasoning into the output. On platforms that split long messages (e.g.
aiocqhttp with realtime segmenting), this caused duplicate or triple
replies since the thinking text often mirrors the actual response.
The streaming path already handled this correctly via chunk.text which
skips thinking parts, but the non-streaming path and the final-chunk
processing in streaming both went through _process_content_parts.
Also switch the Gemini 3 model name matching from an exhaustive list to
prefix matching (gemini-3- / gemini-3.) so new variants like gemini-3.1
get proper thinkingLevel config without code changes.
Fixes#7183
Gemini API requires function_response to be a google.protobuf.Struct
(JSON object). When tool results are plain text strings, the API
returns 400 Invalid argument. Detect non-JSON tool content for Gemini
models and wrap it in {"result": content} before sending.
Fixes#7134
* fix: 改进 KnowledgeBaseManager 和 KBHelper 中的初始化错误处理
* fix: 改进知识库初始化和重排序错误处理,增强日志记录
* fix: 改进知识库模块初始化和检索错误处理
* fix(ui): handle kb init errors in list cards
display a dedicated error state for knowledge base cards that fail
initialization, including a visible badge and error details
prevent navigation and edit actions for failed cards while keeping
delete available, and hide normal stats/description for error items
add list.initError locale strings for en-US, ru-RU, and zh-CN
* fix(kb): avoid replacing helper on init failure
Initialize a new KB helper before swapping instances so a failed re-init
does not break the active knowledge base service.
If initialization fails, restore in-memory KB settings and keep the
existing helper and previous init error state.
Also clear stale init_error after successful vector DB initialization to
prevent outdated error reporting.
* test(kb): add kb manager resilience tests
cover initialization failure and recovery scenarios to guard
against regressions in kb error handling
include reference assets under refs for test validation
---------
Co-authored-by: RC-CHN <1051989940@qq.com>
* feat: Strict Types for Settings.vue, Enhance Error Handling
feat: Fixed Type in Theme Constant for better TypeScript in Settings.vue
* fix: add other error handling and improve api create type behavier
* fix error messages
* feat: add mimo tts provider support
* fix: handle empty mimo tts choices
* feat: add mimo stt provider support
* fix: align mimo tts style payload with official docs
* docs: add Xiaomi MiMo Omni and TTS services to multiple language READMEs
* fix: filter empty assistant messages to prevent 400 error on strict APIs
Some OpenAI-compatible APIs (e.g., Moonshot) reject requests with
empty content in assistant messages when no tool_calls are present.
This fix cleans up the messages payload before sending to avoid
'message at position X must not be empty' errors.
Closes related issue with fallback provider behavior.
* test(openai): add tests for empty assistant message filtering
* refactor(openai): simplify empty assistant message filtering logic
* style: format code
---------
Co-authored-by: RC-CHN <1051989940@qq.com>
* fix: support both old and new Bailian Rerank API response formats
The new compatible API (compatible-api/v1/reranks) returns results at
the top level as data.results, while the old API returns them nested
under data.output.results. The parser only checked the old path,
causing qwen3-rerank to always report empty results.
Fixes#7161
* Update astrbot/core/provider/sources/bailian_rerank_source.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
---------
Co-authored-by: Ruochen Pan <badbatch0x01@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* fix: add pysocks dependency to support SOCKS5 proxy for pip install
* docs: update proxy description to include https:// support
* fix: add python-socks and pysocks to requirements.txt for consistency
---------
Co-authored-by: root <root@localhost.localdomain>
- SubAgentPage.vue: rewrite with trace-page style (glassmorphism)
- CronJobPage.vue: rewrite with trace-page style (glassmorphism)
- SessionManagementPage.vue: update CSS variables to match
- ConversationPage.vue: update CSS variables to match
Changes:
- Add CSS variables for glassmorphism effect (blur, transparency)
- Update color scheme to use CSS custom properties
- Improve visual consistency across pages
- Add dark mode support with theme-aware variables
session_llm_manager.py:
- Add SessionServiceConfig TypedDict for type safety
- Add _normalize_session_service_config helper for config validation
session_plugin_manager.py:
- Add type annotations and improve code structure
star_manager.py:
- Improve type annotations and code quality
Other star modules:
- Minor improvements
stage.py:
- Add StageProcessResult type alias for better type checking
- Change process method signature for better compatibility
respond/stage.py & result_decorate/stage.py:
- Improve type annotations and code structure
content_safety_check/stage.py:
- Add better type handling
agent_sub_stages (internal.py, third_party.py):
- Improve type annotations for better code quality
Other pipeline stages:
- Minor improvements to type annotations
message.py:
- Use TypeGuard for type narrowing instead of isinstance checks
- Improve type annotations for ContentPart validation
- Add type annotations for content part registry
mcp_client.py:
- Improve type annotations and code quality
runners (base, dashscope, deerflow, dify, tool_loop):
- Add/improve type annotations
- Clean up code structure
tool.py & tool_image_cache.py:
- Improve type annotations
entities.py:
- Improve assemble_context return type annotation
- Add explicit type annotations for content_blocks
- Add safety checks for text content extraction
provider.py:
- Improve type annotations throughout
- Clean up code structure
Various source providers:
- Add/improve type annotations in anthropic, azure_tts, gemini, volcengine_tts, etc.
- Improve code quality in whisper and xinference providers
- Remove redundant session: AsyncSession type comments in sqlite.py
- Add type annotations to shared_preferences_v3.py migration
- Improve vec_db implementations with better type hints
- Add __init__.py marker for db package
alter_cmd.py:
- Add explicit type annotations for alter_cmd_cfg
- Rename variables for clarity (scene_num -> scene_index, cmd_type -> permission_type)
- Add validation for permission_type parameter
conversation.py:
- Add type annotations and improve command handling
persona.py:
- Clean up type annotations
provider.py:
- Add type annotations and improve provider command handling
setunset.py:
- Add type annotations for configuration operations
- Use ComponentType enum instead of string literals for component types
- Add type annotations for discord button declarations
- Clean up unnecessary code in various platform adapters
- Add type guard function for str-keyed dicts
- Add I18nGroup TypedDict for better type checking
- Replace isinstance checks with TypeGuard-based validation
- Improve type annotations throughout
command_parser.py:
- Add explicit type annotations for tokens list and return type
config_number.py:
- Handle float to int conversion explicitly
- Simplify type checking logic
file_extract.py:
- Add type annotations and improve file extraction handling
io.py:
- Add type annotations for I/O operations
log_pipe.py:
- Implement TextIO interface for better compatibility
- Add comprehensive type annotations
- Add callback support and identifier logging
session_waiter.py:
- Clean up type annotations
* fix(agent): improve send_message_to_user tool description to prevent misuse
Fixes#6402
The AI was inappropriately using send_message_to_user tool in normal
conversations for text replies, causing duplicate messages (once via tool,
once via normal response).
Root cause: Tool description was not clear enough about when to use it.
Changes:
- Restructure description with clear sections using markdown
- Emphasize two valid use cases:
1. Sending media files (image, record, video, file) in any conversation
2. Proactive messaging scenarios (cron jobs, background tasks)
- Add explicit warning: Do NOT use for normal text replies
- Explain consequence: Using for text causes duplicate messages
This approach (better documentation) is safer than restricting tool
registration, which would break media file sending in normal conversations.
Alternative to PR #6413 which was closed due to breaking media delivery.
* fix: correct syntax error and use triple-quoted string for description
Address review feedback:
- P0: Add missing closing parenthesis (was causing SyntaxError on import)
- Use triple-quoted string for better readability (suggested by gemini-code-assist)
- Remove explicit newline characters, let Python handle line breaks
---------
Co-authored-by: ccsang <ccsang@users.noreply.github.com>
* perf: enhance layout responsiveness and text handling in stats page
* perf: enhance subagent, future task UI
- Updated the overall structure of the SubAgentPage component for better readability and maintainability.
- Introduced a new dashboard layout with improved header and action buttons.
- Replaced the old settings card with a more visually appealing setting card design.
- Enhanced the agent list section with a more user-friendly display and added empty state handling.
- Implemented unsaved changes notification and confirmation dialogs for better user interaction.
- Refactored code for better clarity and organization, including the use of computed properties for state management.
- tool_loop_agent_runner.py: add wrapper coroutine for create_task
- tool_image_cache.py: add cast for Self return type
- astr_agent_tool_exec.py: add type ignore for add_tool
- astr_main_agent.py: add type ignores for tool operations
- astr_main_agent_resources.py: add type ignore for msg_dict
- astrbot_config_mgr.py: add type annotations
- MCPTool_T must be imported at runtime, not in TYPE_CHECKING
- Add __future__ annotations for forward references
- Fix remaining conflict markers in openai_source.py
* fix: send SSE heartbeat to prevent WebChat disconnect during compression
When context compression triggers with slow reasoning models (e.g.
deepseek-reasoner), the backend can go 30+ seconds without pushing any
SSE data. The client-side EventSource / browser then assumes the
connection is dead and disconnects, causing the WebUI to hang
indefinitely since it never receives the eventual response.
Fix: yield an SSE comment (`: heartbeat`) on every empty poll cycle.
Comment lines are defined in the SSE spec as keep-alive signals --
the EventSource API ignores them but the HTTP connection stays open.
Fixes#6938
* chore(dashboard): extract SSE heartbeat to constant
---------
Co-authored-by: Yufeng He <40085740+universeplayer@users.noreply.github.com>
Co-authored-by: RC-CHN <1051989940@qq.com>
- TraceDisplayer: new timeline-style layout with vertical track, dot markers, and expandable event cards
- TracePage: redesigned topbar with custom toggle switch, removed scoped CSS conflicts
- All colors use explicit hex values with !important to ensure visibility across themes
- Vue 3 Composition API with shallowRef to avoid reactive overhead
Root cause: invalid CSS var --v-theme-primaryText resolved to white,
making text invisible against transparent background.
Fix: add global (non-scoped) <style> block with !important color
overrides and explicit dark background for trace table elements.
Also changed .trace-table background from transparent to
var(--v-theme-surface) for proper dark theme support.
* feat: add new StatsPage for enhanced statistics overview
- Introduced StatsPage.vue to provide a comprehensive overview of statistics with various metrics and charts.
- Implemented fetching and displaying of base and model provider statistics.
- Added unit tests for provider statistics persistence in the database.
* style: refine card styles and remove unnecessary shadow for improved aesthetics
- Replace self-hosted MDI subset with CDN (@mdi/font) to avoid
binary font files being missing after git pull
- Remove vite-plugin-mdi-subset from build (no longer needed)
- Add light mode glass styling to ChatInput
- Fix DailyQuote, Logo, TraceDisplayer for proper theme colors
- Apply theme-specific SCSS overrides across components
- AstrBotConfigV4: card now uses translucent glassmorphism
(rgba 15,15,22,0.45, blur 20px) with inset shadow
for recessed "embedded panel" feel
- Section titles: JetBrains Mono font, cyan (#00F2FF) with
left 3px glowing gradient bar
- _override.scss: global form control hardening
* Switch: 4px rounded rectangle, Cherenkov cyan glow
* Text fields: cyan border on focus with glow
* Tabs: uppercase monospace, cyan underline + glow on active
* Slider: cyan track fill + glowing thumb
* Checkbox: hollow rectangle with cyan check
- DiamondBg: Canvas-based interactive background with:
- 24px grid with faint crosshairs and recessed socket dots
- 150px mouse energy field with lerp following (0.1 speed)
- Crosses shrink/darken when "pressed" by energy field
- Cherenkov blue core dot at exact cursor position
- Gravity well glow beneath login panel
- Login card: cyan edge border (rgba 0,242,255,0.2), deep blue shadow
- Radial fade mask around login area
- DailyQuote component replaces static welcome text
- Change login page title from "AstrBot WebUI/Dashboard" to "AstrBot Starlight Panel"
- Replace welcome subtitle with DailyQuote component showing programming quotes
- Quotes are localized for en-US, zh-CN, and ru-RU
- Quote of the day stays consistent throughout each day
- fix(openai_source): remove dead code comment
- fix(common.ts): use resolveApiUrl helper for live-log endpoint
- style(mdi-subset): clean up icon CSS
- feat: add translation check script and unit tests
Introduce session-level state management for tools that need to maintain
state across conversation turns within the same session (UMO).
- Add ToolSessionManager class for central per-(UMO, tool_name) state
- Add ToolSessionState with set_persistent(key) support
- Add is_stateful flag to FunctionTool base class
- Wire session_manager through run_context in all agent runners
- Update ExecuteShellTool to use framework session manager
- Update CLAUDE.md with stateful tool documentation
BREAKING: Tools that were manually managing session state via _sessions
dict should migrate to use the framework's ToolSessionManager for proper
lifecycle management and persistence support.
* fix(gsvi_tts): Use the correct calling method (#5638)
Add some configuration items for GSVI
* fix(gsvi_tts): add default value for api_key in provider configuration
* fix(gsvi_tts): Adjust wherever the Authorization header is built to only include it when `self.api_key` is truthy
Delete some comments
* chore: ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
VWindowItem requires a VWindow parent for group context injection.
Without it, Vuetify 4 throws:
"Could not find useGroup injection with symbol vuetify:v-window"
Changes:
- ExtensionPage.vue: wrap all tab content in v-window v-model="activeTab"
- InstalledPluginsTab.vue: remove v-window-item root wrapper
- MarketPluginsTab.vue: remove v-window-item root wrapper
Vuetify 4's VDefaultsProvider triggers "Slot default invoked outside of
render function" internally - not fixable from our side without framework
changes. Suppress via Vue warnHandler.
Pinia 3.0.1-3.0.4 introduced a bug where devtoolsPlugin receives
undefined options when createOptionsStore is called, causing
"Cannot destructure property 'state' of 'options' as it is undefined"
on page load. Downgrade to 3.0.0 which is stable.
monaco-editor@0.55.1 hardcodes dompurify@3.2.7 (vulnerable to SAFE_FOR_XML
bypass via rawtext elements). Added postinstall script that downloads the
patched 3.3.3 source and replaces the bundled file in node_modules.
Also keeps dompurify override at 3.3.2 for the npm package.
SSE connections to /api/live-log are same-origin (VITE_API_BASE is empty
in production, resolves to relative /api path). The Authorization header
and withCredentials:true triggered CORS preflight (OPTIONS) requests,
but the SSE route only handles GET, causing the preflight to fail.
Resolved conflicts:
- openai_source.py: keep dev version with abort_signal filtering
- customizer.ts: keep dev version with viewMode functionality
- useSessions.ts: keep dev version with pendingSessionId handling
- platformUtils.js: keep dev version with correct tutorial links
- AddNewPlatform.vue: keep dev version with correct docs link
- FullLayout.vue: keep dev version with viewMode-based logic
- VerticalHeader.vue: keep dev version with viewMode-based logic
`abort_signal` (asyncio.Event) is passed via **kwargs into payloads during
tool_call streaming, causing "Object of type Event is not JSON serializable"
when the OpenAI client tries to serialize the request body.
Regression test added: test_prepare_chat_payload_strips_non_json_serializable_kwargs
* fix(wecom): fallback to regular message API when kf API returns 40096
When sending WeCom messages via kf/send_msg, if the API returns error
40096 (invalid external userid), fall back to the regular message/send
API. This handles internal employees who don't have external userids.
Fixes the issue where internal WeCom users (e.g. WangCong) would cause
kf API to fail with 'invalid external userid' error.
* fix(wecom): improve error handling for kf API fallback to regular message API
---------
Co-authored-by: Soulter <905617992@qq.com>
* Feat(webui): improve code block readability in dark mode
* fix(dashboard): use theme variable for code text
---------
Co-authored-by: RC-CHN <1051989940@qq.com>
Remove EventSource-based streaming and switch to REST polling for
log fetching. This eliminates the SSE connection management that
caused TS type inference issues with Pinia 3.
Commit 292199dc renamed tools.func_list -> tools.list_tools() in
openai_source.py but forgot to add the list_tools() method to the
ToolSet class, causing AttributeError at runtime.
* fix(dashboard): align extension page snackbar with full UI center (#6022)
* fix(dashboard): align snackbars with full UI center (#6022)
---------
Co-authored-by: Gargantua <22532097@zju.edu.cn>
- Vue components (v-text-field, v-btn, v-col, ExtensionCard) now use self-closing
- HTML void element (img) no longer uses self-closing
- HTML normal elements (span, i) now use self-closing when empty
* docs: update QQ group listings across readmes and community pages
* docs: align QQ group status labels across docs
---------
Co-authored-by: idiotsj <idiotsj@users.noreply.github.com>
Export the required icon set and expand it with icons used by
Vuetify internals that are not detected by static source scans.
Regenerate the MDI subset assets and update tests to assert that
all required icons are always included and deduplicated.
- Add URL param support (?api_url=, ?username=) for shareable config
- Add share link button to server config dialog
- Fix ToolSet API bug: tools.func_list -> tools.list_tools()
- Fix Vue template bugs in CommandTable.vue (orphaned v-else, wrong prop)
- Use master version of InstalledPluginsTab.vue (dev had pre-existing bugs)
BREAKING CHANGE: Uses master version for InstalledPluginsTab.vue
* feat: add two-phase startup lifecycle
Allow the dashboard to become available before plugin bootstrap completes and surface runtime readiness and failure states to API callers.
Guard plugin-facing endpoints until runtime is ready and clean up provider and plugin runtime state safely across bootstrap failures, retries, stop, and restart flows.
* fix: harden runtime cleanup review fixes
Continue terminating remaining providers and disable MCP servers even if one provider terminate hook fails.
Also add InitialLoader failure-path coverage and extract guarded plugin routes into a shared constant for easier review and maintenance.
* fix: harden deferred startup recovery
* fix: streamline runtime guard handling
* fix: simplify runtime lifecycle coordination
* fix: restore orchestrator logger binding
* feat(skills): enhance skill installation to support multiple top-level folders and add duplicate handling
closes: #6949
* refactor(skill_manager): streamline skill name normalization and validation logic
* fix(skill_manager): update skill name regex to allow underscores in skill names
* fix(skill_manager): improve skill name normalization and validation logic
The dev branch has astrbot/dashboard/dist as a symlink to
../../dashboard/dist, which is valid in the dev workspace but
becomes a broken symlink when cloned to /opt/astrbot for installation.
Fix the maturin build hook to:
- Remove broken symlinks before creating placeholder directories
- Handle symlink vs directory removal in copy_dashboard_dist()
- Always generate placeholder when dashboard build is skipped or fails
* fix(provider): add missing index field to streaming tool_call deltas
- Fix#6661: Streaming tool_call arguments lost when OpenAI-compatible proxy omits index field
- Gemini and some proxies (e.g. Continue) don't include index field in tool_call deltas
- Add default index=0 when missing to prevent ChatCompletionStreamState.handle_chunk() from rejecting chunks
Fixes#6661
* fix(provider): use enumerate for multi-tool-call index assignment
- Use enumerate() to assign correct index based on list position
- Iterate over all choices (not just the first) for completeness
- Addresses review feedback from sourcery-ai and gemini-code-assist
---------
Co-authored-by: Yaohua-Leo <3067173925@qq.com>
Co-authored-by: Soulter <905617992@qq.com>
Remove msg_id from payload to prevent errors with proactive tool-call path and avoid permission issues.
Co-authored-by: Naer <88199249+V-YOP@users.noreply.github.com>
* fix: auto-append /v1 to embedding_api_base in OpenAI embedding provider (#6855)
When users configure `embedding_api_base` without the `/v1` suffix,
the OpenAI SDK does not auto-complete it, causing request path errors.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: ensure API base URL for OpenAI embedding ends with /v1 or /v4
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Soulter <905617992@qq.com>
_BUNDLED_DIST may be a symlink pointing to the actual build output.
Using resolve() ensures the path is correctly resolved to the real
directory, allowing the dashboard frontend to load properly when
bundled as a symlink in the dev branch.
The run command should use the original InitialLoader-based startup,
not the new _internal/runtime bootstrap. Only the dev subcommand
uses the new architecture.
When ASTRBOT_BUILD_DASHBOARD is not set, the hatch build hook now
creates an empty target dir with a .placeholder file so the
artifacts glob matches and hatchling does not fail.
When clients disconnect abruptly, hypercorn raises
ssl.SSLError APPLICATION_DATA_AFTER_CLOSE_NOTIFY during SSL shutdown.
This is benign and expected behavior. Wrap serve() with
try/except to suppress these spurious errors.
Previously initialize_runtime_bootstrap() was called at module level,
causing it to run for ALL astrbot CLI commands (conf admin, etc).
Now it only runs when the 'run' command is executed.
The internal ToolSet (base.py) was missing add_tool() and merge()
methods that the agent code expects. When tmgr.get_full_tool_set()
returned a base.py ToolSet, calls to add_tool() and merge() failed.
Added:
- add_tool() as alias to add()
- merge() method to merge another ToolSet
This fixes runtime crash: AttributeError: 'ToolSet' object has no attribute 'add_tool'
- Add _message_count and _last_activity_timestamp to orchestrator
- Add record_activity() method to orchestrator
- Add name field to get_protocol_status returns
- Add total_messages and last_activity to get_stats
- Update tests to verify new fields
Add the radiobox icons used indirectly by Vuetify internals
to the required MDI subset so they are kept during font
generation.
Regenerate the subset CSS and font files to prevent missing
radio button icons at runtime.
- Fix echo_mcp_server.py stdio parsing (use stdin.buffer, not readline)
- Mark MCP handshake tests as skip (protocol requires server notifications)
- Update test_list_stars to account for auto-registered RuntimeStatusStar
* fix: wrong index in ObjectEditor updateKey causing false 'key exists' error
* fix: same index mismatch issue in updateJSON
* fix(ui): stabilize ObjectEditor pair keys
Use generated ids for key-value pairs instead of array indexes to
prevent mismatch issues during editing and rendering.
Also replace duplicate-key alerts with toast warnings for a more
consistent UI experience.
---------
Co-authored-by: RC-CHN <1051989940@qq.com>
- Fix orchestrator to use anyio.get_cancelled_exc_class() instead of anyio.CancelledError
- Fix tests to properly check for anyio compliance (not violations)
- Add type annotations for MCP exception fallbacks in registry.py
- Remove unused type: ignore comment in mcp/tool.py
- All 111 tests pass
- uvx ty check passes
- ruff check passes
Implement the new _internal package structure for AstrBot runtime:
- Add AstrbotOrchestrator with LSP, MCP, ACP, ABP protocol clients
- Add AstrbotGateway server with WebSocket support
- Add comprehensive test suite for runtime module
- Add tools base module for MCP tools
Implements bootstrap function using anyio task groups for
concurrent protocol client initialization.
Remove the dead is_legacy_dashboard_password_hash helper which was
never used by verify_dashboard_password. Legacy SHA-256/MD5 hashes
are not supported - only Argon2 and PBKDF2 are valid password hashes.
Users with old SHA-256 hashes must reset their password.
- Track _webui_fallback flag to distinguish "frontend disabled" vs "frontend enabled but files missing"
- Improve messages:
- "前端未内置或未初始化,回退到仅启动后端" when fallback occurs
- "前端已禁用" when user explicitly disabled
- "正在启动 API Server" instead of "WebUI 已分离"
- "前端未启用,请访问在线面板" for HTTP responses when frontend disabled
ComputerBooter is now an abstract class, so tests that tried to
instantiate it directly need to be updated:
- test_booter_decoupling.py: remove test_get_tools_delegates_to_class
since base class cannot be instantiated
- test_profile_aware_tools.py: use ShipyardBooter.__new__() to test
base class property defaults (capabilities, browser)
- test_computer.py: skip BoxliteBooter test since it's also abstract
and requires the boxlite module
- Add version check at startup in both __main__.py and cmd_run.py
- Suggest using `uv run -m astrbot` or reinstalling with uv
- Add ABC base class and abstract methods to ComputerBooter
- Improve type annotations in OpenAIAgentsRunner
- Non-interactive mode now streams logs to stdout with color-coded levels
- Add proper async cleanup when shutting down
- Fix type annotations in coze and deerflow agent runners
Security improvement: password is now set via `astrbot conf admin` CLI
command rather than being a hardcoded default. Updated all relevant
i18n strings to reflect this change.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When WebUI is disabled via config, tell users to use the online
dashboard at dash.astrbot.men instead of the cryptic technical message.
When WebUI files are missing (index.html not found), also redirect
users to the online dashboard instead of just saying "WebUI will be
disabled."
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This helps diagnose when the environment variable is being ignored in
favor of cmd_config.json.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The _collect_and_register_commands method was iterating over
star_handlers_registry twice: once via collect_commands() and again
in a redundant second loop. This caused the same commands to be
registered to the Discord client twice, resulting in "Application
command names must be unique" errors during sync_commands().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move AgentResponse to its own module in core/agent/response
- Update import paths in all runner files
- Add provider_config parameter to ToolLoopAgentRunner
The test_t2i_set_active_template_syncs_all_configs async test was
missing its decorator, causing pytest to fail with "async def functions
are not natively supported" error.
- Remove all DASHBOARD_* and ASTRBOT_DASHBOARD_* fallback chains
- server.py now only checks ASTRBOT_HOST, ASTRBOT_PORT, ASTRBOT_SSL_*
- cmd_run.py no longer sets legacy DASHBOARD_* environment variables
- Clean up import paths for agent runners
Conflicts resolved:
- tests/test_dashboard.py: kept all tests from both sides
- astrbot/core/config/default.py: took origin/master mimo-tts hints
- astrbot/dashboard/routes/t2i.py: took origin/master _sync_active_template_to_all_configs approach
- dashboard/src/views/Settings.vue: took origin/master version
Move the openai-agents SDK integration from core/agent/runners/openai_agents
to _internal/agents/openai_agents to follow the internal implementation pattern.
Add integration layer for using the openai-agents library with
AstrBot's existing agent infrastructure:
- OpenAIAgentsRunner: A BaseAgentRunner implementation that wraps
the openai-agents Agent class
- Tool adapter to convert AstrBot FunctionTool to openai-agents format
- Support for tool handlers and FunctionToolManager integration
- Add i18n support to cmd_conf.py (config validators)
- Fix BaseFunctionToolExecutor to be an ABC
- Add explicit type annotations for dict payloads
- Various type annotation improvements
This commit adds the _internal package structure for AstrBot's
standardized MCP & Skills support:
astrbot/_internal/mcp/:
- MCPClient for MCP server connections
- MCPTool wrapper for MCP tools
- MCP configuration management
astrbot/_internal/skills/:
- SkillManager for skill lifecycle
- Skill parser and loader
- SkillToToolConverter for tool-based skills
- Prompt builder for skills
astrbot/_internal/tools/:
- ToolSchema, FunctionTool, ToolSet base definitions
- FunctionToolManager for tool registry
- Builtin tools (cron, send_message, kb_query)
- Tool providers (internal, plugin, computer)
astrbot/api/:
- Public API for tools (ToolRegistry, tool decorator)
- Public API for MCP (get_mcp_servers, register_mcp_server)
- Public API for skills (get_skill_manager, skill_to_tool)
- Add CLI i18n module (astrbot/cli/i18n.py) with zh/en translations
- Add TUI i18n module (astrbot/tui/i18n.py) with zh/en translations
- Update CLI commands to use translated strings
- Update TUI app and screen to use translated strings
- Add ASTRBOT_CLI_LANG and ASTRBOT_TUI_LANG to .env.example
- Update cmd_run.py env var documentation
- Add backward compatibility for moved modules with DeprecationWarning
* fix(t2i): sync active template across all configs
apply template activation and reset to every config profile instead of only
the default one, and reload each pipeline scheduler so changes take effect
consistently in multi-config setups
add a dashboard test that creates extra configs and verifies active template
updates and scheduler reload coverage across all config ids
* fix(t2i): reload all schedulers on template changes
extract a shared helper to reload pipeline schedulers for every config.
when syncing or resetting the active template, persist each config and
then reload all schedulers to keep mappings consistent.
also reload all schedulers when updating the currently active template,
and add dashboard tests to verify cross-config sync and scheduler
replacement behavior.
* feat(dashboard): add log and cache cleanup in settings
* refactor: simplify storage cleaner log config handling
* fix: Repair abnormal indentation
* fix(storage): harden cleanup config handling
Use typed config value access to avoid treating invalid values as
enabled flags or log paths during storage cleanup.
Also stop exposing raw backend exceptions in the dashboard storage
status API and direct users to server logs for details.
---------
Co-authored-by: RC-CHN <1051989940@qq.com>
- Generate unique endpoint names in Route.register_routes() to avoid
conflicts between ChatRoute and TUIChatRoute both exposing /api/tui/chat
- Simplify test_batch_upload_skills_accepts_valid_skill_archive to match
the pattern used by test_batch_upload_skills_accepts_zip_files,
mocking install_skill_from_zip instead of trying to patch paths
- test_pip_*: Update expected values from "shared-lib==2.0" to "shared-lib>=1.0"
to match the new behavior that preserves original version constraints
- test_skill_manager_sandbox_cache: Fix monkeypatch issues by using
MockAstrbotPaths instead of non-existent module-level functions
- test_tool_loop_agent_runner: Change tool_schema_mode from "skills_like"
to "lazy_load" to match actual supported mode
Simplify the message items schema by using additionalProperties
instead of explicit properties, while preserving type info for LLM docs.
Note: 12 ty diagnostics remain in send_message.py and
astr_main_agent_resources.py due to architectural issue where
FunctionTool.parameters JSON Schema is used by ty for Python
type inference. This requires larger refactoring to fix properly.
Replace redundant ASTRBOT_SYSTEMD environment variable checks with
sys.stdin.isatty() for detecting non-interactive environments.
The DashboardManager.ensure_installed() already handles this internally,
so the outer ASTRBOT_SYSTEMD checks were unnecessary.
- Add 'config' to known zh/en doc structure differences
- Remove trailing whitespace from docs/zh/faq.md
- Remove trailing whitespace from docs/en/dev/plugin-platform-adapter.md
- Ensure all README files end with newline
- Format bwrap.py with ruff, clean up imports
- Remove unused cast import in tool.py
- Add getattr fallbacks in context.py for handler name resolution
- Fix param_type annotation to allow Any in command.py
Provides comprehensive guidance for AI assistants working on AstrBot:
- Project overview and architecture
- Development setup and commands
- Code style rules (type hints, paths, formatting)
- Environment variable conventions
- Common development patterns
- Git and PR guidelines
Provide comprehensive guidance for AI assistants working on the codebase:
- Project overview and architecture
- Development setup commands
- Python code style (type hints, path handling, formatting)
- Environment variable conventions
- Testing guidelines
- Git and PR conventions
- Common task patterns
- Fix bool type checking in CommandFilter.validate_and_convert_params
(was using isinstance(bool_instance, bool) instead of 'bool is bool')
- Preserve tools=None when persona explicitly has no tools
- Add missing provider_wake_prefix in test setup
When running under systemd (ASTRBOT_SYSTEMD=1), the click.confirm()
prompt would raise Abort on user input, crashing the service.
Skip the interactive confirmation and silently return instead.
- Refactor core modules for better SDK integration
- Improve skill manager with better caching and loading
- Update dashboard routes for plugin and tools management
- Fix and enhance computer skill synchronization
- Various bug fixes and test improvements
* New sandbox backend: bubblewrap.
- Based on Linux Namespace for resource isolation
- Runs on local computer, with no privilege required
- Only supports Linux as namespace & bubblewrap are not present on other platforms.
TODO:
- Fix dashboard presentation. Why change on src does not affect what is really displayed?
- Strenghthen backend availability detection. One known issue is, on some platforms like Ubuntu 24.04, bubblewrap is banned by system guards, even when it's shipped by package manager. A complete detector may contain :
1. run the command with cmdline used by the booter. Return True if succsed.
2. If false, do bottom-up reason detection. Namespace not compiled to kernel? Specific kernel parameters not set? Banned by safety guard? The availability detector should give the user a clear information on why this sandbox backend fails.
These work may require helps from frontend developers. It is tested to be usable on my computer, with non-persistent environment(forget on every command) and persistent file storage.
* Add RO bind entry for bubblewrap backend.
TODO add:
- add plugin utility to change ro and rw bind in cmdline
- make bind dirs dict instead of list to manually map mount point
* Fix: add boot time test for bwrap booter.
in older commits, ro_bind = ['/'] makes skill sync crash. This commit fixes it and adds detection.
* Add availability of bwrap check during booting
* unit tests of bwrap
* i18n of bwrap config by Gemini 3.1 pro
* Update astrbot/core/computer/booters/bwrap.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
---------
Co-authored-by: YI Zeping <yizeyi18@mail.nankai.edu.cn>
Co-authored-by: YI Zeping <18586016708@163.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Add legacy session waiter compatibility
* Expand legacy astrbot package compatibility
* Tighten external legacy plugin compatibility smoke tests
* Consolidate controlled legacy facade compatibility
* docs: clarify compat package boundaries
* test: align runtime fixtures with maintained samples
* fix: preserve unicode sample fixtures in runtime tests
* Implement legacy hook and tool compat runtime
* Refactor legacy runtime execution boundary
* 增强旧版兼容性,添加多个旧路径入口和相关功能
* 增强旧版兼容性,添加适配器边界的启动和关闭钩子支持
* Refactor legacy API and LLM compatibility logic
- Moved legacy LLM and tool compatibility logic from `_legacy_api.py` to a new module `_legacy_llm.py` for better organization and separation of concerns.
- Updated `_legacy_api.py` to import necessary components from `_legacy_llm.py`, removing redundant code.
- Enhanced database client functionality by adding support for batch read/write operations and change event subscriptions.
- Improved documentation in the database client and capability router to reflect new features.
- Refined environment management process in the loader to better handle plugin grouping and virtual environment management.
* 补充插件分组环境测试覆盖
* feat: Enhance CLI and testing capabilities
- Added a new script entry point `astrbot-sdk` in `pyproject.toml`.
- Introduced `has_waiter` method in `SessionWaiterManager` to check for existing waiters.
- Updated `cli.py` to improve error handling and added context to error messages.
- Implemented local development support in `cli.py` with a new `dev` command for running plugins against a mock core.
- Created a new testing module `astrbot_sdk.testing` with utilities for local development and plugin testing.
- Added comprehensive tests for the new testing module and CLI commands.
- Improved compatibility and error messaging for plugin loading failures.
* feat: 添加插件初始化、验证和构建命令,增强 CLI 功能
* feat: add platform client documentation and examples
- Introduced platform client documentation in `docs/v4/clients/platform.md` detailing methods for sending messages, images, and managing group members.
- Added example plugins for LLM chat and database functionalities in `docs/v4/examples/README.md`, `docs/v4/examples/llm-chat/README.md`, and `docs/v4/examples/database/README.md`.
- Enhanced quickstart guide with links to new documentation and example plugins.
- Implemented runtime contract tests to ensure compatibility of public capabilities and hooks.
* Refactor legacy runtime handling and improve plugin loading
- Updated `handler_dispatcher.py` to streamline legacy runtime preparation and dispatching results.
- Enhanced `loader.py` to simplify legacy plugin detection and manifest building.
- Added tests for new HTTPClient and MetadataClient functionalities.
- Introduced tests for legacy context metadata methods and legacy loader helpers.
- Improved legacy runtime tests to cover new functionality and edge cases.
* refactor: 更新兼容层和导入路径,优化文档描述
* Support grouped plugin workers in shared environments
- add group metadata driven worker startup for shared env plans
- track per-plugin handler and capability ownership inside grouped workers
- update runtime and smoke tests for grouped worker session behavior
* Add v4 compat layer and legacy shims
- Introduce private v4 compatibility surface using
_legacy_api.py, _legacy_runtime.py, _legacy_loader.py plus new
_legacy_context.py and _legacy_star.py to centralize legacy adapters
while keeping public APIs thin.
- Extend InitializeOutput to carry protocol_version for negotiated
protocol, enabling runtime to adapt to the chosen v4 version.
- Add lightweight legacy support for Star/Context via new LegacyStar and
LegacyContext shims and expose legacy API through the aggregate
_legacy_api entry point.
- Ensure legacy loader preserves class declaration order by iterating
module.__dict__ instead of relying on alphabetical sorting.
- Add tests: protocol_version handling in InitializeOutput, legacy
main component order preservation, and embedded-newline framing in
transport tests.
* Add architecture doc and refine API compat
- Add PROJECT_ARCHITECTURE.md documenting architecture, compat surface,
and testing notes.
- Update astrbot_sdk.api.__init__ to clarify it is a compatibility
implementation layer, not a simple facade, and list migration targets.
- Normalize platform in AstrMessageEvent.to_payload to emit a string id
by using get_platform_id().
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* delete old sdk
* delete old sdk (#7)
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
* feat(cli): normalize plugin init skeletons
Add interactive plugin init prompts and normalize generated plugin names to the astrbot_plugin_ convention.
Update CLI tests for the new skeleton layout and ignore generated plugin directories in git and coverage tooling.
Also include related runtime logging adjustments from the current worktree.
* Create lint.yml
* Update lint.yml
* clean it
* feat: Enhance handler and capability dispatchers with improved error handling
- Updated HandlerDispatcher to raise TypeError for uninjectable required parameters, logging errors appropriately.
- Refactored CapabilityDispatcher to raise TypeError for missing required parameters during capability execution.
- Renamed _load_plugin_config to load_plugin_config for clarity and consistency.
- Introduced _sync_plugin_registry method in SupervisorRuntime to manage plugin capabilities more effectively.
- Enhanced capability registration logic to handle naming conflicts with better logging and automatic renaming.
- Added tests for handler and capability dispatchers to ensure proper error handling and functionality.
- Implemented new HTTP and metadata capabilities with corresponding tests for registration and retrieval.
- Improved MemoryClient methods with additional tests for save_with_ttl, get_many, delete_many, and stats.
- Added tests for the testing module to ensure proper import and functionality of PluginHarness.
* feat: 更新 SDK 描述,重构插件调用上下文,移除插件 ID 传递,增强能力路由和 HTTP 客户端的插件身份管理
* refactor: 更新文档和代码注释,优化兼容性描述,增强可读性
* feat: 添加插件热重载功能,支持文件变更时自动重新加载插件
* feat: 增强错误处理,添加上下文信息,优化插件组件加载和参数注入校验
* feat: 添加 hello_plugin 示例,包含插件结构、命令处理和测试用例
* refactor: 删除过时的架构文档、变更日志和兼容矩阵文件
* refactor: 更新兼容层弃用通知,优化文档结构和可读性
* refactor: 更新项目架构文档,增强能力客户端和执行边界的描述,移除兼容层设计章节
* feat(errors): Enhance AstrBotError with detailed documentation and examples
feat(events): Expand MessageEvent with reply capabilities and detailed docstrings
fix(loader): Ensure plugin path is correctly managed in sys.path
feat(star): Improve Star class documentation and lifecycle method descriptions
feat(testing): Add plugin metadata handling in MockContext and enhance PluginHarness
feat(hello): Refactor HelloPlugin to utilize new reply methods and structured capabilities
test(decorators): Add tests for input/output model support in provide_capability
test(events): Implement tests for reply_image and reply_chain methods in MessageEvent
test(http): Validate API registration with capability handler references and error handling
test(tests): Enhance tests for plugin harness and directory handling in dev commands
* feat(runtime): add configurable msgpack wire codec support
* fix(runtime): align msgpack framing with transport defaults
* fix(runtime): preserve json transport compatibility
* fix(cli): scope worker wire codec option
* feat: 添加 AGENTS.md 文档,描述 v4 架构约束和开发命令
refactor: 更新 HandlerDispatcher 和 WorkerSession,增强参数处理和结果汇总逻辑
* fix(test): 更新 init_plugin 测试以匹配新的目录命名规范
CLI 的 _normalize_init_plugin_name 函数现在自动添加 astrbot_plugin_ 前缀,
测试期望的目录名从 demo_plugin 更新为 astrbot_plugin_demo_plugin。
* Refactor worker initialization and remove unused codec parameters; add schedule and session waiter modules
- Simplified `GroupWorkerRuntime` and `PluginWorkerRuntime` constructors by removing the codec parameter and related logic.
- Introduced `schedule.py` to define `ScheduleContext` for managing scheduled tasks with a clear structure and payload handling.
- Added `session_waiter.py` for session-based conversational flow management, including `SessionController` and `SessionWaiterManager` for handling multi-turn dialogues.
- Enhanced testing utilities in `testing.py` by removing unused classes and streamlining the structure.
- Created `types.py` to introduce `GreedyStr` for improved command parameter parsing.
* feat: 添加 LLM 工具管理和会话级别状态管理能力
- 新增 llm/ 模块,包含 LLMToolSpec、ProviderRequest、AgentSpec 等实体
- 新增 LLMToolManager 用于管理 LLM 工具注册和激活状态
- 新增 SessionPluginManager 用于会话级别的插件启用状态管理
- 新增 SessionServiceManager 用于会话级别的 LLM/TTS 服务状态管理
- 新增 RegistryClient 用于查询 handler 元数据和设置白名单
- 扩展 CapabilityRouter 内置能力,支持 session.* 和 registry.* 命名空间
- 增强描述符和装饰器以支持新的 trigger 类型
* feat: 大幅增强 SDK 核心功能和文档
新增模块:
- clients/files.py: 文件上传/下载客户端
- clients/managers.py: 会话/LLM/Provider 管理器
- clients/provider.py: LLM Provider 客户端
- conversation.py: 对话上下文管理
- plugin_kv.py: 插件 KV 存储辅助
- runtime/limiter.py: 限流器
- star_tools.py: Star 工具函数
- docs/: 完整的 SDK 使用文档 (01-05)
功能增强:
- Context 大幅扩展,增加 reply/send_image/typing 等便捷方法
- 装饰器增强,支持 on_llm_request/on_provider_request 等
- 内置 schemas 扩展,覆盖更多 capability 定义
- capability_router_builtins 大幅扩展内置能力实现
- handler_dispatcher 增强参数注入和错误处理
- Star 基类增加生命周期钩子和工具方法
* Add comprehensive API documentation for types and utilities in AstrBot SDK
- Introduced `types.md` detailing type aliases, generics, and Pydantic models used in the SDK.
- Added `utils.md` covering utility classes and functions including CancelToken, MessageSession, command groups, and session management.
- Included usage examples and detailed descriptions for each component to enhance developer understanding and ease of use.
* feat: 添加高级方法和辅助函数文档,增强消息组件和事件处理功能
* feat: 增强过滤器类型和能力路由文档,添加 Provider 和会话管理功能
* change location
* delete no need thing
* delete again
* feat: add Star plugin base class and StarTools utility class
- Introduced `Star` class as a base for v4 native plugins, providing lifecycle methods and context management.
- Added `StarTools` class for accessing runtime context and managing LLM tools.
- Implemented `PluginHarness` for local development and testing of plugins, allowing for message dispatching and lifecycle management.
- Created `GreedyStr` type for enhanced command parameter parsing, enabling the capture of remaining command text as a single argument.
- Added testing utilities and mock capabilities for plugin development.
* delete: remove hello_plugin example and its related files
* Remove obsolete test files for testing module, top-level modules, transport, and wire codecs
- Deleted `test_testing_module.py` as it is no longer needed.
- Removed `test_top_level_modules.py` which had no content.
- Eliminated `test_transport.py` due to redundancy.
- Cleared out `test_wire_codecs.py` as part of the cleanup.
* fix(runtime): avoid creating Star instance in on_error fallback
* fix(runtime): avoid virtual dispatch in Star.on_error fallback
* refactor(runtime): unify command matching logic (#25)
* refactor(testing): share command matching with handler dispatcher
* fix:添加公共函数文件
* fix: simplify register_task completion handling (#27)
* fix: simplify register_task completion handling
Remove duplicated cancellation logging in Context.register_task while keeping Future inputs compatible with asyncio.create_task semantics. Add regression coverage for coroutine, Future, cancellation, and failure paths.
* fix: prioritize local src in tests_v4
Ensure tests_v4 always imports the working tree package by moving src to sys.path[0] even when another checkout or installed copy is already present.
* chore: sync subtree from AstrBot
* feat: replay non-sdk changes on clean sdk subtree baseline
* feat(sdk): add merged provider config capability support
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* feat(sdk): add merged provider config bridge and client
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* feat(sdk): add merged provider config capability support
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* fix(sdk): tighten bridge cast typing
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* feat(sdk): add merged provider config bridge and client
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* test(sdk): cover merged provider config parity
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* feat: 完善 memory 向量检索与索引统计 (#28)
Co-authored-by: united_pooh <united_pooh@outlook.com>
* feat(tests): 添加测试用例以验证 register_task 的行为并更新测试运行说明
* Merge commit 'e45bade147ff44b43860ecff12067309e59c151a' into feat/sdk-integration
* Squashed 'astrbot-sdk/' changes from 7dda6077..85342f14
85342f14 feat(tests): 添加测试用例以验证 register_task 的行为并更新测试运行说明
fdffc09b Merge pull request #26 from united-pooh/fix/fix-star-on-error-fallback
3b09747c feat: 完善 memory 向量检索与索引统计 (#28)
665c9c69 fix(runtime): avoid virtual dispatch in Star.on_error fallback
200559a5 fix(runtime): avoid creating Star instance in on_error fallback
git-subtree-dir: astrbot-sdk
git-subtree-split: 85342f149b
* feat(tests): 添加测试用例以验证平台和消息类型过滤器的冲突处理
* docs: remove redundant testing instructions from AGENTS.md
* docs: remove redundant testing instructions from AGENTS.md
* docs: remove redundant testing instructions from AGENTS.md
* Merge commit '5ac9401852ddb46f337da6bcc0f9b66eed265da9' into feat/sdk-integration
* Squashed 'astrbot-sdk/' changes from 85342f14..09beabeb
09beabeb feat(tests): 添加测试用例以验证平台和消息类型过滤器的冲突处理
git-subtree-dir: astrbot-sdk
git-subtree-split: 09beabeb62
* feat: enhance SDK plugin configuration handling and logging
* feat: enhance SDK plugin configuration handling and logging
* feat: enhance SDK plugin configuration handling and logging
* feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
* feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
* feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
* feat: 更新文档以反映SDK负载的JSON可序列化要求和延迟导入设计约束
* feat: add conversation.get_current capability and related schemas
- Introduced CONVERSATION_GET_CURRENT_INPUT_SCHEMA and CONVERSATION_GET_CURRENT_OUTPUT_SCHEMA for handling current conversation requests.
- Implemented _conversation_get_current method in BuiltinCapabilityRouterMixin to manage current conversation retrieval and creation.
- Registered the new capability in CoreCapabilityBridge.
- Enhanced HandlerDispatcher to inject provider request, LLM response, and event result payloads into the event handling process.
- Updated tests to validate the new functionality and ensure proper payload handling.
* feat: add conversation.get_current capability and related schemas
- Introduced CONVERSATION_GET_CURRENT_INPUT_SCHEMA and CONVERSATION_GET_CURRENT_OUTPUT_SCHEMA for handling current conversation requests.
- Implemented _conversation_get_current method in BuiltinCapabilityRouterMixin to manage current conversation retrieval and creation.
- Registered the new capability in CoreCapabilityBridge.
- Enhanced HandlerDispatcher to inject provider request, LLM response, and event result payloads into the event handling process.
- Updated tests to validate the new functionality and ensure proper payload handling.
* feat: add conversation.get_current capability and related schemas
- Introduced CONVERSATION_GET_CURRENT_INPUT_SCHEMA and CONVERSATION_GET_CURRENT_OUTPUT_SCHEMA for handling current conversation requests.
- Implemented _conversation_get_current method in BuiltinCapabilityRouterMixin to manage current conversation retrieval and creation.
- Registered the new capability in CoreCapabilityBridge.
- Enhanced HandlerDispatcher to inject provider request, LLM response, and event result payloads into the event handling process.
- Updated tests to validate the new functionality and ensure proper payload handling.
* Refactor tool call handling in SdkPluginBridge
- Introduced a dictionary to map tool call IDs to tool names for better clarity and efficiency.
- Enhanced the extraction of tool call information from raw results, ensuring compatibility with both dictionary and object formats.
- Updated the logic to retrieve tool names based on tool call IDs, improving the robustness of the tool calls result processing.
* Refactor tool call handling in SdkPluginBridge
- Introduced a dictionary to map tool call IDs to tool names for better clarity and efficiency.
- Enhanced the extraction of tool call information from raw results, ensuring compatibility with both dictionary and object formats.
- Updated the logic to retrieve tool names based on tool call IDs, improving the robustness of the tool calls result processing.
* Refactor tool call handling in SdkPluginBridge
- Introduced a dictionary to map tool call IDs to tool names for better clarity and efficiency.
- Enhanced the extraction of tool call information from raw results, ensuring compatibility with both dictionary and object formats.
- Updated the logic to retrieve tool names based on tool call IDs, improving the robustness of the tool calls result processing.
* feat: add session and system capabilities for plugin management and event handling
- Implemented SessionCapabilityMixin with methods to manage session-level plugin states and handlers.
- Added SystemCapabilityMixin to handle system-level functionalities including file management, event handling, and dynamic command registration.
- Introduced methods for enabling/disabling plugins, filtering handlers, and managing LLM and TTS service states.
- Registered various system capabilities for data directory access, HTML rendering, and event streaming.
* feat: add session and system capabilities for plugin management and event handling
- Implemented SessionCapabilityMixin with methods to manage session-level plugin states and handlers.
- Added SystemCapabilityMixin to handle system-level functionalities including file management, event handling, and dynamic command registration.
- Introduced methods for enabling/disabling plugins, filtering handlers, and managing LLM and TTS service states.
- Registered various system capabilities for data directory access, HTML rendering, and event streaming.
* Squashed 'astrbot-sdk/' changes from 09beabeb..3204c9db
3204c9db Merge sdk-remote dev into feat/sdk-integration
3a2d715e Refactor tool call handling in SdkPluginBridge
ed1b9665 feat: add conversation.get_current capability and related schemas
e74123bb feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
bb361cf9 feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
c6237f52 Merge sdk-remote/dev into astrbot-sdk subtree
e12029ff feat: enhance SDK plugin configuration handling and logging
5e54bbb3 feat: enhance SDK plugin configuration handling and logging
f48e2041 Merge commit '5ac9401852ddb46f337da6bcc0f9b66eed265da9' into feat/sdk-integration
619672e6 Merge commit '5ac9401852ddb46f337da6bcc0f9b66eed265da9' into feat/sdk-integration
d5a3796d docs: remove redundant testing instructions from AGENTS.md
323e3f4d docs: remove redundant testing instructions from AGENTS.md
f8438a7b Merge commit 'e45bade147ff44b43860ecff12067309e59c151a' into feat/sdk-integration
96d1df85 Merge commit 'e45bade147ff44b43860ecff12067309e59c151a' into feat/sdk-integration
f8a7e253 feat(sdk): add merged provider config bridge and client
752dc6cf feat(sdk): add merged provider config capability support
git-subtree-dir: astrbot-sdk
git-subtree-split: 3204c9db9f
* Implement feature X to enhance user experience and optimize performance
* Implement feature X to enhance user experience and optimize performance
* chore(sdk): stop tracking uv.lock
* feat(sdk): add merged provider config capability support
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* feat(sdk): add merged provider config bridge and client
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* feat(tests): 添加测试用例以验证 register_task 的行为并更新测试运行说明
* feat(tests): 添加测试用例以验证平台和消息类型过滤器的冲突处理
* docs: remove redundant testing instructions from AGENTS.md
* feat: enhance SDK plugin configuration handling and logging
* feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
* feat: add conversation.get_current capability and related schemas
- Introduced CONVERSATION_GET_CURRENT_INPUT_SCHEMA and CONVERSATION_GET_CURRENT_OUTPUT_SCHEMA for handling current conversation requests.
- Implemented _conversation_get_current method in BuiltinCapabilityRouterMixin to manage current conversation retrieval and creation.
- Registered the new capability in CoreCapabilityBridge.
- Enhanced HandlerDispatcher to inject provider request, LLM response, and event result payloads into the event handling process.
- Updated tests to validate the new functionality and ensure proper payload handling.
* Refactor tool call handling in SdkPluginBridge
- Introduced a dictionary to map tool call IDs to tool names for better clarity and efficiency.
- Enhanced the extraction of tool call information from raw results, ensuring compatibility with both dictionary and object formats.
- Updated the logic to retrieve tool names based on tool call IDs, improving the robustness of the tool calls result processing.
* feat: add session and system capabilities for plugin management and event handling
- Implemented SessionCapabilityMixin with methods to manage session-level plugin states and handlers.
- Added SystemCapabilityMixin to handle system-level functionalities including file management, event handling, and dynamic command registration.
- Introduced methods for enabling/disabling plugins, filtering handlers, and managing LLM and TTS service states.
- Registered various system capabilities for data directory access, HTML rendering, and event streaming.
* fix(runtime): avoid creating Star instance in on_error fallback
* fix(runtime): avoid virtual dispatch in Star.on_error fallback
* feat: refactor injected parameter handling and introduce is_framework_injected_parameter utility
* Squashed 'astrbot-sdk/' changes from 027c15b4..d078e510
d078e510 feat: refactor injected parameter handling and introduce is_framework_injected_parameter utility
461f7276 Merge branch 'dev' of https://github.com/united-pooh/astrbot-sdk into dev
5ead59c4 fix(runtime): avoid virtual dispatch in Star.on_error fallback
d2382858 fix(runtime): avoid creating Star instance in on_error fallback
e961e361 feat: add session and system capabilities for plugin management and event handling
5a46321a Refactor tool call handling in SdkPluginBridge
47698448 feat: add conversation.get_current capability and related schemas
9b35bec8 feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
48a20240 feat: enhance SDK plugin configuration handling and logging
cb593a53 docs: remove redundant testing instructions from AGENTS.md
f4942076 feat(tests): 添加测试用例以验证平台和消息类型过滤器的冲突处理
b0f8b2d6 feat(tests): 添加测试用例以验证 register_task 的行为并更新测试运行说明
6e417c6d feat(sdk): add merged provider config bridge and client
659eabce feat(sdk): add merged provider config capability support
REVERT: 027c15b4 Implement feature X to enhance user experience and optimize performance
REVERT: c272661f chore: pull sdk subtree from dev (resolve delete/modify conflict)
REVERT: 0a2a3592 feat: add session and system capabilities for plugin management and event handling
REVERT: 3204c9db Merge sdk-remote dev into feat/sdk-integration
REVERT: 36443f1d Refactor tool call handling in SdkPluginBridge
REVERT: 3a2d715e Refactor tool call handling in SdkPluginBridge
REVERT: b93c2c2b feat: add conversation.get_current capability and related schemas
REVERT: ed1b9665 feat: add conversation.get_current capability and related schemas
REVERT: e74123bb feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
REVERT: bb361cf9 feat: 增强装饰器功能,添加会话命令支持及相关权限和限流装饰器
REVERT: c6237f52 Merge sdk-remote/dev into astrbot-sdk subtree
REVERT: e12029ff feat: enhance SDK plugin configuration handling and logging
REVERT: 5e54bbb3 feat: enhance SDK plugin configuration handling and logging
REVERT: f48e2041 Merge commit '5ac9401852ddb46f337da6bcc0f9b66eed265da9' into feat/sdk-integration
REVERT: 619672e6 Merge commit '5ac9401852ddb46f337da6bcc0f9b66eed265da9' into feat/sdk-integration
REVERT: d5a3796d docs: remove redundant testing instructions from AGENTS.md
REVERT: 323e3f4d docs: remove redundant testing instructions from AGENTS.md
REVERT: f8438a7b Merge commit 'e45bade147ff44b43860ecff12067309e59c151a' into feat/sdk-integration
REVERT: 96d1df85 Merge commit 'e45bade147ff44b43860ecff12067309e59c151a' into feat/sdk-integration
REVERT: f8a7e253 feat(sdk): add merged provider config bridge and client
REVERT: 752dc6cf feat(sdk): add merged provider config capability support
git-subtree-dir: astrbot-sdk
git-subtree-split: d078e51051
* refactor: reorganize imports and enhance type hints in sdk_bridge modules
* refactor: update import paths to use Path for better compatibility
* refactor(injection): centralize legacy injected parameter filtering
* fix(testing): use public session waiter probe in PluginHarness
* docs: add TODO for documentation content in _command_model.py
* feat: add memory management capabilities to CoreCapabilityBridge and implement unit tests
* feat: enhance memory search functionality and improve metadata retrieval in SDK
* feat: add memory management attributes and typed provider method to CapabilityMixinHost
* Implement feature X to enhance user experience and optimize performance
* Refactor memory utility functions and enhance memory capability mixin
- Added new utility functions for memory management in _memory_utils.py.
- Refactored memory capability mixin methods to utilize the new utility functions for better readability and maintainability.
- Updated PROJECT_ARCHITECTURE.md to reflect changes in documentation and structure.
* Squashed 'astrbot-sdk/' changes from d078e510..208bc591
208bc591 Merge pull request #30 from united-pooh/refactor/unify-legacy-injected-params
d86534a2 docs: add TODO for documentation content in _command_model.py
090724a7 refactor(injection): centralize legacy injected parameter filtering
git-subtree-dir: astrbot-sdk
git-subtree-split: 208bc591dd
* Initial plan
* docs: fix path, Python version, and client API table in PROJECT_ARCHITECTURE.md
Co-authored-by: whatevertogo <149563971+whatevertogo@users.noreply.github.com>
* Squashed 'astrbot-sdk/' changes from 208bc591..ad5e8d13
ad5e8d13 Merge pull request #37 from united-pooh/sdk/whatevertogo
5751701f Merge pull request #38 from united-pooh/copilot/sub-pr-37
e21acba5 docs: fix path, Python version, and client API table in PROJECT_ARCHITECTURE.md
ee67cab4 Initial plan
7d921570 Refactor memory utility functions and enhance memory capability mixin
git-subtree-dir: astrbot-sdk
git-subtree-split: ad5e8d1397
* docs: fix TODO comment formatting in _command_model.py
* 集成SDK命令候选项,优化Telegram和Discord平台适配器的命令收集逻辑
* 删除AI女友插件的单元测试文件
* 更新文档,添加Telegram和Discord原生命令菜单的注册说明
* Squashed 'astrbot-sdk/' changes from ad5e8d13..5003da58
5003da58 Merge pull request #40 from united-pooh/sdk/whatevertogo
b5084c44 Merge branch 'sdk/whatevertogo' of https://github.com/united-pooh/astrbot-sdk into sdk/whatevertogo
7559edf7 docs: fix TODO comment formatting in _command_model.py
git-subtree-dir: astrbot-sdk
git-subtree-split: 5003da58f5
* fix(testing): route session waiter followups through dispatcher (#33)
* fix(testing): route session waiter followups through dispatcher
* fix(testing): preserve waiter context and completion state
* fix(runtime): preserve session waiter plugin identity
* fix(runtime): scope session waiters by plugin
* fix(testing): isolate waiter replacement and followup drains
* fix(runtime): normalize waiter routing inputs
* fix(cli): route protocol stdout at command entry (#41)
* 添加内存后端支持,优化插件内存管理逻辑
* feat(memory): enhance memory schemas and add namespace support
- Updated MEMORY_SEARCH_INPUT_SCHEMA to include `namespace` and `include_descendants`.
- Modified MEMORY_SEARCH_OUTPUT_SCHEMA to allow nullable `namespace`.
- Added `namespace` to MEMORY_GET_INPUT_SCHEMA, MEMORY_DELETE_INPUT_SCHEMA, MEMORY_SAVE_WITH_TTL_INPUT_SCHEMA, MEMORY_GET_MANY_INPUT_SCHEMA, and MEMORY_DELETE_MANY_INPUT_SCHEMA.
- Enhanced MEMORY_STATS_INPUT_SCHEMA to support `namespace` and `include_descendants`.
- Updated MEMORY_GET_OUTPUT_SCHEMA and MEMORY_STATS_OUTPUT_SCHEMA to include `namespace` and `namespace_count`.
- Introduced `_memory_backends` in CapabilityRouterHost and CapabilityRouterBridgeBase for better memory management.
- Refactored MemoryCapabilityMixin to utilize memory backends for plugin-specific memory operations.
- Improved memory search functionality to respect namespaces and include descendants based on input parameters.
- Added tests to validate memory operations across different namespaces and ensure persistence across restarts.
- Implemented error handling in the handler dispatcher to manage exceptions gracefully.
* fix: guard session_waiter blocking usage
* fix(runtime): preserve request-scoped system event overlays
* test(runtime): lock peer initialization and transport failure semantics
* test(loader): cover plugin reload and import isolation regressions
* refactor(supervisor): clarify plugin registry sync phases
* test(clients): cover provider lifecycle regressions
* feat(cli): improve astr init defaults
* feat(plugin): add plugin ID validation and data directory resolution
- Implemented `validate_plugin_id` to ensure safe plugin identifiers.
- Added `resolve_plugin_data_dir` to resolve plugin data directories securely.
- Updated memory and system capabilities to utilize new plugin ID validation.
- Refactored session waiter management to simplify plugin ID handling.
- Enhanced tests for plugin ID validation and data directory resolution.
* fix(cli): exit cleanly on init abort
* feat(memory): enhance namespace handling and add tests for memory client
* feat(agent): add tool status message handling and improve SDK command integration
* Refactor SDK structure for backward compatibility
- Moved message result and session classes to internal modules while preserving legacy import paths for compatibility.
- Updated imports across the SDK to reflect the new internal structure.
- Enhanced session waiter management to support multiple plugins and improve error handling.
- Added tests to ensure LLM tool registration and session waiter functionality align with dispatcher expectations.
- Cleaned up code and improved documentation for clarity and maintainability.
* 增强异步下载功能,更新组件导入方式,并添加相关测试用例
* 添加任务重入锁以支持会话等待器的嵌套清理,并更新相关测试用例以验证后续消息的序列化处理
* 添加 .astrbot_sdk_testing 到 .gitignore 文件
* Add unit tests for provider management and tool capabilities
- Introduced new test suite for provider platform management in `test_sdk_provider_platform_management.py`, covering scenarios for merged provider configurations, reserved plugin checks, and provider management functionalities.
- Added tests for tool capabilities and provider queries in `test_sdk_provider_tool_platform_capabilities.py`, validating interactions with LLM tools and specialized proxies.
- Removed obsolete `test_sdk_transport.py` as it contained outdated tests for transport layer functionality.
* 添加多个模块和测试用例,增强SDK功能并支持单元测试
* fix(bridge): add missing capability registrations for db/memory/http/metadata
Register methods for db, memory, http, and metadata capabilities exist in
BasicCapabilityMixin but were never called in CoreCapabilityBridge.__init__.
This caused SDK plugins using ctx.memory, ctx.db, ctx.http to fail with
"LookupError: capability not found".
* feat(kb): enhance knowledge base capabilities with document management and serialization
* 添加知识库文档管理功能,包括文档上传、列表、获取、删除和刷新能力,更新相关的能力路由和协议模式
* feat(conversation): add ability to unset conversation persona and update related methods
* 添加对话管理和元数据管理功能,包括清空对话人格和保存插件配置的能力
* feat(conversation): add test for unsetting conversation persona and verify state
* feat(plugin): add save_plugin_config method and related tests for plugin configuration persistence
* 优化插件配置保存方法的代码格式
* feat(sdk): enhance handler metadata with descriptions, priority, kind, and admin requirements
* 添加描述、优先级和其他元数据到处理程序元数据和描述符中,优化相关功能
* feat(sdk): enhance SDK integration with local extras handling and message payloads
* 添加对 MessageEvent 的额外字段支持,优化事件处理器的参数注入,增强 SDK 本地临时数据的管理能力
* 增强插件日志记录功能,添加控制台输出格式化和路径标签支持,新增单元测试以验证日志格式
* feat: Enhance command and tool management in dashboard
- Refactor CommandRoute to utilize AstrBotCoreLifecycle for improved command handling.
- Introduce command_key for commands to streamline toggling, renaming, and permission updates.
- Implement support for SDK commands in the dashboard, marking them as read-only.
- Update ToolTable and CommandTable components to use new command_key and tool_key properties.
- Add runtime_kind and plugin_id to tools for better management.
- Enhance API tests to cover SDK commands and tools, ensuring proper functionality and error handling.
- Update localization files to include new messages related to SDK commands.
* 优化插件日志记录和能力代理模块,增强异常处理,确保优先级参数为整数
* feat: 增强LLM能力,添加聊天提供者协议和异常处理,更新单元测试以验证提供者有效性
* feat: Implement SDK skill management capabilities
- Added SkillCapabilityMixin to handle skill registration, unregistration, and listing.
- Integrated skill management into the CoreCapabilityBridge.
- Enhanced SkillManager to support SDK-registered skills, including loading, saving, and syncing skills.
- Updated computer_client to utilize SkillManager for skill synchronization with sandboxes.
- Refactored skill export functionality in SkillsRoute to accommodate new skill management structure.
- Introduced tests for SDK skill registration, unregistration, and syncing to ensure functionality.
- Improved skill handling in the dashboard and test suite to reflect changes in skill management.
* 添加技能注册功能,包含技能注册、注销和列出能力的实现,增强插件能力管理
* 删除CLAUDE.md文档,移除过时的已知问题描述
* 删除 AGENTS.md 文档,移除过时的架构约束和开发命令说明
* 更新测试用例,修复插件发现失败时的错误信息,确保使用正确的运行时字段
* 修复错误处理和权限检查,新增单元测试以验证功能
* format
* 增强命名空间管理,优化数据库操作,添加 HTTP 路由验证,新增并发隔离测试,完善命令模型解析单元测试
* 增强 HTTP 路由功能,添加 HTTP 方法注销逻辑的单元测试
* 格式化日志输出,优化批量插入时无内容提供的调试信息
* fix: add uv dependency for plugin environment groups
* 删除代码审查文档 CODE_REVIEW_ISSUES.md
* 添加消息历史管理功能,包括消息记录的增删查改,完善相关能力混合类和测试用例
* 实现 SDK 消息历史管理功能,包括记录的增删查改操作
* Add unit tests for MCP contract and capabilities in SDK
- Implemented `_mcp_contract.py` to test local MCP server functionalities including listing, enabling, and disabling servers.
- Created `test_sdk_mcp_capabilities.py` to cover various aspects of the CoreCapabilityBridge and SdkPluginBridge, including session management and global MCP server operations.
- Introduced fake classes to simulate MCP server behavior and manage tool configurations for testing.
- Ensured comprehensive coverage of MCP session lifecycle, including opening, listing tools, calling tools, and closing sessions.
* feat(mcp): Implement local and global MCP server management capabilities
- Added MCP management client to the context for local/global MCP service management.
- Introduced decorators to acknowledge global MCP risk for plugins.
- Defined schemas for MCP server operations including get, list, enable, disable, and session management.
- Created MCP capability mixin to handle local and global MCP server operations.
- Enhanced provider capabilities to include active local MCP tool names.
- Updated capability router to support MCP functionalities and maintain session state.
- Added tests for MCP functionalities, ensuring proper behavior and risk acknowledgment.
---------
Co-authored-by: whatevertogo <149563971+whatevertogo@users.noreply.github.com>
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: letr <letr007@foxmail.com>
Co-authored-by: united_pooh <united_pooh@outlook.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: united_pooh <united_pooh@icloud.com>
Co-authored-by: Lishiling <m18384519631@163.com>
Co-authored-by: Li-shi-ling <114913764+Li-shi-ling@users.noreply.github.com>
Co-authored-by: letr <123731298+letr007@users.noreply.github.com>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: catDforD <3276453835@qq.com>
Co-authored-by: united_pooh <united_pooh@MBP-F6H6T2CYVV-2219.local>
- Remove test_computer_config.py (discover_bay_credentials not found)
- Remove test_main.py (check_dashboard_files not found)
- Remove test_skill_metadata_enrichment.py (_parse_frontmatter_description not found)
- Fix test_uninstall.py assertions to match actual output
- Fix test_bk.py digest test async mock
- Fix test_booter_decoupling.py shipyard test (incomplete config returns 0 tools)
- Fix computer_client.py _list_local_skill_dirs type error (Path vs anyio.Path)
- Remove TestApplySandboxTools class (function _apply_sandbox_tools not found)
* refactor(persona): replace local folder components with shared folder components
* feat(webui): implement draggable reordering with animation for pinned plugins
* refactor(webui): extract PinnedPluginItem into a standalone component
* feat: supports weixin personal account
* feat(weixin): update documentation for personal WeChat integration and add QR code image
* feat(weixin): refactor send method to streamline message handling
* fix(weixin): correct AES key encoding in media payload construction
* feat(weixin): update weixin_oc_base_url description for clarity in config metadata
* feat(weixin): enhance WeChat integration with QR code support and configuration updates
* feat(weixin): implement WeixinOCClient for improved media handling and API requests
* feat(platform): update platform status refresh interval to 5 seconds
- Lower default max_agent_step from 30 to 3 across all agent runners
(coze, dashscope, deerflow, dify) for faster responses
- Refactor ExecuteShellTool to use plumbum with session-based isolation,
maintaining shell state per session (cwd, env vars, etc.)
- Remove unused API-specific environment variables from cmd_run
- Fix data access bug in shipyard_neo._maybe_model_dump
- Add plumbum>=1.10.0 dependency
* fix(lark): defer streaming card creation and renew card on tool call break
- Defer CardKit streaming card creation until the first text token
arrives, preventing an empty card from rendering before content.
- Handle `type="break"` signal in send_streaming: close the current
card and lazily create a new one for post-tool-call text, so the
new card appears below the tool status message in correct order.
- Only emit "break" signal when show_tool_use is enabled; when tool
output is hidden, the AI response continues on the same card.
* style: format ruff
* fix: cr bug
* fix: cr
* fix(skills): use actual sandbox path from cache instead of hardcoded workspace root
Fixes#6273
When using Shipyard booter, the sandbox workspace directory is
`/home/ship_{session_id}/workspace/` instead of the hardcoded `/workspace`.
This caused Agent to fail reading SKILL.md files with 'No such file or directory'.
Changes:
- In build_skills_prompt: prefer skill.path (from sandbox cache) over
hardcoded SANDBOX_WORKSPACE_ROOT for sandbox_only skills
- In list_skills: always prefer sandbox_cached_paths over hardcoded path
for sandbox_only skills
The actual path is resolved at sandbox scan time via Path.resolve() in
_build_scan_command, which returns the correct absolute path based on
the sandbox's actual working directory.
* docs: add comment explaining show_sandbox_path behavior for sandbox_only skills
Address Sourcery AI review comment:
- Clarify that show_sandbox_path is implicitly True for sandbox_only skills
- Explain why the flag is effectively ignored (no local path exists)
* refactor: simplify path_str fallback using or operator
Address review feedback: use single-line fallback instead of if-not pattern.
* style: format skill_manager.py with ruff
Fix ruff format-check failure
* fix(skills): sanitize cached sandbox skill paths
Normalize sandbox cache paths before reading or writing them so invalid,
empty, or mismatched entries fall back to a safe default SKILL.md path.
This avoids using malformed cached paths, keeps path rendering
consistent, and ensures sandbox skill listings always point to the
expected workspace location.
---------
Co-authored-by: ccsang <ccsang@users.noreply.github.com>
Co-authored-by: RC-CHN <1051989940@qq.com>
* fix(agent): pass tool_call_timeout to SubAgent handoff execution
- Add tool_call_timeout parameter to _execute_handoff method
- Pass run_context.tool_call_timeout to ctx.tool_loop_agent
- Add unit test to verify tool_call_timeout is correctly passed
- Fixes#6711: SubAgent MCP tool call timeout now respects configured timeout
The SubAgent handoff execution was using the default 60-second timeout
instead of the configured tool_call_timeout from provider settings.
This change ensures that SubAgent MCP tool calls respect the user's
configured timeout settings.
* test: add unit test for tool_call_timeout in SubAgent handoff
* fix: restore deleted test and fix test assertion
- Restore test_collect_handoff_image_urls_filters_extensionless_missing_event_file
- Fix test_collect_handoff_image_urls_keeps_extensionless_existing_event_file assertion
- Keep new test_execute_handoff_passes_tool_call_timeout_to_tool_loop_agent
* refactor: simplify tool_call_timeout passing in _execute_handoff
- Pass run_context.tool_call_timeout directly to ctx.tool_loop_agent
- Remove unnecessary local variable assignment
- Addresses review feedback from Sourcery AI
* fix(config): increase default tool call timeout from 60 to 120 seconds
---------
Co-authored-by: LehaoLin <linlehao@cuhk.edu.cn>
Co-authored-by: Soulter <905617992@qq.com>
* fix: reject follow-up messages after stop requested (#6626)
Once a user sends /stop, follow-up messages should no longer be
accepted for that runner. Previously, there was a race window where
messages sent after stop could still be queued as follow-ups.
This fix gates the follow_up() method to check both done() and
_stop_requested before accepting a new follow-up message.
Acceptance criteria met:
- After /stop, later follow-up messages return None (rejected)
- Post-stop follow-ups are not added to _pending_follow_ups
- No post-stop text is injected into tool results
- Graceful-stop behavior otherwise unchanged
- Follow-ups submitted before stop retain current behavior
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: add regression tests for issue #6626 follow-up rejection
Add focused tests that verify the complete tool-result injection path
for follow-up messages after stop is requested:
- test_follow_up_rejected_and_runner_stops_without_execution: Verifies
that when stop is requested before any execution, follow-ups are
rejected and the runner stops gracefully without executing tools.
- test_follow_up_merged_into_tool_result_before_stop: Verifies that
follow-ups queued before stop are properly merged into tool results
via _merge_follow_up_notice().
- test_follow_up_after_stop_not_merged_into_tool_result: Regression
test that simulates the race condition from issue #6626. Verifies
that only pre-stop follow-ups are merged into tool results, and
post-stop follow-ups are rejected at the admission point.
These tests validate the fix in ToolLoopAgentRunner.follow_up() that
checks both self.done() and self._stop_requested before accepting
new follow-up messages.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(agent): update stop request check in ToolLoopAgentRunner
---------
Co-authored-by: ccsang <ccsang@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Soulter <905617992@qq.com>
* fix: 解决 MCP 工具与内置工具重名时的连坐问题
- 修改 get_func 方法:优先返回已激活的工具
- 修改 get_full_tool_set 方法:使用 add_tool 防止同名冲突
- 修改 add_tool 方法:优先保留已激活的工具
Fixes#5821
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: address PR review feedback for tool conflict resolution
- Fix inconsistency: get_func now uses reversed() to match ToolSet.add_tool's
"last-active-wins" logic, preventing potential "tool hijacking" issues
- Improve readability: replace double negative condition with clearer logic
- Add compatibility: use getattr with default for tools without 'active' attribute
- Remove unnecessary deepcopy: MCPTool runtime objects should not be deep copied
- Update docstring: accurately describe the actual tool resolution behavior
Addresses review comments from sourcery-ai, gemini-code-assist, and Copilot.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for tool conflict resolution (issue #5821)
Add comprehensive tests for ToolSet.add_tool, get_func, and get_full_tool_set
to verify the conflict resolution behavior when MCP tools share names with
built-in tools.
Test cases:
- ToolSet.add_tool: active/inactive priority, last-one-wins for same state
- get_func: returns last active tool, fallback to last matching tool
- get_full_tool_set: deduplication logic, no deepcopy, MCP overrides disabled builtin
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: 修复工具冲突处理逻辑,确保未激活工具不被错误移除
---------
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Add Kimi Code provider
* Add icon mapping for Kimi Code provider
* Clarify Kimi CodingPlan provider labeling
* Refine Kimi Code header handling
* modified docker compose
* fix: correct Kimi Coding Plan label and update API base URL
---------
Co-authored-by: Soulter <905617992@qq.com>
* fix: update hint for ID whitelist configuration to clarify behavior when empty
* fix: update whitelist hint
---------
Co-authored-by: machina <1531829828@qq.com>
Co-authored-by: Soulter <905617992@qq.com>
* fix(ui): localize session management group texts
Replace hardcoded Chinese strings in SessionManagementPage with i18n
lookups for group management labels, dialogs, and action feedback.
Add and align translation keys in en-US, ru-RU, and zh-CN for group
management and batch operation messages to ensure consistent multilingual
UI behavior.
* fix(ui): localize interval method hint text
* docs(sandbox): document shipyard neo setup
Expand the Chinese sandbox guide to cover Shipyard Neo as the
recommended driver and distinguish it from legacy Shipyard.
Add deployment and configuration guidance for standalone and
compose-based setups, include a full annotated config example,
and clarify profile selection, TTL behavior, workspace paths,
and persistence semantics.
* docs(sandbox): recommend standalone shipyard neo
Clarify that Shipyard Neo is best deployed on a separate,
better-provisioned host for long-term use.
Update the setup steps and AstrBot connection guidance, and
remove the earlier combined Docker Compose deployment flow.
* docs(sandbox): expand shipyard neo guide
Document Shipyard Neo as the recommended sandbox driver and
clarify how it differs from the legacy Shipyard setup.
Add guidance for deployment, performance requirements, Bay
configuration, profile selection, TTL behavior, workspace
persistence, and browser capability support.
Also reorganize the sandbox configuration section and keep the
legacy Shipyard instructions for compatibility.
* docs(sandbox): fix shipyard neo doc links
Update the sandbox guides in English and Chinese to link
directly to the upstream `config.yaml` example.
Replace duplicated TTL and persistence notes with references
to the dedicated sections to keep the guide concise and easier
to maintain.
- Fixed '_GeneratorContextManager' error in pip_installer.py by using synchronous 'with' for constraints_file().
- Fixed 'CoroutineType' has no attribute 'is_file' in dashboard/routes/config.py by adding missing await.
- Fixed undefined names (Group, ComponentTypes, File, Reply, At) in aiocqhttp_platform_adapter.py.
- Added 'pytest-cov' for code coverage testing.
- Dashboard: Catch missing index.html error, log warning, and disable WebUI instead of crashing.
- Dashboard: Use anyio.Path for async file existence checks in SSL config.
- CLI/Backup: Replace blocking file operations with anyio async operations.
- Core: Replace blocking file operations with anyio in Coze/Dify clients and TTS simulation.
- Provider: Rename 'timeout' param to 'init_timeout'/'request_timeout' to fix ASYNC109 warnings.
- Ruff: Fix various ASYNC230/ASYNC240 errors across multiple files.
* perf(dashboard): subset MDI icon font and self-host Google Fonts
* perf(dashboard): subset MDI icon font and self-host Google Fonts
* perf(dashboard): subset MDI icon font and self-host Google Fonts
* perf(dashboard): subset MDI icon font cr fix
* chore: update lockfile
Multiple models (Gemini 3, GPT-5.2, Claude Sonnet, Kimi K2.5) consistently
pick FileDownloadTool when they should pick FileUploadTool. The old
descriptions used "upload/download" which is ambiguous from the LLM's
perspective — it doesn't know which side is "local" vs "remote".
Rewrite descriptions to use explicit directional language:
- Upload: "Transfer FROM host INTO sandbox" + "when user sends a file"
- Download: "Transfer FROM sandbox OUT to host" + "ONLY when user asks
to retrieve/export"
Also improve parameter descriptions with the same directional clarity.
Fixes#6497
Co-authored-by: Yufeng He <40085740+universeplayer@users.noreply.github.com>
* feat(dashboard): add auto switch theme (default off)
feat(dashboard): move all get theme and set theme by check current theme into stores/customizer
* feat(dashboard): fix duplicate for auto switch theme
根据Gemini的意见更改了一些地方。
将原本的状态更新挪到了App.vue里,可以去除很多地方更新theme所需要的theme依赖。
将翻译修改了
将监听器改为了watch
* feat: Add OpenRouter chat completion provider adapter with custom headers. (#6436)
* chore: update astrbot.service configuration
* fix(core): use original version constraints instead of locking to installed version
Fixes#6420
The core constraints mechanism was using the currently installed version as
an exact constraint (e.g., `aiosqlite==0.21.0`), preventing plugins from
installing higher versions even when they satisfy the original constraint.
Changes:
- Preserve original version specifier from pyproject.toml (e.g., `>=0.21.0`)
- Allow plugins to require higher versions as long as they satisfy core constraint
- Prevent downgrade by using `>=installed` for packages without version constraint
Example:
- Before: Core constraint `aiosqlite==0.21.0`, plugin requires `>=0.22.1` → BLOCKED
- After: Core constraint `aiosqlite>=0.21.0`, plugin requires `>=0.22.1` → ALLOWED
This enables better dependency management while still protecting core dependencies
from incompatible downgrades.
---------
Co-authored-by: Futureppo <luominzhi2005@qq.com>
Co-authored-by: LIghtJUNction <lightjunction.me@gmail.com>
Co-authored-by: ccsang <ccsang@users.noreply.github.com>
- Introduce 'astrbot bk' command with GPG signing, encryption, and digest support
- Add import/export functionality using core backup modules
- Refactor path management to use 'AstrbotPaths' singleton across CLI commands
- Replace blocking subprocess calls with asyncio.create_subprocess_exec in backup command
- Add comprehensive tests for uninstall and backup commands
- Improve module resource handling for bundled dashboard assets
* fix: only pass dimensions param when explicitly configured
Models like bge-m3 don't support the dimensions parameter in the
embedding API, causing HTTP 400 errors. Previously dimensions was
always sent with a default value of 1024, even when the user never
configured it. Now dimensions is only included in the request when
embedding_dimensions is explicitly set in provider config.
Closes#6421
Signed-off-by: JiangNan <1394485448@qq.com>
* fix: handle invalid dimensions config and align get_dim return
- Add try-except around int() conversion in _embedding_kwargs to
gracefully handle invalid embedding_dimensions config values
- Update get_dim() to return 0 when embedding_dimensions is not
explicitly configured, so callers know dimensions weren't specified
and can handle it accordingly
- Both methods now share consistent logic for reading the config
Signed-off-by: JiangNan <1394485448@qq.com>
* fix: improve logging for invalid embedding_dimensions configuration
---------
Signed-off-by: JiangNan <1394485448@qq.com>
Co-authored-by: Soulter <905617992@qq.com>
* fix: 修改 register_agent 以避免运行时导入 AstrAgentContext
* test: improve register_agent test robustness
- Add fixture for llm_tools cleanup to avoid test interference
- Use multiple import patterns to make guard more robust to refactors
- Add assertion to verify decorated coroutine is wired as handoff handler
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* 删除测试文件: 移除 register_agent 装饰器的运行时行为测试
---------
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Soulter <905617992@qq.com>
* fix: resolve subagent persona lookup for 'default' and unify resolution logic
- Add PersonaManager.get_persona_v3_by_id() to centralize v3 persona resolution
- Handle 'default' persona_id mapping to DEFAULT_PERSONALITY in subagent orchestrator
- Fix HandoffTool.default_description using agent_name parameter correctly
- Add tests for default persona in subagent config and tool deduplication
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: simplify get_default_persona_v3 using get_persona_v3_by_id
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
There is an issue with reading the skill directory on the Windows system, which results in a high probability of files under the skill directory being unrecognizable, now fix it.
The async engine is created without a busy timeout, so concurrent
writes (agent responses, metrics, session updates) fail instantly
with 'database is locked' instead of waiting for the lock.
Add connect_args={'timeout': 30} for SQLite engines so the driver
waits up to 30 seconds for the write lock. Combined with the existing
WAL journal mode, this handles the typical concurrent write bursts
from agent + metrics + session operations.
Fixes#6443
* fix(ui): localize session management group texts
Replace hardcoded Chinese strings in SessionManagementPage with i18n
lookups for group management labels, dialogs, and action feedback.
Add and align translation keys in en-US, ru-RU, and zh-CN for group
management and batch operation messages to ensure consistent multilingual
UI behavior.
* fix(ui): localize interval method hint text
- Implement 'astrbot uninstall' to remove systemd service and data files
- Add '--log-level' option to 'astrbot run' (default: INFO)
- Pass log level config to core logger via env var
Fixes#6283
When adding a new embedding provider, the knowledge base creation page
did not show the new provider until restart.
Root cause: create_provider() did not update self.providers_config,
which is used by get_provider_config_list() to return provider lists.
This fix syncs the in-memory config after loading the new provider,
consistent with how reload() handles config updates.
Co-authored-by: ccsang <ccsang@users.noreply.github.com>
Address Sourcery AI review feedback: the image-handling logic was
duplicated for ImageContent and EmbeddedResource cases.
Changes:
- Extract _handle_image_content() helper function
- Consolidate image caching, result appending, and yielding logic
- Reduce code duplication and improve maintainability
Fixes#6140
When a tool returns CallToolResult with multiple content items (e.g.,
both TextContent and ImageContent), the agent was only processing
content[0], ignoring the rest.
Changes:
- Replace direct content[0] access with enumerate(res.content) loop
- Process all content items: TextContent, ImageContent, EmbeddedResource
- Use content_index for image caching to distinguish multiple images
This fixes the issue where tools like Bilibili plugin return both
text descriptions and screenshots, but LLM only received one of them.
* Fix CreateSkillPayloadTool array schema missing items field
The payload parameter's anyOf array variant lacked an items field,
causing Gemini API to reject the tool declaration with 400 Bad Request:
'parameters.properties[payload].any_of[1].items: missing field.'
Add items: {type: object} to the array variant to satisfy the Gemini
API requirement for array type schemas.
Fixes#6279
* Fix TypeError when OpenAI-compatible API returns null choices
Some providers (e.g. OpenRouter) may return a completion where
choices is None rather than an empty list — for instance on rate
limiting, content filtering, or transient errors. The existing code
used len(completion.choices) which throws TypeError on None.
Replace all len(...choices) == 0 checks with 'not ... .choices' which
handles both None and empty list. Affects _query_stream, _parse_openai_completion,
and _extract_reasoning_content.
Fixes#6252
Fixes#6294
QQ official bot receives emoji/sticker messages as raw XML-like tags:
`<faceType=4,faceId="",ext="eyJ0ZXh0IjoiW+a7oeWktOmXruWPt10ifQ==">`
This made the LLM unable to understand the emoji content.
Changes:
- Added `_parse_face_message()` method to parse face message format
- Decode base64 `ext` field to get emoji description text
- Replace face tags with `[表情:描述]` format for readability
Example:
- Input: `<faceType=4,faceId="",ext="eyJ0ZXh0IjoiW+a7oeWktOmXruWPt10ifQ==">`
- Output: `[表情:[满头问号]]`
Co-authored-by: ccsang <ccsang@users.noreply.github.com>
- Add local file caching for dashboard downloads with version validation
- Implement fallback to 'latest' version if specific version download fails
- Add robust error handling in CLI check_dashboard to prevent crashes
- Remove dashboard caching from smoke tests (backend-only mode)
- Update CSS for inline code elements in the welcome announcement section
- Ensure proper contrast and emphasis in both light and dark modes
- Fix issue where code blocks appeared as white boxes in dark mode
- Replaced Logo component with original inline text implementation in VerticalHeader
- Added missing isChristmas computed property
- Removed v-spacer centering for logo to match master branch layout
- This fixes the display issue where the logo/title appeared incorrect or misaligned
- Replace constrained v-container with full-width div in app bar
- Add 'app' prop to v-app-bar to fix layout flow
- Restore missing sidebar toggle buttons for desktop/mobile
- Clean up unused dev dependencies in package.json
1. Fix missing spaces in cron job wake prompt string concatenation.
Python implicit string concatenation produced:
"...scheduled taskProceed..." and "...conversation.After..."
which sent garbled instructions to the LLM agent, causing unreliable
cron job execution.
2. Replace deprecated datetime.utcnow() with
datetime.now(datetime.timezone.utc) in JWT generation.
utcnow() is deprecated since Python 3.12 and returns naive datetime
which can cause incorrect token expiry on non-UTC systems.
Closes#6103Closes#6165
Co-authored-by: easonysliu <easonysliu@tencent.com>
* fix: update scrollbar styles to follow theme variables
* fix: update theme colors to use CSS variables for consistency
* fix: change login button color to primary for better visibility
* fix: update theme colors for Dark and Light themes; change login button color to secondary
* fix: update border and theme colors for consistency in DarkTheme
* fix: update sidebar list class to conditionally hide scrollbar in mini sidebar mode
* fix: simplify button visibility logic and remove unnecessary leftPadding style
* fix: refactor language switcher to use grouped menu for better UX
* fix: update theme colors to use primary color for consistency across components
* fix: add preview text for template output in multiple languages
In _handle_api_error(), when a 429 rate-limit is encountered, the code
calls available_api_keys.remove(chosen_key). If the same key was already
removed in a previous retry iteration (e.g. the key rotated back to the
same value), this raises ValueError which crashes the entire LLM request
with an opaque error instead of a proper retry/fallback.
Add a membership check before calling remove() to prevent the crash.
Co-authored-by: easonysliu <easonysliu@tencent.com>
* Add binding for local temp directory in YAML
Bind the local temp directory to the sandbox for file access.
* Update compose-with-shipyard.yml
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.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>
Updated the quick start command from 'astrbot' to 'astrbot run' across all
language versions of README documentation for consistency and correctness.
Co-authored-by: DroidKali <DroidKali@users.noreply.github.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- .gitignore: keep both .serena and .worktrees/ entries
- astr_main_agent_resources.py: keep deletion (refactored to tools/)
- send_message.py: port video message type support from master
- shipyard_neo: browser property now returns None when not initialized
instead of raising RuntimeError, matching ComputerBooter base contract
- computer_tool_provider: remove dead os.environ writes for shipyard
(SHIPYARD_ENDPOINT / SHIPYARD_ACCESS_TOKEN are never read anywhere)
and remove unused os import
- Rewrite TestApplySandboxToolsRefactored to test ComputerToolProvider
directly (_apply_sandbox_tools was removed; old tests permanently skipped)
- Add TestExecutorCapabilityGuard with 5 strict tests for browser
capability rejection at executor level
- Fix typo: "on hehalf you" -> "on behalf of you" in subagent result
- Remove extra blank lines (ruff E303) after _apply_sandbox_tools comment
- Remove dead _build_sync_and_scan_command (no callers after refactor)
* fix(qqofficial): fix streaming message delivery for C2C
* fix(qqofficial): rewrite send_streaming for C2C vs non-C2C split
* fix(qqofficial): add _extract_response_message_id for safe id extraction
* fix(qqofficial): flush stream segment on tool-call break signal
* fix(qqofficial): downgrade rich-media to non-stream send in C2C
* fix(qqofficial): auto-append \n to final stream chunk (state=10)
* fix(qqofficial): propagate stream param to all _send_with_markdown_fallback call sites
* fix(qqofficial): retry on STREAM_MARKDOWN_NEWLINE_ERROR with newline fix
* fix(qqofficial): handle None/non-dict response in post_c2c_message gracefully
* fix(qqofficial): remove msg_id from video/file media payloads in send_by_session
QQ API rejects msg_id on proactive media (video/file, msg_type=7) messages
sent via the tool-call path, returning "请求参数msg_id无效或越权". The
msg_id passive-reply credential is consumed by the first send and cannot be
reused for subsequent media uploads in the same session.
Remove msg_id from the payload after setting msg_type=7 for video and file
sends, for both FRIEND_MESSAGE (C2C) and GROUP_MESSAGE paths.
* fix(qqofficial): replace deprecated get_event_loop() with get_running_loop()
asyncio.get_event_loop() is deprecated since Python 3.10 and raises a
DeprecationWarning (or errors) when called from inside a running coroutine
without a current event loop set on the thread. Replace both call-sites
in the streaming throttle logic with asyncio.get_running_loop(), which is
the correct API to use inside an already-running async context.
Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
---------
Co-authored-by: 2ndelement <2ndelement@users.noreply.github.com>
Co-authored-by: Claude Sonnet <noreply@anthropic.com>
Two changes to make the tool schema sent to the LLM deterministic:
1. ToolSet.normalize() — sort tools by name before serialization.
Called at the end of build_main_agent() after all injection passes.
Eliminates ordering drift from plugin load order, MCP reconnection,
and persona tool list differences.
2. Always inject full sandbox tool set — ComputerToolProvider now
returns get_default_sandbox_tools() unconditionally, regardless of
sandbox boot state. Browser tools are always in the schema even if
the sandbox profile lacks browser capability. The executor rejects
calls to unavailable browser tools with a descriptive error instead
of silently omitting them from the schema.
This eliminates the pre-boot/post-boot tool set jump that caused
prefix cache misses on the second request of a conversation.
- Add get_default_tools/get_tools/get_system_prompt_parts to ComputerBooter base
- Each booter subclass (ShipyardNeo, Shipyard, Boxlite) declares its own tools
- ComputerToolProvider now delegates to booter API via computer_client helpers
- Add unified query API: get_sandbox_tools, get_default_sandbox_tools, etc.
- Extract Neo prompts to dedicated computer/prompts.py module
- Add booter type constants (booters/constants.py)
- Fix subagent tool path to pass sandbox_cfg and session_id
- Fix Sourcery issues: shell injection in send_message, typo in prompts,
internal tools bypass inactivated_llm_tools check
* feat: add video message support and enhance message type descriptions in SendMessageToUserTool
* feat: add error handling for disabled sandbox runtime in get_booter function
- Add audio data validation in MiniMax TTS get_audio() method to detect empty responses
- Validate generated audio file size in TTSProvider.test() to ensure valid output
- Provide detailed error messages guiding users to check group_id configuration
- Auto-cleanup test audio files after validation
- Fixes issue where 0KB audio files would pass TTS detection when group_id is not configured
* feat(extension): add PluginSortControl reusable component for sorting
* i18n: add i18n keys for plugin sorting and filtering features
* feat(extension): add sorting and status filtering for installed plugins
Backend changes (plugin.py):
- Add _resolve_plugin_dir method to resolve plugin directory path
- Add _get_plugin_installed_at method to get installation time from file mtime
- Add installed_at field to plugin API response
Frontend changes (InstalledPluginsTab.vue):
- Import PluginSortControl component
- Add status filter toggle (all/enabled/disabled) using v-btn-toggle
- Integrate PluginSortControl for sorting options
- Add toolbar layout with actions and controls sections
Frontend changes (MarketPluginsTab.vue):
- Import PluginSortControl component
- Replace v-select + v-btn combination with unified PluginSortControl
Frontend changes (useExtensionPage.js):
- Add installedStatusFilter, installedSortBy, installedSortOrder refs
- Add installedSortItems and installedSortUsesOrder computed properties
- Add sortInstalledPlugins function with multi-criteria support
- Support sorting by install time, name, author, and update status
- Add status filtering in filteredPlugins computed property
- Disable default table sorting by setting sortable: false
* test: add tests for installed_at field in plugin API
- Assert all plugins have installed_at field in get_plugins response
- Assert installed_at is not null after plugin installation
* fix(extension): add explicit fallbacks for installed plugin sort comparisons
* i18n(extension): rename install time label to last modified
* fix(extension): cache installed_at parsing and validate timestamp format in tests
* test(dashboard): strengthen installed_at coverage for plugin API
* fix(provider): handle MiniMax ThinkingBlock when max_tokens reached
Fixes#5912
Problem: MiniMax API returns ThinkingBlock when stop_reason='max_tokens',
but AstrBot throws 'completion 无法解析' exception because both
completion_text and tools_call_args are empty.
Root cause: The validation logic didn't consider ThinkingBlock
(reasoning_content) as valid content.
Fix: When completion_text and tools_call_args are empty but
reasoning_content is present, treat it as valid instead of throwing
exception. This happens when the model thinks but runs out of tokens
before generating the actual response.
Impact: MiniMax models now work correctly when responses are truncated
due to max_tokens limit.
* refactor: address review feedback
1. Use getattr for safe stop_reason access (prevent AttributeError)
2. Use ValueError instead of generic Exception for better error handling
Thanks @gemini-code-assist and @sourcery-ai for the review!
* refactor: flatten nested if/else with guard clause
Address Gemini Code Assist feedback:
- Use guard clause for early return
- Flattened nested conditional for better readability
Logic unchanged, just cleaner code structure.
* fix(provider): improve logging for ThinkingBlock completions in ProviderAnthropic
---------
Co-authored-by: Soulter <905617992@qq.com>
* fix: prevent crash on malformed MCP server config (#5666)
* fix: prevent crash on malformed MCP server config (#5666)
* fix: validate MCP connection before persisting server config
* fix: guard mcpServers type before iterating server list
* refactor: use typed empty-config error and extract MCP rollback helper
* fix: translate error messages and comments to English for consistency
---------
Co-authored-by: Soulter <905617992@qq.com>
* fix(extension): support searching installed plugins by display name
* fix: unify plugin search matching across installed and market tabs
* refactor(extension): optimize plugin search matcher and remove redundant checks
* refactor(extension-page): centralize search query normalization and text matching logic
- Extract `buildSearchQuery` to create normalized query objects from raw input
- Extract `matchesText` as a reusable text matching helper for normalized/loose/pinyin/initials matching
- Remove unused `marketCustomFilter` to eliminate dead code
- Simplify `matchesPluginSearch` to accept query object instead of pre-normalized string
- Replace Set with Array for candidates to simplify control flow
- Avoid redundant normalization by having callers pass raw strings to `buildSearchQuery`
* refactor: remove unused marketCustomFilter from extension page components
- Remove marketCustomFilter from destructuring in ExtensionPage.vue, InstalledPluginsTab.vue, and MarketPluginsTab.vue
* refactor(extension): extract plugin search utilities into shared module
- Create pluginSearch.js to centralize plugin search helpers
- Move `normalizeStr`, `normalizeLoose`, `toPinyinText`, and `toInitials` into the shared module
- Add `buildSearchQuery`, `matchesText`, and `matchesPluginSearch` for reusable search matching
- Refactor useExtensionPage.js to consume the shared utilities
- Simplify plugin search logic by consolidating normalization and matching in one place
* refactor(extension): add caching to pinyin utilities and extract search fields helper
- Add Map-based caching for `toPinyinText` and `toInitials` to avoid redundant pinyin computation
- Extract `getPluginSearchFields` function to retrieve plugin fields for searching
- Improve plugin search performance with caching and better code organization
* perf(extension): add bounded caching for plugin search
- cap normalization and pinyin caches with `MAX_SEARCH_CACHE_SIZE`
- add `setCacheValue()` for oldest-entry eviction
- cache normalized and loose text values to avoid repeated string processing
- skip pinyin matching for non-CJK text using Unicode `\p{Unified_Ideograph}` property
- improve search performance while keeping memory usage bounded
* refactor(extension): extract memoizeLRU helper for cache management
- Create `memoizeLRU` higher-order function to generate LRU-cached functions
- Replace manual cache implementation with `memoizeLRU` for cleaner code
- Optimize `matchesText` to lazily compute looseValue only when needed
- Simplify caching logic while maintaining bounded cache size
* refactor(extension): simplify memoization and remove LRU logic
- Rename `memoizeLRU` to `memoizeStringFn` and remove bounded cache size
- Simplify cache hit logic for cleaner code
- Remove `MAX_SEARCH_CACHE_SIZE` constant as it's no longer needed
* fix: apply reply_with_quote and reply_with_mention to image-only responses
* fix: restrict reply_with_quote and reply_with_mention to plain-text/image chains
* feat(skills): add batch upload functionality for multiple skill ZIP files
- Implemented a new endpoint for batch uploading skills.
- Enhanced the SkillsSection component to support multiple file selection and drag-and-drop functionality.
- Updated localization files for new upload features and messages.
- Added tests to validate batch upload behavior and error handling.
* feat(skills): improve batch upload handling and enhance accessibility for dropzone
* feat(skills): enhance batch upload process and improve UI for better user experience
* feat(skills): enhance skills upload dialog layout and styling for improved usability
* feat(skills): update upload dialog description styling for better visibility and usability
* feat(skills): improve upload dialog button styling and layout for enhanced usability
* feat(skills): refine upload dialog text for clarity and consistency
* feat(skills): enhance batch upload functionality by ignoring __MACOSX entries and improving upload dialog styling
* feat(skills): refactor upload dialog and button styles for improved consistency and usability
---------
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
* test(skill_manager): update sandbox cache path expectations
adjust sandbox cache tests to match absolute path resolution in
list_skills for sandbox runtime.
verify sandbox-cached skills cannot be deactivated via set_skill_active
by asserting a PermissionError, and keep active-only listing behavior
intact.
add coverage for show_sandbox_path=false to ensure local skills still
override cached metadata while sandbox-only skills retain cached paths.
* test(skill_manager): tighten local skill path assertions
- use stable sidebar list keys to avoid vnode reuse drift
- sanitize persisted opened groups against current sidebar menu
- guard non-array customization keys from localStorage
Co-authored-by: Gargantua <22532097@zju.edu.cn>
* refactor: bundled webui static files into wheel and replace astrbot cli log with English
- Translated and standardized log messages in cmd_conf.py for better clarity.
- Updated initialization logic in cmd_init.py to provide clearer user prompts and error handling.
- Improved plugin management commands in cmd_plug.py with consistent language and error messages.
- Enhanced run command in cmd_run.py with clearer status messages and error handling.
- Updated utility functions in basic.py and plugin.py to improve readability and maintainability.
- Added version comparison logic in version_comparator.py with clearer comments.
- Enhanced logging configuration in log.py to suppress noisy loggers.
- Updated the updater logic in updator.py to provide clearer error messages for users.
- Improved IO utility functions in io.py to handle dashboard versioning more effectively.
- Enhanced dashboard server logic in server.py to prioritize bundled assets and improve user feedback.
- Updated pyproject.toml to include bundled dashboard assets and custom build hooks.
- Added a custom build script (hatch_build.py) to automate dashboard builds during package creation.
* refactor: improve exception messages and formatting in CLI command validation
* perf: change npm install to npm ci for consistent dependency installation
* fix
* fix: resolve MCP tools race condition causing 'completion 无法解析' error
- Wait for MCP client initialization to complete before accepting requests
- Add Future-based synchronization in init_mcp_clients()
- Prevent tool_calls from being rejected due to empty func_list
- Improve error logging for MCP initialization failures
Fixes race condition where AI attempts to call MCP tools before they are
registered, resulting in 'API 返回的 completion 无法解析' exceptions.
The issue occurred because:
1. MCP clients were initialized asynchronously without waiting
2. System accepted user requests immediately after startup
3. AI received empty tool list and attempted to call non-existent tools
4. Tool matching failed, causing parsing errors
This fix ensures all MCP tools are loaded before the system processes
any requests that might use them.
* perf: add timeout and better error handling for MCP initialization
- Add 20-second total timeout to prevent slow MCP servers from blocking startup
- Show detailed configuration info when MCP initialization fails
- List all failed services in a summary warning
- Gracefully handle timeout by using already-completed services
This ensures that even if some MCP servers are slow or unreachable,
the system will start within a reasonable time and provide clear
feedback about which services failed and why.
* refactor: simplify MCP init orchestration and improve log security
- Replace Future-based sync with asyncio.wait + name→task mapping
- Explicitly cancel timed-out tasks after 20s timeout
- Downgrade sensitive config details (command/args/URL) to debug level
- Move urllib.parse import to top-level
* fix: prevent initialized MCP clients from being cleaned up on timeout
- Do not cancel pending tasks on timeout; let them continue running
in the background waiting for the termination signal (event.set()),
so successfully initialized services remain available
- Track initialization state with a flag to distinguish init failures
from post-init cancellations in _init_mcp_client_task_wrapper
* fix: restore task cancellation on timeout per review feedback
Pending tasks in asyncio.wait are tasks that have NOT completed
initialization within 20s, so cancelling them is safe and correct.
* fix: separate init signal from client lifetime in MCP task wrapper
The previous design awaited task completion, but tasks only finish
on shutdown (after event.wait()), causing asyncio.wait to always
hit the 20s timeout and cancel all clients.
Fix: introduce a dedicated ready_event that is set immediately after
_init_mcp_client completes. init_mcp_clients now waits only for
ready_event (with 20s timeout), while the long-lived client task
continues running in the background until shutdown_event is set.
This ensures startup returns promptly once clients are ready.
* security: redact sensitive MCP config from debug logs
Only log executable name and argument count instead of full
command/args to avoid leaking tokens or credentials even at
debug level.
* refactor: use McpClientInfo dataclass and MCP_INIT_TIMEOUT constant
- Extract MCP_INIT_TIMEOUT = 20.0 as a named module-level constant
- Replace tuple-based client_info with _McpClientInfo dataclass to
eliminate index-based access and improve readability
- Remove _wait_ready helper; use asyncio.create_task(event.wait()) directly
- Await cancelled tasks after timeout to prevent lingering background
tasks and unobserved exceptions
* fix: handle CancelledError and clean up wait_tasks on timeout
- Catch asyncio.CancelledError separately in _init_mcp_client_task_wrapper
so ready_event.set() is always called (Python 3.8+ CancelledError
inherits BaseException, not Exception)
- Cancel and await lingering wait_tasks after timeout to prevent
them from hanging indefinitely when ready_event is never set
* fix: align enable_mcp_server with new wrapper API and fix security/config issues
- Fix enable_mcp_server to pass shutdown_event + ready_event instead of
ready_future, matching _init_mcp_client_task_wrapper's current signature
- Cancel and await init_task on timeout; clean up mcp_client_event on failure
- Read MCP_INIT_TIMEOUT from env var ASTRBOT_MCP_INIT_TIMEOUT (default 20s)
so operators can tune it without code changes
- Strip userinfo from URL in debug log (use hostname+port only, not netloc)
to avoid leaking credentials embedded in URLs
* refactor: register mcp_client_event only after successful init in enable_mcp_server
Move self.mcp_client_event[name] assignment to after initialization
succeeds, so callers never observe a stale event for a failed client.
* fix: harden MCP init state handling and timeout parsing
* fix: improve MCP timeout and post-init error observability
* refactor: simplify MCP init lifecycle orchestration
* refactor: simplify MCP init flow and cap timeout values
* fix: refine mcp timeout handling and lifecycle task tracking
* fix: harden mcp shutdown and timeout source logging
* refactor: simplify mcp runtime registry and timeout flow
* fix: keep mcp init summary return contract
* refactor: streamline mcp lifecycle and init errors
* refactor: unify mcp lifecycle wait handling
* refactor: simplify mcp runtime ownership and timeout resolution
* fix: harden mcp shutdown waiting and startup signaling
* refactor: streamline mcp lifecycle and shutdown errors
* refactor: harden mcp runtime access and shutdown
* fix: ensure mcp client cleanup and clarify views
* refactor: cache mcp client view and guard startup
* refactor: simplify mcp init cleanup and runtime lock
* refactor: reduce mcp runtime duplication
* refactor: reuse mcp cleanup and client view
---------
Co-authored-by: idiotsj <idiotsj@users.noreply.github.com>
Co-authored-by: 邹永赫 <1259085392@qq.com>
* fix: resolve unhandled UTC timezone offset for timestamps in conversation records
* fix: standardize timezone imports
* fix: unify UTC datetime normalization in dashboard routes
---------
Co-authored-by: 邹永赫 <1259085392@qq.com>
* test: add tests for star base class and config management
- Add Star base class safety helper tests
- Expand config management unit tests
- Update cron manager tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: fix plugin_manager test isolation issues
- Use local mock plugin instead of real network requests
- Clear sys.modules cache for entire data module tree
- Clear star_map and star_registry in teardown
- Use pytest_asyncio.fixture for async fixture support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: fix test isolation and compatibility issues
- test_main.py: fix version comparison and path assertions for Windows
- test_smoke.py: add missing apscheduler.triggers mock modules
- test_tool_loop_agent_runner.py: update assertion for new interrupt behavior
- test_api_key_open_api.py: use unique session IDs to avoid test conflicts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add unit tests for _version_info comparisons
* test: enhance plugin manager tests with mock implementations and improved assertions
* test: add mock plugin builder and updater for plugin management tests
* fix: resolve pipeline and star import cycles (#5353)
* fix: resolve pipeline and star import cycles
- Add bootstrap.py and stage_order.py to break circular dependencies
- Export Context, PluginManager, StarTools from star module
- Update pipeline __init__ to defer imports
- Split pipeline initialization into separate bootstrap module
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: add logging for get_config() failure in Star class
* fix: reorder logger initialization in base.py
---------
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: update cron job scheduling tests and refactor star base tests for clarity
* test: expand star base tests for comprehensive coverage
- Add tests for Star class initialization and context handling
- Add tests for text_to_image with/without config
- Add tests for html_render method
- Add tests for initialize/terminate lifecycle methods
- Add type hint validation tests for Context
- Add circular import prevention tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address PR review feedback - use TYPE_CHECKING instead of Any
- pipeline/context.py: Use TYPE_CHECKING to import PluginManager instead of Any
- pipeline/__init__.py: Add TYPE_CHECKING imports for __all__ exports to satisfy static analyzers
- star/register/star_handler.py: Use TYPE_CHECKING to import AstrAgentContext instead of Any
- tests: Remove invalid type hint tests that tested incorrect assumptions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: improve TYPE_CHECKING pattern for circular import resolution
- star/register/star_handler.py: Use AstrAgentContext instead of Any in generic types
- star/context.py: Remove unnecessary else branch with CronJobManager = Any
(with __future__ annotations, TYPE_CHECKING imports are sufficient)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
- Updated links in Japanese, Russian, and Traditional Chinese README files to include a new Simplified Chinese README.
- Enhanced the description and features of AstrBot across all language versions.
- Improved formatting of supported messaging platforms and model services in Japanese, Russian, and Traditional Chinese README files.
- Added a new README file in Simplified Chinese with comprehensive details about AstrBot, including features, deployment methods, and community contributions.
expose skill source metadata and sandbox cache status in the skills API
response so the dashboard can distinguish local, sandbox-only, and
synced skills.
prevent enabling, disabling, or deleting sandbox-only preset skills in
both backend guards and UI actions to avoid invalid local operations.
add source badges, discovery-pending hinting for sandbox runtime, and
new i18n strings for source labels and readonly warnings.
default sandbox skill paths to /workspace/skills/<name>/SKILL.md
when loading config and when exposing sandbox paths.
preserve cached sandbox paths when available to avoid losing
resolved locations for existing skills.
* feat: implement websockets transport mode selection for chat
- Added transport mode selection (SSE/WebSocket) in the chat component.
- Updated conversation sidebar to include transport mode options.
- Integrated transport mode handling in message sending logic.
- Refactored message sending functions to support both SSE and WebSocket.
- Enhanced WebSocket connection management and message handling.
- Updated localization files for transport mode labels.
- Configured Vite to support WebSocket proxying.
* feat(webchat): refactor message parsing logic and integrate new parsing function
* feat(chat): add websocket API key extraction and scope validation
keep sandbox skill cache in sync when deleting a skill from disk.
this prevents stale entries in the UI when no sandbox session is
active to refresh runtime cache
Add explicit Neo lifecycle instructions to the main agent prompt so
skill creation and updates follow payload -> candidate -> promotion
instead of direct local folder writes.
Clarify lifecycle tool descriptions and parameter semantics, including
skill_key/source_execution_ids usage and stable release sync_to_local
behavior, to reduce ambiguity and improve consistent skill publishing.
Sanitized the name field in SKILL.md frontmatter within astrbot/core/skills/neo_skill_sync.py. This prevents potential frontmatter injection vulnerabilities by removing newlines and control characters from the skill name. Verified the fix with a reproduction script and ensured existing tests pass.
Sanitize the `name` field in `SKILL.md` frontmatter to remove newlines and control characters. This prevents potential frontmatter injection vulnerabilities where a malicious skill name could introduce arbitrary YAML fields or corrupt the file structure.
- Modified `_ensure_skill_frontmatter` in `astrbot/core/skills/neo_skill_sync.py` to normalize whitespace in `name`.
- Ensured `name` is cast to string before splitting to handle non-string inputs safely.
Disable the Neo mode toggle unless runtime is sandbox with
shipyard_neo configured, and show a warning when Neo is unavailable.
Also avoid loading Neo data when the environment is not compatible and
fall back to local mode to prevent invalid requests and confusion.
Add backend routes to delete neo candidates and releases with optional
reason support and demo mode protection.
Expose delete actions in the Skills dashboard for candidate and release
rows, refresh data after success, and add localized success/failure
messages in en-US and zh-CN.
Normalize SKILL.md content during sync so each file includes name and
description metadata in a frontmatter block.
Preserve existing frontmatter values when present, derive description
from markdown content when missing, and fallback to a default
description to keep metadata complete and consistent.
Normalize release stage values before stability checks so enum-like
objects and mixed-case strings are handled consistently.
When stable sync fails, treat "no previous release exists" during
auto-rollback as a skipped rollback instead of raising a secondary
runtime error
append a Shipyard Neo-specific system prompt note for filesystem
tool calls so paths are provided relative to the workspace root.
this prevents models from prepending `/workspace` and causing tool
path resolution failures
* fix:fix the issue where incomplete cleanup of residual plugins occurs in the failed loading of plugins
* fix:ruff format,apply bot suggestions
* Apply suggestion from @gemini-code-assist[bot]
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* perf: batch metadata query in KB retrieval to fix N+1 problem
Replace N sequential get_document_with_metadata() calls with a single
get_documents_with_metadata_batch() call using SQL IN clause.
Benchmark results (local SQLite):
- 10 docs: 10.67ms → 1.47ms (7.3x faster)
- 20 docs: 26.00ms → 2.68ms (9.7x faster)
- 50 docs: 63.87ms → 2.79ms (22.9x faster)
* refactor: use set[str] param type and chunk IN clause for SQLite safety
Address review feedback:
- Change doc_ids param from list[str] to set[str] to avoid unnecessary conversion
- Chunk IN clause into batches of 900 to stay under SQLite's 999 parameter limit
- Remove list() wrapping at call site, pass set directly
* fix(dashboard): 强化 API Key 复制临时节点清理逻辑
* fix(embedding): 自动检测改为探测 OpenAI embedding 最大可用维度
* fix: normalize openai embedding base url and add hint key
* i18n: add embedding_api_base hint translations
* i18n: localize provider embedding/proxy metadata hints
* fix: show provider-specific embedding API Base URL hint as field subtitle
* fix(embedding): cap OpenAI detect_dim probes with early short-circuit
* fix(dashboard): return generic error on provider adapter import failure
* 回退检测逻辑
- Implemented a new composable `useExtensionPage` to handle various functionalities related to plugin management, including fetching extensions, handling updates, and managing UI states.
- Added support for conflict checking, plugin installation, and custom source management.
- Integrated search and filtering capabilities for plugins in the market.
- Enhanced user experience with dialogs for confirmations and notifications.
- Included pagination and sorting features for better plugin visibility.
* i18n: complete internationalization for subagent orchestration page
- Replace hardcoded English strings in [SubAgentPage.vue] with i18n keys.
- Update `en-US` and `zh-CN` locales with missing hints, validation messages, and empty state translations.
- Fix translation typos and improve consistency across the SubAgent orchestration UI.
* fix(bug_risk): 避免在模板中的翻译调用上使用 || 'Close' 作为回退值。
* fix: resolve pipeline and star import cycles
- Add bootstrap.py and stage_order.py to break circular dependencies
- Export Context, PluginManager, StarTools from star module
- Update pipeline __init__ to defer imports
- Split pipeline initialization into separate bootstrap module
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: add logging for get_config() failure in Star class
* fix: reorder logger initialization in base.py
---------
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(config): handle UTF-8 BOM in configuration file loading
Problem:
On Windows, some text editors (like Notepad) automatically add UTF-8 BOM
to JSON files when saving. This causes json.decoder.JSONDecodeError:
"Unexpected UTF-8 BOM" and AstrBot fails to start when cmd_config.json
contains BOM.
Solution:
Add defensive check to strip UTF-8 BOM (\ufeff) if present before
parsing JSON configuration file.
Impact:
- Improves robustness and cross-platform compatibility
- No breaking changes to existing functionality
- Fixes startup failure when configuration file has UTF-8 BOM encoding
Relates-to: Windows editor compatibility issues
* style: fix code formatting with ruff
Fix single quote to double quote to comply with project code style.
* fix(chatui): add copy rollback path and error message.
* fix(chatui): fixed textarea leak in the copy button.
* fix(chatui): use color styles from the component library.
* feat: add stop functionality for active agent sessions and improve handling of stop requests
* feat: update stop button icon and tooltip in ChatInput component
* fix: correct indentation in tool call handling within ChatRoute class
* feat(dashboard): make desktop release base URL configurable
* refactor(dashboard): use generic release base URL env with upstream default
* fix(dashboard): guard release base URL normalization when env is unset
* refactor(dashboard): use generic release URL helpers and avoid latest suffix duplication
* feat:为subagent添加后台任务参数
* ruff
* fix: update terminology from 'handoff mission' to 'background task' and refactor related logic
* fix: update terminology from 'background_mission' to 'background_task' in HandoffTool and related logic
* fix(HandoffTool): update background_task description for clarity on usage
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: support registering command aliases for Telegram
Now when registering commands with aliases, all aliases will be
registered as Telegram bot commands in addition to the main command.
Example:
@register_command(command_name="draw", alias={"画", "gen"})
Now /draw, /画, and /gen will all appear in the Telegram command menu.
* feat(telegram): add duplicate command name warning when registering commands
Log a warning when duplicate command names are detected during Telegram
command registration to help identify configuration conflicts.
* feat: add Anthropic Claude Code OAuth provider and adaptive thinking support
* fix: add defensive guard for metadata overrides and align budget condition with docs
* refactor: adopt sourcery-ai suggestions for OAuth provider
- Use use_api_key=False in OAuth subclass to avoid redundant
API-key client construction before replacing with auth_token client
- Generalize metadata override helper to merge all dict keys
instead of only handling 'limit', improving extensibility
* feat(dashboard): improve plugin platform support display and mobile accessibility
- Replace hover-based tooltips with interactive click menus for platform support information.
- Fix mobile touch issues by introducing explicit state control for status capsules.
- Enhance UI aesthetics with platform-specific icons and a structured vertical list layout.
- Add dynamic chevron icons to provide clear visual cues for expandable content.
* refactor(dashboard): refactor market card with computed properties for performance
* refactor(dashboard): unify plugin platform support UI with new reusable chip component
- Create shared 'PluginPlatformChip' component to encapsulate platform meta display.
- Fix mobile interaction bugs by simplifying menu triggers and event handling.
- Add stacked platform icon previews and dynamic chevron indicators within capsules.
- Improve information hierarchy using structured vertical lists for platform details.
- Optimize rendering efficiency with computed properties across both card views.
* feat: astrbot http api
* Potential fix for code scanning alert no. 34: Use of a broken or weak cryptographic hashing algorithm on sensitive data
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* fix: improve error handling for missing attachment path in file upload
* feat: implement paginated retrieval of platform sessions for creators
* feat: refactor attachment directory handling in ChatRoute
* feat: update API endpoint paths for file and message handling
* feat: add documentation link to API key management section in settings
* feat: update API key scopes and related configurations in API routes and tests
* feat: enhance API key expiration options and add warning for permanent keys
* feat: add UTC normalization and serialization for API key timestamps
* feat: implement chat session management and validation for usernames
* feat: ignore session_id type chunks in message processing
---------
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
- Resolve skills root via Path.resolve() so LLM prompts always
reference absolute paths regardless of sandbox cwd
- Use resolved path in skill metadata for reliable cat/head commands
- Add DRY cross-reference comment for frontmatter parser
- Remove dead skills_root_abs field from JSON output (no consumer)
- Remove unnecessary os import and fake resolve/abspath branch
- Rewrite build_skills_prompt() with structured numbered rules and
markdown formatting for better LLM comprehension
- Sanitize example_path with _SAFE_PATH_RE before embedding in system
prompt to prevent prompt injection via crafted skill paths
- Add docstring to _parse_frontmatter_description()
- Remove debug print(top_dirs) from install_skill_from_zip()
- Remove stale commented-out SANDBOX_SKILLS_ROOT line
_apply_sandbox_tools now checks the booted session's capabilities
before registering browser tools (BrowserExecTool, BrowserBatchExecTool,
RunBrowserSkillTool).
- If no session exists yet (first request), all tools are registered
conservatively to avoid breaking the initial interaction
- If a session exists without browser capability, browser tools are
omitted, preventing CapabilityNotSupportedError from Bay
- Skill lifecycle tools remain unconditionally registered
Add capabilities property to ComputerBooter base class (returns None)
and ShipyardNeoBooter (returns immutable tuple from sandbox).
- Extract DEFAULT_PROFILE class constant to replace scattered magic string
- Use tuple[str, ...] for immutability (no defensive copy needed)
- Add _resolve_profile() for smart profile selection:
- honour user-specified profile
- query Bay API, prefer browser-capable profiles
- re-raise auth errors (401/403), fallback on transient failures
- Conditionally create NeoBrowserComponent only when profile has browser
- Log resolved profile and capabilities at boot
Add BayContainerManager to manage Bay container lifecycle via Docker
Engine API, similar to how BoxliteBooter manages Ship containers.
When ShipyardNeoBooter endpoint is empty or set to '__auto__', Bay is
automatically pulled, started, health-checked, and credentials are
read from the container.
- New bay_manager.py: ensure_running, wait_healthy, read_credentials
- Integrate auto-start into ShipyardNeoBooter boot/shutdown
- Reuse Bay container across sessions (unless-stopped policy)
- Friendly error messages for Docker and credential failures
* feat: add support for plugin astrbot-version and platform requirement checks
* fix: remove unsupported platform and version constraints from metadata.yaml
* fix: remove restriction on 'v' in astrbot_version specification format
* ruff format
* ci: remove Electron desktop build from release pipeline
* chore: remove electron desktop and switch to tauri release trigger
* ci: remove desktop workflow dispatch trigger
* refactor: migrate data paths to astrbot_path helpers
* fix: point desktop update prompt to AstrBot-desktop releases
When saving config with shipyard_neo sandbox, _validate_neo_connectivity()
performs an async /health check against the Bay endpoint. If Bay is
unreachable, a ⚠️ warning is appended to the success snackbar message.
Config still saves successfully — the warning is informational only.
- Add _discover_bay_credentials() auto-discovery in _get_neo_client_config()
- Catch ValueError separately in _with_neo_client(), log at DEBUG instead of
ERROR with full traceback — prevents log spam when visiting Skills page
without Bay configured
- Add _send_voice_with_fallback helper to deduplicate voice forbidden handling
- Catch telegram.error.BadRequest instead of bare Exception with string matching
- Add text field to Record component to preserve TTS source text
- Store original text in Record during TTS conversion for use as document caption
- Skip _send_chat_action when chat_id is empty to avoid unnecessary warnings
* feat: add MarketPluginCard component and integrate random plugin feature in ExtensionPage
* feat: update random plugin selection logic to use pluginMarketData and refresh on relevant events
separate sandbox skill syncing into distinct apply and scan steps
while keeping the legacy combined command for compatibility
improve observability by adding phase-based logs and richer shell
error details that include exit code, stderr, and stdout tail
reuse a shared python-exec command builder to reduce duplication
and keep command generation consistent
extract shared promote/sync orchestration into `NeoSkillSyncManager` so
computer tools and dashboard routes use the same rollback and error logic
add a reusable neo tool base runner to remove duplicated admin checks and
try/catch handling across skill-related tools, keeping responses consistent
factor sync result serialization into a single helper and reuse it where
stable release sync output is returned
extract a shared `_with_neo_client` wrapper to handle neo client
setup, teardown, and error responses in one place.
reduce duplicated try/except and `BayClient` context boilerplate across
neo skills endpoints while preserving existing request validation and
response payloads.
set the base booter browser property to return None instead of
raising NotImplementedError so callers can handle missing browser
support through capability checks
- Generated config uses allow_anonymous: false (triggers auto-provision)
- Set BAY_DATA_DIR so credentials.json writes to pkgs/bay/
- Add read_bay_credentials() to extract auto-generated key after boot
- Display API key in config hints for easy AstrBot setup
When shipyard_neo_access_token is not configured, _discover_bay_credentials()
searches for Bay's credentials.json in:
1. BAY_DATA_DIR env var
2. Mono-repo relative path ../pkgs/bay/
3. Current working directory
Enables zero-config dev mode when Bay runs locally alongside AstrBot.
Add scripts/start-with-neo.sh: one-click launcher that auto-generates
Bay config.yaml (anonymous mode, host_port), pulls Ship image, starts
Bay (port 8114) with health check, then starts AstrBot in foreground.
Ctrl+C stops both services. Supports BAY_PORT env var override.
Add _log_computer_config_changes() to detect and log modifications to
computer_use_runtime and sandbox.* keys when saving config via Dashboard.
Sensitive fields (tokens/secrets) are masked in log output.
* fix: handle list format content from OpenAI-compatible APIs
Some LLM providers (e.g., GLM-4.5V via SiliconFlow) return content as
list[dict] format like [{'type': 'text', 'text': '...'}] instead of
plain string. This causes the raw list representation to be displayed
to users.
Changes:
- Add _normalize_content() helper to extract text from various content formats
- Use json.loads instead of ast.literal_eval for safer parsing
- Add size limit check (8KB) before attempting JSON parsing
- Only convert lists that match OpenAI content-part schema (has 'type': 'text')
to avoid collapsing legitimate list-literal replies like ['foo', 'bar']
- Add strip parameter to preserve whitespace in streaming chunks
- Clean up orphan </think> tags that may leak from some models
Fixes#5124
* fix: improve content normalization safety
- Try json.loads first, fallback to ast.literal_eval for single-quoted
Python literals to avoid corrupting apostrophes (e.g., "don't")
- Coerce text values to str to handle null or non-string text fields
* feat: implement fallback provider support for chat models and update configuration
* feat: enhance provider selection display with count and chips for selected providers
* feat: update fallback chat providers to use provider settings and add warning for non-list fallback models
When an OnLLMRequestEvent hook stops event propagation, the
reset_coro created by build_main_agent was never awaited, causing
a RuntimeWarning. Close the coroutine explicitly before returning.
Fixes#5032
Co-authored-by: Limitless2023 <limitless@users.noreply.github.com>
* feat: temporary file handling and introduce TempDirCleaner
- Updated various modules to use `get_astrbot_temp_path()` instead of `get_astrbot_data_path()` for temporary file storage.
- Renamed temporary files for better identification and organization.
- Introduced `TempDirCleaner` to manage the size of the temporary directory, ensuring it does not exceed a specified limit by deleting the oldest files.
- Added configuration option for maximum temporary directory size in the dashboard.
- Implemented tests for `TempDirCleaner` to verify cleanup functionality and size management.
* ruff
* fix: patch pip distlib finder for frozen electron runtime
* fix: use certifi CA bundle for runtime SSL requests
* fix: configure certifi CA before core imports
* fix: improve mac font fallback for dashboard text
* fix: harden frozen pip patch and unify TLS connector
* refactor: centralize dashboard CJK font fallback stacks
* perf: reuse TLS context and avoid repeated frozen pip patch
* refactor: bootstrap TLS setup before core imports
* fix: use async confirm dialog for provider deletions
* fix: replace native confirm dialogs in dashboard
- Add shared confirm helper in dashboard/src/utils/confirmDialog.ts for async dialog usage with safe fallback.
- Migrate provider, chat, config, session, platform, persona, MCP, backup, and knowledge-base delete/close confirmations to use the shared helper.
- Remove scattered inline confirm handling to keep behavior consistent and avoid native blocking dialog focus/caret issues in Electron.
* fix: capture runtime bootstrap logs after logger init
- Add bootstrap record buffer in runtime_bootstrap for early TLS patch logs before logger is ready.
- Flush buffered bootstrap logs to astrbot logger at process startup in main.py.
- Include concrete exception details for TLS bootstrap failures to improve diagnosis.
* fix: harden runtime bootstrap and unify confirm handling
- Simplify bootstrap log buffering and add a public initialize hook for non-main startup paths.
- Guard aiohttp TLS patching with feature/type checks and keep graceful fallback when internals are unavailable.
- Standardize dashboard confirmation flow via shared confirm helpers across composition and options API components.
* refactor: simplify runtime tls bootstrap and tighten confirm typing
* refactor: align ssl helper namespace and confirm usage
* fix: avoid frozen restart crash from multiprocessing import
* fix: include missing frozen dependencies for windows backend
* fix: use execv for stable backend reboot args
* Revert "fix: use execv for stable backend reboot args"
This reverts commit 9cc27becff.
* Revert "fix: include missing frozen dependencies for windows backend"
This reverts commit 52554bea1f.
* Revert "fix: avoid frozen restart crash from multiprocessing import"
This reverts commit 10548645b0.
* fix: reset pyinstaller onefile env before reboot
* fix: unify electron restart path and tray-exit backend cleanup
* fix: stabilize desktop restart detection and frozen reboot args
* fix: make dashboard restart wait detection robust
* fix: revert dashboard restart waiting interaction tweaks
* fix: pass auth token for desktop graceful restart
* fix: avoid false failure during graceful restart wait
* fix: start restart waiting before electron restart call
* fix: harden restart waiting and reboot arg parsing
* fix: parse start_time as numeric timestamp
* fix: patch pip distlib finder for frozen electron runtime
* fix: use certifi CA bundle for runtime SSL requests
* fix: configure certifi CA before core imports
* fix: improve mac font fallback for dashboard text
* fix: harden frozen pip patch and unify TLS connector
* refactor: centralize dashboard CJK font fallback stacks
* perf: reuse TLS context and avoid repeated frozen pip patch
* refactor: bootstrap TLS setup before core imports
* fix: use async confirm dialog for provider deletions
* fix: replace native confirm dialogs in dashboard
- Add shared confirm helper in dashboard/src/utils/confirmDialog.ts for async dialog usage with safe fallback.
- Migrate provider, chat, config, session, platform, persona, MCP, backup, and knowledge-base delete/close confirmations to use the shared helper.
- Remove scattered inline confirm handling to keep behavior consistent and avoid native blocking dialog focus/caret issues in Electron.
* fix: capture runtime bootstrap logs after logger init
- Add bootstrap record buffer in runtime_bootstrap for early TLS patch logs before logger is ready.
- Flush buffered bootstrap logs to astrbot logger at process startup in main.py.
- Include concrete exception details for TLS bootstrap failures to improve diagnosis.
* fix: harden runtime bootstrap and unify confirm handling
- Simplify bootstrap log buffering and add a public initialize hook for non-main startup paths.
- Guard aiohttp TLS patching with feature/type checks and keep graceful fallback when internals are unavailable.
- Standardize dashboard confirmation flow via shared confirm helpers across composition and options API components.
* refactor: simplify runtime tls bootstrap and tighten confirm typing
* refactor: align ssl helper namespace and confirm usage
* feat: enhance persona tool management and update UI localization for subagent orchestration
* fix: remove debug logging for final ProviderRequest in build_main_agent function
* Initial plan
* feat: add delete button to persona management dialog
- Added delete button to PersonaForm dialog (only visible when editing)
- Implemented deletePersona method with confirmation dialog
- Connected delete event to PersonaManager for proper handling
- Button positioned on left side of dialog actions for clear separation
- Uses existing i18n translations for delete button and messages
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
* fix: use finally block to ensure saving state is reset
- Moved `this.saving = false` to finally block in deletePersona
- Ensures UI doesn't stay in saving state after errors
- Follows best practices for state management
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
* feat: add desktop wrapper with frontend-only packaging
* docs: add desktop build docs and track dashboard lockfile
* fix: track desktop lockfile for npm ci
* fix: allow custom install directory for windows installer
* chore: migrate desktop workflow to pnpm
* fix(desktop): build AppImage only on Linux
* fix(desktop): harden packaged startup and backend bundling
* fix(desktop): adapt packaged restart and plugin dependency flow
* fix(desktop): prevent backend respawn race on quit
* fix(desktop): prefer pyproject version for desktop packaging
* fix(desktop): improve startup loading UX and reduce flicker
* ci: add desktop multi-platform release workflow
* ci: fix desktop release build and mac runner labels
* ci: disable electron-builder auto publish in desktop build
* ci: avoid electron-builder publish path in build matrix
* ci: normalize desktop release artifact names
* ci: exclude blockmap files from desktop release assets
* ci: prefix desktop release assets with AstrBot and purge blockmaps
* feat: add electron bridge types and expose backend control methods in preload script
* Update startup screen assets and styles
- Changed the icon from PNG to SVG format for better scalability.
- Updated the border color from #d0d0d0 to #eeeeee for a softer appearance.
- Adjusted the width of the startup screen from 460px to 360px for improved responsiveness.
* Update .gitignore to include package.json
* chore: remove desktop gitkeep ignore exceptions
* docs: update desktop troubleshooting for current runtime behavior
* refactor(desktop): modularize runtime and harden startup flow
---------
Co-authored-by: Soulter <905617992@qq.com>
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
* feat: implement media file handling utilities for audio and video processing
* feat: refactor file upload handling for audio and video in LarkMessageEvent
* feat: add cleanup for failed audio and video conversion outputs in media_utils
* feat: add utility methods for sending messages and uploading files in LarkMessageEvent
* Fix TypeError when MCP schema type is a list
Fixes crash in Gemini native tools with VRChat MCP.
* Refactor: avoid modifying schema in place per feedback
* Fix formatting and cleanup comments
* fix: add error handling to avoid ghost plugins
Add null checks to filter out incomplete plugin metadata objects that would appear as ghost plugins in the API response.
This fix ensures that plugins with all null key fields (name, author, desc, version, display_name) are not included in the plugin list response, preventing ghost plugins from appearing in the UI.
Issue: #4833
* fix: improve ghost plugin detection logic for better accuracy
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: add computer use runtime configuration and handling for skills execution
* fix: improve user notification for disabled Computer Use feature in skills execution
* fix: preserve MCP tools in _plugin_tool_fix filter
Tools without handler_module_path (such as MCP tools and built-in tools)
were being incorrectly skipped during plugin-based tool filtering.
This fix ensures that tools without plugin association are preserved,
as they should not be affected by plugin-level filtering logic.
* fix: retain MCP tools in _plugin_tool_fix function
---------
Co-authored-by: idiotsj <idiotsj@users.noreply.github.com>
Co-authored-by: Soulter <905617992@qq.com>
* feat: add trace settings management and UI for enabling/disabling trace logging
* feat: enhance trace feature with internationalization support for hints and status messages
* fix: improve tool info extraction in run_agent function
* fix: merge chatui pop-up prompt into chatui default persona and improve chatui persona handle
* fix: update webchat persona handling to avoid default assignment for None
- Updated FunctionToolExecutor to improve background task handling and integrate new system prompts for proactive agents.
- Enhanced MainAgentBuildConfig with additional configuration options for tool management and context handling.
- Introduced new system prompts for proactive agents triggered by cron jobs and background tasks to improve user interaction.
- Refactored cron job management to utilize ProviderRequest for better context management and tool integration.
- Renamed cron job tools for clarity, changing "create_cron_job" to "create_future_task" and similar adjustments for consistency.
- Improved error handling and logging for cron job execution and agent responses.
- Added support for image captioning and persona management in agent requests.
* fix(mcp): support renaming when editing MCP servers
When editing the MCP server configuration, you can now change the server name. The frontend will save the original name in edit mode, and the backend will recognize the rename operation through the oldName field.
* fix(mcp): fixed an issue where renaming the MCP server did not check for name conflicts
When renaming an MCP server, add a check to see if the target name already exists. If the name exists and it is a rename operation, return an error message to avoid overwriting the configuration.
- Implemented proactive cron job tools in InternalAgentSubStage for scheduling tasks.
- Created SendMessageToUserTool for sending messages to users based on cron job triggers.
- Added CreateActiveCronTool, DeleteCronJobTool, and ListCronJobsTool for cron job management.
- Introduced CronRoute for handling cron job API requests in the dashboard.
- Developed CronJobPage.vue for managing cron jobs in the dashboard UI.
- Updated SubAgentPage.vue to include persona selection for subagents.
* fix: Fixed a bug where the front end still displayed a success message when Skills upload failed.
* refactor(dashboard): unify API response handling in SkillsSection
* feat: support anthropic skills
closes: #4687
* chore: ruff
* feat: implement skills management and selection in persona configuration
* feat: enhance skills management with local environment tools and permissions
* 修复gemini toolcall 的名称导致的循环调用
* Apply suggestions from code review
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* Refactor function response creation for tool role
Refactor function response handling for tool role to ensure proper ID injection.
---------
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: astr live
* chore: remove
* feat: metrics
* feat: enhance audio processing and metrics display in live mode
* feat: genie tts
* feat: enhance live mode audio processing and text handling
* feat: add metrics
* feat: eyes
* feat: nervous
* chore: update readme
Added '自动压缩对话' feature and updated features list.
* feat: skip saving head system messages in history (#4538)
* feat: skip saving the first system message in history
* fix: rename variable for clarity in system message handling
* fix: update logic to skip all system messages until the first non-system message
* fix: clarify logic for skipping initial system messages in conversation
* chore: bump version to 4.12.2
* docs: update 4.12.2 changelog
* refactor: update event types for LLM tool usage and response
* chore: bump version to 4.12.3
* fix: ensure embedding dimensions are returned as integers in providers (#4547)
* fix: ensure embedding dimensions are returned as integers in providers
* chore: ruff format
* perf: T2I template editor preview (#4574)
* feat: add file drag upload feature for ChatUI (#4583)
* feat(chat): add drag-drop upload and fix batch file upload
* style(chat): adjust drop overlay to only cover input container
* fix: streaming response for DingTalk (#4590)
closes: #4384
* #4384 钉钉消息回复卡片模板
* chore: ruff format
* chore: ruff format
---------
Co-authored-by: ManJiang <man.jiang@jg-robust.com>
Co-authored-by: Soulter <905617992@qq.com>
* feat: implement persona folder for advanced persona management (#4443)
* feat(db): add persona folder management for hierarchical organization
Implement hierarchical folder structure for organizing personas:
- Add PersonaFolder model with recursive parent-child relationships
- Add folder_id and sort_order fields to Persona model
- Implement CRUD operations for persona folders in database layer
- Add migration support for existing databases
- Extend PersonaManager with folder management methods
- Add dashboard API routes for folder operations
* feat(persona): add batch sort order update endpoint for personas and folders
Add new API endpoint POST /persona/reorder to batch update sort_order
for both personas and folders. This enables drag-and-drop reordering
in the dashboard UI.
Changes:
- Add abstract batch_update_sort_order method to BaseDatabase
- Implement batch_update_sort_order in SQLiteDatabase
- Add batch_update_sort_order to PersonaManager with cache refresh
- Add reorder_items route handler with input validation
* feat(persona): add folder_id and sort_order params to persona creation
Extend persona creation flow to support folder placement and ordering:
- Add folder_id and sort_order parameters to insert_persona in db layer
- Update PersonaManager.create_persona to accept and pass folder params
- Add get_folder_detail API endpoint for retrieving folder information
- Include folder_id and sort_order in persona creation response
- Add session flush/refresh to return complete persona object
* feat(dashboard): implement persona folder management UI
- Add folder management system with tree view and breadcrumbs
- Implement create, rename, delete, and move operations for folders
- Add drag-and-drop support for organizing personas and folders
- Create new PersonaManager component and Pinia store for state management
- Refactor PersonaPage to support hierarchical structure
- Update locale files with folder-related translations
- Handle empty parent_id correctly in backend route
* feat(dashboard): centralize folder expansion state in persona store
Move folder expansion logic from local component state to global Pinia
store to persist expansion state.
- Add `expandedFolderIds` state and toggle actions to `personaStore`
- Update `FolderTreeNode` to use store state instead of local data
- Automatically navigate to target folder after moving a persona
* feat(dashboard): add reusable folder management component library
Extract folder management UI into reusable base components and create
persona-specific wrapper components that integrate with personaStore.
- Add base folder components (tree, breadcrumb, card, dialogs) with
customizable labels for i18n support
- Create useFolderManager composable for folder state management
- Implement drag-and-drop support for moving personas between folders
- Add persona-specific wrapper components connecting to personaStore
- Reorganize PersonaManager into views/persona directory structure
- Include comprehensive README documentation for component usage
* refactor(dashboard): remove legacy persona folder management components
Remove deprecated persona folder management Vue components that have been
superseded by the new reusable folder management component library.
Deleted components:
- CreateFolderDialog.vue
- FolderBreadcrumb.vue
- FolderCard.vue
- FolderTree.vue
- FolderTreeNode.vue
- MoveTargetNode.vue
- MoveToFolderDialog.vue
- PersonaCard.vue
- PersonaManager.vue
These components are replaced by the centralized folder management
implementation introduced in commit 3fbb3db2.
* fix(dashboard): add delayed skeleton loading to prevent UI flicker
Implement a 150ms delay before showing the skeleton loader in
PersonaManager to prevent visual flicker during fast loading operations.
- Add showSkeleton state with timer-based delay mechanism
- Use v-fade-transition for smooth skeleton visibility transitions
- Clean up timer on component unmount to prevent memory leaks
- Only display skeleton when loading exceeds threshold duration
* feat(dashboard): add generic folder item selector component for persona selection
Introduce BaseFolderItemSelector.vue as a reusable component for selecting
items within folder hierarchies. Refactor PersonaSelector to use this new
base component instead of its previous flat list implementation.
Changes:
- Add BaseFolderItemSelector with folder tree navigation and item selection
- Extend folder types with SelectableItem and FolderItemSelectorLabels
- Refactor PersonaSelector to leverage the new base component
- Add i18n translations for rootFolder and emptyFolder labels
* feat(persona): add tree-view display for persona list command
Add hierarchical folder tree output for the persona list command,
showing personas organized by folders with visual tree connectors.
- Add _build_tree_output method for recursive tree structure rendering
- Display folders with 📁 icon and personas with 👤 icon
- Show root-level personas separately from folder contents
- Include total persona count in output
* refactor(persona): simplify tree-view output with shorter indentation lines
Replace complex tree connector logic with simpler depth-based indentation
using "│ " prefix. Remove unnecessary parameters (prefix, is_last) and
computed variables (has_content, total_items, item_idx) in favor of a
cleaner depth-based approach.
* feat(dashboard): add duplicate persona ID validation in create form
Add frontend validation to prevent creating personas with duplicate IDs.
Load existing persona IDs when opening the create form and validate
against them in real-time.
- Add existingPersonaIds array and loadExistingPersonaIds method
- Add validation rule to check for duplicate persona IDs
- Add i18n messages for duplicate ID error (en-US and zh-CN)
- Fix minLength validation to require at least 1 character
* i18n(persona): add createButton translation key for folder dialog
Move create button label to folder-specific translation path
instead of using generic buttons.create key.
* feat(persona): show target folder name in persona creation dialog
Add visual feedback showing which folder a new persona will be created in.
- Add info alert in PersonaForm displaying the target folder name
- Pass currentFolderName prop from PersonaManager and PersonaSelector
- Add recursive findFolderName helper to resolve folder ID to name
- Add i18n translations for createInFolder and rootFolder labels
* style:format code
* fix: remove 'persistent' attribute from dialog components
---------
Co-authored-by: Soulter <905617992@qq.com>
* perf: live mode entry
* chore: remove japanese prompt
---------
Co-authored-by: Anima-IGCenter <cacheigcrystal2@gmail.com>
Co-authored-by: Clhikari <Clhikari@qq.com>
Co-authored-by: jiangman202506 <jiangman202506@163.com>
Co-authored-by: ManJiang <man.jiang@jg-robust.com>
Co-authored-by: Ruochen Pan <67079377+RC-CHN@users.noreply.github.com>
* feat(db): add persona folder management for hierarchical organization
Implement hierarchical folder structure for organizing personas:
- Add PersonaFolder model with recursive parent-child relationships
- Add folder_id and sort_order fields to Persona model
- Implement CRUD operations for persona folders in database layer
- Add migration support for existing databases
- Extend PersonaManager with folder management methods
- Add dashboard API routes for folder operations
* feat(persona): add batch sort order update endpoint for personas and folders
Add new API endpoint POST /persona/reorder to batch update sort_order
for both personas and folders. This enables drag-and-drop reordering
in the dashboard UI.
Changes:
- Add abstract batch_update_sort_order method to BaseDatabase
- Implement batch_update_sort_order in SQLiteDatabase
- Add batch_update_sort_order to PersonaManager with cache refresh
- Add reorder_items route handler with input validation
* feat(persona): add folder_id and sort_order params to persona creation
Extend persona creation flow to support folder placement and ordering:
- Add folder_id and sort_order parameters to insert_persona in db layer
- Update PersonaManager.create_persona to accept and pass folder params
- Add get_folder_detail API endpoint for retrieving folder information
- Include folder_id and sort_order in persona creation response
- Add session flush/refresh to return complete persona object
* feat(dashboard): implement persona folder management UI
- Add folder management system with tree view and breadcrumbs
- Implement create, rename, delete, and move operations for folders
- Add drag-and-drop support for organizing personas and folders
- Create new PersonaManager component and Pinia store for state management
- Refactor PersonaPage to support hierarchical structure
- Update locale files with folder-related translations
- Handle empty parent_id correctly in backend route
* feat(dashboard): centralize folder expansion state in persona store
Move folder expansion logic from local component state to global Pinia
store to persist expansion state.
- Add `expandedFolderIds` state and toggle actions to `personaStore`
- Update `FolderTreeNode` to use store state instead of local data
- Automatically navigate to target folder after moving a persona
* feat(dashboard): add reusable folder management component library
Extract folder management UI into reusable base components and create
persona-specific wrapper components that integrate with personaStore.
- Add base folder components (tree, breadcrumb, card, dialogs) with
customizable labels for i18n support
- Create useFolderManager composable for folder state management
- Implement drag-and-drop support for moving personas between folders
- Add persona-specific wrapper components connecting to personaStore
- Reorganize PersonaManager into views/persona directory structure
- Include comprehensive README documentation for component usage
* refactor(dashboard): remove legacy persona folder management components
Remove deprecated persona folder management Vue components that have been
superseded by the new reusable folder management component library.
Deleted components:
- CreateFolderDialog.vue
- FolderBreadcrumb.vue
- FolderCard.vue
- FolderTree.vue
- FolderTreeNode.vue
- MoveTargetNode.vue
- MoveToFolderDialog.vue
- PersonaCard.vue
- PersonaManager.vue
These components are replaced by the centralized folder management
implementation introduced in commit 3fbb3db2.
* fix(dashboard): add delayed skeleton loading to prevent UI flicker
Implement a 150ms delay before showing the skeleton loader in
PersonaManager to prevent visual flicker during fast loading operations.
- Add showSkeleton state with timer-based delay mechanism
- Use v-fade-transition for smooth skeleton visibility transitions
- Clean up timer on component unmount to prevent memory leaks
- Only display skeleton when loading exceeds threshold duration
* feat(dashboard): add generic folder item selector component for persona selection
Introduce BaseFolderItemSelector.vue as a reusable component for selecting
items within folder hierarchies. Refactor PersonaSelector to use this new
base component instead of its previous flat list implementation.
Changes:
- Add BaseFolderItemSelector with folder tree navigation and item selection
- Extend folder types with SelectableItem and FolderItemSelectorLabels
- Refactor PersonaSelector to leverage the new base component
- Add i18n translations for rootFolder and emptyFolder labels
* feat(persona): add tree-view display for persona list command
Add hierarchical folder tree output for the persona list command,
showing personas organized by folders with visual tree connectors.
- Add _build_tree_output method for recursive tree structure rendering
- Display folders with 📁 icon and personas with 👤 icon
- Show root-level personas separately from folder contents
- Include total persona count in output
* refactor(persona): simplify tree-view output with shorter indentation lines
Replace complex tree connector logic with simpler depth-based indentation
using "│ " prefix. Remove unnecessary parameters (prefix, is_last) and
computed variables (has_content, total_items, item_idx) in favor of a
cleaner depth-based approach.
* feat(dashboard): add duplicate persona ID validation in create form
Add frontend validation to prevent creating personas with duplicate IDs.
Load existing persona IDs when opening the create form and validate
against them in real-time.
- Add existingPersonaIds array and loadExistingPersonaIds method
- Add validation rule to check for duplicate persona IDs
- Add i18n messages for duplicate ID error (en-US and zh-CN)
- Fix minLength validation to require at least 1 character
* i18n(persona): add createButton translation key for folder dialog
Move create button label to folder-specific translation path
instead of using generic buttons.create key.
* feat(persona): show target folder name in persona creation dialog
Add visual feedback showing which folder a new persona will be created in.
- Add info alert in PersonaForm displaying the target folder name
- Pass currentFolderName prop from PersonaManager and PersonaSelector
- Add recursive findFolderName helper to resolve folder ID to name
- Add i18n translations for createInFolder and rootFolder labels
* style:format code
* fix: remove 'persistent' attribute from dialog components
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: skip saving the first system message in history
* fix: rename variable for clarity in system message handling
* fix: update logic to skip all system messages until the first non-system message
* fix: unique session not working
* fix: correct session initialization and update unified_msg_origin setter
* fix: update session ID assignment in WakingCheckStage
* docs: standardize Context class documentation formatting
- Unified all method docstrings to standard format
- Fixed mixed language and formatting issues
- Added complete parameter and return descriptions
- Enhanced developer experience for plugin creators
- Fixes#4429
* docs: fix Context class documentation issues per review
- Restored Sphinx directives for versionadded notes
- Fixed MessageSesion typo to MessageSession throughout file
- Added clarification for kwargs propagation in tool_loop_agent
- Unified deprecation marker format
- Fixes#4429
* Convert developer API comments to English
* chore: revise comments
---------
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
Corrected the property from `item-key` to `item-value` to align with
Vuetify 3 API. This ensures each row has a unique identifier for
the expansion state.
* fix: ensure atomic creation of knowledge base with proper cleanup on failure
- Added pre-validation for embedding_provider_id parameter
- Added check for existing knowledge base with same name
- Implemented proper rollback mechanism when KBHelper initialization fails
- Uses same session for cleanup to ensure data consistency
- Fixes#4403
* fix: ensure atomic KB creation with session.flush() to remove race condition risks
* fix: ensure change the annotation back
* feat(chat): enhance reply functionality to support selected text quoting
* perf: improve ui
* feat(chat): add label for tools used in tool calls and update translations
* feat(chat): simplify reply handling by removing text truncation logic
* feat: optimize plugin update changelog feature, refactor to reuse ReadmeDialog and support independent view entry
* fix: distinguish error state from empty state in ReadmeDialog
* feat: context compressor
Co-authored-by: kawayiYokami <289104862@qq.com>
* Add comprehensive tests for ContextManager and ContextTruncator
- Implemented a full test suite for ContextManager covering initialization, message processing, token-based compression, and error handling.
- Added tests for ContextTruncator focusing on message fixing, truncation by turns, dropping oldest turns, and halving.
- Ensured that both test suites validate edge cases and maintain expected behavior with various message types, including system and tool messages.
* feat: add MockProvider for LLM compression tests
* chore: remove lock
* ruff fix
* fix
* perf
* feat: enhance context compression with token tracking and logging
* feat: update logging for context compression trigger
* feat: implement context compression logic with dynamic threshold and token tracking
* fix: reorder import statements for consistency
* feat: add token_usage tracking to conversations and update related processing logic
---------
Co-authored-by: kawayiYokami <289104862@qq.com>
- Added support for template schemas in the configuration editor, allowing users to define and manage additional parameters like temperature, top_p, and max_tokens.
- Improved UI components in ProviderModelsPanel and ObjectEditor for better user interaction, including new configuration buttons and enhanced input handling.
- Updated localization files to include new configuration options.
* feat: 添加模板列表配置支持,包含验证和编辑功能
* refactor(dashboard): extract ConfigItemRenderer to eliminate code duplication
- Create ConfigItemRenderer.vue to centralize rendering logic for various config types (string, int, bool, selectors, etc.)
- Refactor TemplateListEditor.vue to use the new renderer for entry fields
- Refactor AstrBotConfig.vue and AstrBotConfigV4.vue to simplify metadata-driven rendering
- Resolve circular dependency by decoupling TemplateListEditor from the base renderer
* ruff format
* refactor: improve config validation and fix unidirection data flow
- Frontend: Fix one-way data flow in TemplateListEditor.vue by cloning entries before applying defaults and emitting updates instead of in-place modification.
- Frontend: Remove unused TemplateListEditor import in ConfigItemRenderer.vue.
- Backend: Refactor validate_config in config.py by extracting _expect_type and _validate_template_list helpers to reduce nesting and complexity.
* perf(satori): increase websocket max message size to 10MB
Add max_size parameter to websocket connection to handle larger messages
and prevent connection drops when receiving large payloads from Satori platform.
* chore: ruff format
---------
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
* perf: support extended thinking for Anthropic, DeepSeek reasoning mode, and Gemini text part thought signatures to improve multi-turn reasoning performance.
* chore: remove verbose
* perf
* refactor: remove special tools handling for deepseek-reasoner model in openai source
* fix: improve error handling and logging in InternalAgentSubStage processing
* refactor: remove unused reasoning content from Gemini source processing
* refactor: enhance modality determination logic in useProviderSources
Co-authored-by: kawayiYokami <289104862@qq.com>
* fix: handle None values in _extract_usage to prevent TypeError
Some LLM providers (especially API proxies) may return None for
prompt_tokens and completion_tokens in the usage response. This
causes a TypeError when attempting arithmetic operations.
Added null checks with fallback to 0 for both prompt_tokens and
completion_tokens before performing calculations.
* refactor: use explicit None check and reuse cached variable
- Use `is None` instead of `or 0` to avoid masking unexpected falsy values
- Reuse `cached` variable for `input_cached` to avoid redundant calculation
* ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat(command): persist aliases on rename and apply to runtime filter
* feat(dashboard-api): support aliases in rename command endpoint
* feat(dashboard-ui): add alias editor to rename command dialog
* feat(dashboard-ui): enhance alias editor UI in rename dialog
- Revised the subtitle in the provider feature localization files to provide a more detailed description of functionalities, including chat model configuration and third-party service integrations.
- Expanded model name checks to include specific Gemini 2.5 and 3 variants, ensuring correct configuration for thinking parameters based on the model used.
- Updated `ProviderModelMenu.vue` to manage menu state and load provider configurations dynamically upon opening.
- Filtered provider configurations to exclude those with `enable` set to false.
- Improved session selection logic in `useSessions.ts` to ensure the currently selected session is highlighted and properly managed during navigation.
* fix: improve error handling in tool execution to prevent infinite tool call loops
- Enhanced error handling in `call_local_llm_tool` to provide more informative exceptions for ValueError and TypeError, including detailed parameter information.
- Updated `ToolLoopAgentRunner` to yield appropriate messages for cases with no response or unsupported types, ensuring clearer communication to users.
- Improved logging and messaging consistency across tool execution processes.
* refactor: clean up unused router parameter in message retrieval functions
- Removed the unused `router` parameter from `getSessionMessages` and related function calls in `Chat.vue` and `useMessages.ts`.
- Commented out the `tool_calls` dictionary in `chat.py` for clarity, indicating it is not currently in use.
* fix: enhance exception handling in tool execution for clearer error reporting
- Improved exception handling in `call_local_llm_tool` by chaining exceptions for ValueError and TypeError, providing more context in error messages.
- Ensured that traceback information is preserved in raised exceptions for better debugging.
* perf(agent): add max step limit to prevent infinite tool call loops
* feat: implement max step limit handling in main agent runner
- Enhanced the agent runner to enforce a maximum step limit, logging a warning and forcing a final response when the limit is reached.
- Updated message handling to append a user prompt when the tool call limit is exceeded.
- Refactored tool response handling to yield appropriate messages based on the response type, including handling cases with no response or unsupported types.
- Improved conversation message formatting to ensure consistent output in the assistant's responses.
* chore: ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: add changelog functionality and dialog component
- Implemented new routes for fetching changelogs and available versions in StatRoute.
- Created ChangelogDialog.vue for displaying changelog content and version selection.
- Updated VerticalSidebar.vue to include a button for opening the changelog dialog.
- Enhanced localization files for English and Chinese to support new changelog features.
- Adjusted styles in VerticalHeader.vue for improved layout consistency.
* chore: ruff format
- Introduced a watcher to monitor changes in customizer.viewMode, automatically redirecting to the homepage when switching from 'chat' to 'bot' mode.
- Updated imports to include useRoute from vue-router for routing functionality.
- Adjusted button styles for improved layout consistency in bot mode.
* feat: add KaTeX and Mermaid support for enhanced markdown rendering in MessageList.vue
closes: #3747
- Integrated @mdit/plugin-katex and katex for LaTeX rendering.
- Added markstream-vue for improved markdown rendering capabilities.
- Updated MessageList.vue to utilize MarkdownRender component for rendering markdown content.
- Enhanced UI for dark mode compatibility across various components.
- Introduced new styles for file links, reasoning blocks, and tool call cards to improve visual consistency.
* refactor: replace markdown-it with markstream-vue for improved markdown rendering
- Removed markdown-it and related configurations from ReadmeDialog.vue, VerticalHeader.vue, and ConversationPage.vue.
- Integrated markstream-vue for enhanced markdown rendering capabilities, including support for KaTeX and Mermaid.
- Updated components to utilize MarkdownRender for rendering markdown content, improving consistency and performance.
* chore: remove deprecated markdown-it and marked dependencies from pnpm-lock.yaml
- Cleaned up pnpm-lock.yaml by removing markdown-it and marked entries, streamlining the dependency list.
- This change follows the recent integration of markstream-vue for improved markdown rendering capabilities.
* chore: remove d3 dependency and update MessageList.vue for dark mode support
- Removed d3 from package.json and commented out its import in LongTermMemory.vue to clean up unused dependencies.
- Updated MessageList.vue to ensure consistent dark mode styling by passing the isDark prop to MarkdownRender components.
* feat: add loading indicator for message retrieval in Chat and MessageList components
- Introduced a loading overlay in Chat.vue and MessageList.vue to indicate when messages are being loaded.
- Added a new `isLoadingMessages` prop to manage loading state and enhance user experience during message retrieval.
- Updated styles to ensure the loading indicator is visually integrated with the existing UI.
* feat: add provider configuration dialog to chat sidebar
- Introduced a new `ProviderConfigDialog` component for managing provider settings.
- Added a menu item in the `ConversationSidebar` to open the provider configuration dialog.
- Updated English and Chinese localization files to include translations for the new provider configuration feature.
* feat: update dashboard components and styles for improved chat experience
- Replaced font in index.html to use 'Outfit' for a fresh look.
- Changed icon in ConversationSidebar.vue to 'mdi-creation' for better representation.
- Refactored MessageList.vue to streamline loading indicators and enhance styling consistency.
- Updated localization files to change 'Provider Configuration' to 'AI Configuration' for clarity.
- Introduced new styles for loading indicators and chat mode adjustments in FullLayout.vue.
- Added functionality for toggling between bot and chat modes in the header.
- Removed deprecated sidebar item for chat navigation.
* feat: xmas easter egg
* chore: remove pnpm lock file
* fix: Handle quoted messages correctly as user context
This change ensures quoted messages, including text and image captions, are appended to the conversation history as a user message rather than being injected into the system prompt.
Fixes#3886
* 注入到req.prompt里
- Introduced logging warnings in ProviderManager and Context classes when a provider ID is not found, indicating potential issues due to ID modifications.
- Updated the ProviderPage.vue to advise against modifying provider IDs, highlighting possible configuration impacts.
* perf: enhance chat components with theme and fullscreen toggles
- Added theme and fullscreen toggle functionality to Chat.vue and ConversationSidebar.vue.
- Introduced a new StyledMenu component for improved dropdown menus.
- Updated MessageList.vue and ChatInput.vue for better mobile responsiveness and UI consistency.
- Enhanced language switcher integration in ConversationSidebar.vue.
- Added new settings translations in English and Chinese locales.
* fix: streamline conversation selection handling in Chat.vue
- Updated handleSelectConversation function to immediately set the current session ID and selected sessions, reducing the need for multiple clicks.
- Adjusted padding in ConversationSidebar.vue for improved layout consistency.
* feat: supports thinking level of google gemini
- Updated google-genai version to >=1.56.0 in pyproject.toml and requirements.txt.
- Changed model configuration from "gemini-1.5-flash" to "gemini-3-flash-preview" in default.py.
- Enhanced thinking configuration handling in gemini_source.py to support new parameters for Gemini 3 models.
* fix: standardize thinking level configuration in default.py and gemini_source.py
- Updated the thinking level values in default.py to uppercase for consistency.
- Enhanced gemini_source.py to validate the thinking level and default to "HIGH" if an invalid value is provided.
* feat: enhance tool call handling and UI integration for tool calls render
- Added support for tool call messages in the agent runner and webchat event handling.
- Implemented JSON message component for structured tool call data.
- Updated chat route to save tool call information in message history.
- Enhanced frontend to display tool call details in a collapsible format, including status and results.
- Introduced elapsed time tracking for ongoing tool calls in the chat interface.
* fix: improve message handling in agent run utility and tool loop runner
- Refactored message sending logic in `astr_agent_run_util.py` to use `msg_chain` directly for better clarity.
- Added a check in `tool_loop_agent_runner.py` to ensure `tool_call_result_blocks` is not empty before yielding the last tool call result, preventing potential errors.
* refactor: enhance message structure and UI for chat components
- Updated message handling in `MessageList.vue` to support structured message parts, including plain text, images, audio, and files.
- Improved the `Chat.vue` component styles for better visual consistency.
- Refactored message parsing logic in `useMessages.ts` to accommodate new message formats and ensure proper rendering of embedded content.
- Removed deprecated tool call handling from the message structure, streamlining the message display process.
* chore: ruff format
* feat: implement agent statistics tracking and display in chat
- Added `AgentStats` and `TokenUsage` data classes to track agent performance metrics.
- Enhanced `ToolLoopAgentRunner` to collect and update agent statistics during execution.
- Integrated agent statistics sending to webchat for real-time updates.
- Updated chat route to save and display agent statistics in message history.
- Improved frontend components to visualize agent statistics, including token usage and duration metrics.
* fix: improve message handling in Telegram event and agent run utility
- Updated message sending logic in `astr_agent_run_util.py` to send the correct message chain for tool calls.
- Enhanced `tg_event.py` to edit messages during streaming breaks, improving message management and user experience.
- Added error handling for message editing failures to ensure robustness.
* chore: ruff format
- Renamed "QQ 个人号(OneBot v11)" to "OneBot v11" in the configuration.
- Added a new logo for OneBot in the dashboard assets.
- Updated platform icon retrieval logic to include the new OneBot logo.
* fix: validation error for ToolCall.extra_content in specific upstream model providers
* fix: handle missing extra_content gracefully in ToolCall serialization
* feat: supports thinking level of google gemini
- Updated google-genai version to >=1.56.0 in pyproject.toml and requirements.txt.
- Changed model configuration from "gemini-1.5-flash" to "gemini-3-flash-preview" in default.py.
- Enhanced thinking configuration handling in gemini_source.py to support new parameters for Gemini 3 models.
* fix: standardize thinking level configuration in default.py and gemini_source.py
- Updated the thinking level values in default.py to uppercase for consistency.
- Enhanced gemini_source.py to validate the thinking level and default to "HIGH" if an invalid value is provided.
* feat: enhance tool call handling and UI integration for tool calls render
- Added support for tool call messages in the agent runner and webchat event handling.
- Implemented JSON message component for structured tool call data.
- Updated chat route to save tool call information in message history.
- Enhanced frontend to display tool call details in a collapsible format, including status and results.
- Introduced elapsed time tracking for ongoing tool calls in the chat interface.
* fix: improve message handling in agent run utility and tool loop runner
- Refactored message sending logic in `astr_agent_run_util.py` to use `msg_chain` directly for better clarity.
- Added a check in `tool_loop_agent_runner.py` to ensure `tool_call_result_blocks` is not empty before yielding the last tool call result, preventing potential errors.
* refactor: enhance message structure and UI for chat components
- Updated message handling in `MessageList.vue` to support structured message parts, including plain text, images, audio, and files.
- Improved the `Chat.vue` component styles for better visual consistency.
- Refactored message parsing logic in `useMessages.ts` to accommodate new message formats and ensure proper rendering of embedded content.
- Removed deprecated tool call handling from the message structure, streamlining the message display process.
* chore: ruff format
* feat: implement agent statistics tracking and display in chat
- Added `AgentStats` and `TokenUsage` data classes to track agent performance metrics.
- Enhanced `ToolLoopAgentRunner` to collect and update agent statistics during execution.
- Integrated agent statistics sending to webchat for real-time updates.
- Updated chat route to save and display agent statistics in message history.
- Improved frontend components to visualize agent statistics, including token usage and duration metrics.
* fix: improve message handling in Telegram event and agent run utility
- Updated message sending logic in `astr_agent_run_util.py` to send the correct message chain for tool calls.
- Enhanced `tg_event.py` to edit messages during streaming breaks, improving message management and user experience.
- Added error handling for message editing failures to ensure robustness.
* chore: ruff format
- Renamed "QQ 个人号(OneBot v11)" to "OneBot v11" in the configuration.
- Added a new logo for OneBot in the dashboard assets.
- Updated platform icon retrieval logic to include the new OneBot logo.
* fix: validation error for ToolCall.extra_content in specific upstream model providers
* fix: handle missing extra_content gracefully in ToolCall serialization
* fix: omit content field for the LLM request after tool calls are completed and content is empy string or none
* chore: ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
- Added icons for 'modelstack', 'tokenpony', and 'compshare' in providerUtils.js.
- Updated ProviderPage.vue to display the correct count of displayed provider sources.
- Enhanced the logic for displaying provider sources to include placeholders for unselected templates.
- Improved the display name for provider sources to show template keys for placeholders.
- Adjusted styles for better layout and overflow handling in provider source list and cards.
- Refactored source selection logic to handle placeholder sources correctly.
- Updated error handling in provider testing to provide clearer messages.
* fix: webui log output incompletely
* fix: improve SSE log parsing to handle partial data chunks
* fix: enhance log handling by implementing local cache and fetching history
* fix: log time handling to use epoch time
* refactor: improve UI layout and interaction for list item management
* feat: enhance list configuration UI with batch import functionality
* feat: add internationalization support for list configuration UI
* feat: custom plugin api source manager
* fix: rename plugin source file in a safer way
* chore: turned the way of saving plugin source to backend and refacted some components
* style: clean up whitespace and improve logging message formatting
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: segment reply supports segmentation words
* chore: ruff format
* feat: enhance segmented reply processing by refining word extraction logic
* ruff format
* fix: handle on_agent_done in error responses
- Introduced an LLMResponse for error messages to be processed by agent hooks, ensuring better error reporting and handling.
* fix: improve error logging in on_agent_done hook
---------
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
* feat: add Kubernetes manifests for astrbot and napcat deployment with services and persistent storage
* chore: remove 11451 port
---------
Co-authored-by: Soulter <905617992@qq.com>
- Added French, Russian, and Traditional Chinese README files to support a wider audience.
- Updated English and Japanese README files with improved descriptions of AstrBot's capabilities and features.
- Enhanced community section in all README files to include QQ, Telegram, and Discord group information.
- Adjusted plugin marketplace badge and key features list for clarity and consistency across languages.
- Introduced PlatformStatus enum to manage platform states (pending, running, error, stopped).
- Added error recording and retrieval functionality in the Platform class.
- Implemented a new method in PlatformManager to gather statistics for all platforms.
- Updated the dashboard to display platform statuses and error details, including a dialog for error insights.
- Enhanced localization for runtime statuses and error dialogs in both English and Chinese.
- Added a fallback to the `_post_send` method without parameters when the stream payload is not set, ensuring proper message handling in all scenarios.
fixes: #3893
* refactor: message storage format of webchat
* refactor: update image and record handling in webchat event processing
* fix: thinking placeholder in webchat
* feat: supports file upload in webchat
* feat: supports to delete attachments when webchat session is deleted
* perf: improve performance of file downloading
* refactor: remove unused import in chat route
* feat: add message timestamp formatting and localization support in chat
* fix: handle missing filename in file upload for chat route
* feat: enhance file handling in chat and webchat, supporting video uploads and improved attachment management
* fix: update property name for embedded files in message handling
* fix: compute variable errors after uninstalling plugins
* feat: supported for reply message and standarlize the message param
* fix: ensure message actions are displayed for the last message in the list
- Updated the `test` method in all provider classes to remove return values and raise exceptions for failure cases, enhancing clarity and consistency.
- Adjusted related logic in the dashboard and command routes to align with the new `test` method behavior, simplifying error handling.
- Added a `test` method to each provider class to standardize availability checks.
- Updated the dashboard and command routes to utilize the new `test` method for provider reachability verification, simplifying the logic and improving maintainability.
- Removed redundant reachability check logic from the command handler.
* fix: assistant message validation error when tool_call exists but content not exists
* fix: enhance content validation in Message model to allow None for assistant role with tool_calls
* feat: add image caption provider configuration for group chat
- Introduced `image_caption_provider_id` to allow separate configuration for group chat image understanding.
- Updated metadata and hints in English and Chinese for clarity on new settings.
- Adjusted logic in long term memory to utilize the new provider ID for image captioning.
* fix: format
* Fix logic for image caption and active reply settings
* Fix indentation and formatting in long_term_memory.py
* chore: ruff format
---------
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
Co-authored-by: Soulter <905617992@qq.com>
- Added a tooltip to show detailed provider status, including availability and error messages.
- Refactored item details template to include status chips for better visual representation.
- Removed unused status section to streamline the UI.
- Introduced a reload lock to prevent concurrent reloads of providers.
- Added logging to indicate when a provider is disabled and when providers are being synchronized with the configuration.
- Refactored the reload method to improve clarity and maintainability.
Co-authored-by: anka <1350989414@qq.com>
* feat: enhance long-term memory message formatting
- Added support for 'At' message components in long-term memory, allowing for better representation of mentions in messages.
* chore: ruff check
- Added an information button linking to custom rules documentation.
- Adjusted layout for improved spacing and readability in the session management page.
- Minor refactoring of the data table component for better alignment.
* refactor: umo custom rules
* feat(i18n): update session management translations and improve provider configuration handling
- Updated English and Chinese translations for session management, including "Unified Message Origin" and "Follow Config".
- Enhanced provider configuration options to include "Follow Config" as a selectable item.
- Removed unused clear buttons and refactored provider configuration saving logic to handle updates and deletions more efficiently.
Update the configuration hint for `words_count_threshold` to explicitly state that it acts as a maximum limit for segmentation, preventing user confusion about it being a minimum trigger.
* feat(chat): add standalone chat component and integrate with config page for testing configurations
* feat(chat): add error handling for message sending and session creation
- Implemented CozeAPIClient for file upload, image download, chat messaging, and context management.
- Developed DashscopeAgentRunner for handling requests to the Dashscope API with streaming support.
- Created DifyAgentRunner to manage interactions with the Dify API, including file uploads and workflow execution.
- Introduced DifyAPIClient for making asynchronous requests to the Dify API.
- Updated third-party agent imports to reflect new module structure.
- Added `ThirdPartyAgentSubStage` to handle interactions with third-party agent runners (Dify, Coze, Dashscope).
- Refactored `star_request.py` to ensure consistent return types in the `process` method.
- Updated `stage.py` to initialize and utilize the new `AgentRequestSubStage`.
- Modified `ProviderManager` to skip loading agent runner providers.
- Removed `Dify` source implementation as it is now handled by the new agent runner structure.
- Enhanced `DifyAPIClient` to support file uploads via both file path and file data.
- Cleaned up shared preferences handling to simplify session preference retrieval.
- Updated dashboard configuration to reflect changes in agent runner provider selection.
- Refactored conversation commands to accommodate the new agent runner structure and remove direct dependencies on Dify.
- Adjusted main application logic to ensure compatibility with the new conversation management approach.
- Introduced `ConversationSidebar.vue` for improved conversation management and sidebar functionality.
- Enhanced `MessageList.vue` to handle loading states and improved message rendering.
- Created new composables: `useConversations`, `useMessages`, `useMediaHandling`, `useRecording` for better code organization and reusability.
- Added loading indicators and improved user experience during message processing.
- Ensured backward compatibility and maintained existing functionalities.
- Introduced `ConversationSidebar.vue` for improved conversation management and sidebar functionality.
- Enhanced `MessageList.vue` to handle loading states and improved message rendering.
- Created new composables: `useConversations`, `useMessages`, `useMediaHandling`, `useRecording` for better code organization and reusability.
- Added loading indicators and improved user experience during message processing.
- Ensured backward compatibility and maintained existing functionalities.
- Introduced `ConversationSidebar.vue` for improved conversation management and sidebar functionality.
- Enhanced `MessageList.vue` to handle loading states and improved message rendering.
- Created new composables: `useConversations`, `useMessages`, `useMediaHandling`, `useRecording` for better code organization and reusability.
- Added loading indicators and improved user experience during message processing.
- Ensured backward compatibility and maintained existing functionalities.
- Introduced `ConversationSidebar.vue` for improved conversation management and sidebar functionality.
- Enhanced `MessageList.vue` to handle loading states and improved message rendering.
- Created new composables: `useConversations`, `useMessages`, `useMediaHandling`, `useRecording` for better code organization and reusability.
- Added loading indicators and improved user experience during message processing.
- Ensured backward compatibility and maintained existing functionalities.
- Introduced `ConversationSidebar.vue` for improved conversation management and sidebar functionality.
- Enhanced `MessageList.vue` to handle loading states and improved message rendering.
- Created new composables: `useConversations`, `useMessages`, `useMediaHandling`, `useRecording` for better code organization and reusability.
- Added loading indicators and improved user experience during message processing.
- Ensured backward compatibility and maintained existing functionalities.
- Added WebChatSession model for managing user sessions.
- Introduced methods for creating, retrieving, updating, and deleting WebChat sessions in the database.
- Updated core lifecycle to include migration from version 4.6 to 4.7, creating WebChat sessions from existing platform message history.
- Refactored chat routes to support new session-based architecture, replacing conversation-related endpoints with session endpoints.
- Updated frontend components to handle sessions instead of conversations, including session creation and management.
* ci: build test image on master pushes
* ci: split workflows for master test and release builds
* test ci
* test ci
* Update docker-image.yml
* test ci
Updated README to enhance deployment instructions.
* Make GHCR publishing optional in Docker workflow
* chore: Update DockerHub password secret in workflow
* Update .github/workflows/docker-image.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* chore: rename job to build nightly image in workflow
* feat: schedule the nightly build at 0:00 am everyday, if have new commits
* fix: update build-nightly-image job to trigger only on schedule events
* Update fetch-depth and enable fetch-tag in workflows
---------
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
Co-authored-by: LIghtJUNction <lightjunction.me@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Soulter <905617992@qq.com>
* feat: enhance parameter type handling in LLM tool registration with JSON schema support
* refactor: remove debug print statement from FunctionToolManager
* refactor: LLM response handling with reasoning content
- Added a `show_reasoning` parameter to `run_agent` to control the display of reasoning content.
- Updated `LLMResponse` to include a `reasoning_content` field for storing reasoning text.
- Modified `WebChatMessageEvent` to handle and send reasoning content in streaming responses.
- Implemented reasoning extraction in various provider sources (e.g., OpenAI, Gemini).
- Updated the chat interface to display reasoning content in a collapsible format.
- Removed the deprecated `thinking_filter` package and its associated logic.
- Updated localization files to include new reasoning-related strings.
* feat: add Groq chat completion provider and associated configurations
* Update astrbot/core/provider/sources/gemini_source.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* refactor: LLM response handling with reasoning content
- Added a `show_reasoning` parameter to `run_agent` to control the display of reasoning content.
- Updated `LLMResponse` to include a `reasoning_content` field for storing reasoning text.
- Modified `WebChatMessageEvent` to handle and send reasoning content in streaming responses.
- Implemented reasoning extraction in various provider sources (e.g., OpenAI, Gemini).
- Updated the chat interface to display reasoning content in a collapsible format.
- Removed the deprecated `thinking_filter` package and its associated logic.
- Updated localization files to include new reasoning-related strings.
* feat: add Groq chat completion provider and associated configurations
* Update astrbot/core/provider/sources/gemini_source.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* feat: OPENAI系支持自定义添加请求头
* chore: add custom headers and extra body to config for zhipu
---------
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
* Add xai_native_search configuration option
* Implement xAI compatibility and search injection
Add support for xAI integration with search parameters injection.
* Refactor xAI handling in openai_source.py
Removed the _is_xai method and updated xAI search injection logic.
* Fix formatting of condition in default.py
* Fix formatting in openai_source.py
* feat 初次提交
* fix: Modify the At logic in the DingTalk adapter.
* del uv.lock
* 添加at_users为空判断
* 优化钉钉at的处理逻辑,不用重复判断机器人是否is_in_at_list
* fix: refine handling of mentioned users in group messages
---------
Co-authored-by: linyiming <linyiming@example.com>
Co-authored-by: Soulter <905617992@qq.com>
* feat:add Xinference rerank provider
* feat:add default rerank_api_key option for Xinference provider
* style: format code
* fix: refactor XinferenceRerankProvider initialization for better error handling
* fix: update XinferenceRerankProvider to use async client methods for initialization and reranking
* feat: add launch_model_if_not_running option to XinferenceRerankProvider for better control over model initialization
* chore: remove unused asyncio import from xinference_rerank_source.py
* fix: update repository references from Soulter/AstrBot to AstrBotDevs/AstrBot across documentation and codebase
- Updated README_ja.md to reflect new GitHub repository links.
- Modified AstrBotUpdator to download from the new repository.
- Changed download URLs in io.py for dashboard releases.
- Updated changelogs to point to the new issue links.
- Adjusted Docker compose file to reference the new repository.
- Updated Vue components in the dashboard to link to the new repository.
- Changed main.py to provide the correct download instructions for the new repository.
* fix: improve error handling for configId selection in AddNewPlatform component
* Update astrbot/core/utils/io.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Removed the disable attribute of Input in isConvRunning. Added an activeSSE counter to correctly determine the current session state and prevent new input from causing interface display errors during session_waiter execution. Set isStreaming after streaming input ends to restore the text box.
#3037#2892
Guard against cases where message chain is None during pipeline execution. This change enhances error-resilience for logging and processing message chains.
- Updated AstrMessageEvent._outline_chain to return an empty string when input chain is None
- Updated AstrMessageEvent.set_result to ensure result.chain is always at least an empty list
This prevents TypeError when result.chain or chain is unexpectedly None, improving pipeline stability when handling external plugins or corner cases.
Co-authored-by: engine-labs-app[bot] <140088366+engine-labs-app[bot]@users.noreply.github.com>
Co-authored-by: cto-new[bot] <140088366+cto-new[bot]@users.noreply.github.com>
Updated README.md to improve clarity and fix formatting issues. Removed outdated developer group information and added support details for new platforms and services.
* feat: 添加并优化服务提供商独立测试功能
* feat: add small size to action buttons in ItemCard and ProviderPage for better UI consistency
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat(core): reuse persona conf in new conversation
#2985
* refactor(core): simplify persona retrieval logic
* style: code format
---------
Co-authored-by: Soulter <905617992@qq.com>
* reply as at for tg
Add handling for bot replies in group messages.
* style: type checking and ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat: add toast notification system with snackbar component
* feat: enhance chat functionality with conversation running state and notifications
* fix: update bot message avatar rendering during streaming
* feat: implement conversation tracking context manager for webchat
* fix: update conversation tracking to remove conversation ID on exit
* fix: 修复linux下utf-8解码错误的问题
* feat: use incremental decoder
* fix: add type hint for response parameter in _stream_sse and refactor file upload method
---------
Co-authored-by: Soulter <905617992@qq.com>
* fix: revert changes in command_group.py at 782c036 to fix command group permission check
* fix: 不传递 GroupCommand handler
* perf: alter_cmd 指令支持对子指令、指令组进行配置
* chore: remove test commands and subcommands from test_group
* chore: add cache for complete command names list in CommandFilter and CommandGroupFilter
---------
Co-authored-by: Dt8333 <25431943+Dt8333@users.noreply.github.com>
Co-authored-by: Soulter <905617992@qq.com>
Adjusts logic to prioritize type annotations over default values when setting handler_params in CommandFilter. This ensures that parameter types are correctly inferred when available.
* stage
* refactor: 重构 Function Tool 管理并引入 multi agent handsoff 机制
- Updated `star_request.py` to use the global `call_handler` instead of context-specific calls.
- Modified `entities.py` to remove the dependency on `FunctionToolManager` and streamline the function tool handling.
- Refactored `func_tool_manager.py` to simplify the `FunctionTool` class and its methods, removing deprecated code and enhancing clarity.
- Adjusted `provider.py` to align with the new function tool structure, removing unnecessary type unions.
- Enhanced `star_handler.py` to support agent registration and tool association, introducing `RegisteringAgent` for better encapsulation.
- Updated `star_manager.py` to handle tool registration for agents, ensuring proper binding of handlers.
- Revised `main.py` in the web searcher package to utilize the new agent registration system for web search tools.
* chore: websearch
* perf: 减少嵌套
* chore: 移除未使用的 mcp 导入
* refactor: mcp server reload mechanism
* fix: wait for client events
* fix: all other mcp servers are terminated when disable selected server
* fix: resolve type hinting issues in MCPClient and FuncCall methods
* perf: optimize mcp server loaders
* perf: improve MCP client connection testing
* perf: improve error message
* perf: clean code
* perf: increase default timeout for MCP connection and reset dialog message on close
---------
Co-authored-by: Raven95676 <Raven95676@gmail.com>
I have fixed a potential vulnerability in the `/api/chat/get_file` endpoint that could allow unauthorized access to files by ensuring the request has a jwt token.
Thank you for taking the time to report this issue! Please describe your problem accurately. If possible, please provide a reproducible snippet (this will help resolve the issue more quickly). Please note that issues that are not detailed or have no logs will be closed immediately. Thank you for your understanding. / 感谢您抽出时间报告问题!请准确解释您的问题。如果可能,请提供一个可复现的片段(这有助于更快地解决问题)。请注意,不详细 / 没有日志的 issue 会被直接关闭,谢谢理解。
- type:textarea
attributes:
label:发生了什么
description:描述你遇到的异常
label:What happened / 发生了什么
description:Description
placeholder:>
一个清晰且具体的描述这个异常是什么。
Please provide a clear and specific description of what this exception is. Please note that issues that are not detailed or have no logs will be closed immediately. Thank you for your understanding. / 一个清晰且具体的描述这个异常是什么。请注意,不详细 / 没有日志的 issue 会被直接关闭,谢谢理解。
validations:
required:true
- type:textarea
attributes:
label:如何复现?
label:Reproduce / 如何复现?
description:>
复现该问题的步骤
The steps to reproduce the issue. / 复现该问题的步骤
placeholder:>
如: 1. 打开 '...'
Example: 1. Open '...'
validations:
required:true
- type:textarea
attributes:
label:AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
description:>
请提供您的 AstrBot 版本和部署方式。
label:AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
placeholder:>
如: 3.1.8 Docker, 3.1.7 Windows启动器
Example: 4.5.7 Docker, 3.1.7 Windows Launcher
validations:
required:true
- type:dropdown
attributes:
label:操作系统
label:OS
description:|
你在哪个操作系统上遇到了这个问题?
On which operating system did you encounter this problem? / 你在哪个操作系统上遇到了这个问题?
multiple:false
options:
- 'Windows'
@@ -53,30 +51,30 @@ body:
- type:textarea
attributes:
label:报错日志
label:Logs / 报错日志
description:>
如报错日志、截图等。请提供完整的 Debug 级别的日志,不要介意它很长!
Please provide complete Debug-level logs, such as error logs and screenshots. Don't worry if they're long! Please note that issues with insufficient details or no logs will be closed immediately. Thank you for your understanding. / 如报错日志、截图等。请提供完整的 Debug 级别的日志,不要介意它很长!请注意,不详细 / 没有日志的 issue 会被直接关闭,谢谢理解。
placeholder:>
请提供完整的报错日志或截图。
Please provide a complete error log or screenshot. / 请提供完整的报错日志或截图。
validations:
required:true
- type:checkboxes
attributes:
label:你愿意提交 PR 吗?
label:Are you willing to submit a PR? / 你愿意提交 PR 吗?
description:>
这不是必需的,但我们很乐意在贡献过程中为您提供指导特别是如果你已经很好地理解了如何实现修复。
This is not required, but we would be happy to provide guidance during the contribution process, especially if you already have a good understanding of how to implement the fix. / 这不是必需的,但我们很乐意在贡献过程中为您提供指导特别是如果你已经很好地理解了如何实现修复。
I have read and agree to abide by the project's [Code of Conduct](https://docs.github.com/zh/site-policy/github-terms/github-community-code-of-conduct)。
required:true
- type:markdown
attributes:
value:"感谢您填写我们的表单!"
value:"Thank you for filling out our form! / 感谢您填写我们的表单!"
description:Submit a suggestion to help us improve. / 提交建议帮助我们改进。
labels:["enhancement"]
body:
- type:markdown
attributes:
value:|
感谢您抽出时间提出新功能建议,请准确解释您的想法。
Thank you for taking the time to suggest a new feature! Please explain your idea clearly and accurately. / 感谢您抽出时间提出新功能建议,请准确解释您的想法。
- type:textarea
attributes:
label:描述
description:简短描述您的功能建议。
label:Description / 描述
description:Please describe the feature you want to be added in detail. / 请详细描述您希望添加的功能。
- type:textarea
attributes:
label:使用场景
description:你想要发生什么?
placeholder:>
一个清晰且具体的描述这个功能的使用场景。
label:Use Case / 使用场景
description:Please describe the use case for this feature. / 请描述这个功能的使用场景。
- type:checkboxes
attributes:
label:你愿意提交PR吗?
label:Willing to Submit PR? / 是否愿意提交PR?
description:>
这不是必须的,但我们欢迎您的贡献。
This is not required, but if you are willing to submit a PR to implement this feature, it would be greatly appreciated! / 这不是必需的,但如果您愿意提交 PR 来实现这个功能,我们将不胜感激!
options:
- label:是的, 我愿意提交PR!
- label:Yes,I am willing to submit a PR. / 是的,我愿意提交PR。
I have read and agree to abide by the project's [Code of Conduct](https://docs.github.com/zh/site-policy/github-terms/github-community-code-of-conduct). /
<!--Please describe the motivation for this change: What problem does it solve? (e.g., Fixes XX issue, adds YY feature)-->
<!--请描述此项更改的动机:它解决了什么问题?(例如:修复了 XX issue,添加了 YY 功能)-->
### Motivation
### Modifications / 改动点
<!--解释为什么要改动-->
<!--Please summarize your changes: What core files were modified? What functionality was implemented?-->
<!--请总结你的改动:哪些核心文件被修改了?实现了什么功能?-->
### Modifications
- [x] This is NOT a breaking change. / 这不是一个破坏性变更。
<!-- If your changes is a breaking change, please uncheck the checkbox above -->
<!--简单解释你的改动-->
### Screenshots or Test Results / 运行截图或测试结果
<!--Please paste screenshots, GIFs, or test logs here as evidence of executing the "Verification Steps" to prove this change is effective.-->
<!--请粘贴截图、GIF 或测试日志,作为执行“验证步骤”的证据,证明此改动有效。-->
---
### Checklist / 检查清单
<!--If merged, your code will serve tens of thousands of users! Please double-check the following items before submitting.-->
<!--如果分支被合并,您的代码将服务于数万名用户!在提交前,请核查一下几点内容。-->
- [ ] 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
- [ ] 👀 My changes have been well-tested, **and "Verification Steps" and "Screenshots" have been provided above**.
/ 我的更改经过了良好的测试,**并已在上方提供了“验证步骤”和“运行截图”**。
- [ ] 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in `requirements.txt` and `pyproject.toml`.
AstrBot is a multi-platform LLM chatbot and development framework written in Python with a Vue.js dashboard. It supports multiple messaging platforms (QQ, Telegram, Discord, etc.) and various LLM providers (OpenAI, Anthropic, Google Gemini, etc.).
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
astrbot run --backend-only # start the backend only
```
Exposed an API server on `http://localhost:6185` by default.
### Dashboard(WebUI)
```
cd dashboard
bun install # First time only.
bun dev
```
Runs on `http://localhost:3000` by default.
## Pre-commit setup
AstrBot uses [pre-commit](https://pre-commit.com/) hooks to automatically format and lint Python code before each commit. The hooks run `ruff check`, `ruff format`, and `pyupgrade` (see [`.pre-commit-config.yaml`](.pre-commit-config.yaml) for details).
To set it up:
```bash
pip install pre-commit
pre-commit install
```
After installation, the hooks will run automatically on `git commit`. You can also run them manually at any time:
```bash
ruff format .
ruff check .
```
> **Note:** If you use VSCode, install the `Ruff` extension for real-time formatting and linting in the editor.
## Dev environment tips
- **Main entry**: `astrbot/__main__.py` or via CLI `astrbot run`
Platform adapters are in `astrbot/core/platform/sources/`:
- Each adapter extends base platform classes
- Use `@register_platform_adapter` decorator
- Events flow through `commit_event()` to message queue
### Star (Plugin) System
Stars are plugins in `astrbot/builtin_stars/`:
- Extend `Star` base class
- Use decorators for command handlers: `@star.on_command`, `@star.on_message`, etc.
- Access via `context` object
## Code Style
1.**Type hints required** - Use Python 3.12+ syntax:
-`list[str]` not `List[str]`
-`int | None` not `Optional[int]`
- Avoid `Any` when possible. Use proper `TypedDict`, `dataclass`, or `Protocol` instead.
- When encountering dict access issues (e.g., `msg.get("key")` where type inference is wrong), define a `TypedDict` with `total=False` to explicitly declare allowed keys.
Good example:
```python
class MessageComponent(TypedDict, total=False):
type: str
text: str
path: str
```
Bad example (avoid):
```python
msg: Any = something
msg = cast(dict, msg)
```
2. **Path handling** - Always use `pathlib.Path`:
```python
from pathlib import Path
# Use astrbot.core.utils.path_utils for data/temp directories
from astrbot.core.utils.path_utils import get_astrbot_data_path
```
3. **Formatting** - Run before committing:
```bash
ruff format .
ruff check .
```
4. **Comments** - Use English for all comments and docstrings
5. **Imports** - Use absolute imports via `astrbot.` prefix
### Environment Variables
When adding new environment variables:
1. Use `ASTRBOT_` prefix: `ASTRBOT_ENABLE_FEATURE`
2. Add to `.env.example` with description
3. Update `astrbot/cli/commands/cmd_run.py`:
- Add to module docstring under "Environment Variables Used in Project"
- Add to `keys_to_print` list for debug output
## Testing
1. Tests go in `tests/` directory
2. Use `pytest` with `pytest-asyncio`
3. Run: `uv sync --group dev && uv run pytest --cov=astrbot tests/`
4. Test files: `test_*.py` or `*_test.py`
### Code Quality Scoring Test
The project enforces a **code quality score** via `tests/test_code_quality_typing.py`. All agents must treat this as a hard constraint when modifying code.
**Run the test:**
```bash
uv run pytest tests/test_code_quality_typing.py -v
```
**Scoring rules (target: 100/100, threshold for PASS: 80/100):**
First off, thanks for taking the time to contribute! ❤️
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉
### Table of Contents
- [Reporting Issues](#reporting-issues)
- [Pull Requests](#pull-requests)
### Reporting Issues
If you encounter any issues while using AstrBot, please follow these steps to report them:
1.**Check Existing Issues**: Before submitting a new issue, please check if a similar issue already exists in the [Issues](https://github.com/AstrBotDevs/AstrBot/issues) section of the repository.
2.**Create a New Issue**: If no similar issue exists, please create a new issue. Make sure to provide the following information:
- A brief description of the issue
- Steps to reproduce the issue
- Expected and actual results
- Relevant logs or error messages
### Pull Requests
#### Branch Naming
We use the `fix/` prefix for bug fixes and the `feat/` prefix for new features. For `fix/` branches, please use a short description or directly use the Issue number, e.g., `fix/1234` or `fix/1234-login-typo`. For `feat/` branches, please use a short description, e.g., `feat/add-user-profile`.
#### PR Description
- Please use English to describe your PR.
- Use semantic prefixes like `fix: `, `feat: `, `docs: `, `style: `, `refactor: `, `test: `, `chore: ` in the title, followed by a brief description of the changes, e.g., `fix: correct login page typo`.
#### Code Style
##### Core
We use Ruff as our code formatter and static analysis tool. Before submitting your code, please run the following commands to ensure your code adheres to the style guidelines:
```bash
ruff format .
ruff check .
```
##### PR completeness checks (recommended)
To run a local validation flow close to CI, use:
```bash
make pr-test-neo
```
This command runs:
-`uv sync --group dev`
-`ruff format --check .` and `ruff check .`
- Neo-related critical tests
- a startup smoke test against `http://localhost:6185`
For full validation, use:
```bash
make pr-test-full
```
For faster repeated runs (skip dependency sync and dashboard build), use:
> We love open-source software and are always committed to providing all users with a healthy, safe, and reliable experience. ❤️
**Last updated:** January 12, 2026
Thank you for using **AstrBot**.
Please read the following notice carefully before using this project.
**By installing, running, or using this project, you acknowledge that you have read, understood, and agreed to all the terms stated below.**
## 1. Nature of the Project
AstrBot is a **free and open-source software project** released under the **GNU Affero General Public License v3 (AGPLv3)**.
* AstrBot does not constitute any form of commercial service;
* The AstrBot Team does not provide any paid services through this project;
* AstrBot’s implementation does not involve reverse engineering, cracking, decompilation, or circumvention of security mechanisms of any third-party systems. AstrBot only uses and supports officially published bot integration interfaces, open platform capabilities, or related communication protocols provided by instant messaging (IM) platforms for integration and communication.
## 2. No Warranty
AstrBot is provided **“as is”**, without any express or implied warranties.
The AstrBot Team makes no guarantees regarding:
* The security, reliability, or stability of the system;
* The security, correctness, or trustworthiness of any third-party plugins;
* The availability, quality, accuracy, or safety of any third-party AI model APIs or external services;
* The fitness of the software for any particular purpose.
**All risks arising from the use of this software are borne solely by the user.**
## 3. Third-Party Plugins and Services
* AstrBot supports third-party plugins and external AI services;
* The AstrBot Team does **not audit, control, endorse, or guarantee** any third-party plugins, extensions, or services;
* Any risks, losses, data leaks, or legal consequences arising from the use of third-party plugins or services are solely the responsibility of the user;
* “Third-party plugins” refer to plugins that are not built into AstrBot. Built-in plugins are those whose implementation code is included in the AstrBotDevs/AstrBot repository. All plugins available in the plugin marketplace are third-party plugins.
## 4. Usage and Content Restrictions
You agree not to use AstrBot for any of the following activities:
* Inputting, generating, distributing, or processing any illegal, extremist, violent, pornographic, hateful, abusive, or otherwise harmful content;
* Engaging in activities that violate the laws or regulations of your country or region, or any applicable international laws;
* Attempting to bypass, disable, weaken, or undermine the built-in safety mechanisms or content restrictions of the system;
* Any activities that infringe upon the legitimate rights and interests of others, harm the physical or mental well-being of yourself or others, or involve personal privacy or sensitive personal information.
## 5. Intended Use
AstrBot is a **tool-oriented conversational and agent system** that provides limited human-like interaction capabilities under the principles of **safety, health, and friendliness**.
The primary goals of the project are to:
* Provide agent capabilities and automation assistance;
* Help users improve efficiency in work, study, and information processing;
* Offer a friendly human–computer interaction experience within reasonable boundaries;
* Support user growth and provide content beneficial to users’ physical and mental well-being.
## 6. Safety Measures
The AstrBot Team has made **reasonable efforts** at both technical and policy levels to implement safety and content restriction mechanisms, guiding the system to produce healthy, friendly, and safe outputs.
However, please understand that:
* No system in the world can be guaranteed to be completely error-free, absolutely secure, or immune to misuse;
* Users remain responsible for properly configuring, supervising, and using the system.
If you wish to disable AstrBot’s default “Safety Mode,” please set `provider_settings.llm_safety_mode` to `False` in `cmd_config.json`. However, please note that disabling Safety Mode is not recommended and may lead to unsafe or inappropriate outputs. Any risks or consequences arising from disabling this feature are solely borne by the user, and the AstrBot Team assumes no responsibility.
## 7. Mental Health Notice
If you experience psychological discomfort or emotional distress due to system outputs during use,
or if you are experiencing significant psychological stress, emotional instability, anxiety, or depression and are using this project for such reasons,
please prioritize seeking help from qualified professionals, such as psychologists, psychiatrists, or local mental health support services.
In case of emergency (for example, if there is a risk of self-harm or harm to others), please immediately contact your local emergency number or professional crisis support services.
## 8. Metrics and Privacy
AstrBot may collect a limited amount of anonymous usage statistics to understand system usage, identify issues, and continuously improve the project.
Collected metrics are limited to basic technical indicators related to system operation and feature usage, such as feature usage frequency and error information.
AstrBot **does not collect, upload, or store your conversation content, message bodies, input text, or any personally identifiable or sensitive information**.
You may manually disable this feature by setting the environment variable `ASTRBOT_DISABLE_METRICS=1` to turn off anonymous metrics collection.
## 9. Limitation of Liability
To the maximum extent permitted by law, the AstrBot Team shall not be liable for any direct or indirect losses arising from, including but not limited to:
* The use or inability to use this software;
* The use of third-party plugins or services;
* Generated content or system outputs;
* Data loss, service interruptions, or security incidents.
## 10. Acceptance of Terms
By installing, running, modifying, or using AstrBot, you confirm that:
* You have read and understood this Notice;
* You agree to and accept all the terms stated above;
* You assume full responsibility for your use of the software.
If you do not agree with any part of this Notice, please do not use this project.
## 11. License and Copyright
The source code, documentation, and related materials of AstrBot are protected by copyright laws and applicable regulations.
Subject to compliance with this Notice and the AGPLv3 license, AstrBot grants you a non-exclusive, non-transferable, non-sublicensable license to download, install, run, modify, and distribute this software.
Unless otherwise required by law or expressly stated in this Notice, the AstrBot Team reserves all rights not expressly granted.
## 12. Governing Law
The interpretation and application of this Notice shall be governed by the laws and regulations applicable in your jurisdiction or the jurisdiction where the project is released.
If any provision of this Notice is held to be invalid or unenforceable, the remaining provisions shall remain in full force and effect.
AstrBot is an Agentic AI assistant for personal and group chats, with support for multiple IM platforms and a wide range of built-in features. We hope it brings you an efficient and enjoyable experience. ❤️
Important notice:
AstrBot is a **free and open-source software project** protected by the AGPLv3 license. You can find the full source code and related resources on our [**official website**](https://astrbot.app) and [**GitHub**](https://github.com/astrbotdevs/astrbot).
As of now, AstrBot has **no commercial services of any kind**, and the official team **will never charge users any fees** under any name.
If anyone asks you to pay while using AstrBot, **you are likely being scammed**. Please request a refund immediately and report it to us by email.
📊 Please read the [End User License Agreement](https://github.com/AstrBotDevs/AstrBot/blob/master/EULA.md) carefully before using this project. By installing, you agree to all its contents.
📮 Official email: [community@astrbot.app](mailto:community@astrbot.app)
AstrBot — это Agentic AI-ассистент для личных и групповых чатов с поддержкой множества IM-платформ и широким набором встроенных функций. Надеемся, что он сделает ваше общение эффективным и приятным. ❤️
Важное уведомление:
AstrBot — это **бесплатный проект с открытым исходным кодом**, защищённый лицензией AGPLv3. Полный исходный код и связанные ресурсы доступны на [**официальном сайте**](https://astrbot.app) и [**GitHub**](https://github.com/astrbotdevs/astrbot).
На данный момент AstrBot **не предоставляет никаких коммерческих услуг**, и официальная команда **никогда не будет взимать плату с пользователей** под каким-либо названием.
Если кто-то просит вас заплатить при использовании AstrBot, **вас, скорее всего, пытаются обмануть**. Немедленно запросите возврат средств и сообщите нам по электронной почте.
📊 Пожалуйста, внимательно прочитайте [Лицензионное соглашение](https://github.com/AstrBotDevs/AstrBot/blob/master/EULA.md) перед использованием. Устанавливая программу, вы соглашаетесь со всеми его условиями.
AstrBot is an open-source all-in-one Agent chatbot platform that integrates with mainstream instant messaging apps. It provides reliable and scalable conversational AI infrastructure for individuals, developers, and teams. Whether you're building a personal AI companion, intelligent customer service, automation assistant, or enterprise knowledge base, AstrBot enables you to quickly build production-ready AI applications within your IM platform workflows.
For users who want to quickly experience AstrBot, are familiar with command-line usage, and can install a `uv` environment on their own, we recommend the `uv` one-click deployment method ⚡️:
```bash
git clone https://github.com/Soulter/AstrBot
uv tool install astrbot --python 3.12
astrbot init # Only execute this command for the first time to initialize the environment
astrbot run
```
> Requires [uv](https://docs.astral.sh/uv/) to be installed.
> AstrBot requires Python 3.12 or later. The `--python 3.12` option ensures that `uv` creates the tool environment with Python 3.12.
> [!NOTE]
> For macOS users: due to macOS security checks, the first run of the `astrbot` command may take longer (about 10-20s).
Update `astrbot`:
```bash
uv tool upgrade astrbot --python 3.12
```
> [!WARNING]
> AstrBot deployed via `uv` **does not support upgrading through the WebUI**. To update, please run the command above from the command line.
### Docker Deployment
For users familiar with containers and looking for a more stable, production-ready deployment method, we recommend deploying AstrBot with Docker / Docker Compose.
Please refer to the official documentation: [Deploy AstrBot with Docker](https://docs.astrbot.app/deploy/astrbot/docker.html#%E4%BD%BF%E7%94%A8-docker-%E9%83%A8%E7%BD%B2-astrbot).
### Deploy on RainYun
For users who want one-click deployment and do not want to manage servers themselves, we recommend RainYun's one-click cloud deployment service ☁️:
[](https://app.rainyun.com/apps/rca/store/5994?ref=NjU1ODg0)
### Desktop Application Deployment
For users who want to use AstrBot on desktop and mainly use ChatUI, we recommend AstrBot App.
Visit [AstrBot-desktop](https://github.com/AstrBotDevs/AstrBot-desktop) to download and install; this method is designed for desktop usage and is not recommended for server scenarios.
### Launcher Deployment
For desktop users who also want fast deployment and isolated multi-instance usage, we recommend AstrBot Launcher.
Visit [AstrBot Launcher](https://github.com/Raven95676/astrbot-launcher) to download and install.
### Deploy on Replit
Replit deployment is maintained by the community and is suitable for online demos and lightweight trials.
[](https://repl.it/github/AstrBotDevs/AstrBot)
### AUR
AUR deployment targets Arch Linux users who prefer installing AstrBot through the system package workflow.
Run the command below to install `astrbot-git`, then start AstrBot in your local environment.
```bash
yay -S astrbot-git
```
**More deployment methods**
If you need panel-based management or deeper customization, see [BT-Panel Deployment](https://docs.astrbot.app/deploy/astrbot/btpanel.html) for BT Panel app-store setup, [1Panel Deployment](https://docs.astrbot.app/deploy/astrbot/1panel.html) for 1Panel app-market deployment, [CasaOS Deployment](https://docs.astrbot.app/deploy/astrbot/casaos.html) for NAS/home-server visual deployment, and [Manual Deployment](https://docs.astrbot.app/deploy/astrbot/cli.html) for fully custom source-based installation with `uv`.
## Supported Messaging Platforms
Connect AstrBot to your favorite chat platform.
| Platform | Maintainer |
|---------|---------------|
| QQ | Official |
| OneBot v11 protocol implementation | Official |
| Telegram | Official |
| Wecom & Wecom AI Bot | Official |
| WeChat Official Accounts | Official |
| Feishu (Lark) | Official |
| DingTalk | Official |
| Slack | Official |
| Discord | Official |
| LINE | Official |
| Satori | Official |
| KOOK | Official |
| Misskey | Official |
| Mattermost | Official |
| WhatsApp (Coming Soon) | Official |
| [Matrix](https://github.com/stevessr/astrbot_plugin_matrix_adapter) | Community |
| [Rocket.Chat](https://github.com/NET-Homeless/astrbot_plugin_rocket_chat_adapter) | Community |
| [VoceChat](https://github.com/HikariFroya/astrbot_plugin_vocechat) | Community |
Issues and Pull Requests are always welcome! Feel free to submit your changes to this project :)
### How to Contribute
You can contribute by reviewing issues or helping with pull request reviews. Any issues or PRs are welcome to encourage community participation. Of course, these are just suggestions—you can contribute in any way you like. For adding new features, please discuss through an Issue first.
### Development Environment
AstrBot uses `ruff` for code formatting and linting.
> If this project has helped you in your life or work, or if you're interested in its future development, please give the project a Star. It's the driving force behind maintaining this open-source project <3
<div align="center">
[](https://star-history.com/#soulter/astrbot&Date)
[](https://star-history.com/#astrbotdevs/astrbot&Date)
</div>
## Disclaimer
1. The project is protected under the `AGPL-v3` opensource license.
2. The deployment of WeChat (personal account) utilizes [Gewechat](https://github.com/Devo919/Gewechat) service. AstrBot only guarantees connectivity with Gewechat and recommends using a WeChat account that is not frequently used. In the event of account risk control, the author of this project shall not bear any responsibility.
3. Please ensure compliance with local laws and regulations when using this project.
_Companionship and capability should never be at odds. What we aim to create is a robot that can understand emotions, provide genuine companionship, and reliably accomplish tasks._
AstrBot is a loosely coupled, asynchronous chatbot and development framework that supports multi-platform deployment, featuring an easy-to-use plugin system and comprehensive Large Language Model (LLM) integration capabilities.
## ✨ Key Features
1.**LLM Conversations** - Supports various LLMs including OpenAI API, Google Gemini, Llama, Deepseek, ChatGLM, etc. Enables local model deployment via Ollama/LLMTuner. Features multi-turn dialogues, personality contexts, multimodal capabilities (image understanding), and speech-to-text (Whisper).
2.**Multi-platform Integration** - Supports QQ (OneBot), QQ Channels, WeChat (Gewechat), Feishu, and Telegram. Planned support for DingTalk, Discord, WhatsApp, and Xiaomi Smart Speakers. Includes rate limiting, whitelisting, keyword filtering, and Baidu content moderation.
3.**Agent Capabilities** - Native support for code execution, natural language TODO lists, web search. Integrates with [Dify Platform](https://astrbot.app/others/dify.html) for easy access to Dify assistants/knowledge bases/workflows.
4.**Plugin System** - Optimized plugin mechanism with minimal development effort. Supports multiple installed plugins.
5.**Web Dashboard** - Visual configuration management, plugin controls, logging, and WebChat interface for direct LLM interaction.
6.**High Stability & Modularity** - Event bus and pipeline architecture ensures high modularization and loose coupling.
| OpenAI API | ✔ | Text Generation | Supports all OpenAI API-compatible services including DeepSeek, Google Gemini, GLM, Moonshot, Alibaba Cloud Bailian, Silicon Flow, xAI, etc. |
| Claude API | ✔ | Text Generation | |
| Google Gemini API | ✔ | Text Generation | |
| Dify | ✔ | LLMOps | |
| DashScope (Alibaba Cloud) | ✔ | LLMOps | |
| Ollama | ✔ | Model Loader | Local deployment for open-source LLMs (DeepSeek, Llama, etc.) |
| LM Studio | ✔ | Model Loader | Local deployment for open-source LLMs (DeepSeek, Llama, etc.) |
| LLMTuner | ✔ | Model Loader | Local loading of fine-tuned models (e.g. LoRA) |
| OneAPI | ✔ | LLM Distribution | |
| Whisper | ✔ | Speech-to-Text | Supports API and local deployment |
| SenseVoice | ✔ | Speech-to-Text | Local deployment |
AstrBot est une plateforme de chatbot Agent tout-en-un open source qui s'intègre aux principales applications de messagerie instantanée. Elle fournit une infrastructure d'IA conversationnelle fiable et évolutive pour les particuliers, les développeurs et les équipes. Que vous construisiez un compagnon IA personnel, un service client intelligent, un assistant d'automatisation ou une base de connaissances d'entreprise, AstrBot vous permet de créer rapidement des applications d'IA prêtes pour la production dans les flux de travail de votre plateforme de messagerie.
2. ✨ Dialogue avec de grands modèles d'IA, multimodal, Agent, MCP, Skills, Base de connaissances, Paramétrage de personnalité, compression automatique des dialogues.
3. 🤖 Prise en charge de l'accès aux plateformes d'Agents telles que Dify, Alibaba Cloud Bailian, Coze, etc.
5. 📦 Extension par plugins, avec plus de 1000 plugins déjà disponibles pour une installation en un clic.
6. 🛡️ Environnement isolé [Agent Sandbox](https://docs.astrbot.app/use/astrbot-agent-sandbox.html) : exécution sécurisée de code, appels Shell et réutilisation des ressources au niveau de la session.
7. 💻 Support WebUI.
8. 🌈 Support Web ChatUI, avec sandbox d'agent intégrée, recherche web, etc.
9. 🌐 Support de l'internationalisation (i18n).
<br>
<table align="center">
<tr align="center">
<th>💙 Jeux de rôle & Accompagnement émotionnel</th>
Pour les utilisateurs qui veulent découvrir AstrBot rapidement, qui sont familiers avec la ligne de commande et peuvent installer eux-mêmes l'environnement `uv`, nous recommandons la méthode de déploiement en un clic avec `uv` ⚡️ :
```bash
uv tool install astrbot --python 3.12
astrbot init # Exécutez cette commande uniquement la première fois pour initialiser l'environnement
astrbot run
```
> [uv](https://docs.astral.sh/uv/) doit être installé.
> AstrBot nécessite Python 3.12 ou une version plus récente. L'option `--python 3.12` garantit que `uv` crée l'environnement tool avec Python 3.12.
> [!NOTE]
> Pour les utilisateurs macOS : en raison des vérifications de sécurité de macOS, la première exécution de la commande `astrbot` peut prendre plus de temps (environ 10-20s).
Mettre à jour `astrbot` :
```bash
uv tool upgrade astrbot --python 3.12
```
> [!WARNING]
> AstrBot déployé via `uv` **ne prend pas en charge la mise à jour via le WebUI**. Pour mettre à jour, exécutez la commande ci-dessus depuis le terminal.
### Déploiement Docker
Pour les utilisateurs familiers avec les conteneurs et qui souhaitent une méthode plus stable et adaptée à la production, nous recommandons de déployer AstrBot avec Docker / Docker Compose.
Veuillez consulter la documentation officielle [Déployer AstrBot avec Docker](https://docs.astrbot.app/deploy/astrbot/docker.html#%E4%BD%BF%E7%94%A8-docker-%E9%83%A8%E7%BD%B2-astrbot).
### Déployer sur RainYun
Pour les utilisateurs qui souhaitent déployer AstrBot en un clic sans gérer le serveur eux-mêmes, nous recommandons le service de déploiement cloud en un clic de RainYun ☁️ :
[](https://app.rainyun.com/apps/rca/store/5994?ref=NjU1ODg0)
### Déploiement de l'application de bureau
Pour les utilisateurs qui veulent utiliser AstrBot sur desktop et passer principalement par ChatUI, nous recommandons AstrBot App.
Accédez à [AstrBot-desktop](https://github.com/AstrBotDevs/AstrBot-desktop) pour télécharger et installer l'application ; cette méthode est conçue pour un usage desktop et n'est pas recommandée pour les scénarios serveur.
### Déploiement avec le lanceur
Également sur desktop, pour les utilisateurs qui souhaitent un déploiement rapide avec isolation d'environnement et multi-instances, nous recommandons AstrBot Launcher.
Accédez à [AstrBot Launcher](https://github.com/Raven95676/astrbot-launcher) pour télécharger et installer.
### Déployer sur Replit
Le déploiement sur Replit est maintenu par la communauté et convient aux démonstrations en ligne et aux essais légers.
[](https://repl.it/github/AstrBotDevs/AstrBot)
### AUR
Le mode AUR s'adresse aux utilisateurs Arch Linux qui préfèrent installer AstrBot via le gestionnaire de paquets système.
Exécutez la commande ci-dessous pour installer `astrbot-git`, puis lancez AstrBot localement.
```bash
yay -S astrbot-git
```
**Autres méthodes de déploiement**
Si vous avez besoin d'une gestion par panneau ou d'une personnalisation plus poussée, consultez [Déploiement BT-Panel](https://docs.astrbot.app/deploy/astrbot/btpanel.html) pour une installation via BT Panel, [Déploiement 1Panel](https://docs.astrbot.app/deploy/astrbot/1panel.html) pour le marketplace 1Panel, [Déploiement CasaOS](https://docs.astrbot.app/deploy/astrbot/casaos.html) pour un déploiement visuel sur NAS/serveur domestique, et [Déploiement manuel](https://docs.astrbot.app/deploy/astrbot/cli.html) pour une installation complète depuis les sources avec `uv`.
## Plateformes de messagerie prises en charge
Connectez AstrBot à vos plateformes de chat préférées.
| Plateforme | Maintenance |
|---------|---------------|
| QQ | Officielle |
| Implémentation du protocole OneBot v11 | Officielle |
| Telegram | Officielle |
| Application WeChat Work & Bot intelligent WeChat Work | Officielle |
| Volcano Engine TTS | Services de synthèse vocale |
## ❤️ Contribuer
Les Issues et Pull Requests sont toujours les bienvenues ! N'hésitez pas à soumettre vos modifications à ce projet :)
### Comment contribuer
Vous pouvez contribuer en examinant les issues ou en aidant à la revue des pull requests. Toutes les issues ou PRs sont les bienvenues pour encourager la participation de la communauté. Bien sûr, ce ne sont que des suggestions - vous pouvez contribuer de la manière que vous souhaitez. Pour l'ajout de nouvelles fonctionnalités, veuillez d'abord en discuter via une Issue.
### Environnement de développement
AstrBot utilise `ruff` pour le formatage et le linting du code.
> Si ce projet vous a aidé dans votre vie ou votre travail, ou si vous êtes intéressé par son développement futur, veuillez donner une étoile au projet. C'est la force motrice derrière la maintenance de ce projet open source <3
<div align="center">
[](https://star-history.com/#astrbotdevs/astrbot&Date)
</div>
<div align="center">
_La compagnie et la capacité ne devraient jamais être des opposés. Nous souhaitons créer un robot capable à la fois de comprendre les émotions, d'offrir de la présence, et d'accomplir des tâches de manière fiable._
AstrBot は、主要なインスタントメッセージングアプリと統合できるオープンソースのオールインワン Agent チャットボットプラットフォームです。個人、開発者、チームに信頼性が高くスケーラブルな会話型 AI インフラストラクチャを提供します。パーソナル AI コンパニオン、インテリジェントカスタマーサービス、オートメーションアシスタント、エンタープライズナレッジベースなど、AstrBot を使用すると、IM プラットフォームのワークフロー内で本番環境対応の AI アプリケーションを迅速に構築できます。
[](https://app.rainyun.com/apps/rca/store/5994?ref=NjU1ODg0)
AstrBot — это универсальная платформа Agent-чатботов с открытым исходным кодом, которая интегрируется с основными приложениями для обмена мгновенными сообщениями. Она предоставляет надёжную и масштабируемую инфраструктуру разговорного ИИ для частных лиц, разработчиков и команд. Будь то персональный ИИ-компаньон, интеллектуальная служба поддержки, автоматизированный помощник или корпоративная база знаний — AstrBot позволяет быстро создавать готовые к использованию ИИ-приложения в рабочих процессах вашей платформы обмена сообщениями.
2. ✨ Диалоги с ИИ-моделями, мультимодальность, Agent, MCP, Skills, База знаний, Настройка личности, автоматическое сжатие диалогов.
3. 🤖 Поддержка интеграции с платформами Agents, такими как Dify, Alibaba Cloud Bailian, Coze и др.
4. 🌐 Мультиплатформенность: поддержка QQ, WeChat для предприятий, Feishu, DingTalk, публичных аккаунтов WeChat, Telegram, Slack и [других](#Поддерживаемые-платформы-обмена-сообщениями).
5. 📦 Расширение плагинами: доступно более 1000 плагинов для установки в один клик.
6. 🛡️ Изолированная среда[Agent Sandbox](https://docs.astrbot.app/use/astrbot-agent-sandbox.html): безопасное выполнение любого кода, вызов Shell, повторное использование ресурсов на уровне сессии.
7. 💻 Поддержка WebUI.
8. 🌈 Поддержка Web ChatUI: встроенная песочница агента, веб-поиск и др.
Для пользователей, которые хотят быстро попробовать AstrBot, знакомы с командной строкой и могут самостоятельно установить окружение `uv`, мы рекомендуем использовать развёртывание в один клик через `uv` ⚡️:
```bash
uv tool install astrbot --python 3.12
astrbot init # Выполните эту команду только при первом запуске для инициализации окружения
astrbot run
```
> Требуется установленный [uv](https://docs.astral.sh/uv/).
> Для AstrBot требуется Python 3.12 или новее. Параметр `--python 3.12` гарантирует, что `uv` создаст tool-окружение с Python 3.12.
> [!NOTE]
> Для пользователей macOS: из-за проверок безопасности macOS первый запуск команды `astrbot` может занять больше времени (около 10-20 секунд).
Обновить `astrbot`:
```bash
uv tool upgrade astrbot --python 3.12
```
> [!WARNING]
> AstrBot, развёрнутый через `uv`, **не поддерживает обновление через WebUI**. Для обновления выполните указанную выше команду из командной строки.
### Развёртывание Docker
Для пользователей, знакомых с контейнерами и которым нужен более стабильный и подходящий для production способ, мы рекомендуем разворачивать AstrBot через Docker / Docker Compose.
См. официальную документацию [Развёртывание AstrBot с Docker](https://docs.astrbot.app/deploy/astrbot/docker.html#%E4%BD%BF%E7%94%A8-docker-%E9%83%A8%E7%BD%B2-astrbot).
### Развёртывание на RainYun
Для пользователей, которые хотят развернуть AstrBot в один клик и не хотят самостоятельно управлять сервером, мы рекомендуем облачный сервис развёртывания в один клик от RainYun ☁️:
[](https://app.rainyun.com/apps/rca/store/5994?ref=NjU1ODg0)
### Развёртывание десктопного приложения
Для пользователей, которые хотят использовать AstrBot на десктопе и в основном работают через ChatUI, мы рекомендуем AstrBot App.
Перейдите в [AstrBot-desktop](https://github.com/AstrBotDevs/AstrBot-desktop), скачайте и установите приложение; этот вариант предназначен для десктопа и не рекомендуется для серверных сценариев.
### Развёртывание через лаунчер
Также на десктопе, для пользователей, которым нужен быстрый запуск и мультиинстанс с изоляцией окружений, мы рекомендуем AstrBot Launcher.
Перейдите в [AstrBot Launcher](https://github.com/Raven95676/astrbot-launcher), чтобы скачать и установить.
### Развёртывание на Replit
Развёртывание через Replit поддерживается сообществом и подходит для онлайн-демо и лёгких тестовых запусков.
[](https://repl.it/github/AstrBotDevs/AstrBot)
### AUR
AUR-вариант предназначен для пользователей Arch Linux, которым удобна установка через системный менеджер пакетов.
Выполните команду ниже для установки `astrbot-git`, затем запустите AstrBot локально.
```bash
yay -S astrbot-git
```
**Другие способы развёртывания**
Если вам нужна панельная установка или более глубокая кастомизация, смотрите [Развёртывание BT-Panel](https://docs.astrbot.app/deploy/astrbot/btpanel.html) (установка через BT Panel), [Развёртывание 1Panel](https://docs.astrbot.app/deploy/astrbot/1panel.html) (развёртывание через маркетплейс 1Panel), [Развёртывание CasaOS](https://docs.astrbot.app/deploy/astrbot/casaos.html) (визуальный вариант для NAS и домашних серверов) и [Ручное развёртывание](https://docs.astrbot.app/deploy/astrbot/cli.html) (полностью настраиваемая установка из исходников через `uv`).
## Поддерживаемые платформы обмена сообщениями
Подключите AstrBot к вашим любимым чат-платформам.
| Платформа | Поддержка |
|---------|---------------|
| QQ | Официальная |
| Реализация протокола OneBot v11 | Официальная |
| Telegram | Официальная |
| Приложение WeChat Work и интеллектуальный бот WeChat Work | Официальная |
| Служба поддержки WeChat и официальные аккаунты WeChat | Официальная |
| Приложения Alibaba Cloud Bailian | Платформы LLMOps |
| Coze | Платформы LLMOps |
| OpenAI Whisper | Сервисы распознавания речи |
| SenseVoice | Сервисы распознавания речи |
| Xiaomi MiMo Omni | Сервисы распознавания речи |
| OpenAI TTS | Сервисы синтеза речи |
| Gemini TTS | Сервисы синтеза речи |
| GPT-Sovits-Inference | Сервисы синтеза речи |
| GPT-Sovits | Сервисы синтеза речи |
| FishAudio | Сервисы синтеза речи |
| Edge TTS | Сервисы синтеза речи |
| Alibaba Cloud Bailian TTS | Сервисы синтеза речи |
| Azure TTS | Сервисы синтеза речи |
| Minimax TTS | Сервисы синтеза речи |
| Xiaomi MiMo TTS | Сервисы синтеза речи |
| Volcano Engine TTS | Сервисы синтеза речи |
## ❤️ Вклад в проект
Issues и Pull Request всегда приветствуются! Не стесняйтесь отправлять свои изменения в этот проект :)
### Как внести вклад
Вы можете внести вклад, просматривая issues или помогая с ревью pull request. Любые issues или PR приветствуются для поощрения участия сообщества. Конечно, это лишь предложения — вы можете вносить вклад любым удобным для вас способом. Для добавления новых функций сначала обсудите это через Issue.
### Среда разработки
AstrBot использует `ruff` для форматирования и линтинга кода.
> Если этот проект помог вам в жизни или работе, или если вас интересует его будущее развитие, пожалуйста, поставьте проекту звезду. Это движущая сила поддержки этого проекта с открытым исходным кодом <3
<div align="center">
[](https://star-history.com/#astrbotdevs/astrbot&Date)
</div>
<div align="center">
_Сопровождение и способности никогда не должны быть противоположностями. Мы стремимся создать робота, который сможет как понимать эмоции, оказывать душевную поддержку, так и надёжно выполнять работу._
[](https://app.rainyun.com/apps/rca/store/5994?ref=NjU1ODg0)
[](https://app.rainyun.com/apps/rca/store/5994?ref=NjU1ODg0)
"""Fetch the content of a website with the given web url
Args:
url(string): The url of the website to fetch content from
"""
resp=awaitself._get_from_url(url)
returnresp
@llm_tool("web_search_tavily")
asyncdefsearch_from_tavily(
self,
event:AstrMessageEvent,
query:str,
max_results:int=7,
search_depth:str="basic",
topic:str="general",
days:int=3,
time_range:str="",
start_date:str="",
end_date:str="",
)->str:
"""A web search tool that uses Tavily to search the web for relevant content.
Ideal for gathering current information, news, and detailed web content analysis.
Args:
query(string): Required. Search query.
max_results(number): Optional. The maximum number of results to return. Default is 7. Range is 5-20.
search_depth(string): Optional. The depth of the search, must be one of 'basic', 'advanced'. Default is "basic".
topic(string): Optional. The topic of the search, must be one of 'general', 'news'. Default is "general".
days(number): Optional. The number of days back from the current date to include in the search results. Please note that this feature is only available when using the 'news' search topic.
time_range(string): Optional. The time range back from the current date to include in the search results. This feature is available for both 'general' and 'news' search topics. Must be one of 'day', 'week', 'month', 'year'.
start_date(string): Optional. The start date for the search results in the format 'YYYY-MM-DD'.
end_date(string): Optional. The end date for the search results in the format 'YYYY-MM-DD'.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.