Skip to content

Go: add dimensions for list models and fix some embed-bug in providers - #15940

Merged
JinHai-CN merged 3 commits into
infiniflow:mainfrom
Haruko386:master
Jun 11, 2026
Merged

JinHai-CN merged 3 commits into
infiniflow:mainfrom
Haruko386:master

Conversation

@Haruko386

Copy link
Copy Markdown
Member

What problem does this PR solve?

As title

From RAGFlow CLI

RAGFlow(api/default)> list models
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+-------------------------+------------+--------------------------------------------------------------------------------------------------+------------------------------------------------+---------------------------------------------+
| alias                                                                                                                                                                                                          | dimension | dimensions              | max_tokens | model_types                                                                                      | name                                           | thinking                                    |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+-------------------------+------------+--------------------------------------------------------------------------------------------------+------------------------------------------------+---------------------------------------------+
| [deepseek-v4-flash deepseek-chat deepseek-ai/DeepSeek-V4-Flash deepseek-ai/deepseek-v4-flash deepseek/deepseek-v4-flash deepseek-v4-flash-260425]                                                              |           |                         | 1048576    | [chat]                                                                                           | deepseek-v4-flash                              | map[clear_thinking:true default_value:true] |
| [deepseek-v4-flash-base deepseek/deepseek-v4-flash-base deepseek-ai/DeepSeek-V4-Flash-Base deepseek-ai/deepseek-v4-flash-base]                                                                                 |           |                         | 1048576    | [chat]                                                                                           | deepseek-v4-flash-base                         |                                             |
| [deepseek-v4-pro deepseek-ai/DeepSeek-V4-Pro deepseek-ai/deepseek-v4-pro deepseek/deepseek-v4-pro deepseek-v4-pro-260425]                                                                                      |           |                         | 1048576    | [chat]                                                                                           | deepseek-v4-pro                                | map[clear_thinking:true default_value:true] |
| [deepseek-v4-pro-base deepseek/deepseek-v4-pro-base deepseek-ai/DeepSeek-V4-Pro-Base deepseek-ai/deepseek-v4-pro-base]                                                                                         |           |                         | 1048576    | [chat]                                                                                           | deepseek-v4-pro-base                           |                                             |
| [deepseek-ocr-2 deepseek-ai/DeepSeek-OCR-2 deepseek-ai/deepseek-ocr-2]                                                                                                                                         |           |                         | 8192       | [ocr]                                                                                            | deepseek-ocr-2                                 |                                             |
| [deepseek-v3.2 deepseek-ai/DeepSeek-V3.2 deepseek-ai/deepseek-v3.2 deepseek/deepseek-v3.2 Pro/deepseek-ai/DeepSeek-V3.2 deepseek/deepseek-v3.2-251201 deepseek-v3-2-251201]                                    |           |                         | 163840     | [chat]                                                                                           | deepseek-v3.2                                  |                                             |
| [deepseek-v3.2-speciale deepseek-ai/DeepSeek-V3.2-Speciale deepseek-ai/deepseek-v3.2-speciale]                                                                                                                 |           |                         | 163840     | [chat]                                                                                           | deepseek-v3.2-speciale                         |                                             |
| [qwen/qwen3-embedding-0.6b-gguf Qwen/Qwen3-Embedding-0.6B-GGUF qwen3-embedding-0.6b-gguf]                                                                                                                      | 1024      |                         | 32768      | [embedding]                                                                                      | qwen/qwen3-embedding-0.6b-gguf                 |                                             |
| [qwen/qwen3-embedding-4b-gguf Qwen/Qwen3-Embedding-4B-GGUF qwen3-embedding-4b-gguf]                                                                                                                            | 2560      | [128 256 512 1024 2048] | 32768      | [embedding]                                                                                      | qwen/qwen3-embedding-4b-gguf                   |                                             |
| [qwen/qwen3-embedding-8b-gguf Qwen/Qwen3-Embedding-8B-GGUF qwen3-embedding-8b-gguf]                                                                                                                            | 4096      |                         | 32768      | [embedding]                                                                                      | qwen/qwen3-embedding-8b-gguf                   |                                             |
| [qwen/qwen3-reranker-4b Qwen/Qwen3-Reranker-4B qwen3-reranker-4b Qwen3-Reranker-4B]                                                                                                                            |           |                         | 32768      | [rerank]                                                                                         | qwen/qwen3-reranker-4b                         |                                             |
| [qwen/qwen3-embedding-8b Qwen/Qwen3-Embedding-8B qwen3-embedding-8b Qwen3-Embedding-8B]                                                                                                                        | 4096      |                         | 32768      | [embedding]                                                                                      | qwen/qwen3-embedding-8b                        |                                             |
| [qwen/qwen3-embedding-4b Qwen/Qwen3-Embedding-4B qwen3-embedding-4b Qwen3-Embedding-4B]                                                                                                                        | 2560      |                         | 32768      | [embedding]                                                                                      | qwen/qwen3-embedding-4b                        |                                             |
| [qwen/qwen3-embedding-0.6b Qwen/Qwen3-Embedding-0.6B qwen3-embedding-0.6b Qwen3-Embedding-0.6B]                                                                                                                | 1024      | [1 3 5 76 8]            | 32768      | [embedding]                                                                                      | qwen/qwen3-embedding-0.6b                      |                                             |
| [qwen/qwen3-reranker-0.6b Qwen/Qwen3-Reranker-0.6B qwen3-reranker-0.6b Qwen3-Reranker-0.6B]                                                                                                                    |           |                         | 32768      | [rerank]                                                                                         | qwen/qwen3-reranker-0.6b                       |                                             |


