Skip to content

MR for PdfToTextConverter #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 28, 2023

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

@@ -11,11 +11,12 @@ namespace BotSharp.OpenAPI.Controllers;
public class KnowledgeController : ControllerBase, IApiAdapter
{
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