feat: dataset error list#7084
Conversation
Coverage Report
File CoverageNo changed files found. |
|
✅ Admin Preview Image Ready! 🕒 Time: 2026-06-16 12:22:39 (UTC+8) |
|
✅ Build Successful - Preview fastgpt Image for this PR: 🕒 Time: 2026-06-16 12:21:50 (UTC+8) |
f57e244 to
00753ec
Compare
|
Review finding The new dataset-level training error endpoint should validate and cap its nested pagination inputs before passing them into Mongo aggregation.
Suggested fix: use Refs:
|
00753ec to
0688c9a
Compare
| if (hasTrainingData) { | ||
| getData(pageNum); | ||
| } | ||
| await refreshDatasetTrainingError().catch(() => undefined); |
There was a problem hiding this comment.
This polling path now calls the full dataset training-error aggregation every 6 seconds even when the collection list is otherwise idle. getDatasetTrainingError({ pageSize: 1, itemPageSize: 1 }) still runs the grouped error aggregate plus the total aggregate, and when errors exist it also fetches collection metadata and first error items. Consider replacing this badge probe with a lighter exists/count endpoint or only refreshing it when there is active training / dataset status is not active / a user action just changed training state.
| } | ||
| } | ||
| }, | ||
| { $sort: { modeRank: 1, chunkIndex: 1, _id: 1 } }, |
There was a problem hiding this comment.
This error-list pagination sorts on computed modeRank, so the new { teamId, datasetId, collectionId } index can only narrow the match; it cannot support the sort. For collections with many final-error chunks, each page has to compute the $switch, sort the matched set in the aggregation, then skip/limit. Longer term, consider materializing an error status / mode rank field and indexing the list order, or otherwise avoid computed-sort pagination on this hot path.
0688c9a to
8893a39
Compare
b7c5919 to
f34379e
Compare
| } | ||
| // Check team points and lock(No mistakes will be thrown here) | ||
| if (!(await checkTeamAiPointsAndLock(data.teamId))) { | ||
| if (!(await checkTeamAiPointsAndLock(data.teamId, String(data._id)))) { |
| export default NextAPI(handler); | ||
|
|
||
| export { handler }; | ||
| export type updateTrainingDataBody = UpdateTrainingDataBody; |
There was a problem hiding this comment.
新的 api,不会再导出 type 了,都在 openapi 里写 zod
| } | ||
|
|
||
| export default NextAPI(handler); | ||
| export type getTrainingDataDetailBody = GetTrainingDataDetailBody; |
| trainingAmount: z.number().meta({ description: '训练数量' }), | ||
| hasError: z.boolean().optional().meta({ description: '是否错误' }) | ||
| }); | ||
| export const DatasetCollectionsListItemSchema = z |
| fileCustom = 'fileCustom' | ||
| } | ||
|
|
||
| export const BLOCKED_LOCK_TIME = new Date('2050-01-01'); |
f34379e to
f9d9669
Compare
背景
数据集训练异常目前主要按集合查看,知识库级别缺少统一入口;同时训练中的临时失败、最终异常、阻塞异常状态口径不够清晰,容易导致用户不知道哪些任务还会自动重试,哪些需要手动处理。
改动内容
测试