fix(ocr): fill empty MANUAL blocks in guided OCR mode
When a user draws annotation boxes to mark OCR regions, the blocks are created with source=MANUAL and empty text. upsertGuidedBlock was protecting all MANUAL blocks unconditionally, so guided OCR silently produced no output for these drawn-but-empty blocks. Changed the guard to only protect non-empty MANUAL blocks — empty ones are treated like OCR blocks and get their text filled in. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -104,8 +104,8 @@ public class TranscriptionService {
|
||||
public TranscriptionBlock upsertGuidedBlock(UUID documentId, UUID annotationId,
|
||||
String text, UUID userId) {
|
||||
return blockRepository.findByAnnotationId(annotationId).map(existing -> {
|
||||
if (existing.getSource() == BlockSource.MANUAL) {
|
||||
return existing; // never overwrite manual transcription
|
||||
if (existing.getSource() == BlockSource.MANUAL && !existing.getText().isBlank()) {
|
||||
return existing; // never overwrite non-empty manual transcription
|
||||
}
|
||||
existing.setText(sanitizeText(text));
|
||||
existing.setUpdatedBy(userId);
|
||||
|
||||
Reference in New Issue
Block a user