Skip to content

Conversation

@evan-cao-wb
Copy link
Contributor

No description provided.

public interface IPdf2TextConverter
{
Task<string> ConvertPdfToText(IFormFile formFile, int? startPageNum, int? endPageNum);
Task<string> OpenPdfDocumentAsync(IFormFile formFile, int? startPageNum, int? endPageNum);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these 4 functions don't need to be exposed outside. They're used internally. So we can remove these interfaces.

  • OpenPdfDocumentAsync
  • LocalImageToTextsAsync
  • ConvertPdfToLocalImagesAsync
  • DeleteTempFile

{
private readonly IKnowledgeService _knowledgeService;
public KnowledgeController(IKnowledgeService knowledgeService)
private readonly IPdf2TextConverter _pdf2TextConverter;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The converter only be used in FeedKnowledge, so we can get this instance in FeedKnowledge function internally. Don't need to declare it this class level.

await formFile.CopyToAsync(stream);
}

var document = PdfDocument.Open(filePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep PdfPig as one of the implementation of IPdf2TextConverter rather than delete it.

@Oceania2018 Oceania2018 merged commit d16df19 into SciSharp:master Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants