refactor(*): Update hard-code '[__HIDDEN__]' to the constant. (#7048)

This commit is contained in:
-LAN- 2024-08-07 17:30:56 +08:00 • committed by GitHub
commit 536c43257b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 6 deletions

View file

@ -4,6 +4,7 @@ import logging
from json import JSONDecodeError
from typing import Optional
from constants import HIDDEN_VALUE
from core.entities.provider_configuration import ProviderConfiguration
from core.helper import encrypter
from core.helper.model_provider_cache import ProviderCredentialsCache, ProviderCredentialsCacheType
@ -511,7 +512,7 @@ class ModelLoadBalancingService:
for key, value in credentials.items():
if key in provider_credential_secret_variables:
# if send [__HIDDEN__] in secret input, it will be same as original value
if value == '[__HIDDEN__]' and key in original_credentials:
if value == HIDDEN_VALUE and key in original_credentials:
credentials[key] = encrypter.decrypt_token(tenant_id, original_credentials[key])
if validate: