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: only retrieval plugin-compatible providers when provider_name starts with `langgenius` (#15133)

Yeuoly65da9425dff5
diff --git a/api/core/entities/provider_configuration.py b/api/core/entities/provider_configuration.py
index b1a155fea8f..4b8214019c7 100644
--- a/api/core/entities/provider_configuration.py
+++ b/api/core/entities/provider_configuration.py
@@ -187,18 +187,30 @@ class ProviderConfiguration(BaseModel):
:return:
"""
# get provider
- provider_record = (
- db.session.query(Provider)
- .filter(
- Provider.tenant_id == self.tenant_id,
- Provider.provider_type == ProviderType.CUSTOM.value,
- or_(
- Provider.provider_name == ModelProviderID(self.provider.provider).plugin_name,
+ model_provider_id = ModelProviderID(self.provider.provider)
+ if model_provider_id.is_langgenius():
+ provider_record = (
+ db.session.query(Provider)
+ .filter(
+ Provider.tenant_id == self.tenant_id,
+ Provider.provider_type == ProviderType.CUSTOM.value,
+ or_(
+ Provider.provider_name == model_provider_id.provider_name,
+ Provider.provider_name == self.provider.provider,
+ ),
+ )
+ .first()
+ )
+ else:
+ provider_record = (
+ db.session.query(Provider)
+ .filter(
+ Provider.tenant_id == self.tenant_id,
+ Provider.provider_type == ProviderType.CUSTOM.value,
Provider.provider_name == self.provider.provider,
- ),
+ )
+ .first()
)
- .first()
- )
# Get provider credential secret variables
provider_credential_secret_variables = self.extract_secret_variables(
diff --git a/api/core/plugin/entities/plugin.py b/api/core/plugin/entities/plugin.py
index c61e848a425..ad39b972bfa 100644
--- a/api/core/plugin/entities/plugin.py
+++ b/api/core/plugin/entities/plugin.py
@@ -164,6 +164,9 @@ class GenericProviderID:
self.organization, self.plugin_name, self.provider_name = value.split("/")
self.is_hardcoded = is_hardcoded
+ def is_langgenius(self) -> bool:
+ return self.organization == "langgenius"
+
@property
def plugin_id(self) -> str:
return f"{self.organization}/{self.plugin_name}"