fix(LIA): voz femenina en español y quitar emoji de saludo
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
320b47797a
commit
4010e6e6c6
@@ -720,11 +720,20 @@ function _stripMd(text) {
|
|||||||
return text.replace(/\*\*(.+?)\*\*/g,'$1').replace(/^\* /gm,'').replace(/\n/g,' ');
|
return text.replace(/\*\*(.+?)\*\*/g,'$1').replace(/^\* /gm,'').replace(/\n/g,' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _vozFemenina() {
|
||||||
|
const vs = window.speechSynthesis.getVoices();
|
||||||
|
return vs.find(v => v.lang.startsWith('es') && /female|mujer|paulina|sabina|monica|helena|lucia|penelope|conchita|paloma|maria|carmen/i.test(v.name))
|
||||||
|
|| vs.find(v => v.lang.startsWith('es') && !v.name.toLowerCase().includes('male'))
|
||||||
|
|| vs.find(v => v.lang.startsWith('es'))
|
||||||
|
|| null;
|
||||||
|
}
|
||||||
|
|
||||||
function hablarIA(text) {
|
function hablarIA(text) {
|
||||||
if (!_ttsOn || !window.speechSynthesis) return;
|
if (!_ttsOn || !window.speechSynthesis) return;
|
||||||
window.speechSynthesis.cancel();
|
window.speechSynthesis.cancel();
|
||||||
const utt = new SpeechSynthesisUtterance(_stripMd(text));
|
const utt = new SpeechSynthesisUtterance(_stripMd(text));
|
||||||
utt.lang = 'es-CO'; utt.rate = 1.05;
|
utt.lang = 'es-CO'; utt.rate = 1.05;
|
||||||
|
const v = _vozFemenina(); if (v) utt.voice = v;
|
||||||
window.speechSynthesis.speak(utt);
|
window.speechSynthesis.speak(utt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -778,7 +787,7 @@ function _liaGreet() {
|
|||||||
const llave = 'lia_greeted_' + hoy;
|
const llave = 'lia_greeted_' + hoy;
|
||||||
if (localStorage.getItem(llave)) return;
|
if (localStorage.getItem(llave)) return;
|
||||||
localStorage.setItem(llave, '1');
|
localStorage.setItem(llave, '1');
|
||||||
const msg = 'Hola, soy LIA 👋 ¿En qué te puedo asistir hoy?';
|
const msg = 'Hola, soy LIA. ¿En qué te puedo asistir hoy?';
|
||||||
const msgs = document.getElementById('aiMessages');
|
const msgs = document.getElementById('aiMessages');
|
||||||
const el = document.createElement('div');
|
const el = document.createElement('div');
|
||||||
el.className = 'ai-msg bot';
|
el.className = 'ai-msg bot';
|
||||||
|
|||||||
Reference in New Issue
Block a user