-
Notifications
You must be signed in to change notification settings - Fork 106
Document Q&A (#140) #141
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
Document Q&A (#140) #141
Conversation
* Add pdfjs for reading PDF files. * Upgrade various dependeny minor versions. * Add chat button to source action bar. * Add chat model selector in chat toolbar. * chore: bump dependencies * feat(Chat): provide a list of local file types that can be read for chat purposes (PDF and plain text file types). * feat(Chat): Implement online PDF and local file processing for use in Chat. Dramatically improved the ability to summarize, especially larger documents. * chore: Remove unused functions but keep stubs for later use. * fix: a bug where theme settings were not saved to file correctly.
|
Addresses #115 |
| console.log("PDF detected, attempting to extract text from PDF..."); | ||
|
|
||
| // Use http to get the PDF, then use pdfjs to extract the text | ||
| const response = await axios.get(reqUrl, { responseType: "arraybuffer" }); |
Check failure
Code scanning / CodeQL
Server-side request forgery
|
|
||
| return text; | ||
| } else { | ||
| const response = await axios.get(reqUrl); |
Check failure
Code scanning / CodeQL
Server-side request forgery
| ); | ||
| router.delete( | ||
| "/key", | ||
| this.apiKeyController.deleteApiKey.bind(this.apiKeyController) |
Check failure
Code scanning / CodeQL
Missing rate limiting
|
|
||
| getRouter() { | ||
| // Load the source from the database | ||
| router.use(SourceLoader.load); |
Check failure
Code scanning / CodeQL
Missing rate limiting
| router.use(this.summarizer.summarize()); | ||
|
|
||
| // Store the source in the database | ||
| router.use(SourceLoader.store); |
Check failure
Code scanning / CodeQL
Missing rate limiting
| ); | ||
|
|
||
| // Check for the Source in local JSON files. Append to req.body if found. | ||
| if (fs.existsSync(filepath)) { |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
|
|
||
| // Check for the Source in local JSON files. Append to req.body if found. | ||
| if (fs.existsSync(filepath)) { | ||
| const json = fs.readFileSync(filepath, "utf8"); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
|
|
||
| // Store the Source into local JSON file using ID as filename. | ||
| const json = JSON.stringify([text, summary]); | ||
| fs.writeFileSync(filepath, json, "utf8"); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
| ]; | ||
|
|
||
| // Read the file and check if it is a plain text file | ||
| const dataBuffer = fs.readFileSync(filePath); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
| } | ||
|
|
||
| static async fromPdf(filePath: string) { | ||
| const dataBuffer = fs.readFileSync(filePath); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
RobRoyce
left a comment
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.
Looks good
Add PDFjs for reading PDF files (local and remote).
chore: upgrade various dependency minor versions.
feat(Chat): add chat button to source action bar and context menus.
feat(Chat): add model selector in chat toolbar for quickly changing models without opening the settings menu.
chore: bump dependencies
feat(Chat): provide a list of local file types that can be read for chat purposes (PDF and plain text file types).
feat(Chat): Implement online PDF and local file processing for use in Chat. Dramatically improved the ability to summarize, especially larger documents.
fix: a bug where theme settings were not saved to file correctly.
bump version to 0.8.5