Repository navigation
Fix: Remove the pagination from the search and retrieval pages. - #15942
Conversation
📝 WalkthroughWalkthroughThis PR replaces pagination-based result browsing with a fixed top-N selector (10/20/50/100 results) across dataset testing and search workflows. The backend now explicitly surfaces total chunk counts, the new TopSelect component standardizes the UI, hooks manage page size locally, and pagination UI is removed throughout. ChangesTop-N Result Selection
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/src/pages/next-search/hooks.ts (1)
390-392:⚠️ Potential issue | 🟠 MajorTop-N can be overridden to 10 when document selection triggers testing.
RetrievalDocuments’onTestingprop isonTesting(documentIds: string[])and it callsonTesting(value)without providingsize(web/src/pages/next-search/retrieval-documents/index.tsx, interface at lines 27-32 and call at lines ~85-90). MeanwhileuseSearching’shandleTestChunkdefaultssize: number = 10(web/src/pages/next-search/hooks.ts, lines 390-392), so anyonTesting(documentIds)path (doc select/clear) will fetch 10 results even if TopSelect was set.handleTopChangepassessizecorrectly (lines 540-546), but it doesn’t cover this callback path.Suggested fix
- const handleTestChunk = useCallback( - (documentIds: string[], page: number = 1, size: number = 10) => { + const handleTestChunk = useCallback( + (documentIds: string[], page: number = 1, size: number = pageSize) => { const q = trim(searchStr); if (sendingLoading || isEmpty(q)) return; @@ - [ + [ searchStr, sendingLoading, testChunk, kbIds, selectedDocumentIds, testChunkAll, searchId, + pageSize, ], );🤖 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/next-search/hooks.ts` around lines 390 - 392, handleTestChunk currently defaults size to 10 causing document-selection testing to ignore the TopSelect value; update the flow so handleTestChunk uses the current top selection instead of a hard default and ensure RetrievalDocuments' onTesting path calls it with that value. Concretely, remove the hard default in handleTestChunk(size: number = 10) and have the function read the current top N state (the same state updated by handleTopChange), or change RetrievalDocuments' onTesting to pass the current top value through to handleTestChunk when invoking onTesting(documentIds). Reference: handleTestChunk, onTesting (RetrievalDocuments), and handleTopChange so the same top N state is used for both code paths.
🤖 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.
Inline comments:
In `@web/src/locales/zh.ts`:
- Line 830: The label literal "前n条" is awkward as a standalone form label;
update the locale entry for the key "top" (used as knowledgeConfiguration.top)
in web/src/locales/zh.ts to a neutral, generic term such as "数量" or "Top" so it
reads naturally in forms; replace the value for the "top" key with the chosen
neutral label and ensure any usages rendering this label still make sense in
context.
---
Outside diff comments:
In `@web/src/pages/next-search/hooks.ts`:
- Around line 390-392: handleTestChunk currently defaults size to 10 causing
document-selection testing to ignore the TopSelect value; update the flow so
handleTestChunk uses the current top selection instead of a hard default and
ensure RetrievalDocuments' onTesting path calls it with that value. Concretely,
remove the hard default in handleTestChunk(size: number = 10) and have the
function read the current top N state (the same state updated by
handleTopChange), or change RetrievalDocuments' onTesting to pass the current
top value through to handleTestChunk when invoking onTesting(documentIds).
Reference: handleTestChunk, onTesting (RetrievalDocuments), and handleTopChange
so the same top N state is used for both code paths.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e9b26d48-69b0-48ff-8849-dad9b9af7251
📒 Files selected for processing (10)
api/apps/services/dataset_api_service.pyweb/src/components/top-select.tsxweb/src/hooks/use-knowledge-request.tsweb/src/locales/en.tsweb/src/locales/zh.tsweb/src/pages/dataset/testing/index.tsxweb/src/pages/dataset/testing/testing-form.tsxweb/src/pages/dataset/testing/testing-result.tsxweb/src/pages/next-search/hooks.tsweb/src/pages/next-search/search-view.tsx
| community: '社区报告生成', | ||
| communityTip: | ||
| '区块被聚集成层次化的社区,实体和关系通过更高抽象层次将每个部分连接起来。然后,我们使用 LLM 生成每个社区的摘要,称为社区报告。更多信息:https://www.microsoft.com/en-us/research/blog/graphrag-improving-global-search-via-dynamic-community-selection/', | ||
| top: '前n条', |
There was a problem hiding this comment.
Use a neutral label for the field key.
Line 830 uses '前n条', which renders awkwardly as a form label. This key is used as the standalone label (knowledgeConfiguration.top), so it should be generic (e.g., Top/数量) instead of embedding a literal n.
Suggested change
- top: '前n条',
+ top: 'Top',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| top: '前n条', | |
| top: 'Top', |
🤖 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/locales/zh.ts` at line 830, The label literal "前n条" is awkward as a
standalone form label; update the locale entry for the key "top" (used as
knowledgeConfiguration.top) in web/src/locales/zh.ts to a neutral, generic term
such as "数量" or "Top" so it reads naturally in forms; replace the value for the
"top" key with the chosen neutral label and ensure any usages rendering this
label still make sense in context.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15942 +/- ##
=======================================
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:
|
What problem does this PR solve?
Fix: Remove the pagination from the search and retrieval pages.
Type of change