fix(core.gbapp): Added IBM for TTS and removed MSFT while it does not compile on AZR.
This commit is contained in:
parent
12c9bea167
commit
abe4281b73
1 changed files with 13 additions and 8 deletions
|
@ -473,13 +473,14 @@ export class WhatsappDirectLine extends GBService {
|
||||||
return `${attachment.content.title} - ${attachment.content.text}`;
|
return `${attachment.content.title} - ${attachment.content.text}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendFileToDevice(to, url, filename, caption) {
|
public async sendFileToDevice(to, url, filename, caption, chatId) {
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: urlJoin(this.whatsappServiceUrl, 'sendFile'),
|
url: urlJoin(this.whatsappServiceUrl, 'sendFile'),
|
||||||
qs: {
|
qs: {
|
||||||
token: this.whatsappServiceKey,
|
token: this.whatsappServiceKey,
|
||||||
phone: to,
|
phone: chatId ? null : to,
|
||||||
|
chatId: chatId,
|
||||||
body: url,
|
body: url,
|
||||||
filename: filename,
|
filename: filename,
|
||||||
caption: caption
|
caption: caption
|
||||||
|
@ -498,13 +499,14 @@ export class WhatsappDirectLine extends GBService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendAudioToDevice(to, url) {
|
public async sendAudioToDevice(to, url, chatId) {
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: urlJoin(this.whatsappServiceUrl, 'sendPTT'),
|
url: urlJoin(this.whatsappServiceUrl, 'sendPTT'),
|
||||||
qs: {
|
qs: {
|
||||||
token: this.whatsappServiceKey,
|
token: this.whatsappServiceKey,
|
||||||
phone: to,
|
phone: chatId ? null : to,
|
||||||
|
chatId: chatId,
|
||||||
body: url
|
body: url
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -521,25 +523,28 @@ export class WhatsappDirectLine extends GBService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendTextAsAudioToDevice(to, msg) {
|
public async sendTextAsAudioToDevice(to, msg, chatId) {
|
||||||
|
|
||||||
const url = await GBConversationalService.getAudioBufferFromText(
|
const url = await GBConversationalService.getAudioBufferFromText(
|
||||||
msg
|
msg
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.sendFileToDevice(to, url, 'Audio', msg);
|
await this.sendFileToDevice(to, url, 'Audio', msg, chatId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendToDevice(to: string, msg: string, conversationId) {
|
public async sendToDevice(to: string, msg: string, conversationId) {
|
||||||
|
|
||||||
const cmd = '/audio ';
|
const cmd = '/audio ';
|
||||||
|
|
||||||
|
let chatId = WhatsappDirectLine.chatIds[conversationId];
|
||||||
|
|
||||||
if (msg.startsWith(cmd)) {
|
if (msg.startsWith(cmd)) {
|
||||||
msg = msg.substr(cmd.length);
|
msg = msg.substr(cmd.length);
|
||||||
|
|
||||||
return await this.sendTextAsAudioToDevice(to, msg);
|
return await this.sendTextAsAudioToDevice(to, msg, chatId);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let chatId = WhatsappDirectLine.chatIds[conversationId];
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
Loading…
Add table
Reference in a new issue