Skip to content

refactor[go]: replace DSModel with ModelListItem - #17038

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
Haruko386:moon
Jul 20, 2026
Merged

JinHai-CN merged 2 commits into
infiniflow:mainfrom
Haruko386:moon

Conversation

@Haruko386

Copy link
Copy Markdown
Member

Summary

As title:

 ____________________________________________________
< We shouldn't use a common struct in specific model >
 ----------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

@Haruko386 Haruko386 added ci Continue Integration ☯️ refactor Pull request that refactor/refine code labels Jul 17, 2026
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Model-list payloads now use the new ModelListItem type instead of DSModel. Provider adapters, response wrappers, pagination tests, and Gitee fixtures were updated while preserving existing mappings, filtering, and parsing flows.

Changes

Model list item migration

Layer / File(s) Summary
ModelListItem contract
internal/entity/models/types.go, internal/entity/models/deepseek.go
Adds ModelListItem with model metadata fields, changes ModelList.Models to use it, and removes DSModel.
Provider model construction
internal/entity/models/cohere.go, internal/entity/models/deepinfra.go, internal/entity/models/fishaudio.go, internal/entity/models/google.go, internal/entity/models/jina.go, internal/entity/models/ollama.go, internal/entity/models/replicate.go, internal/entity/models/tokenhub.go
Provider listing paths construct ModelListItem values while retaining existing identifiers, ownership values, filtering, and pagination behavior.
Provider response decoding and validation
internal/entity/models/gpustack.go, internal/entity/models/groq.go, internal/entity/models/huaweicloud.go, internal/entity/models/jiekouai.go, internal/entity/models/longcat.go, internal/entity/models/modelscope.go, internal/entity/models/n1n.go, internal/entity/models/perplexity.go, internal/entity/models/ppio.go, internal/entity/models/togetherai.go, internal/entity/models/xinference.go, internal/entity/models/google_test.go, internal/entity/models/gitee_test.go
Model-list response wrappers and related test fixtures decode arrays as ModelListItem.

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

Possibly related PRs

Suggested reviewers: jinhai-cn

Poem

I’m a rabbit hopping through model arrays,
Swapping old shapes for fresh new pairs.
IDs stay bright, ownership stays true,
Pagination follows the trail anew.
ModelListItem now leads the way—
Carrot-powered catalogs pass today!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

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.
Description check ⚠️ Warning The description has the required Summary heading but lacks a real brief summary and background context. Expand the Summary section with the PR goal, the problem it solves, and enough background context to explain the refactor.
✅ Passed checks (3 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 is concise and accurately describes the main refactor from DSModel to ModelListItem.

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.

@Haruko386 Haruko386 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Comment on lines -495 to -500
type DSModel struct {
ID string `json:"id"`
Object string `json:"object"`
OwnedBy string `json:"owned_by"`
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

deleted

Comment on lines +130 to +135
type ModelListItem struct {
ID string `json:"id"`
Object string `json:"object"`
OwnedBy string `json:"owned_by"`
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added

@Haruko386
Haruko386 marked this pull request as draft July 17, 2026 07:54
@Haruko386
Haruko386 marked this pull request as ready for review July 17, 2026 07:54
@Haruko386 Haruko386 added ci Continue Integration and removed ci Continue Integration labels Jul 17, 2026
@Haruko386
Haruko386 marked this pull request as draft July 17, 2026 07:54
@Haruko386
Haruko386 marked this pull request as ready for review July 17, 2026 07:54
@Haruko386 Haruko386 changed the title refactor: replace DSModel with ModelListItem refactor[go]: replace DSModel with ModelListItem Jul 17, 2026

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

LGTM

@Haruko386 Haruko386 added the lgtm This PR has been approved by a maintainer label Jul 17, 2026
@Haruko386
Haruko386 marked this pull request as draft July 18, 2026 22:11
@Haruko386
Haruko386 marked this pull request as ready for review July 18, 2026 22:11
@Haruko386 Haruko386 added ci Continue Integration and removed ci Continue Integration labels Jul 18, 2026
@JinHai-CN
JinHai-CN merged commit 0f94e05 into infiniflow:main Jul 20, 2026
6 checks passed
@Haruko386
Haruko386 deleted the moon branch July 24, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration lgtm This PR has been approved by a maintainer ☯️ refactor Pull request that refactor/refine code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants