fixes
This commit is contained in:
parent
982932d2f5
commit
4d4db7bb85
2 changed files with 12 additions and 12 deletions
|
|
@ -47,15 +47,15 @@ class RendererImage(BaseRenderer):
|
|||
if not aiService:
|
||||
raise ValueError("AI service is required for image generation")
|
||||
|
||||
# Validate JSON structure
|
||||
if not isinstance(extractedContent, dict):
|
||||
raise ValueError("Extracted content must be a dictionary")
|
||||
# Validate JSON structure (standardized schema: {metadata: {...}, documents: [{sections: [...]}]})
|
||||
if not self._validateJsonStructure(extractedContent):
|
||||
raise ValueError("Extracted content must follow standardized schema: {metadata: {...}, documents: [{sections: [...]}]}")
|
||||
|
||||
if "sections" not in extractedContent:
|
||||
raise ValueError("Extracted content must contain 'sections' field")
|
||||
# Extract metadata from standardized schema
|
||||
metadata = self._extractMetadata(extractedContent)
|
||||
|
||||
# Use title from JSON metadata if available, otherwise use provided title
|
||||
documentTitle = extractedContent.get("metadata", {}).get("title", title)
|
||||
documentTitle = metadata.get("title", title)
|
||||
|
||||
# Create AI prompt for image generation
|
||||
imagePrompt = await self._createImageGeneratePrompt(extractedContent, documentTitle, userPrompt, aiService)
|
||||
|
|
|
|||
|
|
@ -210,15 +210,15 @@ class RendererXlsx(BaseRenderer):
|
|||
# Get style set: default styles, enhanced with AI if userPrompt provided
|
||||
styles = await self._getStyleSet(userPrompt, aiService)
|
||||
|
||||
# Validate JSON structure
|
||||
if not isinstance(jsonContent, dict):
|
||||
raise ValueError("JSON content must be a dictionary")
|
||||
# Validate JSON structure (standardized schema: {metadata: {...}, documents: [{sections: [...]}]})
|
||||
if not self._validateJsonStructure(jsonContent):
|
||||
raise ValueError("JSON content must follow standardized schema: {metadata: {...}, documents: [{sections: [...]}]}")
|
||||
|
||||
if "sections" not in jsonContent:
|
||||
raise ValueError("JSON content must contain 'sections' field")
|
||||
# Extract metadata from standardized schema
|
||||
metadata = self._extractMetadata(jsonContent)
|
||||
|
||||
# Use title from JSON metadata if available, otherwise use provided title
|
||||
document_title = jsonContent.get("metadata", {}).get("title", title)
|
||||
document_title = metadata.get("title", title)
|
||||
|
||||
# Create workbook
|
||||
wb = Workbook()
|
||||
|
|
|
|||
Loading…
Reference in a new issue