feat: self-hosted Whisper server support

- MediaTranscriber: if whisper_url set, POSTs to own server with
  Basic auth (audio_file field); falls back to OpenAI cloud Whisper
- Admin AI tab: new section for whisper_url / whisper_user / whisper_pass
- save-ai endpoint: saves the three whisper fields to config_json

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-05 20:07:49 -05:00
co-authored by Claude Sonnet 4.6
parent 9509c3b4fc
commit fc54ec992b
3 changed files with 72 additions and 3 deletions
+27
View File
@@ -3170,6 +3170,9 @@ HTML;
$aiModel35 = $aiModelVal === 'gpt-3.5-turbo'? ' selected' : '';
$geminiApiKeyVal = self::h($config['gemini_api_key'] ?? '');
$geminiModelVal = $config['gemini_model'] ?? 'gemini-2.5-flash';
$whisperUrlVal = self::h($config['whisper_url'] ?? '');
$whisperUserVal = self::h($config['whisper_user'] ?? '');
$whisperPassVal = self::h($config['whisper_pass'] ?? '');
$geminiModelF25 = $geminiModelVal === 'gemini-2.5-flash' ? ' selected' : '';
$geminiModelF20 = $geminiModelVal === 'gemini-2.0-flash' ? ' selected' : '';
$geminiModelF15 = $geminiModelVal === 'gemini-1.5-flash' ? ' selected' : '';
@@ -3717,6 +3720,26 @@ HTML;
</div>
</div>
<!-- Whisper server (auto-hosted) -->
<div class="form-group" style="margin-top:12px;padding:12px;background:#f0f7f0;border:1px solid #c6e0c6;border-radius:8px">
<label style="font-weight:600">🎙️ Servidor Whisper propio (transcripción de audio)</label>
<div style="font-size:11px;color:#4a5568;margin-bottom:8px">Si se configura, el audio se transcribe aquí en vez del proveedor seleccionado arriba.</div>
<div class="form-group">
<label>URL del servidor</label>
<input type="text" name="whisper_url" value="{$whisperUrlVal}" placeholder="https://whisper.u-s.app/asr">
</div>
<div class="form-row">
<div class="form-group">
<label>Usuario</label>
<input type="text" name="whisper_user" value="{$whisperUserVal}" placeholder="whisper">
</div>
<div class="form-group">
<label>Contraseña</label>
<input type="password" name="whisper_pass" value="{$whisperPassVal}">
</div>
</div>
</div>
<div class="form-row" style="margin-top:4px">
<div class="form-group">
<label>Temperatura ({$aiTempVal})</label>
@@ -3862,6 +3885,10 @@ function saveAiConfig() {
if (oKey) fd.set('openai_api_key', oKey);
if (gKey) fd.set('gemini_api_key', gKey);
if (cKey) fd.set('claude_api_key', cKey);
fd.set('whisper_url', qs('input[name="whisper_url"]')?.value || '');
fd.set('whisper_user', qs('input[name="whisper_user"]')?.value || '');
const wPass = qs('input[name="whisper_pass"]')?.value || '';
if (wPass) fd.set('whisper_pass', wPass);
if (qs('input[name="ai_for_media"]')?.checked) fd.set('ai_for_media', '1');
if (qs('input[name="nlu"]')?.checked) fd.set('nlu', '1');