Skip to content
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

Provide an option to use either selected text in the browser or text copied to the clipboard (necessary for using Google docs etc) #167

Closed
nausher opened this issue Apr 25, 2024 · 13 comments

Comments

@nausher
Copy link

nausher commented Apr 25, 2024

Thanks for creating this excellent extension.
While this works for pure HTML pages, when run on Google docs or slides it is unable to parse just the content, and uses the entire HTML & JS of Google docs.
Can the extension have a keyboard shortcut or a checkbox for content parsing to optionally use just selected text or text in the clipboard? I understand this might need different permissions, so perhaps this can be an optional feature that can be enabled in the extensions settings.

@andrewnguonly
Copy link
Owner

Thanks for the suggestion @nausher!

I've been meaning to find a workaround for the issue you're describing (i.e. parsing content from Google docs, etc). Even the Highlighted Content feature does not work as expected. Let me see what I can come up with.

@sublimator
Copy link

I've noticed similar issues with Google Docs, though never dove in to see exactly what it is. Is it using a lot of nested iframes?

No, actually, I have a vague memory that the window.getSelection() api was not working. Perhaps they implement their own editor control and selection geometry system?

@andrewnguonly
Copy link
Owner

I looked at it briefly a while back and I think they implemented some kind of custom editor. Other tools like Grammarly are able to access the content (seemingly without access to Google APIs), so there must be some way to access it. I'll need to investigate.

@nausher
Copy link
Author

nausher commented May 2, 2024

Would a simpler fix (hack) be to provide a checkbox option to use what's in the clipboard similar to "Disable content parsing".
The user could then just copy the content of the Google doc to their clipboard, the content can be then chunked or truncated depending on the context length and passed to Ollama.

@sublimator
Copy link

Some info, though perhaps stale:
https://stackoverflow.com/questions/75019646/how-to-get-selected-text-in-google-docs-with-javascript

@andrewnguonly
Copy link
Owner

Would a simpler fix (hack) be to provide a checkbox option to use what's in the clipboard similar to "Disable content parsing". The user could then just copy the content of the Google doc to their clipboard, the content can be then chunked or truncated depending on the context length and passed to Ollama.

I'll consider this. However, I prefer to avoid having too many input components cluttering the UI, which is already pretty cluttered IMO.

@andrewnguonly
Copy link
Owner

I think a reasonable product experience is to treat clipboard content like an attachment. If the attachment/clipboard content is present, then those contents will take precedence over the web page's content for parsing. A user must explicitly remove the attachment/clipboard content to resume parsing the web page's content.

This feels simple to understand given the attachment functionality already exists. The Disable content parsing flag will remain as is. If it's checked, Lumos will skip parsing the clipboard content.

@andrewnguonly
Copy link
Owner

Ability to load clipboard content as an attachment will released in v1.0.15.

@nausher
Copy link
Author

nausher commented May 22, 2024

image
Hi, I updated to the 1.0.15 version but I'm not seeing a attach file option.  Please see screenshot attached. 

@andrewnguonly
Copy link
Owner

image Hi, I updated to the 1.0.15 version but I'm not seeing a attach file option.  Please see screenshot attached.

The sideways paperclip icon is the button to attach a file. When you attach a file, another icon will appear that lets you remove the attachment.

However, you don't need to click the button to load clipboard content. Just copy text to your clipboard from any app (i.e. cmd + c), open Lumos, and press the cmd + b shortcut key. Now the clipboard content is loaded. You should see the same icon that lets you remove the attachment, but instead it will be for removing the clipboard content.

@nausher
Copy link
Author

nausher commented May 23, 2024

Thanks, I finally was able to get it working after a few attempts. 
A couple of things I noted - (1) Clicking the 'paper clip icon' immediately opens the file dialog box, perhaps a different icon for clipboard history can be used?
(2) When I copy the content from the Lumos chat pop-up, the text seems to be rich and I get the background yellow copied over too. If this could be a setting or a configuration, there could be an option to copy only the plain text without any formatting from the Lumos window.

Thanks for quickly fixing this issue. I'm now able to use Lumos in Google Apps.

@andrewnguonly
Copy link
Owner

A couple of things I noted - (1) Clicking the 'paper clip icon' immediately opens the file dialog box, perhaps a different icon for clipboard history can be used?

I'll keep iterating on the UI/UX for this feature. Thanks for the feedback! One of the challenges with this feature is that browsers cannot access clipboard content without explicit action from the user. I haven't found a way to optionally render a UI component based on if clipboard content is available. Ideally, I'd like to do that so the UI isn't cluttered with more buttons. I may need to remove some of the existing buttons.

(2) When I copy the content from the Lumos chat pop-up, the text seems to be rich and I get the background yellow copied over too. If this could be a setting or a configuration, there could be an option to copy only the plain text without any formatting from the Lumos window.

Created an issue for this: #181. In the meantime, the cmd + c shortcut copies the last AI message and it doesn't include the yellow background.

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

No branches or pull requests

3 participants