Skip to content

Commit

Permalink
run cs:fix
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Nov 18, 2024
1 parent 68a51de commit 8f70d07
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
string $appName,
IRequest $request,
private OpenAiSettingsService $openAiSettingsService,
private ?string $userId
private ?string $userId,
) {
parent::__construct($appName, $request);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/OldProcessing/Translation/TranslationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions lib/Service/OpenAiAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(
private ICacheFactory $cacheFactory,
private QuotaUsageMapper $quotaUsageMapper,
private OpenAiSettingsService $openAiSettingsService,
IClientService $clientService
IClientService $clientService,
) {
$this->client = $clientService->newClient();
}
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Personal implements ISettings {
public function __construct(
private IInitialState $initialStateService,
private OpenAiSettingsService $openAiSettingsService,
private ?string $userId
private ?string $userId,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion lib/TaskProcessing/TranslateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 8f70d07

Please sign in to comment.