Correcting the speech-to-text output
This commit is contained in:
@@ -51,9 +51,15 @@ export class AiSttService {
|
|||||||
body: form,
|
body: form,
|
||||||
signal: AbortSignal.timeout(timeoutMs),
|
signal: AbortSignal.timeout(timeoutMs),
|
||||||
});
|
});
|
||||||
} catch {
|
} catch (e) {
|
||||||
|
const name = e instanceof Error ? e.name : '';
|
||||||
|
if (name === 'TimeoutError' || name === 'AbortError') {
|
||||||
|
throw new ServiceUnavailableException(
|
||||||
|
'زمان تبدیل صوت تمام شد. اگر تازه مدل عوض شده، چند دقیقه صبر کنید تا دانلود شود و دوباره امتحان کنید.',
|
||||||
|
);
|
||||||
|
}
|
||||||
throw new ServiceUnavailableException(
|
throw new ServiceUnavailableException(
|
||||||
'سرویس تبدیل صوت در دسترس نیست. Pipecat STT را اجرا کنید.',
|
'سرویس تبدیل صوت خاموش است. مدل medium معمولاً حافظهٔ سرور را پر میکند و پروسه را میکشد. در apps/stt/.env مقدار STT_MODEL=small بگذارید و pm2 restart mento-stt بزنید.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -97,7 +97,13 @@ def _get_model() -> WhisperModel:
|
|||||||
compute = _env("STT_COMPUTE_TYPE", "int8") or "int8"
|
compute = _env("STT_COMPUTE_TYPE", "int8") or "int8"
|
||||||
logger.info("Loading Faster-Whisper model=%s device=%s compute=%s", name, device, compute)
|
logger.info("Loading Faster-Whisper model=%s device=%s compute=%s", name, device, compute)
|
||||||
try:
|
try:
|
||||||
loaded = WhisperModel(name, device=device, compute_type=compute)
|
loaded = WhisperModel(
|
||||||
|
name,
|
||||||
|
device=device,
|
||||||
|
compute_type=compute,
|
||||||
|
cpu_threads=2,
|
||||||
|
num_workers=1,
|
||||||
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
_model_error = str(exc)
|
_model_error = str(exc)
|
||||||
logger.exception("Whisper model load failed")
|
logger.exception("Whisper model load failed")
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ module.exports = {
|
|||||||
interpreter: "none",
|
interpreter: "none",
|
||||||
instances: 1,
|
instances: 1,
|
||||||
exec_mode: "fork",
|
exec_mode: "fork",
|
||||||
max_memory_restart: "500M",
|
max_memory_restart: "1500M",
|
||||||
time: true,
|
time: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user