Skip to content

Commit

Permalink
fix: when no AI setting has been set, make sure the selected text pro…
Browse files Browse the repository at this point in the history
…cessing provider is the same as the one that will be used

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Mar 15, 2024
1 parent df1cd1b commit 75127f2
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 75127f2

Please sign in to comment.