-
-
Notifications
You must be signed in to change notification settings - Fork 552
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
MR for PdfToTextConverter #109
Conversation
public interface IPdf2TextConverter | ||
{ | ||
Task<string> ConvertPdfToText(IFormFile formFile, int? startPageNum, int? endPageNum); | ||
Task<string> OpenPdfDocumentAsync(IFormFile formFile, int? startPageNum, int? endPageNum); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
No description provided.