Add generate_page_content functionality for structured page content generation
- Introduced a new AI function `generate_page_content` to create structured content for website pages using JSON blocks. - Updated `AIEngine` to handle the new function and return appropriate messages for content generation. - Enhanced `PageGenerationService` to utilize the new AI function for generating page content based on blueprints. - Modified `prompts.py` to include detailed content generation requirements for the new function. - Updated site rendering logic to accommodate structured content blocks in various layouts.
This commit is contained in:
@@ -41,36 +41,32 @@ function SiteRenderer() {
|
||||
}
|
||||
|
||||
// Build navigation from site definition
|
||||
// Show pages that are published, ready, or in navigation (excluding home and draft/generating)
|
||||
const navigation = siteDefinition.navigation || siteDefinition.pages
|
||||
.filter(p =>
|
||||
p.slug !== 'home' &&
|
||||
(p.status === 'published' || p.status === 'ready' || siteDefinition.navigation?.some(n => n.slug === p.slug))
|
||||
)
|
||||
.sort((a, b) => {
|
||||
// Try to get order from navigation or use page order
|
||||
const navA = siteDefinition.navigation?.find(n => n.slug === a.slug);
|
||||
const navB = siteDefinition.navigation?.find(n => n.slug === b.slug);
|
||||
return (navA?.order ?? a.order ?? 0) - (navB?.order ?? b.order ?? 0);
|
||||
})
|
||||
.map(page => ({
|
||||
label: page.title,
|
||||
slug: page.slug,
|
||||
order: page.order || 0
|
||||
}));
|
||||
// Show all published/ready pages (excluding home and draft/generating)
|
||||
// Use explicit navigation if available, otherwise auto-generate from pages
|
||||
const navigation = siteDefinition.navigation && siteDefinition.navigation.length > 0
|
||||
? siteDefinition.navigation
|
||||
: siteDefinition.pages
|
||||
.filter(p =>
|
||||
p.slug !== 'home' &&
|
||||
(p.status === 'published' || p.status === 'ready') &&
|
||||
p.status !== 'draft' &&
|
||||
p.status !== 'generating'
|
||||
)
|
||||
.sort((a, b) => (a.order || 0) - (b.order || 0))
|
||||
.map(page => ({
|
||||
label: page.title,
|
||||
slug: page.slug,
|
||||
order: page.order || 0
|
||||
}));
|
||||
|
||||
// Filter pages based on current route
|
||||
const currentPageSlug = pageSlug || 'home';
|
||||
const currentPage = siteDefinition.pages.find(p => p.slug === currentPageSlug);
|
||||
|
||||
// If specific page requested, show only that page; otherwise show all published/ready pages
|
||||
const pagesToRender = currentPageSlug && currentPageSlug !== 'home' && currentPage
|
||||
// Show only the current page (home page on home route, specific page on page route)
|
||||
const pagesToRender = currentPage
|
||||
? [currentPage]
|
||||
: siteDefinition.pages.filter(p =>
|
||||
p.status === 'published' ||
|
||||
p.status === 'ready' ||
|
||||
(p.slug === 'home' && p.status !== 'draft' && p.status !== 'generating')
|
||||
);
|
||||
: []; // Fallback: no page found
|
||||
|
||||
return (
|
||||
<div className="site-renderer" style={{
|
||||
|
||||
Reference in New Issue
Block a user