Repository navigation
Fix: update LayoutRecognizeFormField to accept ownerTenantId and refactor model handling in LLM requests - #16781
Conversation
…ctor model handling in LLM requests
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR scopes model-tree fetching by tenant through ChangesTenant-scoped model selection
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant ConfigurationForm
participant LayoutRecognizeFormField
participant useFetchAllAddedModels
ConfigurationForm->>LayoutRecognizeFormField: ownerTenantId from tenant context
LayoutRecognizeFormField->>useFetchAllAddedModels: fetch models with ownerTenantId
useFetchAllAddedModels-->>LayoutRecognizeFormField: tenant-scoped model tree
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
…mbedding-model-error
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 `@web/src/interfaces/request/llm.ts`:
- Around line 121-122: The default-model request/response shape in the LLM
interfaces is out of sync with the current API contract; keep `model_provider`,
`model_instance`, and `model_name` in the `llm.ts` types used by `PATCH
/models/default` and `GET /models/default`, and do not switch these fields to
`model_id` unless the backend and all callers are updated together. Update the
relevant request/response interfaces around the default-model definitions so
they match the existing backend contract and remain compatible with the code
that reads and writes default model settings.
🪄 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: 125008fd-2fa1-48f2-a4aa-d11c08c6c000
📒 Files selected for processing (15)
web/src/components/layout-recognize-form-field.tsxweb/src/hooks/use-llm-request.tsxweb/src/interfaces/database/llm.tsweb/src/interfaces/request/llm.tsweb/src/pages/agent/form/begin-form/index.tsxweb/src/pages/agent/form/parser-form/common-form-fields.tsxweb/src/pages/agent/form/user-fill-up-form/index.tsxweb/src/pages/dataset/dataset-setting/configuration/book.tsxweb/src/pages/dataset/dataset-setting/configuration/laws.tsxweb/src/pages/dataset/dataset-setting/configuration/manual.tsxweb/src/pages/dataset/dataset-setting/configuration/naive.tsxweb/src/pages/dataset/dataset-setting/configuration/one.tsxweb/src/pages/dataset/dataset-setting/configuration/paper.tsxweb/src/pages/dataset/dataset-setting/configuration/presentation.tsxweb/src/pages/user-setting/setting-model/layout/system-setting.tsx
| model_type: string; | ||
| model_name: string; | ||
| model_id: string; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Search for backend default-model endpoint handlers to verify they accept model_id.
# Look for backend route handlers or controllers for the defaultModel endpoint
rg -rn 'defaultModel\|default_model\|setDefaultModel' --type py --type js --type ts -g '!node_modules' -g '!web/src' -g '!**/*.test.*' -g '!**/*.spec.*' .
# Also check for any API documentation or OpenAPI specs that define the default model endpoint
fd -i 'openapi\|swagger\|api-doc' --type f | head -20Repository: infiniflow/ragflow
Length of output: 156
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the frontend request types and nearby usages.
fd -a 'llm.ts' web/src
rg -n 'model_id|model_provider|model_instance|model_name|setDefaultModel|defaultModel' web/src -g '!**/*.test.*' -g '!**/*.spec.*'
# Search the repository for any backend or API contract definitions tied to default model handling.
rg -n 'defaultModel|default_model|setDefaultModel|ISetDefaultModelRequestBody|IDefaultModel' . -g '!node_modules' -g '!web/node_modules' -g '!**/*.test.*' -g '!**/*.spec.*'
# Show the exact interface block around the changed fields.
python3 - <<'PY'
from pathlib import Path
p = Path('web/src/interfaces/request/llm.ts')
text = p.read_text()
for i, line in enumerate(text.splitlines(), 1):
if 105 <= i <= 140:
print(f"{i}: {line}")
PYRepository: infiniflow/ragflow
Length of output: 49196
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the backend default-model handlers and their returned payload shape.
sed -n '108,230p' api/apps/restful_apis/models_api.py
printf '\n---\n'
sed -n '182,260p' api/apps/services/models_api_service.py
printf '\n---\n'
sed -n '113,140p' web/src/interfaces/database/llm.ts
printf '\n---\n'
sed -n '1,80p' web/src/services/llm-service.tsRepository: infiniflow/ragflow
Length of output: 8280
Keep the default-model API contract in sync — PATCH /models/default still accepts model_provider, model_instance, and model_name, and GET /models/default still returns those fields. Switching this request/response shape to model_id will break default-model updates and loading unless the backend changes in the same PR.
🤖 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 `@web/src/interfaces/request/llm.ts` around lines 121 - 122, The default-model
request/response shape in the LLM interfaces is out of sync with the current API
contract; keep `model_provider`, `model_instance`, and `model_name` in the
`llm.ts` types used by `PATCH /models/default` and `GET /models/default`, and do
not switch these fields to `model_id` unless the backend and all callers are
updated together. Update the relevant request/response interfaces around the
default-model definitions so they match the existing backend contract and remain
compatible with the code that reads and writes default model settings.
Summary
Fix: update LayoutRecognizeFormField to accept ownerTenantId and refactor model handling in LLM requests