fix sound

This commit is contained in:
Gal 2025-07-16 01:08:39 +02:00
parent 8c0f88bb5a
commit c8651f3af0
Signed by: gal
GPG Key ID: F035BC65003BC00B
3 changed files with 7 additions and 6 deletions

View File

@ -499,7 +499,7 @@ export default {
id: this.messageId++,
type,
text,
audio: audio ? `data:audio/mp3;base64,${audio}` : null,
audio: audio ? `data:audio/wav;base64,${audio}` : null,
timestamp: new Date(),
showTranslation: false,
loadingTranslation: false,

View File

@ -500,7 +500,7 @@ export default {
id: this.messageId++,
type,
text,
audio: audio ? `data:audio/mp3;base64,${audio}` : null,
audio: audio ? `data:audio/wav;base64,${audio}` : null,
timestamp: new Date(),
// Translation properties for AI messages
showTranslation: false,

View File

@ -108,8 +108,9 @@ class TextToSpeechService:
)
audio_config_params = {
"audio_encoding": texttospeech.AudioEncoding.MP3, # MP3 for faster processing
"audio_encoding": texttospeech.AudioEncoding.LINEAR16, # WAV for better browser compatibility
"speaking_rate": config_set["speaking_rate"],
"sample_rate_hertz": 24000, # Required for LINEAR16
# Remove effects profile for faster generation
}
@ -353,7 +354,7 @@ class BaseConversationFlowService:
"type": "ai_response",
"text": greeting,
"audio": audio_base64,
"audio_format": "mp3",
"audio_format": "wav",
"character": personality_name,
"is_initial_greeting": True
}
@ -395,7 +396,7 @@ class BaseConversationFlowService:
"type": "ai_response",
"text": ai_response,
"audio": audio_base64,
"audio_format": "mp3",
"audio_format": "wav",
"character": personality_name,
"goal_status": goal_status,
"conversation_complete": goal_status.get("all_completed", False)
@ -427,7 +428,7 @@ class BaseConversationFlowService:
"type": "ai_response",
"text": ai_response,
"audio": audio_base64,
"audio_format": "mp3",
"audio_format": "wav",
"character": personality_name,
"goal_status": goal_status,
"conversation_complete": goal_status.get("all_completed", False)