Полностью поддерживает английский язык

This commit is contained in:
AidarKC
2026-11-10 14:02:34 +03:00
parent 405b9a91a7
commit 9c30b33b39
71 changed files with 2658 additions and 1445 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
import { t } from '../i18n/index.js';
const PIPER_LENGTH_SCALE_BY_QUALITY = {
easy: '1.15',
medium: '1.0',
@@ -40,7 +41,7 @@ export async function speakTextBySettings(text, entrySettings) {
if (provider === 'piper-http') {
const baseUrl = String(cfg.piperBaseUrl || '').trim().replace(/\/+$/, '');
if (!baseUrl) throw new Error('Не указан адрес Piper HTTP.');
if (!baseUrl) throw new Error(t('remaining.speech.piper_http_url_is_not_set'));
const quality = String(cfg.quality || 'medium').toLowerCase();
const voice = String(cfg.voice || '').trim();
const lengthScale = PIPER_LENGTH_SCALE_BY_QUALITY[quality] || PIPER_LENGTH_SCALE_BY_QUALITY.medium;
@@ -65,7 +66,7 @@ export async function speakTextBySettings(text, entrySettings) {
if (provider === 'openai') {
const apiKey = String(cfg.apiKey || '').trim();
if (!apiKey) throw new Error('Не заполнен API key для OpenAI TTS.');
if (!apiKey) throw new Error(t('remaining.speech.openai_tts_api_key_is_missing'));
const model = String(cfg.model || '').trim() || 'gpt-4o-mini-tts';
const baseUrl = normalizeOpenAiBaseUrl(cfg.externalBaseUrl || cfg.baseUrl || 'https://api.openai.com/v1');
const voice = String(cfg.voice || '').trim() || 'alloy';
@@ -91,5 +92,5 @@ export async function speakTextBySettings(text, entrySettings) {
return;
}
throw new Error('Неизвестный провайдер озвучки.');
throw new Error(t('remaining.speech.unknown_text_to_speech_provider'));
}