Skip to content

Commit

Permalink
Merge pull request #43993 from nextcloud/fix/noid/ai-settings-default…
Browse files Browse the repository at this point in the history
…-tp-provider

Fix default text processing provider in AI settings
  • Loading branch information
julien-nc authored Mar 15, 2024
2 parents f341c21 + ba94de2 commit 7af282d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public function getForm() {
'name' => $provider->getName(),
'taskType' => $provider->getTaskType(),
];
$textProcessingSettings[$provider->getTaskType()] = $provider instanceof IProviderWithId ? $provider->getId() : $provider::class;
if (!isset($textProcessingSettings[$provider->getTaskType()])) {
$textProcessingSettings[$provider->getTaskType()] = $provider instanceof IProviderWithId ? $provider->getId() : $provider::class;
}
}
$textProcessingTaskTypes = [];
foreach ($textProcessingSettings as $taskTypeClass => $providerClass) {
Expand Down
2 changes: 1 addition & 1 deletion apps/testing/lib/Provider/FakeTextProcessingProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getName(): string {
}

public function process(string $prompt): string {
return strrev($prompt);
return strrev($prompt) . ' (done with FakeTextProcessingProvider)';
}

public function getTaskType(): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getName(): string {
}

public function process(string $prompt): string {
return strrev($prompt);
return strrev($prompt) . ' (done with FakeTextProcessingProviderSync)';
}

public function getTaskType(): string {
Expand Down

0 comments on commit 7af282d

Please sign in to comment.