Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Bug: pai-voice-system server.ts doesn't resolve voice_id from personality config

Open virtualian opened this issue 10 months ago • 1 comments

Summary

Even when voice-personalities config loads successfully, the voice server passes the personality name (e.g., "marrvin") to ElevenLabs API instead of the actual voice_id from the config.

Related Issues

  • #393 - Config path mismatch (must be fixed first for this bug to manifest)
  • #346 - ENV path inconsistent (related path issues)

Expected Behavior

When hook sends voice_id: "marrvin":

  1. Server looks up "marrvin" in voice-personalities config
  2. Finds voice_id: "K5QbygPi6edprgmNThSP"
  3. Sends actual ElevenLabs voice ID to API

Actual Behavior

Server finds config but still sends "marrvin" to ElevenLabs:

📨 Notification: "Marrvin" - "Hello" (voice: true, voiceId: marrvin)
👤 Personality: Ian's primary AI assistant  # Config WAS found
🎙️  Generating speech (voice: marrvin, ...)  # But name sent, not voice_id
ElevenLabs API error: 404 - voice_not_found "marrvin"

Root Cause

In server.ts sendNotification() function (around line 365-388):

const voice = voiceId || DEFAULT_VOICE_ID;  // "marrvin"
const voiceConfig = getVoiceConfig(voice);   // Finds config with voice_id field

// BUG: Uses `voice` (the name) instead of voiceConfig.voice_id
const audioBuffer = await generateSpeech(safeMessage, voice, voiceSettings);

The code retrieves the config (and uses its stability/similarity_boost settings) but never extracts the actual voice_id field.

Fix

const voice = voiceId || DEFAULT_VOICE_ID;
const voiceConfig = getVoiceConfig(voice);

// Resolve the actual ElevenLabs voice ID from config
const actualVoiceId = voiceConfig?.voice_id || voice;

const audioBuffer = await generateSpeech(safeMessage, actualVoiceId, voiceSettings);

Affected Files

  • Packs/pai-voice-system/src/voice/server.ts - sendNotification() function, around line 388

virtualian avatar Jan 12 '26 21:01 virtualian

Thanks for reporting! The voice system was restructured in v3.0 (now released) with improved voice_id resolution. Please upgrade to v3.0.

kaimagnus avatar Feb 15 '26 17:02 kaimagnus