new(all): TTS/STT on Whatsapp channel.
This commit is contained in:
parent
ec317fbd6d
commit
cb13d84abf
4 changed files with 19 additions and 7 deletions
|
@ -147,7 +147,7 @@ export class GBConversationalService {
|
|||
|
||||
try {
|
||||
speechConfig.speechSynthesisLanguage = locale;
|
||||
speechConfig.speechSynthesisVoiceName = "pt-BR-Daniel-Apollo" // pt-BR-HeloisaRUS;
|
||||
speechConfig.speechSynthesisVoiceName = "pt-BR-HeloisaRUS";
|
||||
|
||||
synthesizer.speakTextAsync(text,
|
||||
(result) => {
|
||||
|
|
|
@ -210,7 +210,15 @@ export class GBCoreService implements IGBCoreService {
|
|||
* Loads all items to start several listeners.
|
||||
*/
|
||||
public async loadInstances(): Promise<IGBInstance[]> {
|
||||
return GuaribasInstance.findAll({});
|
||||
if (process.env.LOAD_ONLY !== undefined)
|
||||
{
|
||||
const options = { where: { botId: process.env.LOAD_ONLY } };
|
||||
return GuaribasInstance.findAll(options);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GuaribasInstance.findAll({});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -163,6 +163,10 @@ export class GBMinService {
|
|||
}
|
||||
else {
|
||||
activeMin = GBServer.globals.minInstances.filter(p => p.botId === user.currentBotId)[0];;
|
||||
if (activeMin === undefined) {
|
||||
activeMin = GBServer.globals.minBoot;
|
||||
await (activeMin as any).whatsAppDirectLine.sendToDevice(id, `O outro Bot que você estava falando(${user.currentBotId}), não está mais disponível. Agora você está falando comigo, ${activeMin.instance.title}...`);
|
||||
}
|
||||
await (activeMin as any).whatsAppDirectLine.received(req, res);
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +420,7 @@ export class GBMinService {
|
|||
min.instance.whatsappServiceNumber,
|
||||
min.instance.whatsappServiceUrl
|
||||
);
|
||||
await min.whatsAppDirectLine.setup(true);
|
||||
await min.whatsAppDirectLine.setup(true);
|
||||
}
|
||||
else {
|
||||
const minBoot = GBServer.globals.minBoot as any;
|
||||
|
@ -424,14 +428,14 @@ export class GBMinService {
|
|||
new WhatsappDirectLine(
|
||||
min,
|
||||
min.botId,
|
||||
min.instance.webchatKey,
|
||||
min.instance.webchatKey,
|
||||
minBoot.instance.whatsappServiceKey,
|
||||
minBoot.instance.whatsappServiceNumber,
|
||||
minBoot.instance.whatsappServiceUrl
|
||||
);
|
||||
await min.whatsAppDirectLine.setup(false);
|
||||
await min.whatsAppDirectLine.setup(false);
|
||||
}
|
||||
|
||||
|
||||
min.userProfile = conversationState.createProperty('userProfile');
|
||||
const dialogState = conversationState.createProperty('dialogState');
|
||||
|
||||
|
|
|
@ -320,7 +320,7 @@ export class WhatsappDirectLine extends GBService {
|
|||
let url = await GBConversationalService.getAudioBufferFromText(
|
||||
this.min.instance.speechKey,
|
||||
this.min.instance.cloudLocation,
|
||||
msg, 'pt-br'
|
||||
msg, 'pt-BR'
|
||||
);
|
||||
|
||||
await this.sendFileToDevice(to, url, 'Audio', msg);
|
||||
|
|
Loading…
Add table
Reference in a new issue