Skip to content

feat(dataset/tag): upgrade knowledge base tag management - #7659

Closed
DigHuang wants to merge 3 commits into
labring:mainfrom
DigHuang:dataset-tag
Closed

feat(dataset/tag): upgrade knowledge base tag management#7659
DigHuang wants to merge 3 commits into
labring:mainfrom
DigHuang:dataset-tag

Conversation

@DigHuang

@DigHuang DigHuang commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • upgrade knowledge base tag management with typed values and batch operations
  • add structured collection tag filtering for APIs and workflow nodes
  • preserve legacy tag compatibility and add coverage for filtering and tag behavior

Testing

  • Not run (not requested)

SteelHe and others added 3 commits September 4, 2026 11:17
* [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
@DigHuang
DigHuang marked this pull request as draft September 4, 2026 03:24
@DigHuang

DigHuang commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #7660, which uses upstream/dataset-tag and includes the pro submodule update.

@DigHuang DigHuang closed this Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Build and publish successful - Preview fastgpt Image:

ghcr.io/labring/fastgpt-pr:fastgpt_c6f8d84d75439e9a36e6a8b54bae364058812c6e

🕒 Time: 2026-09-04 11:30:44 (UTC+8)

@DigHuang
DigHuang deleted the dataset-tag branch September 4, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants