Skip to content

feat: files "new file" menu generate image action - #322

Merged
julien-nc merged 6 commits into
mainfrom
feat/files_new_menu/generate-image
Aug 5, 2025
Merged

feat: files "new file" menu generate image action#322
julien-nc merged 6 commits into
mainfrom
feat/files_new_menu/generate-image

Conversation

@andrey18106

Copy link
Copy Markdown

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.

123

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

@andrey18106andrey18106 added enhancement New feature or request 3. to review labels Jul 29, 2025
@julien-nc
julien-ncforce-pushed the feat/files_new_menu/generate-image branch 2 times, most recently from 60a7b76 to 002945eCompareJuly 30, 2025 10:22
@julien-nc

Copy link
Copy Markdown
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.

@julien-ncjulien-nc left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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-ncforce-pushed the feat/files_new_menu/generate-image branch from 002945e to 03696cfCompareAugust 5, 2025 08:42
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc

Copy link
Copy Markdown
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

@kyteinskykyteinsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

Comment threadlib/Listener/LoadAdditionalScriptsListener.php Outdated
Comment threadlib/Service/AssistantService.php Outdated
Comment threadlib/Notification/Notifier.php Outdated
Comment threadlib/Notification/Notifier.php Outdated
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc
julien-nc merged commit bb07161 into mainAug 5, 2025
16 checks passed
@julien-nc
julien-nc deleted the feat/files_new_menu/generate-image branch August 5, 2025 11:05
@janepiejanepie mentioned this pull request Aug 7, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewenhancementNew 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

@andrey18106@julien-nc@kyteinsky