Skip to content

Fix: resolve shared embedding/LLM model selection errors - #16773

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/share-embedding-model-error
Jul 9, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/share-embedding-model-error

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

Fix: resolve shared embedding/LLM model selection errors

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. 🧰 typescript Pull requests that update Typescript code labels Jul 9, 2026
@dcc123456
dcc123456 requested a review from wangq8 July 9, 2026 07:11
@dcc123456 dcc123456 added the ci Continue Integration label Jul 9, 2026
@dcc123456
dcc123456 marked this pull request as draft July 9, 2026 07:11
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds tenant-scoping (ownerTenantId) throughout the model-selection stack: new context/hook, extended data contracts (IAddedModel, IListAllModelsRequestParams), updated useFetchAllAddedModels, and propagation through ModelTreeSelect, NextLLMSelect, LlmSettingFieldItems, LLMFormField, LargeModelFormField, and RerankFormField(s), wired into agent, dataset, and memory setting pages. Also adds a MemorySettingContext provider.

Changes

Tenant-scoped model selection

Layer / File(s) Summary
Contexts, data contracts, and fetch hook
web/src/pages/agent/context.ts, web/src/interfaces/database/llm.ts, web/src/interfaces/request/llm.ts, web/src/hooks/use-llm-request.tsx
Adds OwnerTenantIdContext/useOwnerTenantId, extends IAddedModel with model_id/tenant_id/tenant_name, adds owner_tenant_id to request params, and updates useFetchAllAddedModels to accept/forward ownerTenantId.
Shared model-selection components
web/src/components/model-tree-select.tsx, web/src/components/llm-select/next.tsx, web/src/components/llm-setting-items/*, web/src/components/large-model-form-field.tsx, web/src/components/rerank.tsx
ModelTreeSelect switches to model_id-based node IDs with legacy value normalization and accepts ownerTenantId; NextLLMSelect, LlmSettingFieldItems, LLMFormField, LargeModelFormField, and RerankFormField/RerankFormFields all thread ownerTenantId through.
Agent form pages wiring
web/src/pages/agent/index.tsx, web/src/pages/agent/form/**
agent/index.tsx provides OwnerTenantIdContext from agentDetail?.user_id; agent form components consume useOwnerTenantId and pass it to model/rerank fields.
Dataset setting pages wiring
web/src/pages/dataset/dataset-setting/configuration/common-item.tsx, web/src/pages/dataset/dataset-setting/general-form.tsx, web/src/pages/dataset/testing/testing-form.tsx, web/src/components/parse-configuration/graph-rag-form-fields.tsx
EmbeddingSelect/EmbeddingModelItem/LLMSelect/LLMModelItem accept ownerTenantId; consuming forms supply it via useKnowledgeBaseContext.
Memory setting context and wiring
web/src/pages/memory/memory-setting/memory-setting-context.tsx, web/src/pages/memory/memory-setting/index.tsx, web/src/pages/memory/memory-setting/memory-model-form.tsx
New MemorySettingProvider/useMemorySettingContext wrap the form and supply tenant_id-derived ownerTenantId to model selects.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AgentFormComponent
  participant ModelTreeSelectOrLLMSelect
  participant useFetchAllAddedModels
  participant API

  AgentFormComponent->>AgentFormComponent: useOwnerTenantId()
  AgentFormComponent->>ModelTreeSelectOrLLMSelect: ownerTenantId prop
  ModelTreeSelectOrLLMSelect->>useFetchAllAddedModels: modelType, ownerTenantId
  useFetchAllAddedModels->>API: GET models (owner_tenant_id)
  API-->>useFetchAllAddedModels: tenant-scoped model list
  useFetchAllAddedModels-->>ModelTreeSelectOrLLMSelect: models
  ModelTreeSelectOrLLMSelect-->>AgentFormComponent: rendered tree/select
Loading

Possibly related PRs

  • infiniflow/ragflow#16024: Both PRs modify LlmSettingFieldItems in web/src/components/llm-setting-items/next.tsx, overlapping at the same component/prop typings.
  • infiniflow/ragflow#16178: Both PRs modify RerankFormField/RerankFormFields in web/src/components/rerank.tsx.
  • infiniflow/ragflow#16324: Both PRs modify EmbeddingModelItem and LLMModelItem in common-item.tsx.

Suggested labels: size:XL

Poem

A tenant ID hops through every field,
From context down to models revealed,
ModelTreeSelect learns a legacy trick,
Old IDs mapped so nothing breaks quick.
🐰 Thump-thump — tenant-scoped and neat,
This bunny's form fields are now complete!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the main change: fixing shared embedding/LLM model selection issues with tenant-aware selection handling.
Description check ✅ Passed The description includes the required Summary section and briefly states the PR purpose, so it fits the template.

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.

❤️ Share

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

@dcc123456
dcc123456 marked this pull request as ready for review July 9, 2026 07:14
@dcc123456
dcc123456 marked this pull request as draft July 9, 2026 07:14
@dcc123456
dcc123456 marked this pull request as ready for review July 9, 2026 07:14
@wangq8
wangq8 merged commit a9420a7 into infiniflow:main Jul 9, 2026
18 of 21 checks passed

@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.

Actionable comments posted: 1

🧹 Nitpick comments (5)
web/src/hooks/use-llm-request.tsx (1)

113-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extend the LlmKeys.allModels factory to include ownerTenantId instead of appending it inline.

The query key is built by spreading the factory result and appending ownerTenantId inline: [...LlmKeys.allModels(modelType), ownerTenantId]. This partially bypasses the query key factory pattern and risks cache invalidation mismatches — any invalidateQueries call using LlmKeys.allModels(modelType) won't match keys that include the appended ownerTenantId.

As per coding guidelines: "Never write raw queryKey arrays inline; use a query key factory object that returns as const tuples for every useQuery and invalidateQueries call."

♻️ Proposed fix: extend the factory to accept ownerTenantId
   allModels: (modelType?: string) =>
     [LLMApiAction.AllModels, modelType] as const,
+  allAddedModels: (modelType?: string, ownerTenantId?: string) =>
+    [LLMApiAction.AllModels, modelType, ownerTenantId] as const,

Then update the queryKey in useFetchAllAddedModels:

-    queryKey: [...LlmKeys.allModels(modelType), ownerTenantId],
+    queryKey: LlmKeys.allAddedModels(modelType, ownerTenantId),
🤖 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/hooks/use-llm-request.tsx` at line 113, The `useFetchAllAddedModels`
query key is appending `ownerTenantId` inline instead of using the query key
factory, which can cause cache mismatch with `invalidateQueries`. Update
`LlmKeys.allModels` to accept `ownerTenantId` and return the full `as const`
tuple, then change the `queryKey` in `use-llm-request.tsx` to use that factory
result directly so both `useQuery` and invalidation share the same key shape.

Source: Coding guidelines

web/src/components/parse-configuration/graph-rag-form-fields.tsx (1)

149-149: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract useKnowledgeBaseContext() to the top of the component.

Same as the pattern in testing-form.tsx — calling the hook inline in JSX is valid but inconsistent with other hooks in GraphRagItems (useTranslate, useFormContext, useWatch are all called at the top). Extracting it prevents accidental rules-of-hooks violations.

♻️ Proposed refactor
 const GraphRagItems = ({
   marginBottom = false,
   className = 'p-10',
   data,
   onDelete,
 }: GraphRagItemsProps) => {
   const { t } = useTranslate('knowledgeConfiguration');
   const form = useFormContext();
+  const { knowledgeBase } = useKnowledgeBaseContext();
       <LLMModelItem
         label={t('globalIndexModel')}
         name={'parser_config.llm_id'}
-        ownerTenantId={useKnowledgeBaseContext().knowledgeBase?.tenant_id}
+        ownerTenantId={knowledgeBase?.tenant_id}
       />
🤖 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/components/parse-configuration/graph-rag-form-fields.tsx` at line
149, Move the useKnowledgeBaseContext() call out of the JSX in GraphRagItems and
invoke it once at the top of the component alongside useTranslate,
useFormContext, and useWatch. Then reuse the returned knowledgeBase value when
passing ownerTenantId so the hook usage matches the established pattern in
testing-form.tsx and avoids inline hook calls in render.
web/src/pages/memory/memory-setting/memory-setting-context.tsx (1)

12-21: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Memoize the context value to avoid unnecessary consumer re-renders.

value={{ data }} creates a new object reference on every MemorySettingProvider render, causing all consumers to re-render even when data is unchanged.

♻️ Proposed refactor
 export const MemorySettingProvider: React.FC<{
   children: ReactNode;
   data: IMemory;
 }> = ({ children, data }) => {
+  const value = useMemo(() => ({ data }), [data]);
   return (
-    <MemorySettingContext.Provider value={{ data }}>
+    <MemorySettingContext.Provider value={value}>
       {children}
     </MemorySettingContext.Provider>
   );
 };
🤖 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/pages/memory/memory-setting/memory-setting-context.tsx` around lines
12 - 21, The MemorySettingProvider context value is recreated on every render
because of the inline value object, which triggers unnecessary re-renders in
MemorySettingContext consumers. Update MemorySettingProvider to memoize the
provided value so it keeps a stable reference when data does not change, using
the existing MemorySettingContext.Provider and the data prop as the dependency
source.
web/src/pages/dataset/testing/testing-form.tsx (1)

107-109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract useKnowledgeBaseContext() to the top of the component.

Calling the hook inline in JSX is valid but inconsistent with other hooks in this component (useTranslation, useForm, useWatch are all called at the top). Extracting it prevents accidental rules-of-hooks violations if the JSX later becomes conditional.

♻️ Proposed refactor
 export default function TestingForm({
   loading,
   refetch,
   setValues,
 }: TestingFormProps) {
   const { t } = useTranslation();
   const { id } = useParams();
   const knowledgeBaseId = id;
+  const { knowledgeBase } = useKnowledgeBaseContext();
             <RerankFormFields
-              ownerTenantId={useKnowledgeBaseContext().knowledgeBase?.tenant_id}
+              ownerTenantId={knowledgeBase?.tenant_id}
             ></RerankFormFields>
🤖 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/pages/dataset/testing/testing-form.tsx` around lines 107 - 109, The
hook call in the TestingForm JSX is inline and inconsistent with the other
top-level hooks. Move useKnowledgeBaseContext() to the top of the TestingForm
component alongside useTranslation, useForm, and useWatch, then pass its
knowledgeBase?.tenant_id value into RerankFormFields via a local variable so the
hook usage stays stable if the JSX becomes conditional later.
web/src/pages/dataset/dataset-setting/general-form.tsx (1)

128-131: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract useKnowledgeBaseContext() call to the top of the component.

Calling a hook inline in JSX obscures the hook usage and prevents reuse of the context value. Extract it to a variable at the top of GeneralForm, consistent with how useFormContext and useTranslation are already called.

♻️ Proposed refactor
 export function GeneralForm() {
   const form = useFormContext();
   const { t } = useTranslation();
+  const { knowledgeBase } = useKnowledgeBaseContext();
 
   const languageOptions = useMemo(() => {

And then update the JSX:

       <EmbeddingModelItem
         isEdit={true}
-        ownerTenantId={useKnowledgeBaseContext().knowledgeBase?.tenant_id}
+        ownerTenantId={knowledgeBase?.tenant_id}
       ></EmbeddingModelItem>
🤖 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/pages/dataset/dataset-setting/general-form.tsx` around lines 128 -
131, Move the inline useKnowledgeBaseContext() call out of the JSX in
GeneralForm and assign it to a local variable alongside the existing
useFormContext and useTranslation hooks at the top of the component. Then update
the EmbeddingModelItem props to read ownerTenantId from that variable’s
knowledgeBase?.tenant_id, keeping the hook usage clear and reusable.
🤖 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/components/model-tree-select.tsx`:
- Line 65: NextInnerLLMSelect is passing a raw model_id into LLMLabel, but
LLMLabel only understands the legacy modelName@instanceName@providerName format,
so selected labels render blank. Update the value passed from NextInnerLLMSelect
(or model-tree-select's mapping logic) to use the legacy label format, or extend
LLMLabel to resolve model_id inputs before rendering. Keep the fix anchored
around NextInnerLLMSelect and LLMLabel so the selected model always produces a
visible label.

---

Nitpick comments:
In `@web/src/components/parse-configuration/graph-rag-form-fields.tsx`:
- Line 149: Move the useKnowledgeBaseContext() call out of the JSX in
GraphRagItems and invoke it once at the top of the component alongside
useTranslate, useFormContext, and useWatch. Then reuse the returned
knowledgeBase value when passing ownerTenantId so the hook usage matches the
established pattern in testing-form.tsx and avoids inline hook calls in render.

In `@web/src/hooks/use-llm-request.tsx`:
- Line 113: The `useFetchAllAddedModels` query key is appending `ownerTenantId`
inline instead of using the query key factory, which can cause cache mismatch
with `invalidateQueries`. Update `LlmKeys.allModels` to accept `ownerTenantId`
and return the full `as const` tuple, then change the `queryKey` in
`use-llm-request.tsx` to use that factory result directly so both `useQuery` and
invalidation share the same key shape.

In `@web/src/pages/dataset/dataset-setting/general-form.tsx`:
- Around line 128-131: Move the inline useKnowledgeBaseContext() call out of the
JSX in GeneralForm and assign it to a local variable alongside the existing
useFormContext and useTranslation hooks at the top of the component. Then update
the EmbeddingModelItem props to read ownerTenantId from that variable’s
knowledgeBase?.tenant_id, keeping the hook usage clear and reusable.

In `@web/src/pages/dataset/testing/testing-form.tsx`:
- Around line 107-109: The hook call in the TestingForm JSX is inline and
inconsistent with the other top-level hooks. Move useKnowledgeBaseContext() to
the top of the TestingForm component alongside useTranslation, useForm, and
useWatch, then pass its knowledgeBase?.tenant_id value into RerankFormFields via
a local variable so the hook usage stays stable if the JSX becomes conditional
later.

In `@web/src/pages/memory/memory-setting/memory-setting-context.tsx`:
- Around line 12-21: The MemorySettingProvider context value is recreated on
every render because of the inline value object, which triggers unnecessary
re-renders in MemorySettingContext consumers. Update MemorySettingProvider to
memoize the provided value so it keeps a stable reference when data does not
change, using the existing MemorySettingContext.Provider and the data prop as
the dependency source.
🪄 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: dcad5aa5-c044-4532-8a97-82bef73e4de1

📥 Commits

Reviewing files that changed from the base of the PR and between cc94639 and 348afbb.

📒 Files selected for processing (30)
  • web/src/components/large-model-form-field.tsx
  • web/src/components/llm-select/next.tsx
  • web/src/components/llm-setting-items/llm-form-field.tsx
  • web/src/components/llm-setting-items/next.tsx
  • web/src/components/model-tree-select.tsx
  • web/src/components/parse-configuration/graph-rag-form-fields.tsx
  • web/src/components/rerank.tsx
  • web/src/hooks/use-llm-request.tsx
  • web/src/interfaces/database/llm.ts
  • web/src/interfaces/request/llm.ts
  • web/src/pages/agent/context.ts
  • web/src/pages/agent/form/agent-form/index.tsx
  • web/src/pages/agent/form/browser-use-form/index.tsx
  • web/src/pages/agent/form/categorize-form/index.tsx
  • web/src/pages/agent/form/extractor-form/index.tsx
  • web/src/pages/agent/form/parser-form/pdf-form-fields.tsx
  • web/src/pages/agent/form/parser-form/spreadsheet-form-fields.tsx
  • web/src/pages/agent/form/parser-form/text-html-form-fields.tsx
  • web/src/pages/agent/form/parser-form/video-form-fields.tsx
  • web/src/pages/agent/form/parser-form/word-form-fields.tsx
  • web/src/pages/agent/form/retrieval-form/next.tsx
  • web/src/pages/agent/form/rewrite-question-form/index.tsx
  • web/src/pages/agent/form/tool-form/retrieval-form/index.tsx
  • web/src/pages/agent/index.tsx
  • web/src/pages/dataset/dataset-setting/configuration/common-item.tsx
  • web/src/pages/dataset/dataset-setting/general-form.tsx
  • web/src/pages/dataset/testing/testing-form.tsx
  • web/src/pages/memory/memory-setting/index.tsx
  • web/src/pages/memory/memory-setting/memory-model-form.tsx
  • web/src/pages/memory/memory-setting/memory-setting-context.tsx

children: models.reduce<TreeSelectNode[]>((acc, m) => {
const modelName = getRealModelName(m.name);
const id = `${modelName}@${m.instance_name}@${m.provider_name}`;
const id = m.model_id;

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the LLMLabel component definition and check if it uses parseModelValue
rg -l 'LLMLabel' --type=ts -g '!**/node_modules/**' | head -5
# Then inspect the component for parseModelValue usage
rg -n 'parseModelValue\|model_id\|buildModelValue' --type=ts -g '!**/node_modules/**' -C3 | head -40

Repository: infiniflow/ragflow

Length of output: 156


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== model-tree-select.tsx =="
sed -n '1,260p' web/src/components/model-tree-select.tsx

echo
echo "== LLMLabel references =="
rg -n 'LLMLabel|parseModelValue|buildModelValue|model_id|modelName@instanceName@providerName' web/src -S

Repository: infiniflow/ragflow

Length of output: 10199


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate LLMLabel definition files =="
fd -a 'LLMLabel' web/src . || true
fd -a '*llmlabel*' web/src . || true

echo
echo "== search for label component definition =="
rg -n 'function LLMLabel|const LLMLabel|export .*LLMLabel|parseModelValue|buildModelValue' web/src -S

Repository: infiniflow/ragflow

Length of output: 2160


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== file inventory for model-tree-select and label-related files =="
git ls-files 'web/src/components/*' 'web/src/**/*' | rg 'model-tree-select|LLMLabel|label|model' || true

