Refactor: deco document upload_and_parse API#14366
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:
📝 WalkthroughWalkthroughRemoved the POST Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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 the current code and only fix it if needed.
Inline comments:
In `@api/apps/document_app.py`:
- Line 28: The frontend still defines and uses the UploadAndParse enum value
'upload_and_parse' in web/src/hooks/use-chat-request.ts (symbol: UploadAndParse
and its mutation config) while the backend endpoint/doc_upload_and_parse helper
was removed; remove the UploadAndParse enum and any mutation/config branches
that reference 'upload_and_parse', or replace those branches to call the
new/available backend endpoint or a client-side fallback, ensuring no HTTP
requests are emitted using the string 'upload_and_parse' so the frontend no
longer triggers 404s.
🪄 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: 7e6512ae-1caa-40f5-aead-43816819536f
📒 Files selected for processing (3)
api/apps/document_app.pyapi/db/services/document_service.pytest/testcases/test_web_api/test_document_app/test_upload_documents.py
💤 Files with no reviewable changes (1)
- test/testcases/test_web_api/test_document_app/test_upload_documents.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14366 +/- ##
=======================================
Coverage 95.30% 95.30%
=======================================
Files 10 10
Lines 703 703
Branches 112 112
=======================================
Hits 670 670
Misses 16 16
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@api/apps/document_app.py`:
- Around line 27-29: Remove the stale and duplicate imports: eliminate the
import of doc_upload_and_parse (it no longer exists) and remove the duplicated
DocumentService import so DocumentService is imported only once; keep the needed
duplicate_name import and a single "from api.db.services.document_service import
DocumentService" statement and run ruff to verify no F811/F401 issues.
🪄 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: 67e900eb-78a6-402d-95de-cfb2accdaefb
📒 Files selected for processing (2)
api/apps/document_app.pytest/testcases/test_web_api/test_document_app/test_upload_documents.py
💤 Files with no reviewable changes (1)
- test/testcases/test_web_api/test_document_app/test_upload_documents.py
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
api/db/services/document_service.py (1)
983-1016:⚠️ Potential issue | 🔴 CriticalRestore missing import for
MAXIMUM_TASK_PAGE_NUMBER—queue_raptor_o_graphrag_taskswill fail at runtime.Lines 999–1000 reference
MAXIMUM_TASK_PAGE_NUMBER, but the constant is not imported. This causesNameErrorwhenever the function is invoked. The constant is defined incommon/constants.pyand should be imported alongside the other constants at the top of the file.Proposed fix
-from common.constants import ParserType, StatusEnum, TaskStatus, SVR_CONSUMER_GROUP_NAME +from common.constants import ( + ParserType, + StatusEnum, + TaskStatus, + SVR_CONSUMER_GROUP_NAME, + MAXIMUM_TASK_PAGE_NUMBER, +)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@api/db/services/document_service.py` around lines 983 - 1016, The function queue_raptor_o_graphrag_tasks references MAXIMUM_TASK_PAGE_NUMBER but that constant is not imported, causing a NameError; add an import for MAXIMUM_TASK_PAGE_NUMBER from common.constants alongside the other constants at the top of the file (where other constants/imports are grouped) so queue_raptor_o_graphrag_tasks can use it at lines that set from_page/to_page.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@api/db/services/document_service.py`:
- Around line 983-1016: The function queue_raptor_o_graphrag_tasks references
MAXIMUM_TASK_PAGE_NUMBER but that constant is not imported, causing a NameError;
add an import for MAXIMUM_TASK_PAGE_NUMBER from common.constants alongside the
other constants at the top of the file (where other constants/imports are
grouped) so queue_raptor_o_graphrag_tasks can use it at lines that set
from_page/to_page.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 66fde615-e019-4f0b-a6a3-a68fa9457991
📒 Files selected for processing (2)
api/apps/document_app.pyapi/db/services/document_service.py
🚧 Files skipped from review as they are similar to previous changes (1)
- api/apps/document_app.py
What problem does this PR solve?
remove unused "POST /v1/document/upload_and_parse"
Type of change