feat(dataset): add synonym management and search enhancement - #7558
Conversation
|
zhanglin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
| export const DatasetSynonymMappingCollectionName = 'dataset_synonym_mappings'; | ||
| export const DatasetSynonymJobCollectionName = 'dataset_synonym_jobs'; | ||
| export const DatasetSynonymOperationCollectionName = 'dataset_synonym_operations'; | ||
| export const DatasetMutationLockCollectionName = 'dataset_mutation_locks'; |
|
✅ Build and publish successful - Preview fastgpt Image: 🕒 Time: 2026-09-07 10:16:33 (UTC+8) |
|
这期建议先收敛范围,只实现同义词能力,不在这个 PR 里同时建设一套新的训练/重构队列。 具体调整建议:
因此数据结构可以先简化为同义词配置/映射集合,加已有的 训练/重构队列的通用可靠性问题——例如任务幂等、租约续期、崩溃恢复、向量写入补偿、计费去重和统一进度模型——后续单独开需求统一优化,避免只为同义词做一套专用实现。 |
|
补充本次 review 发现的其他问题。即使按上一条建议简化方案,下面第一组仍需要处理。 简化后仍需修复
如果仍保留当前复杂队列方案,还存在以下阻塞问题
如果按上一条评论删除专用 operation、rollback 和 mutation lock,上述第二组不需要逐项修补;应随相关实现一起移除。 |
707a1fd to
2bcc980
Compare
|
导入和 rebuild 尽量简单、复用原结构。 但当前mutation 自己实现了配置锁、版本快照、全量扫描、批量入队、失败清理和 matcher 缓存。尤其训练队列方面,当前没有充分处理与原有训练任务并存的情况。mutation 复用了旧训练队列 worker,但没有完全复用旧的训练任务创建/rebuild 编排结构,保持精简 |
1612d88 to
9e48fff
Compare
37726d7 to
6caadd7
Compare
b73cfc9 to
66f9a46
Compare
6d52fad to
59322ef
Compare
59322ef to
9e5cb33
Compare
56fd751 to
fd0786e
Compare
fd0786e to
d7c5d15
Compare
d7c5d15 to
c7232e8
Compare
风险点与推荐方案:隔离同义词重建和现有模型重建基于当前提交 已确认的现有逻辑回归以下两个问题均为本 PR 新引入,并且关闭 1. [P1] 纯图片模型重建丢弃新的 VLM 描述 位置:generateVector.ts L270-L279。 现有模型切换流程会将纯图片送入 已对修改前后真实函数做隔离对比:同样传入“training.q 为新描述、data.q 为旧描述、无 imageDescMap”,基线向下游传新描述,PR 不传 q,最终使用旧描述,两者均删除任务。结果是 VLM 已执行并计费,但新描述没有生效。该问题影响已有数据的重建,不是首次图片入库。 2. [P2] 图文重建期间新生成的问题、摘要索引被遗漏 位置:generateVector.ts L281-L293。 图文集合启用 隔离对比确认基线透传新问题、摘要索引,PR 不再透传。保留数据库当前的用户编辑是合理的,但不能因此丢弃本次训练的新产物。 上游字段和流程已按本 PR 固定的 pro 子模块版本 推荐方案区分两个 rebuild 的业务处理路径,可以复用现有训练队列和底层向量操作,但不要为了同义词需求改变原有模型重建的数据来源、训练产物合并和内容写回语义。
同义词重建的具体边界:
另外,当前普通数据更新的 CAS、重建种子任务事务边界、续接失败策略、训练 TTL 索引等修改也不受功能开关隔离。这些不都等于缺陷,但不能以“同义词未上线”为由认定无影响;建议尽量收窄公共链路改动。 验证与验收建议已运行两轮定向测试,共 11 个文件、163 条用例通过;另通过只读函数隔离对比确认上述两处回归。未运行全量测试或真实外部模型端到端测试。 合并前至少补充:
此前发现的同义词专属风险(部分更新提前推进版本、队列为空后的版本差异恢复、转换后超 token 上限导致截断)可作为未上线能力的后续验收项,但上述两处已有业务回归建议本 PR 内解决。 |
eb46587 to
9806a4a
Compare
9806a4a to
07e6b76
Compare
What does this PR do?
This PR adds dataset-level synonym management and integrates synonym normalization into data indexing, retrieval, reranking, and citation metadata.
Each dataset can maintain one active synonym configuration. Synonym mappings are stored as versioned MongoDB snapshots and can be managed through JSON mappings or uploaded files.
Main changes
indexes.textvalues.synonymMappingsin existing knowledge-base citation metadata.Rebuild and consistency behavior
fileVersionto associate mappings with a complete configuration snapshot.rebuildingso the existing queue recovery and retry flow can continue.dataset.updateTimeas a dataset-wide write lock.Permissions and billing
Migration
A Mongo-only migration script is included:
The script runs in dry-run mode by default. Pass
--executeto apply changes.The migration converts legacy synonym configuration and mapping data into the current
schemaVersion=2snapshot format and is designed to be safely rerunnable.The migration should be run during downtime with application and worker processes stopped. Legacy S3 files are not deleted.
The new synonym APIs no longer use legacy S3
fileIdorpendingFileIdfields. Existing synonym data must be migrated before enabling the new implementation.Limits and matching behavior
Verification
The local targeted Vitest run may require access to download the MongoDB binary used by
mongodb-memory-server.Design document
The detailed data model, matching rules, rebuild flow, migration strategy, and compatibility constraints are documented in:
.agents/design/core/dataset/synonym-feature-design.md