Repository navigation
fix(agent): filter TuShare news with upstream keyword input - #16361
yuzhichang merged 7 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughTuShare filtering now chooses the match keyword from the configured parameter or upstream input, logs which source was used, and filters content with explicit missing-value and regex handling. Tests cover both keyword selection paths. ChangesTuShare keyword filtering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 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 |
|
Could a maintainer add the |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@agent/tools/tushare.py`:
- Around line 75-76: The new keyword fallback in the Tushare tool currently
switches between self._param.keyword and ans without any observability; update
the logic in the method that builds tus_res to emit a log entry indicating
whether the keyword came from the explicit parameter or the upstream answer,
while avoiding logging the raw keyword value. Use the existing logger in
agent/tools/tushare.py so the new flow is traceable without exposing sensitive
content.
- Around line 75-76: The filtering in TushareTool around keyword handling uses
pandas str.contains with a user-supplied value, so update the content-matching
expression in the append logic to treat the keyword as a literal string by
setting regex=False. Keep the change localized to the
df[df['content'].str.contains(...)] call so keywords with special characters do
not trigger regex behavior or runtime errors.
🪄 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: 911abe7e-d5f5-4a4b-86ce-a186713e322f
📒 Files selected for processing (2)
agent/tools/tushare.pytest/unit_test/agent/tools/test_tushare.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16361 +/- ##
=======================================
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:
|
|
Addressed the CodeRabbit logging feedback in 8ec7c1f. The TuShare tool now logs whether the filter keyword came from Verification:
|
yuzhichang
left a comment
There was a problem hiding this comment.
Re-reviewed the current head. The behavior change itself looks good: the filter now handles empty keywords safely and adds observability for whether the effective keyword came from explicit config or upstream input. I did not find any remaining correctness issue in the current diff.
One thing to double-check with maintainers is product intent: the implementation still prefers param.keyword when present and only falls back to upstream input when it is empty. If that precedence matches the intended UX for #16360, I'm happy with this PR as-is.
|
Quick CI note after syncing this branch with latest main today. On run https://github.com/infiniflow/ragflow/actions/runs/28306891563 (before the sync), preflight, elasticsearch, and infinity all passed on commit 7bfa16b. After updating the branch, the new preflight run https://github.com/infiniflow/ragflow/actions/runs/28311062428 failed during test collection with the same external tiktoken download error:
The failure is in Could a maintainer rerun preflight when the tiktoken download is stable? The precedence-test fix for #16360 is in 7bfa16b and had full green CI on the prior run. |
78db4e9 to
f86a0e7
Compare
d868d03 to
dc964bd
Compare
|
Synced with latest main. Could a maintainer add the ci label so workflows can run? Okay, please review it. |
e23e9e1 to
47e87f3
Compare
0b2da21 to
8164f71
Compare
|
Follow-up: branch is current with |
Summary
TuShare required non-empty upstream input but filtered fetched news with the static
keywordparam (default empty string), so agent-provided keywords were ignored.Use
self._param.keyword or answhen filtering, matching how AkShare uses upstream input for its query.Fixes #16360
Test plan
test_tushare_filters_with_upstream_keyword_when_param_emptymocks the API and asserts only rows matching the upstream keyword are returned