fix: wire GCP Speech client into tools transcribe (was using unreachable ai-portal path)
Copies GcpSpeechClient into the tools repo so it's deployed with the code; removes the broken dbnToolsAiPortalRoot() path that resolved to a nonexistent /home/dobetternorge/ai-portal directory. Also restarted the CPU Whisper service which had a stuck CLOSE_WAIT socket causing silent fetch failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+14
-17
@@ -75,23 +75,20 @@ if ($azureKey !== '' && !$diarize && $file['size'] <= 1024 * 1024 && str_starts_
|
||||
|
||||
// 2. Google Cloud Speech v2 — long audio, diarization, everything Azure can't handle
|
||||
if ($result === null) {
|
||||
$gcpPath = dbnToolsAiPortalRoot() . '/lib/ai/GcpSpeechClient.php';
|
||||
if (is_file($gcpPath)) {
|
||||
require_once $gcpPath;
|
||||
$gcp = GcpSpeechClient::fromConfig();
|
||||
if ($gcp) {
|
||||
$gcpLang = ($language === 'auto') ? '' : $language;
|
||||
$result = $gcp->transcribe(
|
||||
$file['tmp_name'], $detectedMime, $gcpLang,
|
||||
$diarize,
|
||||
$numSpeakers > 1 ? $numSpeakers : 2,
|
||||
$numSpeakers > 1 ? max($numSpeakers, 2) : 6
|
||||
);
|
||||
if ($result !== null) {
|
||||
$engineUsed = 'gcp';
|
||||
} else {
|
||||
error_log('STT: Google Cloud Speech failed, falling back to Whisper');
|
||||
}
|
||||
require_once __DIR__ . '/../includes/GcpSpeechClient.php';
|
||||
$gcp = GcpSpeechClient::fromConfig();
|
||||
if ($gcp) {
|
||||
$gcpLang = ($language === 'auto') ? '' : $language;
|
||||
$result = $gcp->transcribe(
|
||||
$file['tmp_name'], $detectedMime, $gcpLang,
|
||||
$diarize,
|
||||
$numSpeakers > 1 ? $numSpeakers : 2,
|
||||
$numSpeakers > 1 ? max($numSpeakers, 2) : 6
|
||||
);
|
||||
if ($result !== null) {
|
||||
$engineUsed = 'gcp';
|
||||
} else {
|
||||
error_log('STT: Google Cloud Speech failed, falling back to Whisper');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user