feat(knowledge): add hierarchical level classification for knowledge …#2046
Open
2214376637 wants to merge 5 commits into
Open
feat(knowledge): add hierarchical level classification for knowledge …#20462214376637 wants to merge 5 commits into
2214376637 wants to merge 5 commits into
Conversation
…base - models: add `KnowledgeLevelEnum` defining 4 levels (Top/Second/Third-level Organization, Member) - models: add `level` field to `KnowledgeBase` and `KnowledgeUpdate` schemas - services: update `KnowledgeService.update_knowledge` to support updating the level field - database: add alembic migration script to add `level` column to `knowledge` table
- Fix invalid license format in pyproject.toml to strictly follow SPDX identifier. - Explicitly declare packages in setuptools configuration to avoid multiple top-level packages discovery error. - Replace abandoned `cchardet` with `faust-cchardet` to resolve C++ compilation error (missing longintrepr.h) in Python 3.11.
[状态声明:当前代码为静态编写版本,未经本地完整调试验证,本次提交专门用于推送到远程测试服务器进行沙盒联调。] 核心改动: 1. 模型重构 (Data Model) - KnowledgeBase 新增 `level` 与 `parent_id`,构建无限级层级拓扑结构。 - User 废弃静态 level 字段,引入 `org_knowledge_ids` (JSON) 动态权限绑定位点。 - 创建 Alembic 迁移脚本完成上述表结构的更新。 2. 鉴权引擎 (Auth Engine) - 彻底废弃旧版扁平化 RoleAccess 强绑定校验。 - 引入 `get_granted_kbs_and_descendants` 广度优先(BFS)穿透算法,实现用户根据源头机构自动继承下属子机构的最高管辖权。 - 重构 `judge_knowledge_permission` RAG 检索入口总闸,严格落地“同级精准匹配”与“越权向下兼容”双重物理隔离校验。 3. 接口权限 (API) - 修改 `/user/update` 接口,强制实施超级管理员特权拦截,确保 `org_knowledge_ids` 不被非法越权篡改。 后续排期: - 待在远程环境打通全链路测试后,进一步修复 UI 端 List 接口的分页与新版鉴权引擎对齐问题(鉴权前置化)。
- 移除 `docker-compose.yml` 中后端和前端的预编译镜像依赖 (`dataelement/bisheng-*`) - 引入 `build` 构建上下文,使容器启动时自动基于本地 `src/backend` 和 `src/frontend` 源码进行现场编译打包 - 移除后端开发态的临时源码挂载(Volume bind),确保打包出的镜像为包含最新定制源码的独立生产级镜像
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…base
KnowledgeLevelEnumdefining 4 levels (Top/Second/Third-level Organization, Member)levelfield toKnowledgeBaseandKnowledgeUpdateschemasKnowledgeService.update_knowledgeto support updating the level fieldlevelcolumn toknowledgetable