Skip to content

fix: preserve disabled session knowledge bases - #9456

Open
lxfight wants to merge 1 commit into
AstrBotDevs:masterfrom
lxfight:fix/session-kb-selection-state
Open

fix: preserve disabled session knowledge bases#9456
lxfight wants to merge 1 commit into
AstrBotDevs:masterfrom
lxfight:fix/session-kb-selection-state

Conversation

@lxfight

@lxfight lxfight commented Jul 30, 2026

Copy link
Copy Markdown
Member

The session editor previously treated an empty knowledge base selection as missing configuration and deleted kb_config. The backend then inherited the global configuration, so a session that intentionally disabled all knowledge bases would search every globally enabled knowledge base.

Modifications / 改动点

  • Add an explicit "Follow global knowledge base configuration" switch.
  • Preserve an explicit empty kb_ids list when a session should use no knowledge bases.
  • Delete the session override only when global inheritance is enabled.
  • Disable knowledge base controls while the session inherits global settings.
  • Add translations for English, Simplified Chinese, and Russian.
  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

Verification steps:

cd dashboard
pnpm build

Results:

  • Vue TypeScript checks passed.
  • Production Vite build passed (3,775 modules transformed).
  • Manually verified the session rule editor can switch between global inheritance, selected knowledge bases, and an explicit empty selection without losing the override.

Checklist / 检查清单

  • 😊 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.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。
  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Clarify session-level knowledge base behavior by adding explicit global inheritance controls and preserving empty knowledge base selections so sessions can intentionally disable all knowledge bases.

New Features:

  • Introduce a switch to let sessions explicitly inherit the global knowledge base configuration.

Bug Fixes:

  • Ensure sessions that select no knowledge bases preserve an explicit empty configuration instead of silently inheriting global settings.

Enhancements:

  • Disable individual knowledge base controls when a session is configured to inherit global settings.
  • Initialize and persist knowledge base configuration state based on whether a session overrides or inherits global rules.
  • Add localized text for the new inheritance control in English, Simplified Chinese, and Russian.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. area:webui The bug / feature is about webui(dashboard) of astrbot. feature:knowledge-base The bug / feature is about knowledge base labels Jul 30, 2026
@dosubot

dosubot Bot commented Jul 30, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-08-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about AstrBot Add Dosu to your team

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. feature:knowledge-base The bug / feature is about knowledge base size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant