Update content decoding and validation logic

- Changed `PageNumber` in `Chunk` to nullable `int?` in `IContentDecoder` and updated related logic in `TextContentDecoder`.
- Revised citation rules in `ChatService` for stricter placement and formatting.
- Introduced `QuestionValidator` class with validation rules for `Question` model's `Text` property.
This commit is contained in:
Marco Minerva
2025-06-06 10:50:03 +02:00
parent 5530a84d82
commit dc6bbfde91
4 changed files with 4 additions and 15 deletions
@@ -5,4 +5,4 @@ public interface IContentDecoder
Task<IEnumerable<Chunk>> DecodeAsync(Stream stream, string contentType, CancellationToken cancellationToken = default);
}
public record class Chunk(int PageNumber, int IndexOnPage, string Content);
public record class Chunk(int? PageNumber, int IndexOnPage, string Content);
@@ -12,6 +12,6 @@ public class TextContentDecoder(IServiceProvider serviceProvider) : IContentDeco
var content = await readStream.ReadToEndAsync(cancellationToken);
var paragraphs = textChunker.Split(content);
return paragraphs.Select((text, index) => new Chunk(1, index, text)).ToList();
return paragraphs.Select((text, index) => new Chunk(null, index, text)).ToList();
}
}