Repository navigation
Fix: model provider - #15634
Fix: model provider#15634
Conversation
…into fix/model-provider-001
📝 WalkthroughWalkthroughThe PR corrects a bug in the ChangesAPI Key Verification Return Logic
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly Related PRs
Suggested Labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ 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
🤖 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 `@api/apps/services/provider_api_service.py`:
- Around line 420-421: The return currently does `success = any([embd_passed,
chat_passed, rerank_passed])` and `return success, "success" if success else
msg`, which can return an empty string on failure; change the failure branch to
provide a non-empty default message (e.g., `msg or "no checks passed"` or a
concatenation/aggregate of individual check messages) so the function always
returns a meaningful error string when `success` is False; update the return
expression where `success`, `embd_passed`, `chat_passed`, `rerank_passed`, and
`msg` are used.
🪄 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: 4e0b8e3d-9b21-4e38-bab9-48f7d9d3b785
📒 Files selected for processing (1)
api/apps/services/provider_api_service.py
| success = any([embd_passed, chat_passed, rerank_passed]) | ||
| return success, "success" if success else msg |
There was a problem hiding this comment.
Avoid returning an empty failure message on Line 421.
This fix correctly prevents false "success", but failure can still return "" when no check path populates msg, which produces blank API error responses downstream.
Proposed patch
- success = any([embd_passed, chat_passed, rerank_passed])
- return success, "success" if success else msg
+ success = any([embd_passed, chat_passed, rerank_passed])
+ if success:
+ return True, "success"
+ return False, msg or "API key verification failed"📝 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.
| success = any([embd_passed, chat_passed, rerank_passed]) | |
| return success, "success" if success else msg | |
| success = any([embd_passed, chat_passed, rerank_passed]) | |
| if success: | |
| return True, "success" | |
| return False, msg or "API key verification failed" |
🤖 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 `@api/apps/services/provider_api_service.py` around lines 420 - 421, The return
currently does `success = any([embd_passed, chat_passed, rerank_passed])` and
`return success, "success" if success else msg`, which can return an empty
string on failure; change the failure branch to provide a non-empty default
message (e.g., `msg or "no checks passed"` or a concatenation/aggregate of
individual check messages) so the function always returns a meaningful error
string when `success` is False; update the return expression where `success`,
`embd_passed`, `chat_passed`, `rerank_passed`, and `msg` are used.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15634 +/- ##
=======================================
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?
Not display
successwhen check not passed.Type of change