fixes for idea render and other

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-17 05:58:13 +00:00
parent 4bba5a9a1f
commit 9f826c92f8
4 changed files with 63 additions and 8 deletions

View File

@@ -28,6 +28,39 @@ function formatContentOutline(content: any): string {
let html = '<div class="content-outline">';
// NEW FORMAT: Handle overview + outline structure
if (content.overview && content.outline) {
// Display overview
html += '<div class="outline-intro">';
html += `<div class="outline-paragraph"><strong>Overview:</strong> ${escapeHTML(content.overview)}</div>`;
html += '</div>';
// Display intro focus if available
if (content.outline.intro_focus) {
html += '<div class="outline-section">';
html += `<h3 class="section-heading">Introduction Focus</h3>`;
html += `<div class="section-details">${escapeHTML(content.outline.intro_focus)}</div>`;
html += '</div>';
}
// Display main sections
if (content.outline.main_sections && Array.isArray(content.outline.main_sections)) {
content.outline.main_sections.forEach((section: any) => {
html += '<div class="outline-section">';
if (section.h2_topic) {
html += `<h3 class="section-heading">${escapeHTML(section.h2_topic)}</h3>`;
}
if (section.coverage) {
html += `<div class="section-details">${escapeHTML(section.coverage)}</div>`;
}
html += '</div>';
});
}
html += '</div>';
return html;
}
// Handle introduction section - can be object or string
if (content.introduction) {
html += '<div class="outline-intro">';
@@ -176,7 +209,7 @@ const HTMLContentRenderer: React.FC<HTMLContentRendererProps> = ({
// If content is already an object (dict), use it directly
if (typeof content === 'object' && content !== null) {
// Check for any known structure format
if (content.H2 || content.H3 || content.introduction || content.sections) {
if (content.overview || content.outline || content.H2 || content.H3 || content.introduction || content.sections) {
return formatContentOutline(content);
}
// If it's an object but not structured, try to format it
@@ -225,7 +258,7 @@ const HTMLContentRenderer: React.FC<HTMLContentRendererProps> = ({
}
// Use extracted content as-is (will be processed below)
content = extractedContent;
} else if (parsed.H2 || parsed.H3 || parsed.introduction || parsed.sections) {
} else if (parsed.overview || parsed.outline || parsed.H2 || parsed.H3 || parsed.introduction || parsed.sections) {
// It's a content outline structure
return formatContentOutline(parsed);
}
@@ -238,7 +271,7 @@ const HTMLContentRenderer: React.FC<HTMLContentRendererProps> = ({
// Try to parse as JSON (content outline from GPT-4o mini) - for non-brace-starting JSON
try {
const parsed = JSON.parse(content);
if (typeof parsed === 'object' && (parsed.H2 || parsed.H3 || parsed.introduction || parsed.sections)) {
if (typeof parsed === 'object' && (parsed.overview || parsed.outline || parsed.H2 || parsed.H3 || parsed.introduction || parsed.sections)) {
return formatContentOutline(parsed);
}
} catch {