Skip to content

AI admin settings - #39567

Merged
julien-nc merged 24 commits into
masterfrom
enh/ai-admin-settings
Aug 2, 2023
Merged

AI admin settings#39567
julien-nc merged 24 commits into
masterfrom
enh/ai-admin-settings

Conversation

@marcelklehr

@marcelklehrmarcelklehr commented Jul 25, 2023

Copy link
Copy Markdown
Member

Summary

Adds an admin settings section for AI settings, allowing admins to specify the precedence of machine translation providers, set the speech-to-text provider to use and select which text processing provider to use for which task.

image

Checklist

Comment threadapps/settings/lib/Settings/Admin/ArtificialIntelligence.php Fixed
switch($key) {
case 'ai.textprocessing_provider_preferences':
// fill $value with $defaultValue values
$value = array_merge($defaultValue, $value);

Check notice

Code scanning / Psalm

PossiblyInvalidArgument

Argument 1 of array_merge expects array<array-key, mixed>, but possibly different type array<class-string<OCP\TextProcessing\ITaskType>|int<0, max>, class-string<OCP\TextProcessing\IProvider<OCP\TextProcessing\ITaskType>>|class-string<OCP\Translation\ITranslationProvider>>|class-string<OCP\SpeechToText\ISpeechToTextProvider>|null provided
$value = array_merge($defaultValue, $value);
break;
case 'ai.translation_provider_preferences':
$value += array_diff($defaultValue, $value); // Add entries from $defaultValue that are not in $value to the end of $value

Check notice

Code scanning / Psalm

PossiblyInvalidArgument

Argument 1 of array_diff expects array<array-key, mixed>, but possibly different type array<class-string<OCP\TextProcessing\ITaskType>|int<0, max>, class-string<OCP\TextProcessing\IProvider<OCP\TextProcessing\ITaskType>>|class-string<OCP\Translation\ITranslationProvider>>|class-string<OCP\SpeechToText\ISpeechToTextProvider>|null provided
@susnux

Copy link
Copy Markdown
Contributor

Nice! But keep in mind vuedragable is not accessible, so there is no way to reorder by using the keyboard, this needs to be done by the user of the component itself.

@szaimenszaimen added this to the Nextcloud 28 milestone Jul 27, 2023
@szaimenszaimen added the 3. to review Waiting for reviews label Jul 27, 2023
Comment threadcore/Migrations/Version28000Date20230728104802.php Fixed
Comment threadcore/Migrations/Version28000Date20230728104802.php Fixed
@marcelklehrmarcelklehr mentioned this pull request Jul 28, 2023
5 tasks
@marcelklehr
marcelklehrforce-pushed the enh/ai-admin-settings branch from 8cf0663 to 841a2fbCompareJuly 28, 2023 09:45
@marcelklehr

Copy link
Copy Markdown
MemberAuthor

@susnux How would you go about adding a11y here?

@susnux

Copy link
Copy Markdown
Contributor

How would you go about adding a11y here?

For Forms I suggested this one: nextcloud/forms#1532

So basically either implement key event listeners (arrow up / down) or add additional buttons for ordering

@marcelklehr

Copy link
Copy Markdown
MemberAuthor

image

@marcelklehr

Copy link
Copy Markdown
MemberAuthor

/compile

@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.

Awesome, tested with a FreePrompt, a Summarize and an Outline TP provider.
The fallback works just fine if a provider fails.

Small string changes requested but all the rest LGTM.

I'm also wondering if all the unrelated stuff belongs here but since these are nice fixes, why not letting them in this.

About accessibility, there could be 2 buttons to move items up and down.

Comment threadapps/settings/lib/Settings/Admin/ArtificialIntelligence.php Outdated
Comment threadapps/settings/src/components/AdminAI.vue Outdated
Comment threadapps/settings/src/components/AdminAI.vue Outdated
Comment threadapps/settings/src/components/PersonalInfo/AvatarSection.vue
@marcelklehr

Copy link
Copy Markdown
MemberAuthor

About accessibility, there could be 2 buttons to move items up and down.

Already added :) (see screenshot above)

@marcelklehr
marcelklehrforce-pushed the enh/ai-admin-settings branch from 0d71d57 to dd6e92fCompareJuly 28, 2023 15:40
Comment threadapps/settings/src/components/AdminAI.vue Outdated
Comment threadapps/settings/src/components/PersonalInfo/AvatarSection.vue
Comment threadcore/Migrations/Version28000Date20230728104802.php Outdated
@julien-nc

Copy link
Copy Markdown
Member

/compile

@julien-nc
julien-nc requested a review from PytalAugust 1, 2023 10:11
@julien-nc

Copy link
Copy Markdown
Member

@Pytal Thanks for the review. Your changes have been implemented.
Rebased on master.

@julien-nc
julien-ncforce-pushed the enh/ai-admin-settings branch 3 times, most recently from 1537edf to 474de78CompareAugust 1, 2023 13:32
marcelklehrand others added 20 commits August 2, 2023 12:37
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
…r precedence
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Co-authored-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Co-authored-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc
julien-ncforce-pushed the enh/ai-admin-settings branch from 5f262ca to b13ca86CompareAugust 2, 2023 10:40
@julien-nc

Copy link
Copy Markdown
Member

Cypress failure is related with user settings.
acceptance-app-files failure is related with a file action menu button.

@julien-nc
julien-nc merged commit 114cad3 into masterAug 2, 2023
@julien-nc
julien-nc deleted the enh/ai-admin-settings branch August 2, 2023 12:55
@kesselb

Copy link
Copy Markdown
Contributor

The failing TextProcessingTest looks related:

image

@kesselb

Copy link
Copy Markdown
Contributor

Fix: #39684

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@marcelklehr@susnux@julien-nc@kesselb@Pytal@github-advanced-security@szaimen