RAGFlow(api/default)> list supported models from 'baidu' 'test'
+-----------+--------------+------------+-----------------------------------------------------------------+-------------------------------------------+---------------------------------------------+
| dimension | dimensions   | max_tokens | model_types                                                     | name                                      | thinking                                    |
+-----------+--------------+------------+-----------------------------------------------------------------+-------------------------------------------+---------------------------------------------+
|           |              |            |                                                                 | tao-8k@其他                                   |                                             |
|           |              |            |                                                                 | qianfan-vl-70b@Baidu                      |                                             |
|           |              | 262144     | [chat]                                                          | qwen3-vl-8b-thinking@Tongyi Lab           | map[clear_thinking:true default_value:true] |
|           |              | 131072     | [chat]                                                          | deepseek-r1-distill-qwen-14b@DeepSeek     |                                             |
|           |              |            |                                                                 | qianfan-vl-8b@Baidu                       |                                             |
|           |              | 262144     | [chat]                                                          | qwen3-vl-235b-a22b-thinking@Tongyi Lab    | map[clear_thinking:true default_value:true] |
|           |              | 262144     | [chat]                                                          | qwen3-vl-235b-a22b-instruct@Tongyi Lab    |                                             |
|           |              | 262144     | [chat]                                                          | qwen3-vl-32b-thinking@Tongyi Lab          | map[clear_thinking:true default_value:true] |
|           |              | 262144     | [chat]                                                          | qwen3-vl-32b-instruct@Tongyi Lab          |                                             |
|           |              | 262144     | [chat]                                                          | qwen3-coder-30b-a3b-instruct@Tongyi Lab   |                                             |
|           |              |            |                                                                 | kimi-k2.5@其他                                |                                             |
|           |              | 32768      | [chat]                                                          | qwen3-8b@Tongyi Lab                       |                                             |
| 1024      | [1 3 5 76 8] | 32768      | [embedding]                                                     | qwen3-embedding-0.6b@Tongyi Lab           |                                             |
|           |              | 1048576    | [chat]                                                          | deepseek-v4-pro@DeepSeek                  | map[clear_thinking:true default_value:true] |
|           |              |            |                                                                 | embedding@Baidu                           |                                             |
|           |              | 262144     | [chat]                                                          | qwen3-coder-480b-a35b-instruct@Tongyi Lab |                                             |
|           |              |            |                                                                 | paddleocr-vl-0.9b@Baidu                   |                                             |
|           |              | 163840     | [chat]                                                          | deepseek-v3@DeepSeek                      |                                             |
|           |              |            |                                                                 | qianfan-ocr-fast@Baidu                    |                                             |

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Refactoring

