From e9ce64cf0cabf6a7b50da5fa3eafd91ee349e9d0 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 18 Aug 2026 18:28:40 +0200 Subject: [PATCH] Fixed estimated document pages (#929) --- app/MindWork AI Studio/Tools/DocumentManager.cs | 12 +++++++----- runtime/src/file_data.rs | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/MindWork AI Studio/Tools/DocumentManager.cs b/app/MindWork AI Studio/Tools/DocumentManager.cs index 359ac826..018b4509 100644 --- a/app/MindWork AI Studio/Tools/DocumentManager.cs +++ b/app/MindWork AI Studio/Tools/DocumentManager.cs @@ -23,12 +23,14 @@ public sealed class DocumentManager this.currentPageContent = new StringBuilder(); // - // Sections, not pages: a Word or OpenDocument file carries no fixed page layout, so the - // runtime derives these boundaries from page breaks and heuristics. Calling them pages, - // as the PDF reader does with its real ones, would invite the AI to cite page numbers - // which do not exist in the document. + // A Word or OpenDocument file carries no fixed page layout, so the runtime derives these + // boundaries from page breaks and heuristics. We note the estimate as a comment rather + // than as a heading: a heading would sit on the same level as the document's own first + // level headings, leaving the AI unable to tell the structure of the document apart from + // our boundaries. The presentation reader marks its slides the same way. // - this.currentPageContent.AppendLine($"# Section {pageNumber}"); + this.currentPageContent.AppendLine($""); + this.currentPageContent.AppendLine(); this.currentPageContent.Append(content); return completedPage; } diff --git a/runtime/src/file_data.rs b/runtime/src/file_data.rs index 4ca4446f..34981d87 100644 --- a/runtime/src/file_data.rs +++ b/runtime/src/file_data.rs @@ -76,6 +76,7 @@ pub enum Metadata { page_number: Option, image: Option, }, + Image {}, Presentation {