mirror of
https://github.com/langgenius/dify.git
synced 2026-03-20 01:40:38 +08:00
add credential-removed to the model list api
This commit is contained in:
parent
a7532fdc83
commit
592b2f59d5
@ -19,6 +19,7 @@ class ModelStatus(Enum):
|
||||
QUOTA_EXCEEDED = "quota-exceeded"
|
||||
NO_PERMISSION = "no-permission"
|
||||
DISABLED = "disabled"
|
||||
CREDENTIAL_REMOVED = "credential-removed"
|
||||
|
||||
|
||||
class SimpleModelProviderEntity(BaseModel):
|
||||
|
||||
@ -1598,6 +1598,9 @@ class ProviderConfiguration(BaseModel):
|
||||
if len(model_setting.load_balancing_configs) > 1:
|
||||
load_balancing_enabled = True
|
||||
|
||||
if len(model_configuration.available_model_credentials) > 0 and not model_configuration.credentials:
|
||||
status = ModelStatus.CREDENTIAL_REMOVED
|
||||
|
||||
provider_models.append(
|
||||
ModelWithProviderEntity(
|
||||
model=custom_model_schema.model,
|
||||
|
||||
@ -107,7 +107,7 @@ class CustomModelConfiguration(BaseModel):
|
||||
|
||||
model: str
|
||||
model_type: ModelType
|
||||
credentials: dict
|
||||
credentials: dict | None
|
||||
current_credential_id: Optional[str] = None
|
||||
available_model_credentials: list[CredentialConfiguration] = []
|
||||
|
||||
|
||||
@ -726,7 +726,7 @@ class ProviderManager:
|
||||
# Get cached provider model credentials
|
||||
cached_provider_model_credentials = provider_model_credentials_cache.get()
|
||||
|
||||
if not cached_provider_model_credentials:
|
||||
if not cached_provider_model_credentials and provider_model_record.encrypted_config:
|
||||
try:
|
||||
provider_model_credentials = json.loads(provider_model_record.encrypted_config)
|
||||
except JSONDecodeError:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user