Seth0330 commited on
Commit
28d24c1
·
verified ·
1 Parent(s): fa5ecef

Update frontend/src/components/ocr/ExtractionOutput.jsx

Browse files
frontend/src/components/ocr/ExtractionOutput.jsx CHANGED
@@ -154,8 +154,12 @@ function fieldsToText(fields) {
154
  let text = "=== FULL EXTRACTED TEXT ===\n\n";
155
  text += fields.full_text;
156
 
157
- // If pages array exists, show per-page text
158
- if (fields.pages && Array.isArray(fields.pages)) {
 
 
 
 
159
  text += "\n\n=== TEXT BY PAGE ===\n\n";
160
  fields.pages.forEach((page, idx) => {
161
  text += `--- Page ${page.page_number || idx + 1} ---\n`;
 
154
  let text = "=== FULL EXTRACTED TEXT ===\n\n";
155
  text += fields.full_text;
156
 
157
+ // Don't show pages array separately if full_text already contains page markers
158
+ // (full_text from backend already includes "=== PAGE 1 ===" etc.)
159
+ const hasPageMarkers = fields.full_text.includes("=== PAGE") || fields.full_text.includes("--- Page");
160
+
161
+ // Only show pages array if full_text doesn't already have page breakdown
162
+ if (!hasPageMarkers && fields.pages && Array.isArray(fields.pages)) {
163
  text += "\n\n=== TEXT BY PAGE ===\n\n";
164
  fields.pages.forEach((page, idx) => {
165
  text += `--- Page ${page.page_number || idx + 1} ---\n`;