Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: the model list encountered two children with the same key (#27956)

Kenne153c483b66e
diff --git a/api/core/entities/provider_configuration.py b/api/core/entities/provider_configuration.py
index b10838f8c9c..56c133e598f 100644
--- a/api/core/entities/provider_configuration.py
+++ b/api/core/entities/provider_configuration.py
@@ -1533,6 +1533,9 @@ class ProviderConfiguration(BaseModel):
# Return composite sort key: (model_type value, model position index)
return (model.model_type.value, position_index)
+ # Deduplicate
+ provider_models = list({(m.model, m.model_type, m.fetch_from): m for m in provider_models}.values())
+
# Sort using the composite sort key
return sorted(provider_models, key=get_sort_key)
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
index 9e26d233c97..2e008a0b35d 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
@@ -86,7 +86,7 @@ const ModelList: FC<ModelListProps> = ({
{
models.map(model => (
<ModelListItem
- key={`${model.model}-${model.fetch_from}`}
+ key={`${model.model}-${model.model_type}-${model.fetch_from}`}
{...{
model,
provider,