mirror of https://github.com/langgenius/dify.git
Refactor WorkflowService to handle missing default credentials gracefully
This commit is contained in:
parent
ac9e9b26d0
commit
7f6d48175a
|
|
@ -408,13 +408,13 @@ class WorkflowService:
|
|||
provider_manager = ProviderManager()
|
||||
provider_configurations = provider_manager.get_configurations(tenant_id)
|
||||
models = provider_configurations.get_models(provider=provider, model_type=ModelType.LLM)
|
||||
|
||||
|
||||
target_model = None
|
||||
for model in models:
|
||||
if model.model == model_name and model.provider.provider == provider:
|
||||
target_model = model
|
||||
break
|
||||
|
||||
|
||||
if target_model:
|
||||
target_model.raise_for_status()
|
||||
else:
|
||||
|
|
@ -452,7 +452,8 @@ class WorkflowService:
|
|||
)
|
||||
|
||||
if not default_provider:
|
||||
raise ValueError("No default credential found")
|
||||
# plugin does not require credentials, skip
|
||||
return
|
||||
|
||||
# Check credential policy compliance using the default credential ID
|
||||
from core.helper.credential_utils import check_credential_policy_compliance
|
||||
|
|
|
|||
Loading…
Reference in New Issue