@Haruko386 Haruko386 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration ♾️infinity Pull requests that‘s involved with infinity(DB) labels Jun 11, 2026
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 11, 2026
@Haruko386 Haruko386 added ☯️ refactor Pull request that refactor/refine code size:M This PR changes 30-99 lines, ignoring generated files. and removed ♾️infinity Pull requests that‘s involved with infinity(DB) size:M This PR changes 30-99 lines, ignoring generated files. labels Jun 11, 2026
@Haruko386
Haruko386 marked this pull request as draft June 11, 2026 07:42
@Haruko386
Haruko386 marked this pull request as ready for review June 11, 2026 07:42
@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 399f475f-e6d0-40c2-b8e9-e32ee77590d8

📥 Commits

Reviewing files that changed from the base of the PR and between 121c861 and 6a231be.

📒 Files selected for processing (9)
  • internal/entity/models/astraflow.go
  • internal/entity/models/base_model.go
  • internal/entity/models/cohere.go
  • internal/entity/models/mistral.go
  • internal/entity/models/model.go
  • internal/entity/models/replicate.go
  • internal/entity/models/siliconflow.go
  • internal/entity/models/volcengine.go
  • internal/service/model_service.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • internal/entity/models/cohere.go
  • internal/entity/models/volcengine.go
  • internal/entity/models/mistral.go
  • internal/entity/models/astraflow.go
  • internal/entity/models/siliconflow.go
  • internal/entity/models/base_model.go
  • internal/entity/models/replicate.go

📝 Walkthrough

Walkthrough

The PR adds support for plural embedding dimensions across the model system. It introduces a Dimensions []int field to the Model contract, propagates it through the parsing layer, augments embedding requests across five providers with optional dimension parameters, refactors Replicate's response parsing to a two-stage decode, and exposes the field in service responses.

Changes

Plural dimensions support for embeddings and models

Layer / File(s) Summary
Data schema: Dimensions field contract
internal/entity/models/model.go
Model struct gains a new Dimensions []int JSON field to represent multi-value dimensionality.
Model list parsing: Dimensions propagation and output
internal/entity/models/base_model.go, internal/entity/models/model.go
ParseListModel copies modelEntity.Dimensions to response; ListAllModels removes conditional emission of max_dimension and dimensions from per-model response map.
Embedding request augmentation: Consistent provider implementations
internal/entity/models/astraflow.go, internal/entity/models/cohere.go, internal/entity/models/mistral.go, internal/entity/models/siliconflow.go, internal/entity/models/volcengine.go
Five embedding providers (Astraflow, Cohere, Mistral, Siliconflow, VolcEngine) now conditionally include dimension fields (dimensions or output_dimension) in request bodies when embeddingConfig.Dimension > 0.
Replicate model parsing: Two-stage decode and ID derivation
internal/entity/models/replicate.go
ListModels now uses dedicated internal types and a two-stage decode: first attempts ModelList format, then falls back to replicateModelList, derives model identifiers from ID/Owner/Name fields, and delegates response construction to ParseListModel.
Service layer: Dimensions field exposure
internal/service/model_service.go
ListSupportedModels refactors model response construction to conditionally include the dimensions field only when model.Dimensions is non-empty, alongside existing fields.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • infiniflow/ragflow#15900: Both PRs touch the shared ParseListModel/list-models conversion path in internal/entity/models/base_model.go, with this PR extending ParseListModel to propagate the Dimensions field.
  • infiniflow/ragflow#15939: Both PRs update the model/dimension metadata flow and augment embedding request payloads with dimension parameters across multiple providers.

Suggested labels

💞 feature

Poem

🐰 Through dimensions plural, embeddings now align,
Five providers updated in patterns design,
Replicate's parsing now two-stage and bright,
Each model's dimensions exposed just right!
A feature of features, from schema to sight. 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: adding dimensions support for list models and fixing embedding bugs in providers.
Description check ✅ Passed The description includes the required 'What problem does this PR solve?' section with context and a complete 'Type of change' section with appropriate checkboxes selected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@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 `@internal/entity/models/model.go`:
- Around line 390-395: The provider-scoped list path is missing the new
dimension(s) fields: update the code paths that build provider-instance
responses (specifically ModelProviderService.ListInstanceModels and
ProviderManager.ListModels) to include both model.Dimensions and model.Dimension
(same keys "dimensions" and "dimension" as used in
ProviderManager.ListAllModels). Ensure the builder that constructs modelData for
instance-scoped responses mirrors the logic in the ListAllModels branch so
/providers/:provider/:instance/models returns the same contract whether or not
supported=true.
🪄 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: 7a0a8c00-c537-453d-a8c4-4ca4180ea417

