Skip to content

Refactor: Standardize naming convention to camelCase - #14079

Merged
yingfeng merged 1 commit into
infiniflow:mainfrom
dcc123456:feature/go-duplicate-name
Apr 13, 2026
Merged

yingfeng merged 1 commit into
infiniflow:mainfrom
dcc123456:feature/go-duplicate-name

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Refactor: Standardize naming convention to camelCase

Type of change

  • Refactoring

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 13, 2026
@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A comprehensive naming convention migration from snake_case to camelCase across API endpoint definitions and their consumers throughout the frontend codebase. The refactoring updates the api.ts utility file, all service layer methods, request hooks, and consuming components, while preserving all underlying functionality and control flow logic.

Changes

Cohort / File(s) Summary
API Definition Layer
web/src/utils/api.ts
Renamed 44 endpoint property keys from snake_case to camelCase (e.g., user_info → userInfo, kb_list → kbList, upload_and_parse → uploadAndParse). URL templates and function signatures remain unchanged.
Service Layer
web/src/services/knowledge-service.ts, web/src/services/next-chat-service.ts, web/src/services/user-service.ts, web/src/services/plugin-service.ts
Updated service configurations to destructure and reference camelCase API properties. listPipelineDatasetLogs signature extended to include optional kb_id and keywords parameters. Method definitions and exported function signatures unchanged except where noted.
Request Hooks - Knowledge & Chunk
web/src/hooks/use-knowledge-request.ts, web/src/hooks/use-chunk-request.ts
Updated hook invocations to call renamed kbService methods: retrieval_test → retrievalTest, get_kb_detail → getKbDetail, rm_chunk → rmChunk, create_chunk → createChunk, etc. Control flow and cache logic preserved.
Request Hooks - Document & User
web/src/hooks/use-document-request.ts, web/src/hooks/use-user-setting-request.tsx, web/src/hooks/use-chat-request.ts
Updated service method calls to camelCase. useFetchDocumentList extended with optional loop parameter to control polling behavior based on document run state. Other hook signatures remain unchanged.
Request Hooks - LLM
web/src/hooks/use-llm-request.tsx
Updated userService method calls: llm_list → llmList, factories_list → factoriesList, my_llm → myLlm, set_api_key → setApiKey, add_llm → addLlm, etc. Query and mutation logic preserved.
Page & Component Layer
web/src/pages/dataset/dataset-overview/index.tsx, web/src/pages/next-search/hooks.ts
Updated hook invocations to pass false argument to useFetchDocumentList and call renamed kbService.retrievalTest. Control flow unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

☯️ refactor, 🧰 typescript, size:XL

Suggested reviewers

  • yingfeng
  • yongtenglei
  • asiroliu

Poem

🐰 With whiskers twitching, I hop with glee,
As camelCase brings harmony,
Snake_case slithers to the past,
New naming conventions are here at last!
From api to service, the refactor's spree,
Makes the code flow bounce with me! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly summarizes the main change: a refactoring to standardize naming convention from snake_case to camelCase across the codebase.
Description check ✅ Passed The description follows the template structure with the required 'What problem does this PR solve?' section and 'Type of change' checkbox selection, though the problem statement lacks detail beyond restating the title.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added the ☯️ refactor Pull request that refactor/refine code label Apr 13, 2026
@dcc123456 dcc123456 added ci Continue Integration and removed ☯️ refactor Pull request that refactor/refine code labels Apr 13, 2026
@dcc123456
dcc123456 marked this pull request as draft April 13, 2026 10:02
@dcc123456
dcc123456 marked this pull request as ready for review April 13, 2026 10:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/src/hooks/use-document-request.ts (1)

166-168: ⚠️ Potential issue | 🟡 Minor

useMemo is being used incorrectly for a side effect.

useMemo is intended for memoizing computed values, not for executing side effects like setDocs. This should be useEffect instead.

🔧 Proposed fix
-  useMemo(() => {
-    setDocs(data.docs);
-  }, [data.docs]);
+  useEffect(() => {
+    setDocs(data.docs);
+  }, [data.docs]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/hooks/use-document-request.ts` around lines 166 - 168, Replace the
incorrect useMemo side-effect with useEffect: find the useMemo block that calls
setDocs(data.docs) (in the useDocumentRequest hook) and change it to
useEffect(() => { setDocs(data.docs); }, [data.docs]); and ensure useEffect is
imported from React; keep the same dependency [data.docs] so state updates when
docs change.
🤖 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 `@web/src/hooks/use-document-request.ts`:
- Around line 166-168: Replace the incorrect useMemo side-effect with useEffect:
find the useMemo block that calls setDocs(data.docs) (in the useDocumentRequest
hook) and change it to useEffect(() => { setDocs(data.docs); }, [data.docs]);
and ensure useEffect is imported from React; keep the same dependency
[data.docs] so state updates when docs change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed7dae51-f8d4-4d91-94e7-01507f97ceb1

📥 Commits

Reviewing files that changed from the base of the PR and between a023305 and f805b2e.

📒 Files selected for processing (13)
  • web/src/hooks/use-chat-request.ts
  • web/src/hooks/use-chunk-request.ts
  • web/src/hooks/use-document-request.ts
  • web/src/hooks/use-knowledge-request.ts
  • web/src/hooks/use-llm-request.tsx
  • web/src/hooks/use-user-setting-request.tsx
  • web/src/pages/dataset/dataset-overview/index.tsx
  • web/src/pages/next-search/hooks.ts
  • web/src/services/knowledge-service.ts
  • web/src/services/next-chat-service.ts
  • web/src/services/plugin-service.ts
  • web/src/services/user-service.ts
  • web/src/utils/api.ts

@codecov

codecov Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.66%. Comparing base (3d59448) to head (f805b2e).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14079   +/-   ##
=======================================
  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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

JasleenKaurSethi pushed a commit to stackhpc/ragflow that referenced this pull request Apr 28, 2026
### What problem does this PR solve?

Refactor: Standardize naming convention to camelCase

### Type of change

- [x] Refactoring
@coderabbitai coderabbitai Bot mentioned this pull request Apr 30, 2026
1 of 4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants