feat(dataset/tag): upgrade knowledge base tag management - #7660
Draft
DigHuang wants to merge 3 commits into
Draft
Conversation
* [AI-COMMIT][ADD] 知识库标签过滤功能
- 标签类型扩展:新增 tagType 字段 (string/number/datetime/array),仅创建时确定,编辑不可修改
- Collection 标签值:tags 字段扩展为混合格式 (string ObjectId | {tagId, value}),支持新旧共存
- 标签管理 API (pro): batchUpsert / setCollectionTags / batchSetCollectionTags,事务保护
- 搜索过滤增强:filterCollectionByKeyValueTags + checkValue,支持 4 类型 × 13 操作符
- Collection 创建链路:createOneCollection 支持混合 tags 入参
- Workflow + Agent V2:datasetSearch 节点新增 tagFilterConfig 渲染,Agent 搜索传递 collectionFilterMatch
- UTC 时间工具:toUTCSeconds / fromUTCSeconds
- 错误码 + i18n:501013~501023 标签错误码 × 三国语言
- 历史数据迁移,完全向后兼容
Co-Authored-By: Claude Code <noreply@anthropic.com>
* [AI-COMMIT][FIX] 知识库标签系统评审修复:数组值校验、写路径去重、唯一索引、ReDoS 防护、default_tag 按 fromMigration 定位
- Issue 1: 数组标签详情响应校验 500 —— 提取共享 CollectionTagValueFieldSchema 复用
- Issue 2: 写路径重复 key —— 共享 deduplicateTagValues,同一 tagId 值冲突拒绝整个操作
- Issue 3: 契约不一致 —— 修正设计文档 §4.2 契约层次与 OpenAPI 描述(不改运行时)
- Issue 4: $regex ReDoS —— safe-regex + 分支重叠兜底检测 + pattern/值长度上限
- Issue 5: 并发唯一性 —— v2 表 {teamId,datasetId,tag} unique 索引 + E11000 兜底 + 名称 trim 校验
- Issue 6: 测试覆盖 —— checkValue array 操作符、去重冲突、详情数组、$regex 拦截、真实 Mongo 端到端 benchmark
- Issue 7: default_tag 改名后旧格式过滤失效 —— fromMigration 布尔字段定位迁移承载记录
- Issue 8: 解决 openapi/tag.ts 与 main 的冲突(相对 main 仅新增 datasetTag 一行)
Co-Authored-By: Claude <noreply@anthropic.com>
* [AI-COMMIT][FIX] 标签值共享规范化函数并移除 deleteTagIds 设计流程
- 导出 validateAndNormalizeTagValue,Collection 创建与 pro 写路径共用同一校验+规范化实现
- createOrGetCollectionTags 重构改用该函数(行为不变)
- 新增 validateAndNormalizeTagValue 单测
- 设计文档 §5.3 删除 deleteTagIds 批量删除流程(不在本次范围)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude Code <noreply@anthropic.com>
* feat(dataset/tag): upgrade knowledge base tag management * feat(dataset/tag): support collection tag value settings Add typed collection tag value inputs and persistence for string, number, datetime, and array tags. Refine tag chip overflow rendering, table layout, migration handling, and localized copy. * feat(dataset/tag): improve collection tag management
* fix(dataset/tag): refine tag filter behavior * feat(dataset/tag): add structured workflow tag filters
Coverage Report
File CoverageNo changed files found. |
|
✅ Admin Preview Image Ready! 🕒 Time: 2026-09-04 11:35:26 (UTC+8) |
|
✅ Build and publish successful - Preview fastgpt Image: 🕒 Time: 2026-09-04 11:36:02 (UTC+8) |
Coverage Report
|
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.
Summary
Testing