Fix: agent application can not show Cite#14047
Fix: agent application can not show Cite#14047zpf121 wants to merge 1 commit intoinfiniflow:mainfrom
Conversation
📝 WalkthroughWalkthroughA single parameter modification in the retrieval tool that enables aggregations during metadata-filtered dataset searches. The Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14047 +/- ##
=======================================
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:
|
Close #14018
What problem does this PR solve?
Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR.
Type of change
Problem
In Agent applications, even with the cite option enabled, only inline [ID: x] citation markers are visible (showing chunk content on hover). The Agent does not display the referenced file cards below the response, unlike Chat applications.
Root Cause
The Agent's Retrieval tool (agent/tools/retrieval.py) calls retriever.retrieval() with aggs=False, which means the retrieval results do not include doc_aggs (document aggregation) data. Without doc_aggs, the frontend ReferenceDocumentList component has no data to render the file cards.
In contrast, the Chat application (api/db/services/dialog_service.py) calls the same retriever.retrieval() method with aggs=True.
Fix
Changed aggs=False to aggs=True in agent/tools/retrieval.py so that document aggregation data is returned along with the retrieved chunks.