echo
echo "== read model-tree-select.tsx around relevant lines =="
nl -ba web/src/components/model-tree-select.tsx | sed -n '1,260p'

Repository: infiniflow/ragflow

Length of output: 4250


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== model-tree-select.tsx (lines 1-260) =="
cat -n web/src/components/model-tree-select.tsx | sed -n '1,260p'

echo
echo "== search for LLMLabel definition files =="
fd -a 'LLMLabel*' web/src || true
fd -a '*label*' web/src/components web/src | head -100 || true

echo
echo "== search for parse/build helpers =="
rg -n 'parseModelValue|buildModelValue|modelName@instanceName@providerName|model_id' web/src -S

Repository: infiniflow/ragflow

Length of output: 10309


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate any LLMLabel definitions/usages in web/ =="
rg -n --hidden --glob '!**/node_modules/**' 'LLMLabel|parseModelValue|buildModelValue|modelName@instanceName@providerName|model_id' web

echo
echo "== list candidate files if any =="
fd -a 'LLMLabel' web || true
fd -a '*model*label*' web || true

Repository: infiniflow/ragflow

Length of output: 4163


🌐 Web query:

site:github.com infiniflow ragflow LLMLabel parseModelValue model-tree-select

💡 Result:

In RAGFlow, the components you referenced are part of the web frontend's model selection and configuration system, primarily located in the web/src/components/ directory. ModelTreeSelect and ModelTreeSelectFormField ModelTreeSelect is a component used to render a hierarchical selection tree for available models [1][2][3]. It is frequently used in conjunction with ModelTreeSelectFormField, a wrapper designed for use within forms (often integrated with react-hook-form) to allow users to select specific models, such as LLMs or embedding models, based on predefined model types [3][4][5]. LLMLabel LLMLabel is a component used to display the label or identifier of a selected LLM, often within agent nodes on the flow canvas [6][7]. Recent updates to this component include functionality to detect and notify the user if a configured model has been deleted from the user center, typically by displaying a visual indicator like a red border [8]. parseModelValue There is no specific component or function named parseModelValue within the core codebase of the infiniflow/ragflow repository. While this term appears in other unrelated technical documentation and external open-source projects [9][10][11], it is not a standard part of the RAGFlow model selection logic. The RAGFlow frontend relies on standard form handling patterns and the component structures described above for managing model configurations [12][3].

Citations:


🌐 Web query:

site:github.com/infiniflow/ragflow "LLMLabel" "parseModelValue"

💡 Result:

I couldn’t find any indexed matches for LLMLabel or parseModelValue in infiniflow/ragflow via GitHub/web search. The repo itself is here, but the search results returned no hits for those strings. (github.com)

If you want, I can try a broader code-search strategy (e.g. likely filenames or related symbols).

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== web/src/components/llm-select/llm-label.tsx =="
cat -n web/src/components/llm-select/llm-label.tsx

echo
echo "== web/src/components/llm-select/next.tsx =="
cat -n web/src/components/llm-select/next.tsx

echo
echo "== web/src/utils/llm-util.ts =="
cat -n web/src/utils/llm-util.ts

Repository: infiniflow/ragflow

Length of output: 10035


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
for p in [
    Path('web/src/components/llm-select/llm-label.tsx'),
    Path('web/src/components/llm-select/next.tsx'),
    Path('web/src/utils/llm-util.ts'),
]:
    print(f"== {p} ==")
    text = p.read_text()
    for i, line in enumerate(text.splitlines(), 1):
        print(f"{i:>4} {line}")
    print()
PY

Repository: infiniflow/ragflow

Length of output: 9502


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
files = [
    'web/src/components/llm-select/llm-label.tsx',
    'web/src/components/llm-select/next.tsx',
    'web/src/utils/llm-util.ts',
]
for f in files:
    p = Path(f)
    print(f"== {f} ==")
    for i, line in enumerate(p.read_text().splitlines(), 1):
        if f.endswith('next.tsx') and not (1 <= i <= 180):
            continue
        print(f"{i:>4} {line}")
    print()
