Fix: remove deprecated functions - #19449
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthrough
ChangesTenant LLM service reduction
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change removes deprecated TenantLLMService functionality and redirects retained tenant lookups to the centralized service without an identified behavior regression. The change is ready to merge. Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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. A rabbit trims the service tree, Comment |
wangq8
left a comment
There was a problem hiding this comment.
This is an AI review comment.
Thanks for the cleanup. Most of the large deletion looks safe (the OCR ensure_*_from_env helpers have been relocated to api/db/joint_services/tenant_model_service.py, and all runtime callers already import them from there). However, there is one blocking issue.
🔴 Blocking: removed TenantService re-export is still required
This PR removes:
from api.db.services.user_service import TenantServicefrom api/db/services/tenant_llm_service.py. But api/db/joint_services/tenant_model_service.py still imports it from this module:
# api/db/joint_services/tenant_model_service.py:36
from api.db.services.tenant_llm_service import TenantServiceand uses it at lines 166, 344 and 446 (TenantService.get_by_id, TenantService.get_joined_tenants_by_user_id).
Because this PR only touches tenant_llm_service.py and does not update tenant_model_service.py, dropping the re-export will cause ImportError: cannot import name 'TenantService' from 'api.db.services.tenant_llm_service' as soon as that module is imported — and it is imported at startup by api/apps/services/models_api_service.py, rag/app/naive.py, rag/flow/parser/parser.py, etc. This would break the application.
Suggested fix (either one):
- Update
tenant_model_service.pytofrom api.db.services.user_service import TenantService, or - Keep the
TenantServiceimport intenant_llm_service.py.
✅ Verified safe
ensure_mineru_from_env/ensure_paddleocr_from_env/ensure_opendataloader_from_env: now defined intenant_model_service.py; all runtime callers already import from there.get_api_key,get_model_config,get_my_llms,increase_usage,increase_usage_by_id,get_openai_models,llm_id2llm_type,split_model_name_and_factory,_decode_api_key_config,_encode_api_key_config: no remaining runtime callers (only commented-out code and unit-test stubs/monkeypatches reference them).- Kept
model_instanceandLLM4Tenantdo not reference any of the removed imports (os,json,settings,MINERU_*,PADDLEOCR_*,OPENDATALOADER_*,IntegrityError).
Minor (non-blocking)
tools/scripts/mysql_migration.py(~line 550) still has a comment referencing_encode_api_key_config; it is now stale and could be updated for clarity.
This is an AI review comment.
Summary
As title.