Commit Graph

4891 Commits

Author SHA1 Message Date
LIghtJUNction
5357a29ff2 refactor(computer): improve type safety and error handling
bwrap.py:
- Improve property accessors with better error handling
- Add RuntimeError checks for unavailable components before boot

shipyard.py & shipyard_neo.py:
- Add type annotations and improve code quality

browser.py, fs.py, neo_skills.py, python.py:
- Improve type annotations

computer_tool_provider.py:
- Add type annotations
2026-03-31 20:17:26 +08:00
LIghtJUNction
7b16068a04 refactor(star): improve type safety and code quality
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
2026-03-31 20:17:13 +08:00
LIghtJUNction
585ffb3982 refactor(pipeline): improve type safety and code quality
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
2026-03-31 20:16:59 +08:00
LIghtJUNction
a306c63a92 refactor(agent): improve type safety in agent components
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
2026-03-31 20:16:47 +08:00
LIghtJUNction
9ba2ea62c3 refactor(provider): improve type safety and code quality
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
2026-03-31 20:16:35 +08:00
LIghtJUNction
b152516f69 refactor(db): clean up redundant type annotations and improve code
- 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
2026-03-31 20:16:21 +08:00
LIghtJUNction
806c3dfade refactor(commands): improve type safety and add validation
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
2026-03-31 20:16:02 +08:00
LIghtJUNction
65841684de refactor(platforms): improve type safety in platform adapters
- 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
2026-03-31 20:15:46 +08:00
LIghtJUNction
3eccbca2c9 refactor(i18n): improve type safety and code quality in i18n_utils
- 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
2026-03-31 20:15:28 +08:00
LIghtJUNction
da12fca83d refactor(utils): improve type annotations and code quality
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
2026-03-31 20:15:09 +08:00
LIghtJUNction
97077ed32e test: clean up type: ignore comments and add package markers
- Remove unnecessary type: ignore comments in test files
- Add __init__.py markers for tests and tests/unit packages
2026-03-31 20:14:47 +08:00
LIghtJUNction
7ff6df9853 chore: add type stubs and update pyproject.toml configuration
- Add type stubs for external packages (faiss, psutil, readability, etc.)
- Move typings to types/ directory
- Update pyproject.toml with mypy plugin configuration
- Add project URLs (Homepage, Repository)
- Update python version to 3.12 in pyright config
2026-03-31 20:14:35 +08:00
LIghtJUNction
fc515d447f Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	dashboard/src/assets/mdi-subset/materialdesignicons-subset.css
#	dashboard/src/i18n/locales/ru-RU/features/cron.json
#	dashboard/src/i18n/locales/ru-RU/features/subagent.json
#	dashboard/src/views/ConversationPage.vue
#	dashboard/src/views/CronJobPage.vue
#	dashboard/src/views/SubAgentPage.vue
#	pyproject.toml
2026-03-31 17:26:18 +08:00
LIghtJUNction
328748bd63 Fix cached_tokens handling in _extract_usage method (#6719)
* Fix cached_tokens handling in _extract_usage method

Ensure cached_tokens is an integer and handle None safely.

* ruuf format
2026-03-31 17:14:52 +08:00
LIghtJUNction
87bfecb2f3 chore: update requirements.txt 2026-03-31 17:12:10 +08:00
qingyun
a73e388927 fix(agent): improve send_message_to_user tool description to prevent misuse (#6424)
* 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>
2026-03-31 17:08:42 +08:00
Jacobinwwey
7ff4057fc9 feat(web-search): add provider routing aliases and explicit-engine selection while preserving default engine behavior (#6442)
* feat(web-search): add provider routing and ddg-first default chain

* fix(web-search): keep dev default engine order and demote ddg fallback

* fix(web-search): harden selector/query handling and unify engine naming

* refactor(web-search): streamline provider wiring and harden google query encoding

* fix(web-search): return empty for non-positive filtered result limits

* refactor(web-search): share provider constants and validate engine registry

* refactor(web-search): unify provider normalization and engine registry

* fix(web-search): reduce comet link noise with stricter url filtering

* style(web-search): apply ruff formatting
2026-03-31 17:06:51 +08:00
LIghtJUNction
3f40a1bc00 fix: simplify persona page header layout 2026-03-31 17:05:59 +08:00
LIghtJUNction
d92132293a Merge branch 'dev' of https://github.com/AstrBotDevs/AstrBot into dev 2026-03-31 16:58:32 +08:00
Kangyang Ji
94378d6f35 feat(dashboard): add auto switch theme button to setting page. (#7170)
* feat(dashboard): add auto switch theme button to setting page.

* fix on missing key in en-US translate
2026-03-31 16:58:27 +08:00
LIghtJUNction
4a8686e6a3 Merge branch 'dev' of https://github.com/AstrBotDevs/AstrBot into dev 2026-03-31 16:54:54 +08:00
dependabot[bot]
65a91322e9 chore(deps): bump codecov/codecov-action in the github-actions group (#7209)
Bumps the github-actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `codecov/codecov-action` from 5 to 6
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-31 08:49:43 +08:00
Kangyang Ji
ff2d3d11ca fix: delete duplicate layout in PersonaManager.vue (#7190)
根据代码blame,重复的代码来源于两个commit: `feat: update dashboard (1b9820a)` 和 `merge: pull latest master into dev (1faeee3)`, 所以我保留了`feat: update dashboard (1b9820a)`中的代码,删除了`merge: pull latest master into dev (1faeee3)`添加的重复代码。
2026-03-31 00:56:10 +08:00
Soulter
410f30bf26 perf: improve ui (#7178)
* 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.
2026-03-30 23:53:27 +08:00
Soulter
55f9903b2f perf: enhance token display styles for better readability and layout 2026-03-30 23:50:19 +08:00
Soulter
30d0b1e9da chore: update project metadata in pyproject.html
closes: #7182
2026-03-30 23:49:45 +08:00
LIghtJUNction
a550b88e15 fix: type 2026-03-30 19:30:33 +08:00
LIghtJUNction
f543f16cc1 fix: type 2026-03-30 18:03:27 +08:00
LIghtJUNction
70107b2c8a fix: type 2026-03-30 18:03:22 +08:00
LIghtJUNction
54f6916172 fix: type 2026-03-30 18:03:02 +08:00
LIghtJUNction
4ca8bc7bbc fix: type 2026-03-30 18:02:40 +08:00
LIghtJUNction
abb6a32829 fix: type errors 2026-03-30 18:02:18 +08:00
LIghtJUNction
9b15a60802 fix: resolve 7 type errors in dev branch
- 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
2026-03-30 18:01:37 +08:00
LIghtJUNction
49d17460d6 fix: add type ignore for msg_dict 2026-03-30 17:46:37 +08:00
LIghtJUNction
7e3bdbc9fa fix: add type ignore for merge 2026-03-30 17:46:20 +08:00
LIghtJUNction
f084fba702 fix: add type ignore for func_tool assignment 2026-03-30 17:46:04 +08:00
LIghtJUNction
376161faa8 fix: add type ignore for persona_toolset.add_tool 2026-03-30 17:45:54 +08:00
LIghtJUNction
2aafe18880 fix: add type ignore for add_tool arg 2026-03-30 17:45:42 +08:00
LIghtJUNction
50b7d18a20 fix: resolve Self return type in ToolImageCache 2026-03-30 17:45:27 +08:00
LIghtJUNction
480c77a150 fix: restore dashboard trace and platform logos 2026-03-30 17:41:01 +08:00
LIghtJUNction
e1c4b52fba fix: resolve create_task type error in tool_loop_agent_runner 2026-03-30 17:36:26 +08:00
LIghtJUNction
e8557909d6 fix: restore dev retry logic and add class constants
- Restore simple dev retry flow (no AsyncRetrying wrapper)
- Add EMPTY_OUTPUT_RETRY_* class constants for test compatibility
2026-03-30 17:17:21 +08:00
LIghtJUNction
086dc00498 fix: resolve MCPTool import and openai_source merge conflicts
- 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
2026-03-30 17:14:33 +08:00
LIghtJUNction
efa999c221 merge: origin/master into dev
Resolve merge conflicts:
- Version logic: keep dev (dynamic version from package metadata)
- Backend: merge EmptyModelOutputError retry logic from master
- Frontend: keep dev design, accept master functional enhancements
- SSL/config: keep dev inline implementation
2026-03-30 17:07:57 +08:00
Yufeng He
2ffda752ad fix: send SSE heartbeat to prevent WebChat disconnect during compression (#7003)
* 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>
2026-03-30 15:52:10 +08:00
Soulter
bfd129402d docs: update community events 2026-03-30 13:10:48 +08:00
Stardust
a4d073bcce fix: improve number input UX in config renderer (#7153)
* fix: improve number input UX in config renderer

* fix: address review comments on number input handling
2026-03-30 10:01:24 +08:00
LIghtJUNction
95cb2a8ac6 fix: resolve multiple type errors and runtime bugs
- shell.py: Fix FunctionTool import from correct module (core.agent.tool)
- deerflow/coze agent runners: Remove invalid return type annotations for step/step_until_done
- aiocqhttp_message_event.py: Fix raise string error (must raise Exception not str)
- lark_event.py: Fix file upload by wrapping bytes in BytesIO for SDK compatibility
- tg_adapter.py: Fix update.message None check in nested function
- TraceDisplayer.vue: Fix text color visibility using proper theme variables
2026-03-30 01:08:43 +08:00
LIghtJUNction
de35ff5cda feat(dashboard): complete redesign of Trace page
- 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
2026-03-30 01:07:55 +08:00
LIghtJUNction
2a1544fb6c chore: stage remaining changes 2026-03-30 00:48:16 +08:00