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

Integrate text processing API #4613

Closed
juliushaertl opened this issue Jul 31, 2023 · 10 comments · Fixed by #4627
Closed

Integrate text processing API #4613

juliushaertl opened this issue Jul 31, 2023 · 10 comments · Fixed by #4627
Assignees
Labels
1. to develop enhancement New feature or request

Comments

@juliushaertl
Copy link
Member

juliushaertl commented Jul 31, 2023

Based on nextcloud/server#38854 we will add options to process selected text.

This is the summary of what I discussed with @julien-nc during our meeting:

  • Assistant app will provide a generic way across nextcloud in the menubar
    • Will trigger a dialog
  • For text we will have some sort of action to trigger this dialog which gets prefilled with the selected text, processing task, app, identifier)
  • As text processing is an async operation, we will need
    • a list of pending/finished tasks per document which could be rendered inline
    • the list provides a action to insert at cursor position
    • the list provides an option to dismiss the result
    • the list needs regular refreshing, could also get triggered by the notification from the assistant app

Depends on

  • Server: Provide an OCS endpoint to list tasks for app+identifier
  • Assistant app: Provide a JS API to launch a modal, pseudo code API:
openTextProcessingModal(appId, identifier,  task, inputText) 
    => new Promise((resolve, reject) => { resolve(ScheduledTask) })
  • Assistant app: PHP event dispatched to trigger enhancing the notification with the link to the file to open in text

    • Task is finished -> assistant app prepares a notification -> emits an event -> text adds the file link (based on app+identifier) -> assistant app emits the notification
  • UI questions to discuss

    • Where to put the processing options (menubar button, popover menu on select, menu next to the paragraph)?
    • How does the list look like (positioning, overflow, buttons, mobile)
@juliushaertl juliushaertl added enhancement New feature or request 1. to develop labels Jul 31, 2023
@juliushaertl juliushaertl self-assigned this Jul 31, 2023
@julien-nc
Copy link
Member

julien-nc commented Aug 1, 2023

LGTM!
Depends on

which contains a fix.
The text processing assistant app will be there https://github.com/julien-nc/textprocessing_assistant

@juliushaertl
Copy link
Member Author

@nimishavijay This is the tracking issue for bringing support of nextcloud/server#39478 to text. When discussing this with @julien-nc We were basically considering the following UI wise:

  • Text offers a button to start the modal outlined in ✨ Nextcloud-wide mechanism to translate, lengthen text, make more serious, etc. server#39478 prefilled with the currently selected text
    • Question: Where should we put that button? It could be next to the already existing translate button in the menubar for example or would this be not visible enough?
      Screenshot 2023-08-02 at 18 06 05
  • When the task is scheduled we will list all pending and succeeded tasks in the bottom of a text document
    • This can be used to get back to scheduled tasks once they are finished to insert the result into the document
    • Quick-and-dirty mockup:
      Screenshot 2023-08-02 at 18 16 36

@nimishavijay
Copy link
Member

Question: Where should we put that button? It could be next to the already existing translate button in the menubar for example or would this be not visible enough?

So the original idea was that for Text it would be a floating button next to the line which has the cursor. That way the text fed into the TP widget would be the text in that line, or the text that has been selected. Would that be possible? It would look something like this:

image

If not I would agree that it could go into the formatting bar. Since this is a feature we would like to market, I'd also agree that placing it near Translate is not visible enough. How about we place it as the last action before the remaining actions, and it is styled as a secondary icon-only button similar to the screenshot above. It would be great if the action menu with the subactions is there, but that is also something to be discussed with Julien :) What do you think?

When the task is scheduled we will list all pending and succeeded tasks in the bottom of a text document

That's a great idea! Indicating the progress would be different for each app, but this is a great solution for Text. The quick screenshot you pasted already is pretty close to how it would look ideally. I would only suggest that it be moved to the top right as in the bottom left there is a chance for it to overlap with the outline.

It would also be nice to be able to collapse it in case it gets in the way :)

@nimishavijay nimishavijay self-assigned this Aug 2, 2023
@mejo-
Copy link
Member

mejo- commented Aug 2, 2023

So the original idea was that for Text it would be a floating button next to the line which has the cursor.

I just wanted to mention that we just got rid of the floating menu for links with Nextcloud 26 and that people were constantly annoyed by the floating menu. A button right to cursor position of the editor is less annoying, but still might be a bit too intrusive, given that it travels with your cursor all the time when typing/navigating in the document.

@juliushaertl
Copy link
Member Author

Yes, definitely something to consider. @nimishavijay What do you think? Wouldn't the button changing position all the time be a bit too much when just working with the document?

@juliushaertl
Copy link
Member Author

Another idea would be to just make the bottom overlay area a trigger for the popover menu.

@nimishavijay
Copy link
Member

nimishavijay commented Aug 4, 2023

That's a good point. The reference I had in mind for that is something like Google Docs' comment indicator, which sort of follows your cursor. However that appears only on hovering over the right half of the screen. Would something like that be in scope? Hide the button while typing or while the mouse cursor is stationary for ~ 2 seconds, and show it if the mouse cursor is hovering over the text or the space on the right. Would that be better? @mejo- :)

If that is too complicated, no worries! We will likely have to show it on the formatting bar on mobile anyway, so we can just go with that for desktop as well :)

@juliushaertl
Copy link
Member Author

For reference in my poc pr I put it to the bottom left for now if we want to advertise it more prominently this might be another option, but I'll check your suggestion. See #4627 for screenshots

@nimishavijay
Copy link
Member

The ongoing tasks can look something like this:

image

  • Nextcloud Assistant chip and a way to close the container (replaced by the assistance icon in your POC, so all good until we decide what the entry point is)
  • List of ongoing/completed tasks:
    • indicate status with an icon (MDI icons error in --color-error, check-circle in --color-success, and clock-outline)
    • name of task
    • on hover: action for each item (in screenshot below, note the secondary button styling for action of the completed task. Clicking on this can open the modal with the input and output of that task rather than inserting directly)
    • nice to have: show subline with the input text so if there are multiple of the same tasks the user can distinguish between them

image

For placement, I would suggest maybe the top right so that the is no overlap with the outline :) What do you think? Do we need to revisit any of the points?

@jancborchardt
Copy link
Member

jancborchardt commented Aug 8, 2023

I would say for this feature it is fine if it’s floating, as @nimishavijay said right of the current line, not next to the cursor. Google Docs does the exact same as said. It’s totally fine to have it in the formatting bar as well though.
image

And the currently processing tasks, instead of floating around, could show in the Assistant menu as a last entry "Ongoing tasks" (or "4 ongoing tasks" to actually list how many) and if you click it a submenu opens like we do in Mail for "More actions".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop enhancement New feature or request
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants