generated from ztimson/template
Small tts fix
All checks were successful
Build and publish / Build Container (push) Successful in 1m26s
All checks were successful
Build and publish / Build Container (push) Successful in 1m26s
This commit is contained in:
@@ -118,7 +118,8 @@ export class TTS {
|
|||||||
else rej(e);
|
else rej(e);
|
||||||
};
|
};
|
||||||
window.speechSynthesis.speak(u);
|
window.speechSynthesis.speak(u);
|
||||||
});
|
this._emit('onSentenceStart', {sentence: t});
|
||||||
|
}).finally(() => this._emit('onSentenceEnd', {sentence: t}));
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
@@ -143,11 +144,7 @@ export class TTS {
|
|||||||
if(ss) {
|
if(ss) {
|
||||||
ss.forEach(s => {
|
ss.forEach(s => {
|
||||||
const sentence = s.trim();
|
const sentence = s.trim();
|
||||||
sentenceQueue = sentenceQueue.then(async () => {
|
sentenceQueue = sentenceQueue.then(async () => this.speak(sentence));
|
||||||
this._emit('onSentenceStart', { sentence });
|
|
||||||
await this.speak(sentence);
|
|
||||||
this._emit('onSentenceEnd', { sentence });
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
buf = buf.replace(rx, '');
|
buf = buf.replace(rx, '');
|
||||||
@@ -155,11 +152,7 @@ export class TTS {
|
|||||||
done: async () => {
|
done: async () => {
|
||||||
if (buf.trim()) {
|
if (buf.trim()) {
|
||||||
const sentence = buf.trim();
|
const sentence = buf.trim();
|
||||||
sentenceQueue = sentenceQueue.then(async () => {
|
sentenceQueue = sentenceQueue.then(async () => this.speak(sentence));
|
||||||
this._emit('onSentenceStart', { sentence });
|
|
||||||
await this.speak(sentence);
|
|
||||||
this._emit('onSentenceEnd', { sentence });
|
|
||||||
});
|
|
||||||
buf = '';
|
buf = '';
|
||||||
}
|
}
|
||||||
await sentenceQueue;
|
await sentenceQueue;
|
||||||
|
|||||||
@@ -107,10 +107,10 @@ const ai = new Ai({
|
|||||||
emote: {type: 'string', description: 'Emote to the user', required: true, enum: ['none', ...Object.keys(settings.animations.emote)]}
|
emote: {type: 'string', description: 'Emote to the user', required: true, enum: ['none', ...Object.keys(settings.animations.emote)]}
|
||||||
},
|
},
|
||||||
fn: (args, stream) => {
|
fn: (args, stream) => {
|
||||||
if(!['none', ...Object.keys(settings.animations.emote)].includes(args.emote))
|
const exists = ['none', ...Object.keys(settings.animations.emote)].includes(args.emote);
|
||||||
throw new Error(`Invalid emote, must be one of: ${['none', ...Object.keys(settings.animations.emote)].join(', ')}`)
|
if(!exists) stream({emote: 'none'});
|
||||||
stream({emote: args.emote});
|
else stream({emote: args.emote});
|
||||||
return 'done!';
|
return exists ? 'done!' : `Invalid emote: ${args.emote}`;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'personalize',
|
name: 'personalize',
|
||||||
|
|||||||
Reference in New Issue
Block a user