Skip to content

Commit aabeef0

Browse files
committed
fix cs and psalm
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
1 parent 9293347 commit aabeef0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/Service/OpenAiAPIService.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ public function getModels(?string $userId): array {
170170
}
171171
// if userId is null or the user is an admin and has no own creds set, cache the models for the instance
172172
if ($userId === null || (
173-
($this->openAiSettingsService->getUserApiKey($userId) === ''
174-
|| (
175-
$this->openAiSettingsService->getUseBasicAuth() === '1'
176-
&& $this->openAiSettingsService->getUserBasicUser($userId) === ''
177-
&& $this->openAiSettingsService->getUserBasicPassword($userId) === ''
178-
)
173+
($this->openAiSettingsService->getUserApiKey($userId) === ''
174+
|| (
175+
$this->openAiSettingsService->getUseBasicAuth()
176+
&& $this->openAiSettingsService->getUserBasicUser($userId) === ''
177+
&& $this->openAiSettingsService->getUserBasicPassword($userId) === ''
179178
)
180-
&& $this->groupManager->isAdmin($userId))
179+
)
180+
&& $this->groupManager->isAdmin($userId))
181181
) {
182182
$cache->set($adminCacheKey, $modelsResponse, Application::MODELS_CACHE_TTL);
183183
}

tests/unit/Providers/OpenAiProviderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use OCP\Http\Client\IClientService;
2929
use OCP\IAppConfig;
3030
use OCP\ICacheFactory;
31+
use OCP\IGroupManager;
3132
use PHPUnit\Framework\MockObject\MockObject;
3233
use Psr\Log\LoggerInterface;
3334
use Test\TestCase;
@@ -78,6 +79,7 @@ protected function setUp(): void {
7879
\OC::$server->get(ICacheFactory::class),
7980
\OC::$server->get(QuotaUsageMapper::class),
8081
$this->openAiSettingsService,
82+
\OC::$server->get(IGroupManager::class),
8183
$clientService,
8284
);
8385

0 commit comments

Comments
 (0)