image max count
This commit is contained in:
@@ -733,9 +733,8 @@ class IntegrationSettingsViewSet(viewsets.ViewSet):
|
||||
config['model'] = config.get('imageModel', 'dall-e-3')
|
||||
elif config.get('provider') == 'runware' and 'model' not in config:
|
||||
config['model'] = config.get('runwareModel', 'runware:97@1')
|
||||
# Ensure all image settings have defaults
|
||||
# Ensure all image settings have defaults (except max_in_article_images which must be explicitly set)
|
||||
config.setdefault('image_type', 'realistic')
|
||||
config.setdefault('max_in_article_images', 2)
|
||||
config.setdefault('image_format', 'webp')
|
||||
config.setdefault('desktop_enabled', True)
|
||||
config.setdefault('mobile_enabled', True)
|
||||
@@ -899,20 +898,10 @@ class IntegrationSettingsViewSet(viewsets.ViewSet):
|
||||
)
|
||||
logger.info(f"[get_image_generation_settings] Using system account (aws-admin) settings")
|
||||
except (Account.DoesNotExist, IntegrationSettings.DoesNotExist):
|
||||
logger.error("[get_image_generation_settings] No image generation settings found in system account either")
|
||||
# Return default settings instead of error
|
||||
return success_response(
|
||||
data={
|
||||
'config': {
|
||||
'provider': 'openai',
|
||||
'model': 'dall-e-3',
|
||||
'image_type': 'realistic',
|
||||
'max_in_article_images': 2,
|
||||
'image_format': 'webp',
|
||||
'desktop_enabled': True,
|
||||
'mobile_enabled': True,
|
||||
}
|
||||
},
|
||||
logger.error("[get_image_generation_settings] No image generation settings found in aws-admin account")
|
||||
return error_response(
|
||||
error='Image generation settings not configured in aws-admin account',
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
request=request
|
||||
)
|
||||
|
||||
@@ -937,7 +926,7 @@ class IntegrationSettingsViewSet(viewsets.ViewSet):
|
||||
'provider': config.get('provider', 'openai'),
|
||||
'model': model,
|
||||
'image_type': config.get('image_type', 'realistic'),
|
||||
'max_in_article_images': config.get('max_in_article_images', 2),
|
||||
'max_in_article_images': config.get('max_in_article_images'),
|
||||
'image_format': config.get('image_format', 'webp'),
|
||||
'desktop_enabled': config.get('desktop_enabled', True),
|
||||
'mobile_enabled': config.get('mobile_enabled', True),
|
||||
@@ -948,18 +937,9 @@ class IntegrationSettingsViewSet(viewsets.ViewSet):
|
||||
request=request
|
||||
)
|
||||
except IntegrationSettings.DoesNotExist:
|
||||
return success_response(
|
||||
data={
|
||||
'config': {
|
||||
'provider': 'openai',
|
||||
'model': 'dall-e-3',
|
||||
'image_type': 'realistic',
|
||||
'max_in_article_images': 2,
|
||||
'image_format': 'webp',
|
||||
'desktop_enabled': True,
|
||||
'mobile_enabled': True,
|
||||
}
|
||||
},
|
||||
return error_response(
|
||||
error='Image generation settings not configured',
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
request=request
|
||||
)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user