From 8f70d07f066581f5568480833fce3948194c7ba6 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 18 Nov 2024 14:06:32 +0100 Subject: [PATCH] run cs:fix Signed-off-by: Julien Veyssier --- lib/Controller/ConfigController.php | 2 +- lib/OldProcessing/Translation/TranslationProvider.php | 4 ++-- lib/Service/OpenAiAPIService.php | 10 +++++----- lib/Settings/Personal.php | 2 +- lib/TaskProcessing/TranslateProvider.php | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 98ed2f40..4d15ab3f 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -26,7 +26,7 @@ public function __construct( string $appName, IRequest $request, private OpenAiSettingsService $openAiSettingsService, - private ?string $userId + private ?string $userId, ) { parent::__construct($appName, $request); } diff --git a/lib/OldProcessing/Translation/TranslationProvider.php b/lib/OldProcessing/Translation/TranslationProvider.php index 6db7662c..c07de821 100644 --- a/lib/OldProcessing/Translation/TranslationProvider.php +++ b/lib/OldProcessing/Translation/TranslationProvider.php @@ -126,11 +126,11 @@ public function translate(?string $fromLanguage, string $toLanguage, string $tex $toLanguage = $coreLanguages[$toLanguage]; if ($fromLanguage !== null) { - $this->logger->debug('OpenAI translation FROM['.$fromLanguage.'] TO['.$toLanguage.']', ['app' => Application::APP_ID]); + $this->logger->debug('OpenAI translation FROM[' . $fromLanguage . '] TO[' . $toLanguage . ']', ['app' => Application::APP_ID]); $fromLanguage = $coreLanguages[$fromLanguage] ?? $fromLanguage; $prompt = 'Translate from ' . $fromLanguage . ' to ' . $toLanguage . ': ' . $text; } else { - $this->logger->debug('OpenAI translation TO['.$toLanguage.']', ['app' => Application::APP_ID]); + $this->logger->debug('OpenAI translation TO[' . $toLanguage . ']', ['app' => Application::APP_ID]); $prompt = 'Translate to ' . $toLanguage . ': ' . $text; } $adminModel = $this->config->getAppValue(Application::APP_ID, 'default_completion_model_id', Application::DEFAULT_COMPLETION_MODEL_ID) ?: Application::DEFAULT_COMPLETION_MODEL_ID; diff --git a/lib/Service/OpenAiAPIService.php b/lib/Service/OpenAiAPIService.php index de8b970b..4dc88df6 100644 --- a/lib/Service/OpenAiAPIService.php +++ b/lib/Service/OpenAiAPIService.php @@ -47,7 +47,7 @@ public function __construct( private ICacheFactory $cacheFactory, private QuotaUsageMapper $quotaUsageMapper, private OpenAiSettingsService $openAiSettingsService, - IClientService $clientService + IClientService $clientService, ) { $this->client = $clientService->newClient(); } @@ -470,7 +470,7 @@ public function transcribeBase64Mp3( ?string $userId, string $audioBase64, bool $translate = true, - string $model = Application::DEFAULT_TRANSCRIPTION_MODEL_ID + string $model = Application::DEFAULT_TRANSCRIPTION_MODEL_ID, ): string { return $this->transcribe( $userId, @@ -491,7 +491,7 @@ public function transcribeFile( ?string $userId, File $file, bool $translate = false, - string $model = Application::DEFAULT_TRANSCRIPTION_MODEL_ID + string $model = Application::DEFAULT_TRANSCRIPTION_MODEL_ID, ): string { try { $transcriptionResponse = $this->transcribe($userId, $file->getContent(), $translate, $model); @@ -515,7 +515,7 @@ public function transcribe( ?string $userId, string $audioFileContent, bool $translate = true, - string $model = Application::DEFAULT_TRANSCRIPTION_MODEL_ID + string $model = Application::DEFAULT_TRANSCRIPTION_MODEL_ID, ): string { if ($this->isQuotaExceeded($userId, Application::QUOTA_TYPE_TRANSCRIPTION)) { throw new Exception($this->l10n->t('Audio transcription quota exceeded'), Http::STATUS_TOO_MANY_REQUESTS); @@ -564,7 +564,7 @@ public function transcribe( * @throws Exception */ public function requestImageCreation( - ?string $userId, string $prompt, string $model, int $n = 1, string $size = Application::DEFAULT_DEFAULT_IMAGE_SIZE + ?string $userId, string $prompt, string $model, int $n = 1, string $size = Application::DEFAULT_DEFAULT_IMAGE_SIZE, ): array { if ($this->isQuotaExceeded($userId, Application::QUOTA_TYPE_IMAGE)) { throw new Exception($this->l10n->t('Image generation quota exceeded'), Http::STATUS_TOO_MANY_REQUESTS); diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index 25644c55..8bdfb010 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -12,7 +12,7 @@ class Personal implements ISettings { public function __construct( private IInitialState $initialStateService, private OpenAiSettingsService $openAiSettingsService, - private ?string $userId + private ?string $userId, ) { } diff --git a/lib/TaskProcessing/TranslateProvider.php b/lib/TaskProcessing/TranslateProvider.php index 352748d3..cef11dc9 100644 --- a/lib/TaskProcessing/TranslateProvider.php +++ b/lib/TaskProcessing/TranslateProvider.php @@ -162,7 +162,7 @@ public function process(?string $userId, array $input, callable $reportProgress) $this->logger->debug('OpenAI translation FROM[' . $fromLanguage . '] TO[' . $toLanguage . ']', ['app' => Application::APP_ID]); $prompt = 'Translate from ' . $fromLanguage . ' to ' . $toLanguage . ': ' . $inputText; } else { - $this->logger->debug('OpenAI translation TO['.$toLanguage.']', ['app' => Application::APP_ID]); + $this->logger->debug('OpenAI translation TO[' . $toLanguage . ']', ['app' => Application::APP_ID]); $prompt = 'Translate to ' . $toLanguage . ': ' . $inputText; }