From c11af15dcf2bf53ff9e2fd10c43425a648031a0a Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Tue, 24 Dec 2024 21:29:14 +0800 Subject: [PATCH 1/2] fix: can not find model bug Signed-off-by: yihong0618 --- api/core/entities/provider_configuration.py | 2 +- api/services/entities/model_provider_entities.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/core/entities/provider_configuration.py b/api/core/entities/provider_configuration.py index 2e27b362d3092c..bff5a0ec9c6be7 100644 --- a/api/core/entities/provider_configuration.py +++ b/api/core/entities/provider_configuration.py @@ -872,7 +872,7 @@ def _get_system_provider_models( # if llm name not in restricted llm list, remove it restrict_model_names = [rm.model for rm in restrict_models] for model in provider_models: - if model.model_type == ModelType.LLM and m.model not in restrict_model_names: + if model.model_type == ModelType.LLM and model.model not in restrict_model_names: model.status = ModelStatus.NO_PERMISSION elif not quota_configuration.is_valid: model.status = ModelStatus.QUOTA_EXCEEDED diff --git a/api/services/entities/model_provider_entities.py b/api/services/entities/model_provider_entities.py index 334d009ee5f79f..acbd167bb39e64 100644 --- a/api/services/entities/model_provider_entities.py +++ b/api/services/entities/model_provider_entities.py @@ -152,7 +152,8 @@ class ModelWithProviderEntityResponse(ModelWithProviderEntity): Model with provider entity. """ - provider: SimpleModelProviderEntity + #FIXME type error ignore here + provider: SimpleProviderEntityResponse # type: ignore def __init__(self, model: ModelWithProviderEntity) -> None: super().__init__(**model.model_dump()) From 980beda237a37aeb30ae618d2947f8d92a55c43b Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Tue, 24 Dec 2024 21:30:56 +0800 Subject: [PATCH 2/2] fix: lint error Signed-off-by: yihong0618 --- api/services/entities/model_provider_entities.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/services/entities/model_provider_entities.py b/api/services/entities/model_provider_entities.py index acbd167bb39e64..f1417c6cb94b80 100644 --- a/api/services/entities/model_provider_entities.py +++ b/api/services/entities/model_provider_entities.py @@ -7,7 +7,6 @@ from core.entities.model_entities import ( ModelWithProviderEntity, ProviderModelWithStatusEntity, - SimpleModelProviderEntity, ) from core.entities.provider_entities import QuotaConfiguration from core.model_runtime.entities.common_entities import I18nObject @@ -152,7 +151,7 @@ class ModelWithProviderEntityResponse(ModelWithProviderEntity): Model with provider entity. """ - #FIXME type error ignore here + # FIXME type error ignore here provider: SimpleProviderEntityResponse # type: ignore def __init__(self, model: ModelWithProviderEntity) -> None: