From 15d1e118ed070bae982dbb610f0f92c5457fc4e2 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Wed, 29 Apr 2026 11:59:55 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20TextReference=20component=20=E2=80=94?= =?UTF-8?q?=20original=20text,=20position,=20correction=20in=20findings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shows for each finding: - Original text block from DSE (or "missing" indicator) - Position: section heading, number, parent section, paragraph index - Correction: insert/append/replace with copy button Falls back to plain correction view if no text reference available. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../app/sdk/agent/_components/ScanResult.tsx | 24 +++- .../sdk/agent/_components/TextReference.tsx | 108 ++++++++++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 admin-compliance/app/sdk/agent/_components/TextReference.tsx diff --git a/admin-compliance/app/sdk/agent/_components/ScanResult.tsx b/admin-compliance/app/sdk/agent/_components/ScanResult.tsx index e19d01f..0bf9664 100644 --- a/admin-compliance/app/sdk/agent/_components/ScanResult.tsx +++ b/admin-compliance/app/sdk/agent/_components/ScanResult.tsx @@ -1,6 +1,7 @@ 'use client' import React, { useState } from 'react' +import { TextReference } from './TextReference' interface ServiceInfo { name: string @@ -14,11 +15,27 @@ interface ServiceInfo { status: string } +interface TextRef { + found: boolean + source_url: string + document_type: string + section_heading: string + section_number: string + parent_section: string + paragraph_index: number + original_text: string + issue: string + correction_type: string + correction_text: string + insert_after: string +} + interface ScanFinding { code: string severity: string text: string correction: string + text_reference: TextRef | null } interface ScanData { @@ -157,7 +174,12 @@ export function ScanResult({ data }: { data: ScanData }) {

{f.text}

- {f.correction && ( + {/* Text Reference (original text + position + correction) */} + {f.text_reference && ( + + )} + {/* Fallback: correction without text reference */} + {!f.text_reference && f.correction && (
+ {showCorrection && ( +
+ {issue && ( + + {CORRECTION_LABELS[ref.correction_type] || issue.label} + + )} +
{correctionText}
+ +
+ )} +
+ )} + + ) +}