Repository navigation
Fix: When creating a dataset, if no chunk_method is selected, there is no indication that this is a required field. - #14039
Conversation
… is no indication that this is a required field.
📝 WalkthroughWalkthroughA refactoring effort introduces a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/src/components/data-pipeline-select/index.tsx (1)
83-90:⚠️ Potential issue | 🟡 MinorRequired indicator is only applied in vertical mode.
Line 89 fixes the vertical layout, but the horizontal label still lacks the required marker, so the same UX gap can persist when
layout === FormLayout.Horizontal.Suggested fix
<div className="flex gap-2 justify-between w-1/4"> <FormLabel // tooltip={t('dataFlowTip')} className="text-sm text-text-secondary whitespace-wrap " + required > {t('manualSetup')} </FormLabel> </div>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/components/data-pipeline-select/index.tsx` around lines 83 - 90, The FormLabel's required indicator is only set inside the FormLayout.Vertical branch (layout === FormLayout.Vertical), leaving the FormLayout.Horizontal rendering without the required marker; update the component so the required prop is applied to the FormLabel regardless of layout—either move the required attribute to the shared label rendering logic or add required to the FormLabel in the FormLayout.Horizontal branch so both layouts show the required indicator (references: layout, FormLayout.Vertical, FormLayout.Horizontal, FormLabel, required).
🧹 Nitpick comments (4)
web/src/pages/dataset/dataset-setting/form-schema.ts (1)
16-16: Consider adding required validation forchunk_methodwhenParseType.BuiltInis selected.Given the PR objective is to indicate that
chunk_methodis required, consider adding asuperRefinecheck similar to what's done indataset-creating-dialog.tsx(lines 63-73) wherechunk_methodis validated as required whenparseType === ParseType.BuiltIn.Currently,
chunk_methodonly hasz.string()without a minimum length requirement or conditional validation.💡 Suggested addition to superRefine
.superRefine((data, ctx) => { + if (data.parse_type === ParseType.BuiltIn && !data.chunk_method?.trim()) { + ctx.addIssue({ + path: ['chunk_method'], + message: t('common.pleaseSelect'), + code: 'custom', + }); + } if (data.parse_type === ParseType.Pipeline && !data.pipeline_id) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/pages/dataset/dataset-setting/form-schema.ts` at line 16, The schema currently defines chunk_method as z.string() without enforcing it when ParseType.BuiltIn is selected; update the form-schema's Zod schema to add a superRefine (same pattern used in dataset-creating-dialog.tsx) that checks if parseType === ParseType.BuiltIn and then verifies chunk_method is non-empty (e.g., trim length > 0), returning a validation issue tied to the chunk_method path when missing; reference the chunk_method field, the parseType value, and implement the same conditional required validation as in dataset-creating-dialog.tsx.web/src/pages/dataset/dataset-setting/index.tsx (1)
130-130: Consider removing debug console.log.This appears to be debug logging that could be cleaned up before merging.
🧹 Remove debug logging
- console.log('🚀 ~ DatasetSettings ~ knowledgeDetails:', knowledgeDetails);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/pages/dataset/dataset-setting/index.tsx` at line 130, Remove the debug console.log in the DatasetSettings component that prints "🚀 ~ DatasetSettings ~ knowledgeDetails:" (the line referencing knowledgeDetails)—either delete the console.log entirely or replace it with the project's structured logger if persistent runtime visibility is required; ensure no stray debug console statements remain in the DatasetSettings function/component.web/src/pages/datasets/dataset-creating-dialog.tsx (1)
114-116: Debug logging should use appropriate log level or be removed for production.The error callback with
console.warnis useful for development debugging but consider whether this should remain in production code. If kept, this is acceptable as it only logs validation errors during form submission failures.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/pages/datasets/dataset-creating-dialog.tsx` around lines 114 - 116, The inline console.warn in the form submission error handler should be removed or replaced with a non-production logger: update the onSubmit prop where form.handleSubmit(onSubmit, (errors) => { console.warn(errors); }) is used in dataset-creating-dialog.tsx to either remove the error callback entirely or replace console.warn with a debug-level logger (e.g., logger.debug or a conditional that only logs in development via process.env.NODE_ENV === 'development'), and ensure the validation errors are handled or surfaced to the UI instead of leaving a console-only warning.web/src/components/chunk-method-dialog/index.tsx (1)
31-31: Remove unused empty import.This empty import statement serves no purpose and should be removed.
🧹 Remove empty import
-import {} from 'module';🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/components/chunk-method-dialog/index.tsx` at line 31, Remove the unused empty import statement "import {} from 'module';" from the file; locate the line that imports an empty specifier and delete it so there are no no-op imports remaining (ensure there are no other references to "module" that require importing before removal).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@web/src/components/data-pipeline-select/index.tsx`:
- Around line 83-90: The FormLabel's required indicator is only set inside the
FormLayout.Vertical branch (layout === FormLayout.Vertical), leaving the
FormLayout.Horizontal rendering without the required marker; update the
component so the required prop is applied to the FormLabel regardless of
layout—either move the required attribute to the shared label rendering logic or
add required to the FormLabel in the FormLayout.Horizontal branch so both
layouts show the required indicator (references: layout, FormLayout.Vertical,
FormLayout.Horizontal, FormLabel, required).
---
Nitpick comments:
In `@web/src/components/chunk-method-dialog/index.tsx`:
- Line 31: Remove the unused empty import statement "import {} from 'module';"
from the file; locate the line that imports an empty specifier and delete it so
there are no no-op imports remaining (ensure there are no other references to
"module" that require importing before removal).
In `@web/src/pages/dataset/dataset-setting/form-schema.ts`:
- Line 16: The schema currently defines chunk_method as z.string() without
enforcing it when ParseType.BuiltIn is selected; update the form-schema's Zod
schema to add a superRefine (same pattern used in dataset-creating-dialog.tsx)
that checks if parseType === ParseType.BuiltIn and then verifies chunk_method is
non-empty (e.g., trim length > 0), returning a validation issue tied to the
chunk_method path when missing; reference the chunk_method field, the parseType
value, and implement the same conditional required validation as in
dataset-creating-dialog.tsx.
In `@web/src/pages/dataset/dataset-setting/index.tsx`:
- Line 130: Remove the debug console.log in the DatasetSettings component that
prints "🚀 ~ DatasetSettings ~ knowledgeDetails:" (the line referencing
knowledgeDetails)—either delete the console.log entirely or replace it with the
project's structured logger if persistent runtime visibility is required; ensure
no stray debug console statements remain in the DatasetSettings
function/component.
In `@web/src/pages/datasets/dataset-creating-dialog.tsx`:
- Around line 114-116: The inline console.warn in the form submission error
handler should be removed or replaced with a non-production logger: update the
onSubmit prop where form.handleSubmit(onSubmit, (errors) => {
console.warn(errors); }) is used in dataset-creating-dialog.tsx to either remove
the error callback entirely or replace console.warn with a debug-level logger
(e.g., logger.debug or a conditional that only logs in development via
process.env.NODE_ENV === 'development'), and ensure the validation errors are
handled or surfaced to the UI instead of leaving a console-only warning.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dec90f8d-b614-4635-bc31-88fa4a42946d
📒 Files selected for processing (14)
web/src/components/chunk-method-dialog/index.tsxweb/src/components/data-pipeline-select/index.tsxweb/src/constants/knowledge.tsweb/src/hooks/use-knowledge-request.tsweb/src/locales/en.tsweb/src/locales/zh.tsweb/src/pages/dataset/dataset-setting/configuration/common-item.tsxweb/src/pages/dataset/dataset-setting/form-schema.tsweb/src/pages/dataset/dataset-setting/hooks.tsweb/src/pages/dataset/dataset-setting/index.tsxweb/src/pages/dataset/dataset-setting/saving-button.tsxweb/src/pages/datasets/dataset-creating-dialog.tsxweb/src/pages/datasets/dataset-dataflow-creating-dialog.tsxweb/src/pages/datasets/hooks.ts
💤 Files with no reviewable changes (1)
- web/src/pages/datasets/dataset-dataflow-creating-dialog.tsx
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14039 +/- ##
=======================================
Coverage 96.66% 96.66%
=======================================
Files 10 10
Lines 690 690
Branches 108 108
=======================================
Hits 667 667
Misses 8 8
Partials 15 15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… is no indication that this is a required field. (infiniflow#14039) ### What problem does this PR solve? Fix: When creating a dataset, if no `chunk_method` is selected, there is no indication that this is a required field. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
… is no indication that this is a required field. (infiniflow#14039) ### What problem does this PR solve? Fix: When creating a dataset, if no `chunk_method` is selected, there is no indication that this is a required field. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
… is no indication that this is a required field. (infiniflow#14039) ### What problem does this PR solve? Fix: When creating a dataset, if no `chunk_method` is selected, there is no indication that this is a required field. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
… is no indication that this is a required field. (infiniflow#14039) ### What problem does this PR solve? Fix: When creating a dataset, if no `chunk_method` is selected, there is no indication that this is a required field. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
… is no indication that this is a required field. (infiniflow#14039) ### What problem does this PR solve? Fix: When creating a dataset, if no `chunk_method` is selected, there is no indication that this is a required field. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
What problem does this PR solve?
Fix: When creating a dataset, if no
chunk_methodis selected, there is no indication that this is a required field.Type of change