12
This commit is contained in:
@@ -188,36 +188,20 @@ class GenerateImagePromptsFunction(BaseAIFunction):
|
|||||||
|
|
||||||
# Helper methods
|
# Helper methods
|
||||||
def _get_max_in_article_images(self, account) -> int:
|
def _get_max_in_article_images(self, account) -> int:
|
||||||
"""Get max_in_article_images from IntegrationSettings with fallback to system account"""
|
"""Get max_in_article_images from AWS account IntegrationSettings only"""
|
||||||
try:
|
|
||||||
from igny8_core.modules.system.models import IntegrationSettings
|
from igny8_core.modules.system.models import IntegrationSettings
|
||||||
from igny8_core.auth.models import Account
|
from igny8_core.auth.models import Account
|
||||||
|
|
||||||
# Try account-specific settings first
|
# Only use system account (aws-admin) settings
|
||||||
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')
|
system_account = Account.objects.get(slug='aws-admin')
|
||||||
settings = IntegrationSettings.objects.get(
|
settings = IntegrationSettings.objects.get(
|
||||||
account=system_account,
|
account=system_account,
|
||||||
integration_type='image_generation',
|
integration_type='image_generation',
|
||||||
is_active=True
|
is_active=True
|
||||||
)
|
)
|
||||||
max_images = settings.config.get('max_in_article_images', 2)
|
max_images = settings.config.get('max_in_article_images')
|
||||||
logger.info(f"Using max_in_article_images={max_images} from system account (aws-admin)")
|
logger.info(f"Using max_in_article_images={max_images} from aws-admin account")
|
||||||
return max_images
|
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
|
|
||||||
|
|
||||||
def _extract_content_elements(self, content: Content, max_images: int) -> Dict:
|
def _extract_content_elements(self, content: Content, max_images: int) -> Dict:
|
||||||
"""Extract title, intro paragraphs, and H2 headings from content HTML"""
|
"""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,
|
...createdColumn,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user