Commit Graph

4942 Commits

Author SHA1 Message Date
Soulter
6d798908ad fix: constrain custom workspace paths 2026-07-03 22:45:35 +08:00
lxfight
ea9e3421d9 fix: align knowledge base CRUD API contract with kb_name, canonical payload fields, and matching OpenAPI types (#9000)
Warning: Potential breaking changes in /kb related openapi.

* fix(kb): align CRUD API contract end-to-end

Unify knowledge base create/update/list with kb_name, canonical_payload,
optional list pagination with total, and matching OpenAPI plus dashboard types.

* fix: restore _model_dict references, add KnowledgeBaseCreateRequest, fix OpenAPI allOf validation

- Replace 3 remaining _model_dict() calls with payload.model_dump(exclude_none=True)
- Add KnowledgeBaseCreateRequest schema with required kb_name + embedding_provider_id
- Remove additionalProperties: false from OpenAPI allOf sub-schema to avoid validation failures
- Use Pydantic Field(alias="name") + populate_by_name=True for legacy name migration
- Delegate _canonical_kb_payload to KnowledgeBaseRequest to eliminate duplicated logic
- Add getattr default None for update_kb to prevent AttributeError
- Add validation error tests: missing kb_name, missing embedding_provider_id

* fix: address knowledge base contract follow-ups

* fix: preserve knowledge base create error shape
2026-07-03 22:18:56 +08:00
lxfight
e2f3b00088 fix(kb): clean up KBMedia records on document delete, fix update_kb_stats (#9120)
* fix(kb): clean up KBMedia records on document delete, fix update_kb_stats

- delete_document_by_id now deletes associated KBMedia records before
  removing the KBDocument row, preventing orphaned media data.
- update_kb_stats now passes kb_id filter to vec_db.count_documents,
  fixing chunk count that previously counted across all KBs.
- add tests for document deletion cleanup and update_kb_stats behavior.

* fix(kb): merge media and document deletion into single transaction
2026-07-03 22:13:23 +08:00
lxfight
468eea99c6 fix(kb): improve retrieval resilience on per-KB failure and rerank selection (#9122)
* fix(kb): improve retrieval resilience on per-KB failure and rerank selection

- Remove RuntimeError on single-KB dense retrieval failure: always skip
  the faulty KB and return partial results instead of crashing.
- Simplify rerank provider selection: remove redundant rerank_pi check
  since the provider is already loaded from that ID.

* fix(kb): simplify rerank selection loop, improve dense retrieval error log
2026-07-03 22:12:24 +08:00
lxfight
aecee6fc9f fix(kb): replace fragile error string matching with pre-check for duplicate kb_name (#9121)
* fix(kb): replace fragile error string matching with pre-check for duplicate kb_name

* fix(kb): handle IntegrityError race condition on duplicate kb_name
2026-07-03 22:12:00 +08:00
Glowing Brick
3ce66576f4 fix: Improve MCP client startup and shutdown handling to prevent idle spinning when a server is disabled and ensure proper cleanup on errors, timeouts, and cancellation (#9070)
* fix: mcp cancel scope cross task spin (#9068)

* fix: mcp cancel scope cross task spin

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix: mcp cancel scope cross task spin

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix: mcp cancel scope cross task spin

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-07-03 22:10:53 +08:00
Weilong Liao
e7d5be632f feat: add ChatUI project workspaces (#9066)
* feat: add ChatUI project workspaces

* feat: refine chatui layout

* feat: enhance chat input and project view styles for attachment handling

* feat: adjust chat sidebar brand logo positioning

* feat: enhance project dialog with error handling and loading state
2026-07-03 21:54:20 +08:00
VectorPeak
89b80a6ca7 fix: enable only synced ModelScope MCP servers (#9084)
* fix: enable only synced ModelScope MCP servers

* fix: avoid mutating default MCP config
2026-07-03 01:05:25 +08:00
NayukiChiba
9f50c900b0 feat(platform): 支持扫码创建时自定义机器人ID (#9067)
* feat(platform): 支持扫码创建时自定义机器人ID

- 在扫码创建平台机器人时新增机器人 ID 输入框,允许用户在创建前自定义平台 ID。
- 输入框展示在二维码上方,并对空值、空格、冒号和感叹号进行校验。
- 用户手动填写 ID 后,扫码结果不会再自动覆盖该值。
- 同时补充中英俄三语言文案。

* refactor(platform): 重构扫码创建平台ID输入组件

- 将平台专属CSS类名改为通用名称registration-inline
- 使用统一的isPlatformIdValid方法校验ID格式,替代分散的正则判断
- 移除setter中对platform ID的trim操作,交由校验逻辑处理
- 删除不再使用的.weixin-oc-registration-inline样式定义
2026-07-03 01:04:03 +08:00
Weilong Liao
e8f00960fe chore: bump version to 4.26.4
Release AstrBot v4.26.4.
v4.26.4
2026-07-03 00:54:01 +08:00
100yoGranny
413340fca5 fix: apply fallback chat models to background wakeups (#9094) 2026-07-03 00:40:20 +08:00
伊尔弥亚 - Irmia
152fb3be8f fix: skip _unbind_plugin for inactivated plugins in reload() (#9096)
* fix: skip _unbind_plugin for inactivated plugins in reload()

* fix: only skip _unbind_plugin for deactivated plugins on specified-plugin reload path

Revert the full reload unconditional smd.activated guard added in 555fcfa; it is unnecessary because load() re-adds everything after the clear anyway. Keep the guard only on the specified-plugin reload path.

* test: set tool active=False precondition in turn_on_plugin test; clean up mock_load in unbind test
2026-07-03 00:34:37 +08:00
Weilong Liao
1e3b12acc9 fix: preserve webhook callback responses
Preserve raw webhook callback responses and fix QQ webhook validation handling.
2026-07-03 00:25:09 +08:00
Marshall
ea19be1d06 fix: wecom adapter returning json instead of plain text (#9107)
* Fix wecom adapter returning json instead of plain text

* Fix handle_verify return class
2026-07-02 23:27:08 +08:00
VectorPeak
70a52ea6d0 fix: reject non-200 download responses (#9085)
* fix: reject non-200 download responses

* fix: share download response handling
2026-07-02 11:53:45 +09:00
NLKASHEI
029e9c84af 修复了DISCORD适配器注册命令正则过于严格的问题 (#9102)
* 修复了DISCORD适配器注册命令正则过于严格的问题

* Update astrbot/core/platform/sources/discord/discord_platform_adapter.py

# Discord 支持 Unicode 命令名(如中文),放宽匹配并确保全小写

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>
2026-07-02 11:36:38 +09:00
Cooper
3b41a870ff fix: updated reboot logic (#9073)
* Update updator.py

* test: cover Windows reboot process spawning

---------

Co-authored-by: 邹永赫 <1259085392@qq.com>
2026-07-02 11:33:47 +09:00
エイカク
b673cb375f fix: guard desktop-managed core restart (#9098) 2026-07-02 11:21:02 +09:00
Fiber
4cf210e503 fix: resample and downmix WAV files for Tencent Silk encoding (#9100)
* fix: resample and downmix WAV files for Tencent Silk encoding

* fix: improve WAV to Tencent Silk conversion by handling sample width and resampling
2026-07-01 22:33:36 +08:00
Simon He
372b9f5bfc fix: reduce markdown streaming lag (#9097)
* fix: reduce markdown streaming lag

* refactor: centralize markdown live node limit
2026-07-01 09:53:21 +09:00
Haoran Xu
41f8960302 fix: astrbot_file_read_tool returns clear error for directory path instead of misleading Permission denied (#9088)
When LLM passes a directory path to astrbot_file_read_tool, the tool previously
returned Error: [Errno 13] Permission denied, misleading the LLM into thinking
it was a permissions issue. The real cause: _probe_local_file() calls open('rb')
on the path, which fails on directories with Errno 13 on Windows. This is caught
by except PermissionError and displayed as-is.

Fix: Add os.path.isdir() check in FileReadTool.call() before any file I/O, at
the earliest safe point after path normalization and permission validation.
Returns a clear message: '<path> is a directory, not a file. Use a file path
instead, or use astrbot_execute_shell to list directory contents.'

Changes:
- astrbot/core/tools/computer_tools/fs.py: add isdir guard
- tests/test_computer_fs_tools.py: add test_file_read_tool_rejects_directory_with_clear_message
2026-06-30 20:39:50 +08:00
Soulter
7831c68660 chore: bump version to 4.26.3 v4.26.3 2026-06-30 20:10:58 +08:00
LIghtJUNction
6067a70803 feat: support local plugin install (#8448)
* feat: support local plugin install

* fix: make editable plugin install symlink

* fix: harden local plugin install

* Update tests/test_cli_plugin.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update astrbot/cli/commands/cmd_plug.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>
2026-06-29 01:44:06 +08:00
Weilong Liao
89ec07a92b style: standardize dashboard dialog styling (#9062) 2026-06-28 14:24:19 +08:00
lxfight
758e43273d fix: paginate knowledge base dashboard lists (#9055)
* fix: paginate knowledge base dashboard lists

* fix: preserve knowledge document search pagination
2026-06-28 14:00:45 +08:00
Weilong Liao
3d4c4ed01b fix: validate plugin install sources (#9061) 2026-06-28 13:45:59 +08:00
Gargantua
c1cc74b6bc fix: preserve fallback models for future tasks (#9054)
* fix: preserve fallback models for future tasks

* chore: remove local test markdown ignore

---------

Co-authored-by: Gargantua <22532097@zju.edu.cn>
2026-06-28 00:03:31 +08:00
Weilong Liao
a619988d2d chore: bump version to 4.26.2 (#9052) v4.26.2 2026-06-27 17:50:04 +08:00
Weilong Liao
de572e3fe0 fix: avoid duplicate send_message_to_user replies (#9051) 2026-06-27 16:57:17 +08:00
F. Abyssalis
d4fa9d3d5d fix: align OpenAI tool message sanitizer (#8350)
Co-authored-by: Soulter <905617992@qq.com>
2026-06-27 16:27:32 +08:00
Copilot
771911a893 fix: keep Tab navigation within reset-password inputs in account dialog (#9049)
* Initial plan

* fix: keep tab navigation on account dialog inputs

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-27 16:21:24 +08:00
Weilong Liao
8f30978c8d fix: separate plugin and tool activation state (#9048)
* fix: separate plugin and tool activation state

* style: apply ruff formatting

* fix: preserve manual tool deactivation on load

* fix: harden plugin tool state migration
2026-06-27 16:15:31 +08:00
Weilong Liao
dd2865d28c chore: remove plugin publish issue template (#9050) 2026-06-27 16:11:13 +08:00
Fiber
298078b536 Fix: KV storage not cleared on plugin uninstall. Improved cleanup logic and updated i18n strings to indicate database KV data removal. (#8291)
* fix: 完善插件卸载时的清理逻辑,新增KV数据清理,更新了多语言文案以说明会清理数据库KV数据

* fix: 修复插件关闭时不清理KV的问题,更新单元测试

* refactor: 统一插件ID生成逻辑

将插件ID生成逻辑抽离到StarMetadata类中,移除重复的代码实现,
同时在__post_init__中自动补全plugin_id字段。

* refactor: 将plugin_id属性从方法转换为属性,确保在属性赋值后正确计算
2026-06-27 16:06:14 +08:00
伊尔弥亚 - Irmia
3667487dd7 fix: DeepSeek V4 proxy model recognition — substring match instead of exact set match for reasoning_content injection (#9015)
* fix: DeepSeek V4 proxy model recognition — substring match for reasoning_content

* fix: remove deepseek-chat/reasoner exclusion per review feedback
2026-06-27 15:46:11 +08:00
renchonghan
3db778ff09 fix: prevent API 400 errors by ensuring assistant messages with reasoning_content but no content or tool_calls are preserved with a placeholder content value (#8483)
* fix: preserve assistant messages with reasoning_content in sanitize pass

When _sanitize_assistant_messages encounters an assistant message with empty content and no tool_calls but with reasoning_content, keep it with content set to empty string instead of dropping it. Reasoning models (DeepSeek V4, MiMo, etc.) require this history for subsequent turn validation.

* Update astrbot/core/provider/sources/openai_source.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix: default to empty TokenUsage when completion.usage is None

When completion.usage is None (e.g. certain proxy/streaming edge cases), llm_response.usage stayed unset (None). Plugins accessing .input_tokens on it would crash with AttributeError.

Always assign llm_response.usage — extract from completion.usage if present, otherwise fall back to a zeroed TokenUsage().

Closes #8605

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: renchonghan <renchonghan@users.noreply.github.com>
2026-06-27 15:26:09 +08:00
F. Abyssalis
8213c14cc6 fix: sanitize orphaned tool_result blocks in Anthropic provider (#8952)
* sanitize orphaned tool_result blocks in Anthropic provider

Sanitize tool_result blocks and merge consecutive messages with the same role to comply with Anthropic API requirements.

* Fix content handling in message merging logic

* fix: sanitize anthropic assistant messages

* fix: validate anthropic tool result ordering

---------

Co-authored-by: Soulter <905617992@qq.com>
2026-06-27 15:18:33 +08:00
Florance
b5784abc55 fix: only show plugin update for newer market versions
Only mark installed plugins as updatable when the marketplace version is a known newer version, including pre-release-to-stable transitions. Conflict resolution also keeps per-plugin marketplace source lookup from current master.
2026-06-27 15:12:53 +08:00
FuShang114
b8f4c7d515 fix: handle MiMo STT audio and reasoning output (#8938)
* fix: handle MiMo STT audio and reasoning output

* fix: 移除 MiMo STT 的系统和用户提示词配置

---------

Co-authored-by: Soulter <905617992@qq.com>
2026-06-27 15:04:41 +08:00
Weilong Liao
0ef790d289 fix: track plugin install source for updates (#9037)
* fix: track plugin install source for updates

* feat: refine plugin source management flow

* test: align plugin update expectation
2026-06-27 15:02:04 +08:00
fan
534ad0ccc7 fix: _KeyRotator index bounds check (#9040) 2026-06-27 13:56:26 +08:00
MUHAMED FAZAL PS
b5e29511ac fix: reliably kill shell process tree on Windows timeout (#8822)
* fix: reliably kill shell process tree on Windows timeout

Fixes #8809

* fix: remove redundant import and wrap taskkill in try/except

- Remove 'import subprocess as _sp' (subprocess already imported at top)
- Use subprocess.run directly with DEVNULL for stdout/stderr
- Wrap taskkill in try/except to avoid masking original TimeoutExpired
- If taskkill fails, cleanup failures don't prevent proc.wait() or re-raise

https://buymeacoffee.com/muhamedfazalps

* style: apply ruff formatting to local.py

* test: fix shell component tests to match Popen-based implementation

The tests were monkeypatching subprocess.run but the implementation
now uses subprocess.Popen + communicate() for timeout handling.
Updated tests to mock Popen instead.

Fixes CI Unit Tests failure

* fix: harden windows shell timeout cleanup

---------

Co-authored-by: Soulter <905617992@qq.com>
2026-06-27 00:10:59 +08:00
Weilong Liao
d6738a03f3 fix: preserve jpeg quality during conversion (#9031) 2026-06-26 22:43:15 +08:00
FuShang114
6dd5e1e080 fix: prevent plugin detail marketplace mismatches (#9028) 2026-06-26 22:12:29 +08:00
NayukiChiba
c93bedf04d fix: unify handling of whitespace in streamed message segments and ensure trailing buffers are stripped before sending. (#9029)
* perf(streaming): 将流式消息分段发送的空白过滤逻辑前移至核心方法

- 在 AstrMessageEvent 的 process_buffer 中统一进行 strip 并跳过空段,移除各平台子类的重复处理
- aiocqhttp 平台回退尾部 buffer 直接使用核心逻辑过滤,避免自身再次判断空白
- 简化流式消息发送链路,提升代码可维护性与执行效率

* test(strip-stream): 添加流式消息分段空白过滤的单元测试

- 新增 CollectingMessageEvent 与 CollectingAiocqhttpMessageEvent 辅助类,模拟消息发送与断言
- 覆盖 AstrMessageEvent.process_buffer 对段落前导空白行的 strip 和空段跳过逻辑
- 覆盖 AiocqhttpMessageEvent.send_streaming 回退缓冲区的空白过滤,确保跨平台行为一致

* fix(streaming): 调整流式消息分段发送限速等待位置

- 将限速等待(sleep)从循环末尾移动至消息发送成功后立即执行
- 仅在成功发送文本片段时才进行等待,避免无实际发送时的无谓延迟
- 修复因等待时机不当可能导致的流式消息发送频率异常问题

* test(strip-stream): 添加空白分段时跳过睡眠的单元测试
- 新增测试用例,验证当分段为空时不调用睡眠函数
- 确保处理缓冲区时正确剥离空白字符
- 测试通过验证发送消息的行为

* Delete tests/test_streaming_segment_strip.py

---------

Co-authored-by: Weilong Liao <37870767+Soulter@users.noreply.github.com>
2026-06-26 22:11:31 +08:00
Lovely Moe Moli
110cc8736c fix: 'DashboardRequest' object has no attribute 'get_data' (#9021) (#9023) 2026-06-26 22:04:29 +08:00
Light
ce05ac0db6 docs: add spanish readme (#9020)
* docs(i18n): add Spanish (es) translation for README

* docs(i18n): add Spanish (es) translation for README

* fix(i18n): 修复了导航栏的分隔符与多余字符
2026-06-26 21:52:46 +08:00
Jia
9ae33e9344 docs: update Python requirement to 3.12 (#9022) 2026-06-26 19:43:50 +08:00
Weilong Liao
c6b2c65b04 fix: preserve image formats in media handling (#9019)
* fix: preserve image formats in media handling

* fix: address image format review feedback

* fix: avoid tainted image temp path rename
2026-06-26 11:27:32 +08:00
Weilong Liao
00c50b3b92 chore: bump version to 4.26.1 v4.26.1 2026-06-25 23:12:10 +08:00