Skip to content

fix: support provider-specific verify payload for per-model verify - #17522

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/paddleOCR-error-0729
Jul 29, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/paddleOCR-error-0729

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

fix: support provider-specific verify payload for per-model verify

@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 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Provider configuration now supplies optional verification transforms through draft and saved instance cards. useModelVerify applies transformed form values to per-model verification requests while preserving single-model payload construction and conditionally including region.

Changes

Provider verification transform

Layer / File(s) Summary
Verification contracts and card wiring
web/src/pages/user-setting/setting-model/instance-card/interface.ts, web/src/pages/user-setting/setting-model/instance-card/provider-instance-card.tsx, web/src/pages/user-setting/setting-model/instance-card/components/*-mode-card.tsx, web/src/pages/user-setting/setting-model/instance-card/models-section/*
Adds the VerifyTransform contract and forwards providerConfig.verifyTransform through both card modes into ModelsSection.
Transformed per-model verify requests
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
Uses current form values and the optional transform to derive verification credentials, base URL, and region, while sending one model in model_info.
Save payload callback dependencies
web/src/pages/user-setting/setting-model/instance-card/hooks.tsx
Removes instanceName from the buildPayload callback dependency list.

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

Sequence Diagram(s)

sequenceDiagram
  participant ProviderInstanceCard
  participant ModeCard
  participant ModelsSection
  participant VerifyEndpoint
  ProviderInstanceCard->>ModeCard: pass providerConfig.verifyTransform
  ModeCard->>ModelsSection: pass verifyTransform
  ModelsSection->>ModelsSection: invoke useModelVerify
  ModelsSection->>VerifyEndpoint: send transformed per-model verification payload
Loading

Possibly related PRs

Suggested labels: 💞 feature

Poem

I’m a rabbit with a transform in flight,
Mapping each model’s fields just right.
Keys hop in, regions softly appear,
One model per request, crisp and clear.
The cards pass the magic along—
Verify hops onward with a song!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only repeats the title and lacks the required summary context/background. Add a short summary of the problem, why per-model verification needed provider-specific payloads, and the high-level approach.
✅ 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 matches the main change: provider-specific verify payload support for per-model verification.

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 requested review from Lynn-Inf and wangq8 July 29, 2026 07:27
@dcc123456 dcc123456 added the ci Continue Integration label Jul 29, 2026
@dcc123456
dcc123456 marked this pull request as draft July 29, 2026 07:28
@dcc123456
dcc123456 marked this pull request as ready for review July 29, 2026 07:28

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

🧹 Nitpick comments (1)
web/src/pages/user-setting/setting-model/instance-card/models-section/interface.ts (1)

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

Reuse the shared VerifyTransform contract.

These duplicate callback definitions can drift from the card-level contract.

  • web/src/pages/user-setting/setting-model/instance-card/models-section/interface.ts#L70-L75: import and use VerifyTransform.
  • web/src/pages/user-setting/setting-model/instance-card/models-section/hooks.ts#L408-L413: use the same imported alias for UseModelVerifyArgs.

As per coding guidelines, “Reduce public surface area” and keep refactors centered on the owning abstraction.

Proposed refactor
+import type { VerifyTransform } from '../interface';

- verifyTransform?: (values: Record<string, any>) => {
-   apiKey: string | object | Record<string, any>;
-   baseUrl?: string;
-   region?: string;
-   modelInfo?: IModelInfo[];
- };
+ verifyTransform?: VerifyTransform;
🤖 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/interface.ts`
around lines 70 - 75, Replace the duplicate verifyTransform callback in
web/src/pages/user-setting/setting-model/instance-card/models-section/interface.ts:70-75
with the shared VerifyTransform contract, importing it from its owning
abstraction. Update
web/src/pages/user-setting/setting-model/instance-card/models-section/hooks.ts:408-413
so UseModelVerifyArgs also references that same imported VerifyTransform alias;
no other sites require changes.

Source: Coding guidelines

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

Nitpick comments:
In
`@web/src/pages/user-setting/setting-model/instance-card/models-section/interface.ts`:
- Around line 70-75: Replace the duplicate verifyTransform callback in
web/src/pages/user-setting/setting-model/instance-card/models-section/interface.ts:70-75
with the shared VerifyTransform contract, importing it from its owning
abstraction. Update
web/src/pages/user-setting/setting-model/instance-card/models-section/hooks.ts:408-413
so UseModelVerifyArgs also references that same imported VerifyTransform alias;
no other sites require changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f14a6728-5713-4294-9913-0ff94654cb23

📥 Commits

Reviewing files that changed from the base of the PR and between 1140db3 and a29abb2.

📒 Files selected for processing (8)
  • web/src/pages/user-setting/setting-model/instance-card/components/draft-mode-card.tsx
  • web/src/pages/user-setting/setting-model/instance-card/components/saved-mode-card.tsx
  • web/src/pages/user-setting/setting-model/instance-card/hooks.tsx
  • web/src/pages/user-setting/setting-model/instance-card/interface.ts
  • 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
  • web/src/pages/user-setting/setting-model/instance-card/models-section/interface.ts
  • web/src/pages/user-setting/setting-model/instance-card/provider-instance-card.tsx
💤 Files with no reviewable changes (1)
  • web/src/pages/user-setting/setting-model/instance-card/hooks.tsx

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this PR! The per-model verify flow definitely needed provider-specific credential mapping — this correctly mirrors the existing verifyTransform pattern already used in useVerifyProvider for card-level verify. Good stuff.

A few observations:

1. VerifyTransform type duplication
The type is defined as a named export in instance-card/interface.ts and inlined again in models-section/interface.ts. Consider importing the type from instance-card/interface.ts into the models-section interface to keep the single source of truth. If there are dependency-order concerns preventing this, a comment noting why would help future readers.

2. apiKey as any cast
api_key: apiKey as any — I see the comment explaining why (PaddleOCR produces a nested object where the service signature types string). This is pragmatic and matches the existing pattern in useVerifyProvider. Might be worth a follow-up to make the service type accept string | object properly, but not blocking here.

3. instanceName dependency removal
The removal of instanceName from the useInstanceSaveState dependency array in hooks.tsx is a separate cleanup. As long as instanceName is genuinely unused inside that effect, LGTM — but worth double-checking that the effect body doesn't reference it.

4. Region support
Nice that region is now forwarded in the per-model verify payload — the original handleVerify didn't include it at all, so this is a bonus fix alongside the main change.

5. Tests
No test coverage included. Given that useModelVerify now has a branching code path (verifyTransform vs resolveCreds), a unit test covering both paths would add confidence. Non-blocking but worth a follow-up.

Overall the threading is clean — providerConfig.verifyTransform → DraftModeCard/SavedModeCard → ModelsSection → useModelVerify all lines up. LGTM.

@wangq8
wangq8 merged commit b0bbf9f into infiniflow:main Jul 29, 2026
12 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 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