📥 Commits

Reviewing files that changed from the base of the PR and between 47fb462 and 121c861.

📒 Files selected for processing (10)
  • internal/entity/models/astraflow.go
  • internal/entity/models/base_model.go
  • internal/entity/models/cohere.go
  • internal/entity/models/mistral.go
  • internal/entity/models/model.go
  • internal/entity/models/replicate.go
  • internal/entity/models/siliconflow.go
  • internal/entity/models/types.go
  • internal/entity/models/volcengine.go
  • internal/service/model_service.go

Comment thread internal/entity/models/model.go Outdated
Comment on lines +390 to +395
if model.Dimensions != nil {
modelData["dimensions"] = model.Dimensions
}
if model.Dimension != nil {
modelData["dimension"] = *model.Dimension
}

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Propagate dimension(s) through the provider-scoped list path too.

This only updates ProviderManager.ListAllModels(). The default instance-model response still flows through ProviderManager.ListModels() from ModelProviderService.ListInstanceModels, and that builder still omits both dimension and dimensions. As a result, /providers/:provider/:instance/models stays out of sync with the new list-model contract unless callers pass supported=true.

Suggested follow-up
func (pm *ProviderManager) ListModels(providerName string) ([]map[string]interface{}, error) {
    provider := pm.FindProvider(providerName)
    if provider == nil {
        return nil, fmt.Errorf("provider '%s' not found", providerName)
    }

    modelList := []map[string]interface{}{}
    for _, model := range provider.Models {
        modelData := map[string]interface{}{
            "name":        model.Name,
            "max_tokens":  model.MaxTokens,
            "model_types": model.ModelTypes,
        }
+       if model.Dimension != nil {
+           modelData["dimension"] = model.Dimension
+       }
+       if len(model.Dimensions) > 0 {
+           modelData["dimensions"] = model.Dimensions
+       }
        modelList = append(modelList, modelData)
    }
📝 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
if model.Dimensions != nil {
modelData["dimensions"] = model.Dimensions
}
if model.Dimension != nil {
modelData["dimension"] = *model.Dimension
}
if model.Dimensions != nil {
modelData["dimensions"] = model.Dimensions
}
if model.Dimension != nil {
modelData["dimension"] = *model.Dimension
}
🤖 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 `@internal/entity/models/model.go` around lines 390 - 395, The provider-scoped
list path is missing the new dimension(s) fields: update the code paths that
build provider-instance responses (specifically
ModelProviderService.ListInstanceModels and ProviderManager.ListModels) to
include both model.Dimensions and model.Dimension (same keys "dimensions" and
"dimension" as used in ProviderManager.ListAllModels). Ensure the builder that
constructs modelData for instance-scoped responses mirrors the logic in the
ListAllModels branch so /providers/:provider/:instance/models returns the same
contract whether or not supported=true.

@codecov

codecov Bot commented Jun 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (9d59509) to head (d34d3db).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15940   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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 `@internal/service/model_service.go`:
- Around line 249-267: The code appends two entries per model (first a map with
"max_dimension" and then modelData with "dimension"), causing duplicates; remove
the first append and keep a single consistent map (use the modelData variable)
that includes "name", "max_dimension" (or choose one naming and keep it
consistent), "max_tokens", "model_types", "thinking", and only add "dimensions"
when len(model.Dimensions) > 0; update references to model.Name,
model.MaxDimension, model.Dimensions, model.MaxTokens, model.ModelTypes, and
model.Thinking so the function builds and appends just one entry to result.
🪄 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: 399f475f-e6d0-40c2-b8e9-e32ee77590d8

📥 Commits

Reviewing files that changed from the base of the PR and between 121c861 and 6a231be.

📒 Files selected for processing (9)
  • internal/entity/models/astraflow.go
  • internal/entity/models/base_model.go
  • internal/entity/models/cohere.go
  • internal/entity/models/mistral.go
  • internal/entity/models/model.go
  • internal/entity/models/replicate.go
  • internal/entity/models/siliconflow.go
  • internal/entity/models/volcengine.go
  • internal/service/model_service.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • internal/entity/models/cohere.go
  • internal/entity/models/volcengine.go
  • internal/entity/models/mistral.go
  • internal/entity/models/astraflow.go
  • internal/entity/models/siliconflow.go
  • internal/entity/models/base_model.go
  • internal/entity/models/replicate.go

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

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 `@internal/service/model_service.go`:
- Around line 249-267: The code appends two entries per model (first a map with
"max_dimension" and then modelData with "dimension"), causing duplicates; remove
the first append and keep a single consistent map (use the modelData variable)
that includes "name", "max_dimension" (or choose one naming and keep it
consistent), "max_tokens", "model_types", "thinking", and only add "dimensions"
when len(model.Dimensions) > 0; update references to model.Name,
model.MaxDimension, model.Dimensions, model.MaxTokens, model.ModelTypes, and
model.Thinking so the function builds and appends just one entry to result.
🪄 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: 399f475f-e6d0-40c2-b8e9-e32ee77590d8

📥 Commits

Reviewing files that changed from the base of the PR and between 121c861 and 6a231be.

📒 Files selected for processing (9)
  • internal/entity/models/astraflow.go
  • internal/entity/models/base_model.go
  • internal/entity/models/cohere.go
  • internal/entity/models/mistral.go
  • internal/entity/models/model.go
  • internal/entity/models/replicate.go
  • internal/entity/models/siliconflow.go
  • internal/entity/models/volcengine.go
  • internal/service/model_service.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • internal/entity/models/cohere.go
  • internal/entity/models/volcengine.go
  • internal/entity/models/mistral.go
  • internal/entity/models/astraflow.go
  • internal/entity/models/siliconflow.go
  • internal/entity/models/base_model.go
  • internal/entity/models/replicate.go
🛑 Comments failed to post (1)
internal/service/model_service.go (1)

249-267: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove the duplicate append in supported-model response building.

Each iteration appends two entries for the same model, so clients receive duplicated rows with inconsistent key sets (max_dimension and dimension variants). Keep only one append path.

Suggested fix
 	for _, model := range modelList {
-		result = append(result, map[string]interface{}{
-			"name":          model.Name,
-			"max_dimension": model.MaxDimension,
-			"dimensions":    model.Dimensions,
-			"max_tokens":    model.MaxTokens,
-			"model_types":   model.ModelTypes,
-			"thinking":      model.Thinking,
-		})
 		modelData := map[string]interface{}{
 			"name":        model.Name,
 			"dimension":   model.MaxDimension,
 			"max_tokens":  model.MaxTokens,
 			"model_types": model.ModelTypes,
 			"thinking":    model.Thinking,
 		}
 		if len(model.Dimensions) > 0 {
 			modelData["dimensions"] = model.Dimensions
 		}
 		result = append(result, modelData)
 	}
📝 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.

		for _, model := range modelList {
			modelData := map[string]interface{}{
				"name":        model.Name,
				"dimension":   model.MaxDimension,
				"max_tokens":  model.MaxTokens,
				"model_types": model.ModelTypes,
				"thinking":    model.Thinking,
			}
			if len(model.Dimensions) > 0 {
				modelData["dimensions"] = model.Dimensions
			}
			result = append(result, modelData)
		}
🤖 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 `@internal/service/model_service.go` around lines 249 - 267, The code appends
two entries per model (first a map with "max_dimension" and then modelData with
"dimension"), causing duplicates; remove the first append and keep a single
consistent map (use the modelData variable) that includes "name",
"max_dimension" (or choose one naming and keep it consistent), "max_tokens",
"model_types", "thinking", and only add "dimensions" when len(model.Dimensions)
> 0; update references to model.Name, model.MaxDimension, model.Dimensions,
model.MaxTokens, model.ModelTypes, and model.Thinking so the function builds and
appends just one entry to result.

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 ☯️ 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.

2 participants