Repository navigation
Fix Tag weight should be greater than 0 - #16657
Conversation
📝 WalkthroughWalkthroughTag feature validation now requires positive finite scores in Python and Go. Chunk update errors now carry codes that the handler maps to HTTP 400 for validation-related failures. Both tag feature creation forms now use a minimum frequency of 1. ChangesTag feature validation and update flow
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-creating-modal/tag-feature-item.tsx (1)
1-138: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffConsider consolidating duplicate
TagFeatureItemcomponent.This component is identical to
web/src/pages/dataflow-result/components/chunk-creating-modal/tag-feature-item.tsx. Since both copies were just edited in tandem for this fix, extracting a shared component would prevent future divergence (e.g., if this fix had only been applied to one file).As per coding guidelines, "avoid duplicating component structures in JSX, and favor render props or reusable components."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-creating-modal/tag-feature-item.tsx` around lines 1 - 138, This TagFeatureItem implementation is duplicated in another chunk-creating-modal path, so future changes can drift. Extract the shared JSX and hooks logic from TagFeatureItem into a common reusable component or render-prop-based helper, then have both pages import it instead of maintaining two copies. Keep the current behavior in TagFeatureItem, but centralize the duplicated SelectWithSearch/useFieldArray/form logic so edits only happen in one place.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-creating-modal/tag-feature-item.tsx`:
- Around line 1-138: This TagFeatureItem implementation is duplicated in another
chunk-creating-modal path, so future changes can drift. Extract the shared JSX
and hooks logic from TagFeatureItem into a common reusable component or
render-prop-based helper, then have both pages import it instead of maintaining
two copies. Keep the current behavior in TagFeatureItem, but centralize the
duplicated SelectWithSearch/useFieldArray/form logic so edits only happen in one
place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 589cf928-9fc2-4135-8a8c-4f0e71f50f11
📒 Files selected for processing (5)
common/tag_feature_utils.pyinternal/service/chunk/chunk.gointernal/service/chunk_types.goweb/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-creating-modal/tag-feature-item.tsxweb/src/pages/dataflow-result/components/chunk-creating-modal/tag-feature-item.tsx
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16657 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…:wangq8/ragflow into bugfix/fix-tag-weight-cannot-be-set-to-0
When edit chunk, add a tag, the default value is 0, it will clean all tags, the value is weight, it cannot be less than 0.
go version return 400 (default 500 when error) instead of 200
