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.

Chore: remove unused var in `ModelProviderFactory` (#23690)

Yongtao Huanga44ca2971716
diff --git a/api/core/model_runtime/model_providers/model_provider_factory.py b/api/core/model_runtime/model_providers/model_provider_factory.py
index ad46f64ec39..f8590b38f8b 100644
--- a/api/core/model_runtime/model_providers/model_provider_factory.py
+++ b/api/core/model_runtime/model_providers/model_provider_factory.py
@@ -257,11 +257,6 @@ class ModelProviderFactory:
# scan all providers
plugin_model_provider_entities = self.get_plugin_model_providers()
- # convert provider_configs to dict
- provider_credentials_dict = {}
- for provider_config in provider_configs:
- provider_credentials_dict[provider_config.provider] = provider_config.credentials
-
# traverse all model_provider_extensions
providers = []
for plugin_model_provider_entity in plugin_model_provider_entities:
diff --git a/api/core/model_runtime/schema_validators/common_validator.py b/api/core/model_runtime/schema_validators/common_validator.py
index 810a7c4c44a..b6890074011 100644
--- a/api/core/model_runtime/schema_validators/common_validator.py
+++ b/api/core/model_runtime/schema_validators/common_validator.py
@@ -68,7 +68,7 @@ class CommonValidator:
if credential_form_schema.max_length:
if len(value) > credential_form_schema.max_length:
raise ValueError(
- f"Variable {credential_form_schema.variable} length should not"
+ f"Variable {credential_form_schema.variable} length should not be"
f" greater than {credential_form_schema.max_length}"
)
diff --git a/api/core/model_runtime/utils/helper.py b/api/core/model_runtime/utils/helper.py
deleted file mode 100644
index 5e8a723ec7c..00000000000
--- a/api/core/model_runtime/utils/helper.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import pydantic
-from pydantic import BaseModel
-
-
-def dump_model(model: BaseModel) -> dict:
- if hasattr(pydantic, "model_dump"):
- # FIXME mypy error, try to fix it instead of using type: ignore
- return pydantic.model_dump(model) # type: ignore
- else:
- return model.model_dump()