mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.14k stars 9.94k forks source link

[Feature]: Add "Ask GPT" Feature for PDF Contextual Queries #18818

Closed 003-kalki closed 1 day ago

003-kalki commented 2 days ago

Is the feature relevant to the Firefox PDF Viewer?

Yes

Feature description

-> Context With the increasing demand for AI-assisted tools in document reading, I propose adding an "Ask GPT" feature to PDF.js. This would allow users to interact with the content of their PDFs in real-time, similar to how VSCode integrates ChatGPT.

-> Feature Proposal The idea is to integrate an AI chatbot that enables users to ask questions about the content while reading. This feature could provide definitions, explanations, or summaries directly from the document.

-> Use Cases

-> Steps to Implement

  1. Integration with OpenAI API : Utilize the OpenAI API to handle user queries and return relevant information.
  2. User Interface : Implement a chat window within the PDF.js viewer for users to type their questions.

-> Benefits

-> Additional Information There are existing tools that offer similar functionalities; integrating such a feature could significantly enhance user experience with PDF.js.

Other PDF viewers

No.

Snuffleupagus commented 2 days ago

There's absolutely no way that we'll implement a feature that sends potentially sensitive user information to an unknown/untrusted third-party service!

soham203 commented 1 day ago

we can use llama 3.2 which is open source AI model

marco-c commented 21 hours ago

Building ML-based features in PDF.js is not completely out of the question. Indeed, we've already been doing it with automatically generating alt text for added images. We are planning to build more, whenever possible it will be with local models we are training openly like we are doing for alt text and for translations.

Users could inquire about specific terms or concepts found within the PDF.

Selecting text, right clicking and "search" should already mostly cover this.

The AI could summarize sections or provide contextual information based on user queries.

We could potentially support summarization with local models.