Browse Source
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>
pull/43993/head
Julien Veyssier
2 years ago
No known key found for this signature in database
GPG Key ID: 4141FEE162030638
3 changed files with
5 additions and
3 deletions
-
apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
-
apps/testing/lib/Provider/FakeTextProcessingProvider.php
-
apps/testing/lib/Provider/FakeTextProcessingProviderSync.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) { |
|
|
|
|
|
|
|
@ -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 { |
|
|
|
|
|
|
|
@ -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 { |
|
|
|
|