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

enh(TextProcessing): Allow providers and task types to declare a dynamic ID instead of using className #41088

Merged
merged 9 commits into from
Dec 19, 2023

Conversation

marcelklehr
Copy link
Member

@marcelklehr marcelklehr commented Oct 24, 2023

this allows AppAPI to register anonymous classes as TextProcessing providers and task types

  • Change settings implementation

Checklist

…mic ID instead of using className

this allows AppAPI to register anonymous classes as TextProcessing providers and task types

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
Copy link
Member Author

(I'm sort of sad about the loss of beauty with this, but alas)

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@solracsf solracsf added this to the Nextcloud 28 milestone Oct 27, 2023
@andrey18106
Copy link
Contributor

andrey18106 commented Oct 30, 2023

@marcelklehr What did we decide to do with settings (I mean adjust it to check for new interface with ID), is there any concerns to not do it the same as for Speech-to-Text?

@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
@marcelklehr
Copy link
Member Author

It's not as straightforward as with the STT API, because we need to be able to instantiate task types from their id. When we are using the class name as ID it works fine, but if we're using a getId() method we need to register task types as well. I'm not sure how we can do this in a backward-compatible way.

@blizzz blizzz mentioned this pull request Nov 6, 2023
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
Copy link
Member Author

Decided with @julien-nc not to have task types implementable by ExApps. Then we can keep the class names for TaskTypes and this whole thing gets a lot easier.

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This was referenced Nov 10, 2023
@blizzz blizzz mentioned this pull request Nov 20, 2023
5 tasks
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
Copy link
Member Author

Please review

@marcelklehr marcelklehr added the 3. to review Waiting for reviews label Dec 19, 2023
Comment on lines 286 to 291
$provider = current(array_values(array_filter($providers, function ($provider) use ($preferences, $task) {
if ($provider instanceof IProviderWithId) {
return $provider->getId() === $preferences[$task->getType()];
}
$provider::class === $preferences[$task->getType()];
})));
Copy link
Member

Choose a reason for hiding this comment

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

Indentation is off

Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Small indent issue, otherwise looks good 👍

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr marcelklehr merged commit c3d5b46 into master Dec 19, 2023
50 checks passed
@marcelklehr marcelklehr deleted the enh/text-processing-provider-with-id branch December 19, 2023 16:43
@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants