Feat/optimize entity construct (#1935)

This commit is contained in:
takatost 2024-01-05 09:43:41 +08:00 committed by GitHub
parent 2cfd5568e1
commit af7be9bdd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -40,7 +40,7 @@ class ProviderCredentialsCache:
:param credentials: provider credentials
:return:
"""
redis_client.setex(self.cache_key, 3600, json.dumps(credentials))
redis_client.setex(self.cache_key, 86400, json.dumps(credentials))
def delete(self) -> None:
"""

View File

@ -229,11 +229,18 @@ class ProviderManager:
return None
provider_instance = model_provider_factory.get_provider_instance(default_model.provider_name)
provider_schema = provider_instance.get_provider_schema()
return DefaultModelEntity(
model=default_model.model_name,
model_type=model_type,
provider=DefaultModelProviderEntity(**provider_instance.get_provider_schema().to_simple_provider().dict())
provider=DefaultModelProviderEntity(
provider=provider_schema.provider,
label=provider_schema.label,
icon_small=provider_schema.icon_small,
icon_large=provider_schema.icon_large,
supported_model_types=provider_schema.supported_model_types
)
)
def update_default_model_record(self, tenant_id: str, model_type: ModelType, provider: str, model: str) \