Skip to content

Conversation

andrey18106
Copy link

Resolves: #305

This PR adds new entry "Generate image" to "New file" menu in Files app.

Custom dialog is opened to enter prompt and schedule core:text2image task to generate one image.
TaskSuccessfulEvent listener is adjusted to handle this task with customId set to new-image-file:<folderId> to store the result and create notification with the target link to new image file.
This task also kept visible in the Assistant UI history.

1 2 3

It is possible to disable it with occ config:app:set assistant disableFilesNewMenuPlugin --value 1.

@andrey18106 andrey18106 requested a review from julien-nc July 29, 2025 21:51
@andrey18106 andrey18106 added enhancement New feature or request 3. to review labels Jul 29, 2025
@julien-nc julien-nc force-pushed the feat/files_new_menu/generate-image branch 2 times, most recently from 60a7b76 to 002945e Compare July 30, 2025 10:22
@julien-nc
Copy link
Member

Hey, nicely done. I rebased on main, fixed the conflicts and merged the 2 listeners for OCA\Files\Event\LoadAdditionalScriptsEvent. I hope you don't mind. I'll give a review soon.

Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Could you use a different listener than TaskSuccessfulListener like NewFileMenuTaskSuccessfulListener? It would make it easier to read and the logic is kind of separated anyway.
We don't care about oc_assistant_task_notif for the new file menu tasks, we always send a notification.

'openfile' => 'false',
],
);
} catch (\Exception $e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a failure notification in this case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I also create another TaskFailedEvent listener (to not mix logic with existing) to produce task failure notification?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, yes. It would be nicer to have a new type of notification for this case. Something like "The new image generation in FOLDER_RICH_OBJECT has failed" and an action button (label "View task") to open the assistant on the task.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success notification can stay like it is now IMO.

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
… openAssistantTask

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the feat/files_new_menu/generate-image branch from 002945e to 03696cf Compare August 5, 2025 08:42
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc
Copy link
Member

@andrey18106 I hope you don't mind, I made the changes i suggested 😁 :

  • specific listeners for new file menu tasks
  • custom notifications with rich objects

@julien-nc julien-nc requested review from kyteinsky and janepie August 5, 2025 09:19
Copy link
Contributor

@kyteinsky kyteinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc merged commit bb07161 into main Aug 5, 2025
16 checks passed
@julien-nc julien-nc deleted the feat/files_new_menu/generate-image branch August 5, 2025 11:05
@janepie janepie mentioned this pull request Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New "new file" menu entry to generate an image
3 participants