Skip to content

feat(model): forward instance_id on per-model verify and auto-populate models - #17055

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/model-provider-0717
Jul 22, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/model-provider-0717

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

feat(model): forward instance_id on per-model verify and auto-populate models

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. 💞 feature Feature request, pull request that fullfill a new feature. 🧰 typescript Pull requests that update Typescript code labels Jul 17, 2026
@dcc123456 dcc123456 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Jul 17, 2026
@dcc123456
dcc123456 marked this pull request as draft July 17, 2026 11:27
@dcc123456
dcc123456 marked this pull request as ready for review July 17, 2026 11:28
@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Model verification now supports optional instance identifiers, and draft instances populate their model lists from the catalog once while preserving manually removed models.

Changes

Instance model updates

Layer / File(s) Summary
Instance-scoped model verification
web/src/hooks/use-llm-request.tsx, web/src/pages/user-setting/setting-model/instance-card/models-section/hooks.ts, web/src/pages/user-setting/setting-model/instance-card/models-section/index.tsx
Verification accepts optional instance data, conditionally sends instance_id, and passes the instance through ModelsSection.
Draft catalog population
web/src/pages/user-setting/setting-model/instance-card/models-section/index.tsx
Draft models are populated from the catalog once per provider and instance session, without re-adding manually removed models.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: myf-bee

Poem

A rabbit checks each model with care,
Passing instance IDs through the air.
Draft catalogs fill the list just right,
Removed names stay out of sight.
One gentle hop, the settings bloom.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description has the required Summary section, but it is only a title repeat and lacks the requested background context. Expand the Summary with the problem being solved, relevant context, and the two key behavior changes: instance_id forwarding and draft model auto-population.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 clearly describes the main change: forwarding instance_id for per-model verification and auto-populating models.

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.

@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

🤖 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/pages/user-setting/setting-model/instance-card/models-section/index.tsx`:
- Around line 104-107: Remove the providerName/instanceName reset useEffect that
calls setDraftModels and clears hasAutoPopulatedDraftRef. Leave draft
initialization to component remounting via the host’s React key and preserve the
existing catalog auto-population effect.
🪄 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: 1840c7d8-3bba-49f7-8b63-0991131bb9eb

📥 Commits

Reviewing files that changed from the base of the PR and between 6cc30bc and c5a3b21.

📒 Files selected for processing (3)
  • web/src/hooks/use-llm-request.tsx
  • web/src/pages/user-setting/setting-model/instance-card/models-section/hooks.ts
  • web/src/pages/user-setting/setting-model/instance-card/models-section/index.tsx

Comment on lines 104 to 107
useEffect(() => {
setDraftModels([]);
hasAutoPopulatedDraftRef.current = false;
}, [providerName, instanceName]);

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

Remove broken "safety net" reset effect.

If the component is not remounted on provider/instance change, this manual reset creates a race condition. Because catalog (returned by useModelsCatalog) is not synchronously cleared on provider switch, this effect clears draftModels, only for the second useEffect to immediately auto-populate it with the previous provider's catalog.

Since useModelsCatalog also relies on component remounting to trigger fresh auto-fetches, the host must remount this section via a React key on provider/instance switch. Therefore, this manual state reset is redundant and flawed, and should be removed.

♻️ Proposed fix
-  useEffect(() => {
-    setDraftModels([]);
-    hasAutoPopulatedDraftRef.current = false;
-  }, [providerName, instanceName]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
setDraftModels([]);
hasAutoPopulatedDraftRef.current = false;
}, [providerName, instanceName]);
🤖 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/user-setting/setting-model/instance-card/models-section/index.tsx`
around lines 104 - 107, Remove the providerName/instanceName reset useEffect
that calls setDraftModels and clears hasAutoPopulatedDraftRef. Leave draft
initialization to component remounting via the host’s React key and preserve the
existing catalog auto-population effect.

@dcc123456
dcc123456 marked this pull request as draft July 22, 2026 02:21
@dcc123456
dcc123456 marked this pull request as ready for review July 22, 2026 02:21
@wangq8
wangq8 self-requested a review July 22, 2026 02:22
@wangq8
wangq8 merged commit 744ae77 into infiniflow:main Jul 22, 2026
15 checks passed
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 💞 feature Feature request, pull request that fullfill a new feature. size:M This PR changes 30-99 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