12
This commit is contained in:
@@ -188,36 +188,20 @@ class GenerateImagePromptsFunction(BaseAIFunction):
|
||||
|
||||
# Helper methods
|
||||
def _get_max_in_article_images(self, account) -> int:
|
||||
"""Get max_in_article_images from IntegrationSettings with fallback to system account"""
|
||||
try:
|
||||
from igny8_core.modules.system.models import IntegrationSettings
|
||||
from igny8_core.auth.models import Account
|
||||
|
||||
# Try account-specific settings first
|
||||
try:
|
||||
settings = IntegrationSettings.objects.get(
|
||||
account=account,
|
||||
integration_type='image_generation',
|
||||
is_active=True
|
||||
)
|
||||
max_images = settings.config.get('max_in_article_images', 2)
|
||||
logger.info(f"Using max_in_article_images={max_images} from account {account.id} settings")
|
||||
return max_images
|
||||
except IntegrationSettings.DoesNotExist:
|
||||
# Fallback to system account (aws-admin)
|
||||
logger.info(f"No image_generation settings for account {account.id}, falling back to system account")
|
||||
system_account = Account.objects.get(slug='aws-admin')
|
||||
settings = IntegrationSettings.objects.get(
|
||||
account=system_account,
|
||||
integration_type='image_generation',
|
||||
is_active=True
|
||||
)
|
||||
max_images = settings.config.get('max_in_article_images', 2)
|
||||
logger.info(f"Using max_in_article_images={max_images} from system account (aws-admin)")
|
||||
return max_images
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to get max_in_article_images from IntegrationSettings: {e}, using default=2")
|
||||
return 2 # Default fallback
|
||||
"""Get max_in_article_images from AWS account IntegrationSettings only"""
|
||||
from igny8_core.modules.system.models import IntegrationSettings
|
||||
from igny8_core.auth.models import Account
|
||||
|
||||
# Only use system account (aws-admin) settings
|
||||
system_account = Account.objects.get(slug='aws-admin')
|
||||
settings = IntegrationSettings.objects.get(
|
||||
account=system_account,
|
||||
integration_type='image_generation',
|
||||
is_active=True
|
||||
)
|
||||
max_images = settings.config.get('max_in_article_images')
|
||||
logger.info(f"Using max_in_article_images={max_images} from aws-admin account")
|
||||
return max_images
|
||||
|
||||
def _extract_content_elements(self, content: Content, max_images: int) -> Dict:
|
||||
"""Extract title, intro paragraphs, and H2 headings from content HTML"""
|
||||
|
||||
@@ -290,6 +290,19 @@ export const createContentPageConfig = (
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'word_count',
|
||||
label: 'Words',
|
||||
sortable: true,
|
||||
sortField: 'word_count',
|
||||
width: '100px',
|
||||
align: 'right',
|
||||
render: (value: number) => (
|
||||
<span className="font-mono text-sm text-gray-700 dark:text-gray-300">
|
||||
{value?.toLocaleString() || 0}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
...createdColumn,
|
||||
sortable: true,
|
||||
|
||||
Reference in New Issue
Block a user