From 1008ad0d305830fa18cb06883b7d9dd658f42a0e Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:00:20 +0900 Subject: [PATCH] refactor: rename yomitoku output to document.md for consistency Normalizes the OCR output filename to document.md after finding it, matching pdftotext output naming. Keeps paths clean in cache and LLM context. Co-Authored-By: Claude Opus 4.6 (1M context) --- pkg/agent/loop_media.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/agent/loop_media.go b/pkg/agent/loop_media.go index c8aa32d3d..837dd3fdd 100644 --- a/pkg/agent/loop_media.go +++ b/pkg/agent/loop_media.go @@ -697,12 +697,18 @@ func (al *AgentLoop) ocrPDF( // Keep: .md files, figures/ directory (referenced by markdown output). cleanupOCRPageImages(outputDir, pdfPath) - // Find the output markdown file + // Find the output markdown file and normalize its name to document.md mdPath := findOCROutput(outputDir, pdfPath) if mdPath == "" { logger.WarnCF("agent", "OCR output not found", map[string]any{"output_dir": outputDir}) return fmt.Sprintf("[file:%s]", pdfPath) } + canonical := filepath.Join(outputDir, "document.md") + if mdPath != canonical { + if renameErr := os.Rename(mdPath, canonical); renameErr == nil { + mdPath = canonical + } + } // Read preview from first part of the markdown mdData, err := os.ReadFile(mdPath)