PY

Repository: infiniflow/ragflow

Length of output: 9502


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
files = [
    'web/src/components/llm-select/llm-label.tsx',
    'web/src/utils/llm-util.ts',
]
for f in files:
    p = Path(f)
    print(f"== {f} ==")
    for i, line in enumerate(p.read_text().splitlines(), 1):
        print(f"{i:>4} {line}")
    print()
PY

Repository: infiniflow/ragflow

Length of output: 6297


LLMLabel still needs the legacy value format NextInnerLLMSelect passes the raw model_id into <LLMLabel />, but LLMLabel only parses modelName@instanceName@providerName and returns null for model_id. That leaves the selected value blank unless the label is converted or LLMLabel learns to resolve model_id.

🤖 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/components/model-tree-select.tsx` at line 65, NextInnerLLMSelect is
passing a raw model_id into LLMLabel, but LLMLabel only understands the legacy
modelName@instanceName@providerName format, so selected labels render blank.
Update the value passed from NextInnerLLMSelect (or model-tree-select's mapping
logic) to use the legacy label format, or extend LLMLabel to resolve model_id
inputs before rendering. Keep the fix anchored around NextInnerLLMSelect and
LLMLabel so the selected model always produces a visible label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files. 🧰 typescript Pull requests that update Typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants