mirror of
https://github.com/langgenius/dify.git
synced 2025-11-29 12:24:31 +00:00
Fix: only retrieval plugin-compatible providers when provider_name starts with langgenius (#15133)
This commit is contained in:
parent
b7583e95a5
commit
65da9425df
@ -187,18 +187,30 @@ class ProviderConfiguration(BaseModel):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
# get provider
|
# get provider
|
||||||
provider_record = (
|
model_provider_id = ModelProviderID(self.provider.provider)
|
||||||
db.session.query(Provider)
|
if model_provider_id.is_langgenius():
|
||||||
.filter(
|
provider_record = (
|
||||||
Provider.tenant_id == self.tenant_id,
|
db.session.query(Provider)
|
||||||
Provider.provider_type == ProviderType.CUSTOM.value,
|
.filter(
|
||||||
or_(
|
Provider.tenant_id == self.tenant_id,
|
||||||
Provider.provider_name == ModelProviderID(self.provider.provider).plugin_name,
|
Provider.provider_type == ProviderType.CUSTOM.value,
|
||||||
Provider.provider_name == self.provider.provider,
|
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
|
# Get provider credential secret variables
|
||||||
provider_credential_secret_variables = self.extract_secret_variables(
|
provider_credential_secret_variables = self.extract_secret_variables(
|
||||||
|
|||||||
@ -164,6 +164,9 @@ class GenericProviderID:
|
|||||||
self.organization, self.plugin_name, self.provider_name = value.split("/")
|
self.organization, self.plugin_name, self.provider_name = value.split("/")
|
||||||
self.is_hardcoded = is_hardcoded
|
self.is_hardcoded = is_hardcoded
|
||||||
|
|
||||||
|
def is_langgenius(self) -> bool:
|
||||||
|
return self.organization == "langgenius"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def plugin_id(self) -> str:
|
def plugin_id(self) -> str:
|
||||||
return f"{self.organization}/{self.plugin_name}"
|
return f"{self.organization}/{self.plugin_name}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user