Refactor WorkflowService to handle missing default credentials gracefully

This commit is contained in:
GareArc 2025-09-18 23:56:04 -07:00
parent ac9e9b26d0
commit 7f6d48175a
No known key found for this signature in database
1 changed files with 4 additions and 3 deletions

View File

@ -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