Skip to content

Commit f69d675

Browse files
committed
Vue 3 and other minor changes
Signed-off-by: Lukas Schaefer <[email protected]>
1 parent 0e80763 commit f69d675

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

lib/Service/OpenAiAPIService.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,8 @@ public function getImageRequestOptions(?string $userId): array {
758758
* @throws Exception
759759
*/
760760
public function requestSpeechCreation(
761-
?string $userId, string $prompt, string $model, string $voice, int $speed = 1,
761+
?string $userId, string $prompt, string $model, string $voice, float $speed = 1,
762762
): array {
763-
$this->logger->error('speed is ' . $speed);
764763
if ($this->isQuotaExceeded($userId, Application::QUOTA_TYPE_SPEECH)) {
765764
throw new Exception($this->l10n->t('Speech generation quota exceeded'), Http::STATUS_TOO_MANY_REQUESTS);
766765
}
@@ -779,7 +778,7 @@ public function requestSpeechCreation(
779778
$charCount = mb_strlen($prompt);
780779
$this->quotaUsageMapper->createQuotaUsage($userId ?? '', Application::QUOTA_TYPE_SPEECH, $charCount);
781780
} catch (DBException $e) {
782-
$this->logger->warning('Could not create quota usage for user: ' . $userId . ' and quota type: ' . Application::QUOTA_TYPE_IMAGE . '. Error: ' . $e->getMessage(), ['app' => Application::APP_ID]);
781+
$this->logger->warning('Could not create quota usage for user: ' . $userId . ' and quota type: ' . Application::QUOTA_TYPE_SPEECH . '. Error: ' . $e->getMessage());
783782
}
784783
return $apiResponse;
785784
}

lib/TaskProcessing/TextToSpeechProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ public function process(?string $userId, array $input, callable $reportProgress)
123123
if (isset($input['model']) && is_string($input['model'])) {
124124
$model = $input['model'];
125125
} else {
126-
$model = $this->appConfig->getValueString(Application::APP_ID, 'default_speech_model_id', Application::DEFAULT_MODEL_ID) ?: Application::DEFAULT_SPEECH_MODEL_ID;
126+
$model = $this->appConfig->getValueString(Application::APP_ID, 'default_speech_model_id', Application::DEFAULT_SPEECH_MODEL_ID) ?: Application::DEFAULT_SPEECH_MODEL_ID;
127127
}
128128

129129

130130
if (isset($input['voice']) && is_string($input['voice'])) {
131131
$voice = $input['voice'];
132132
} else {
133-
$voice = $this->appConfig->getValueString(Application::APP_ID, 'default_speech_voice', Application::DEFAULT_MODEL_ID) ?: Application::DEFAULT_SPEECH_VOICE;
133+
$voice = $this->appConfig->getValueString(Application::APP_ID, 'default_speech_voice', Application::DEFAULT_SPEECH_VOICE) ?: Application::DEFAULT_SPEECH_VOICE;
134134
}
135135

136136
$speed = 1;

src/components/AdminSettings.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@
406406
:title="t('integration_openai', 'More information about OpenAI models')"
407407
href="https://beta.openai.com/docs/models"
408408
target="_blank">
409-
<NcButton type="tertiary" aria-label="openai-info">
409+
<NcButton variant="tertiary" aria-label="openai-info">
410410
<template #icon>
411411
<HelpCircleIcon />
412412
</template>
@@ -416,7 +416,7 @@
416416
:title="t('integration_openai', 'More information about LocalAI models')"
417417
href="https://localai.io/model-compatibility/index.html"
418418
target="_blank">
419-
<NcButton type="tertiary" aria-label="localai-info">
419+
<NcButton variant="tertiary" aria-label="localai-info">
420420
<template #icon>
421421
<HelpCircleIcon />
422422
</template>
@@ -430,7 +430,7 @@
430430
<label>{{ t('integration_openai', 'TTS Voices') }}
431431
<NcButton
432432
:title="t('integration_openai', 'A list of voices supported by the endpoint you are using. Defaults to openai\'s list.')"
433-
type="tertiary"
433+
variant="tertiary"
434434
aria-label="voices-info">
435435
<template #icon>
436436
<HelpCircleIcon />
@@ -445,13 +445,13 @@
445445
@input="onInput()" />
446446
</div>
447447
<NcSelect
448-
v-model="state.default_tts_voice"
448+
:model-value="state.default_tts_voice"
449449
class="model-select"
450450
:options="state.tts_voices"
451451
:input-label="t('integration_openai', 'Default voice to use')"
452452
:no-wrap="true"
453453
input-id="openai-tts-voices-select"
454-
@input="onInput()" />
454+
@click="onInput()" />
455455
<div>
456456
<h2>
457457
{{ t('integration_openai', 'Usage limits') }}
@@ -564,8 +564,8 @@
564564
{{ t('integration_openai', 'Speech-to-text provider (to transcribe Talk recordings for example)') }}
565565
</NcCheckboxRadioSwitch>
566566
<NcCheckboxRadioSwitch
567-
:checked="state.tts_provider_enabled"
568-
@update:checked="onCheckboxChanged($event, 'tts_provider_enabled', false)">
567+
:model-value="state.tts_provider_enabled"
568+
@update:model-value="onCheckboxChanged($event, 'tts_provider_enabled', false)">
569569
{{ t('integration_openai', 'Text-to-speech provider') }}
570570
</NcCheckboxRadioSwitch>
571571
</div>
@@ -715,9 +715,9 @@ export default {
715715
716716
const defaultTtsModelId = this.state.default_tts_model_id || response.data?.default_tts_model_id
717717
const ttsModelToSelect = this.models.find(m => m.id === defaultTtsModelId)
718-
|| this.models.find(m => m.id.match(/tts/i))
719-
|| this.models[1]
720-
|| this.models[0]
718+
|| this.models.find(m => m.id.match(/tts/i))
719+
|| this.models[1]
720+
|| this.models[0]
721721
722722
this.selectedModel.text = this.modelToNcSelectObject(completionModelToSelect)
723723
this.selectedModel.image = this.modelToNcSelectObject(imageModelToSelect)

tests/unit/Providers/OpenAiProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public function testTranslationProvider(): void {
557557
}
558558

559559
public function testTextToSpeechProvider(): void {
560-
$translationProvider = new TextToSpeechProvider(
560+
$TTSProvider = new TextToSpeechProvider(
561561
$this->openAiApiService,
562562
$this->createMock(\OCP\IL10N::class),
563563
$this->createMock(\Psr\Log\LoggerInterface::class),

0 commit comments

Comments
 (0)