fix(stage-ui): deduplicate provider models by id (#1282)

This commit is contained in:
Liet Blue
2026-03-11 22:41:56 +08:00
committed by GitHub
parent 53f79713d7
commit 783342c941
+10 -8
View File
@@ -33,6 +33,7 @@ import {
merge,
} from '@xsai-ext/providers/utils'
import { listModels } from '@xsai/model'
import { uniqBy } from 'es-toolkit'
import { isWebGPUSupported } from 'gpuu/webgpu'
import { defineStore } from 'pinia'
import {
@@ -1955,14 +1956,15 @@ export const useProvidersStore = defineStore('providers', () => {
// Transform and store the models
if (runtimeState) {
runtimeState.models = models.map(model => ({
id: model.id,
name: model.name,
description: model.description,
contextLength: model.contextLength,
deprecated: model.deprecated,
provider: providerId,
}))
runtimeState.models = uniqBy(models.filter(model => !!model.id), m => m.id)
.map(model => ({
id: model.id,
name: model.name,
description: model.description,
contextLength: model.contextLength,
deprecated: model.deprecated,
provider: providerId,
}))
return runtimeState.models
}
return []