Skip to content

feat: knowledgebase capacity quota and warning - #3451

Merged
Dallas98 merged 11 commits into
developfrom
feature/moeext/kb-capacity-quota
Jul 21, 2026
Merged

feat: knowledgebase capacity quota and warning#3451
Dallas98 merged 11 commits into
developfrom
feature/moeext/kb-capacity-quota

Conversation

@MoeexT

@MoeexT MoeexT commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

需求总览:知识库容量配额管理

实现三级知识库存储配额体系:

  • SU 设置平台总存储容量,并为各租户分配硬配额;租户间不允许超分。
  • 租户硬配额在上传时强制校验,超出后阻止上传并返回明确提示。
  • 租户管理员可管理本租户的告警开关、告警阈值和严重阈值,并配置知识库软配额。
  • 知识库软配额仅用于容量预警,不阻止上传;多个知识库的软配额可超过租户硬配额,实际写入仍受租户总配额限制。
  • 支持平台、租户和知识库三级容量用量统计,展示进度条、已用容量、剩余容量和告警状态。
  • 根据角色区分权限:SU 仅管理租户配额与平台总览;租户管理员管理知识库配额及告警;开发者仅接收其有管理权限知识库的告警。
  • 支持租户存储和知识库存储的分级预警通知,并提供对应资源管理入口。
  • 兼容历史数据:未配置容量的租户或知识库默认不限额。

评审问题

  1. 租户之间是否能超分:不行,已修改。
  2. 知识库超分不能超过租户总量:不行,如此调整之后就等于不可超分
  3. 知识库加一个能否超分的开关:产品层面很麻烦,比如:开始可以超分,关闭超分之后,已超分的知识库怎么办?
  4. 外部知识库需要屏蔽当前功能入口
  5. 知识库容量是否能调低至使用线下方:可以,等于超分。
  6. 升级上来是否能正常使用:升级上来无限制,由管理员管理
  7. 自动侦测磁盘可用量——之后再做

示例图

配额管理

图片 图片 图片

告警

租户告警

image image

SU告警

image

@MoeexT
MoeexT requested review from Dallas98 and WMC001 as code owners July 17, 2026 07:25
Comment thread backend/apps/quota_app.py
"""Serialize allocation conflicts consistently for quota clients."""
return JSONResponse(
status_code=HTTPStatus.CONFLICT,
content={"error": exc.error, "message": str(exc), **exc.details},
Comment on lines +92 to +99
content={
"error": "TenantStorageFull",
"message": str(exc),
"usage_bytes": exc.usage_bytes,
"hard_limit_bytes": exc.hard_limit_bytes,
"exceeded_by_bytes": exc.exceeded_by_bytes,
"trace_id": trace_id,
},
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

@MoeexT MoeexT changed the title Feature/moeext/kb capacity quota feat: knowledgebase capacity quota Jul 21, 2026
@MoeexT MoeexT changed the title feat: knowledgebase capacity quota feat: knowledgebase capacity quota and warning Jul 21, 2026
@Dallas98
Dallas98 merged commit 8e70550 into develop Jul 21, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants