aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2024-03-05 11:03:58 +0100
committerJulien Veyssier <julien-nc@posteo.net>2024-03-15 13:17:29 +0100
commitba94de2510b3858f10d60f0230a58b1252346372 (patch)
tree19e3b8d25369d885eda8799633a93e6c29227d9f
parent0379a8d7a92f1f3a6ad3639f504bfe9fbea86915 (diff)
downloadnextcloud-server-ba94de2510b3858f10d60f0230a58b1252346372.tar.gz
nextcloud-server-ba94de2510b3858f10d60f0230a58b1252346372.zip
fix: when no AI setting has been set, make sure the selected text processing provider is the same as the one that will be used
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
-rw-r--r--apps/settings/lib/Settings/Admin/ArtificialIntelligence.php4
-rw-r--r--apps/testing/lib/Provider/FakeTextProcessingProvider.php2
-rw-r--r--apps/testing/lib/Provider/FakeTextProcessingProviderSync.php2
3 files changed, 5 insertions, 3 deletions
diff --git a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
index 20d395ba4d7..41b9e837c7e 100644
--- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
+++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
@@ -86,7 +86,9 @@ class ArtificialIntelligence implements IDelegatedSettings {
'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) {
diff --git a/apps/testing/lib/Provider/FakeTextProcessingProvider.php b/apps/testing/lib/Provider/FakeTextProcessingProvider.php
index 845acba7573..3fd93e8abdd 100644
--- a/apps/testing/lib/Provider/FakeTextProcessingProvider.php
+++ b/apps/testing/lib/Provider/FakeTextProcessingProvider.php
@@ -34,7 +34,7 @@ class FakeTextProcessingProvider implements IProvider {
}
public function process(string $prompt): string {
- return strrev($prompt);
+ return strrev($prompt) . ' (done with FakeTextProcessingProvider)';
}
public function getTaskType(): string {
diff --git a/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php b/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php
index 72532d62061..ec627ce8d78 100644
--- a/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php
+++ b/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php
@@ -36,7 +36,7 @@ class FakeTextProcessingProviderSync implements IProviderWithExpectedRuntime {
}
public function process(string $prompt): string {
- return strrev($prompt);
+ return strrev($prompt) . ' (done with FakeTextProcessingProviderSync)';
}
public function getTaskType(): string {